Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] Adjust mce_bt_set flag to gboolean type values
@ 2010-10-13 13:08 Rafal Michalski
  2010-10-13 14:24 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Rafal Michalski @ 2010-10-13 13:08 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Rafal Michalski

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(-)

diff --git a/plugins/maemo6.c b/plugins/maemo6.c
index c396db0..0a1e551 100644
--- a/plugins/maemo6.c
+++ b/plugins/maemo6.c
@@ -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 */
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Adjust mce_bt_set flag to gboolean type values
  2010-10-13 13:08 [PATCH] Adjust mce_bt_set flag to gboolean type values Rafal Michalski
@ 2010-10-13 14:24 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2010-10-13 14:24 UTC (permalink / raw)
  To: Rafal Michalski; +Cc: linux-bluetooth

Hi Rafal,

On Wed, Oct 13, 2010, Rafal Michalski wrote:
> -		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.

> -	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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-13 14:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-13 13:08 [PATCH] Adjust mce_bt_set flag to gboolean type values Rafal Michalski
2010-10-13 14:24 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox