linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Move bit-field var to data->flags
@ 2010-07-16 20:20 Gustavo F. Padovan
  2010-07-16 20:54 ` Marcel Holtmann
  2010-07-19 17:19 ` Anderson Lizardo
  0 siblings, 2 replies; 6+ messages in thread
From: Gustavo F. Padovan @ 2010-07-16 20:20 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: marcel, Gustavo F. Padovan

From: Gustavo F. Padovan <padovan@profusion.mobi>

did_iso_resume keeps only a bit-field value, so moving that to a proper
flags place.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
---
 drivers/bluetooth/btusb.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 6fcb971..d22ce3c 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -149,6 +149,7 @@ static struct usb_device_id blacklist_table[] = {
 #define BTUSB_BULK_RUNNING	1
 #define BTUSB_ISOC_RUNNING	2
 #define BTUSB_SUSPENDING	3
+#define BTUSB_DID_ISO_RESUME	4
 
 struct btusb_data {
 	struct hci_dev       *hdev;
@@ -182,7 +183,6 @@ struct btusb_data {
 	unsigned int sco_num;
 	int isoc_altsetting;
 	int suspend_count;
-	int did_iso_resume:1;
 };
 
 static int inc_tx(struct btusb_data *data)
@@ -810,7 +810,7 @@ static void btusb_work(struct work_struct *work)
 	int err;
 
 	if (hdev->conn_hash.sco_num > 0) {
-		if (!data->did_iso_resume) {
+		if (!test_bit(BTUSB_DID_ISO_RESUME, &data->flags)) {
 			err = usb_autopm_get_interface(data->isoc);
 			if (err < 0) {
 				clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
@@ -818,7 +818,7 @@ static void btusb_work(struct work_struct *work)
 				return;
 			}
 
-			data->did_iso_resume = 1;
+			set_bit(BTUSB_DID_ISO_RESUME, &data->flags);
 		}
 		if (data->isoc_altsetting != 2) {
 			clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
@@ -839,10 +839,8 @@ static void btusb_work(struct work_struct *work)
 		usb_kill_anchored_urbs(&data->isoc_anchor);
 
 		__set_isoc_interface(hdev, 0);
-		if (data->did_iso_resume) {
-			data->did_iso_resume = 0;
+		if (test_and_clear_bit(BTUSB_DID_ISO_RESUME, &data->flags))
 			usb_autopm_put_interface(data->isoc);
-		}
 	}
 }
 
-- 
1.7.1.1


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

* Re: [PATCH] Bluetooth: Move bit-field var to data->flags
  2010-07-16 20:20 [PATCH] Bluetooth: Move bit-field var to data->flags Gustavo F. Padovan
@ 2010-07-16 20:54 ` Marcel Holtmann
  2010-07-19 17:19 ` Anderson Lizardo
  1 sibling, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2010-07-16 20:54 UTC (permalink / raw)
  To: Gustavo F. Padovan; +Cc: linux-bluetooth, Gustavo F. Padovan

Hi Gustavo,

> did_iso_resume keeps only a bit-field value, so moving that to a proper
> flags place.
> 
> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
> ---
>  drivers/bluetooth/btusb.c |   10 ++++------
>  1 files changed, 4 insertions(+), 6 deletions(-)

patch has been applied. Thanks.

Regards

Marcel



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

* Re: [PATCH] Bluetooth: Move bit-field var to data->flags
  2010-07-16 20:20 [PATCH] Bluetooth: Move bit-field var to data->flags Gustavo F. Padovan
  2010-07-16 20:54 ` Marcel Holtmann
@ 2010-07-19 17:19 ` Anderson Lizardo
  2010-07-19 18:40   ` Gustavo F. Padovan
  1 sibling, 1 reply; 6+ messages in thread
From: Anderson Lizardo @ 2010-07-19 17:19 UTC (permalink / raw)
  To: Gustavo F. Padovan; +Cc: linux-bluetooth

Hi Gustavo,

On Fri, Jul 16, 2010 at 4:20 PM, Gustavo F. Padovan <gustavo@padovan.org> wrote:
> @@ -810,7 +810,7 @@ static void btusb_work(struct work_struct *work)
>        int err;
>
>        if (hdev->conn_hash.sco_num > 0) {
> -               if (!data->did_iso_resume) {
> +               if (!test_bit(BTUSB_DID_ISO_RESUME, &data->flags)) {
>                        err = usb_autopm_get_interface(data->isoc);
>                        if (err < 0) {
>                                clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
> @@ -818,7 +818,7 @@ static void btusb_work(struct work_struct *work)
>                                return;
>                        }
>
> -                       data->did_iso_resume = 1;
> +                       set_bit(BTUSB_DID_ISO_RESUME, &data->flags);
>                }
>                if (data->isoc_altsetting != 2) {
>                        clear_bit(BTUSB_ISOC_RUNNING, &data->flags);

Just wondering ... could test_and_set_bit() be used here (instead of
test_bit() + set_bit()) ?

Regards,
-- 
Anderson Lizardo
OpenBossa Labs - INdT
Manaus - Brazil

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

* Re: [PATCH] Bluetooth: Move bit-field var to data->flags
  2010-07-19 17:19 ` Anderson Lizardo
@ 2010-07-19 18:40   ` Gustavo F. Padovan
  2010-07-19 19:03     ` Anderson Lizardo
  0 siblings, 1 reply; 6+ messages in thread
From: Gustavo F. Padovan @ 2010-07-19 18:40 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: linux-bluetooth

Hi Anderson,

* Anderson Lizardo <anderson.lizardo@openbossa.org> [2010-07-19 13:19:52 -0400]:

> Hi Gustavo,
> 
> On Fri, Jul 16, 2010 at 4:20 PM, Gustavo F. Padovan <gustavo@padovan.org> wrote:
> > @@ -810,7 +810,7 @@ static void btusb_work(struct work_struct *work)
> >        int err;
> >
> >        if (hdev->conn_hash.sco_num > 0) {
> > -               if (!data->did_iso_resume) {
> > +               if (!test_bit(BTUSB_DID_ISO_RESUME, &data->flags)) {
> >                        err = usb_autopm_get_interface(data->isoc);
> >                        if (err < 0) {
> >                                clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
> > @@ -818,7 +818,7 @@ static void btusb_work(struct work_struct *work)
> >                                return;
> >                        }
> >
> > -                       data->did_iso_resume = 1;
> > +                       set_bit(BTUSB_DID_ISO_RESUME, &data->flags);
> >                }
> >                if (data->isoc_altsetting != 2) {
> >                        clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
> 
> Just wondering ... could test_and_set_bit() be used here (instead of
> test_bit() + set_bit()) ?

No, because usb_autopm_get_interface() can return a error. In that case
we shall not set the bit.

-- 
Gustavo F. Padovan
http://padovan.org

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

* Re: [PATCH] Bluetooth: Move bit-field var to data->flags
  2010-07-19 18:40   ` Gustavo F. Padovan
@ 2010-07-19 19:03     ` Anderson Lizardo
  2010-07-19 19:48       ` Gustavo F. Padovan
  0 siblings, 1 reply; 6+ messages in thread
From: Anderson Lizardo @ 2010-07-19 19:03 UTC (permalink / raw)
  To: Gustavo F. Padovan; +Cc: linux-bluetooth

On Mon, Jul 19, 2010 at 2:40 PM, Gustavo F. Padovan <gustavo@padovan.org> wrote:
>> On Fri, Jul 16, 2010 at 4:20 PM, Gustavo F. Padovan <gustavo@padovan.org> wrote:
>> > @@ -810,7 +810,7 @@ static void btusb_work(struct work_struct *work)
>> >        int err;
>> >
>> >        if (hdev->conn_hash.sco_num > 0) {
>> > -               if (!data->did_iso_resume) {
>> > +               if (!test_bit(BTUSB_DID_ISO_RESUME, &data->flags)) {
>> >                        err = usb_autopm_get_interface(data->isoc);
>> >                        if (err < 0) {
>> >                                clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
>> > @@ -818,7 +818,7 @@ static void btusb_work(struct work_struct *work)
>> >                                return;
>> >                        }
>> >
>> > -                       data->did_iso_resume = 1;
>> > +                       set_bit(BTUSB_DID_ISO_RESUME, &data->flags);
>> >                }
>> >                if (data->isoc_altsetting != 2) {
>> >                        clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
>>
>> Just wondering ... could test_and_set_bit() be used here (instead of
>> test_bit() + set_bit()) ?
>
> No, because usb_autopm_get_interface() can return a error. In that case
> we shall not set the bit.

Ok, but in this case looks like there is a clear_bit() already there.

Regards,
-- 
Anderson Lizardo
OpenBossa Labs - INdT
Manaus - Brazil

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

* Re: [PATCH] Bluetooth: Move bit-field var to data->flags
  2010-07-19 19:03     ` Anderson Lizardo
@ 2010-07-19 19:48       ` Gustavo F. Padovan
  0 siblings, 0 replies; 6+ messages in thread
From: Gustavo F. Padovan @ 2010-07-19 19:48 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: linux-bluetooth

Hi Anderson,

* Anderson Lizardo <anderson.lizardo@openbossa.org> [2010-07-19 15:03:33 -0400]:

> On Mon, Jul 19, 2010 at 2:40 PM, Gustavo F. Padovan <gustavo@padovan.org> wrote:
> >> On Fri, Jul 16, 2010 at 4:20 PM, Gustavo F. Padovan <gustavo@padovan.org> wrote:
> >> > @@ -810,7 +810,7 @@ static void btusb_work(struct work_struct *work)
> >> >        int err;
> >> >
> >> >        if (hdev->conn_hash.sco_num > 0) {
> >> > -               if (!data->did_iso_resume) {
> >> > +               if (!test_bit(BTUSB_DID_ISO_RESUME, &data->flags)) {
> >> >                        err = usb_autopm_get_interface(data->isoc);
> >> >                        if (err < 0) {
> >> >                                clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
> >> > @@ -818,7 +818,7 @@ static void btusb_work(struct work_struct *work)
> >> >                                return;
> >> >                        }
> >> >
> >> > -                       data->did_iso_resume = 1;
> >> > +                       set_bit(BTUSB_DID_ISO_RESUME, &data->flags);
> >> >                }
> >> >                if (data->isoc_altsetting != 2) {
> >> >                        clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
> >>
> >> Just wondering ... could test_and_set_bit() be used here (instead of
> >> test_bit() + set_bit()) ?
> >
> > No, because usb_autopm_get_interface() can return a error. In that case
> > we shall not set the bit.
> 
> Ok, but in this case looks like there is a clear_bit() already there.

No, the clear_bit() clears the BTUSB_ISOC_RUNNING and not
BTUSB_DID_ISO_RESUME that we are talking here.

-- 
Gustavo F. Padovan
http://padovan.org

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

end of thread, other threads:[~2010-07-19 19:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-16 20:20 [PATCH] Bluetooth: Move bit-field var to data->flags Gustavo F. Padovan
2010-07-16 20:54 ` Marcel Holtmann
2010-07-19 17:19 ` Anderson Lizardo
2010-07-19 18:40   ` Gustavo F. Padovan
2010-07-19 19:03     ` Anderson Lizardo
2010-07-19 19:48       ` Gustavo F. Padovan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).