Skip to contentSkip to conversation

Adjust mce_bt_set flag to gboolean type values

PATCH In review Rafal Michalski 2 participants 2 messages Oct 13, 2010 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Adjust mce_bt_set flag to gboolean type values

This patch makes assignment to mce_bt_set flag more readable and makes sure that it takes only TRUE or FALSE value from gboolean type.

---
 plugins/maemo6.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
plugins/maemo6.c +3 -2
index c396db0..0a1e551 100644
@@ -71,7 +71,8 @@ static gboolean mce_signal_callback(DBusConnection *connection,
 
 		/* set the adapter according to the mce signal
 		   and remember the value */
-		mce_bt_set = !!(sigvalue & MCE_RADIO_STATE_BLUETOOTH);
+		mce_bt_set = sigvalue & MCE_RADIO_STATE_BLUETOOTH ?
+								TRUE : FALSE;
 
 		if (mce_bt_set)
 			btd_adapter_switch_online(adapter);
@@ -111,7 +112,7 @@ static void read_radio_states_cb(DBusPendingCall *call, void *user_data)
 
 	DBG("radio_states: %d", radio_states);
 
-	mce_bt_set = radio_states & MCE_RADIO_STATE_BLUETOOTH;
+	mce_bt_set = radio_states & MCE_RADIO_STATE_BLUETOOTH ? TRUE : FALSE;
 
 	/* check if the adapter has not completed the initial power
 	 * cycle, if so delay action to mce_notify_powered */
Signature · 1 line
1.6.3.3
#1 lore raw

Hi Rafal,

plugins/maemo6.c static gboolean mce_signal_callback(DBusConnection *connection, · line 75

Quoted 3 lines · Rafal Michalski
plugins/maemo6.c +2 -1
-		mce_bt_set = !!(sigvalue & MCE_RADIO_STATE_BLUETOOTH);
+		mce_bt_set = sigvalue & MCE_RADIO_STATE_BLUETOOTH ?
+								TRUE : FALSE;

Ok, that's basically a coding style fix.

plugins/maemo6.c static void read_radio_states_cb(DBusPendingCall *call, void *user_data) · line 115

Quoted 2 lines
plugins/maemo6.c +1 -1
-	mce_bt_set = radio_states & MCE_RADIO_STATE_BLUETOOTH;
+	mce_bt_set = radio_states & MCE_RADIO_STATE_BLUETOOTH ? TRUE : FALSE;

And that's a clear bug fix (since there's no guarantee that the binary and results in the value 1 or TRUE).

In principle I'd prefer having coding style patches separate from real bug fixes (even for trivial changes), but since these are related I've let it go for now and pushed the patch upstream.

Johan