* [PATCH] Bluetooth: i reaches pkts_to_be_removed + 1
@ 2009-02-25 21:58 Roel Kluin
2009-02-25 22:40 ` Marcel Holtmann
0 siblings, 1 reply; 6+ messages in thread
From: Roel Kluin @ 2009-02-25 21:58 UTC (permalink / raw)
To: marcel; +Cc: linux-bluetooth, Andrew Morton
i reaches pkts_to_be_removed + 1
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c
index 894b2cb..177f34b 100644
--- a/drivers/bluetooth/hci_bcsp.c
+++ b/drivers/bluetooth/hci_bcsp.c
@@ -385,7 +385,7 @@ static void bcsp_pkt_cull(struct bcsp_struct *bcsp)
spin_unlock_irqrestore(&bcsp->unack.lock, flags);
- if (i != pkts_to_be_removed)
+ if (i <= pkts_to_be_removed)
BT_ERR("Removed only %u out of %u pkts", i, pkts_to_be_removed);
}
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] Bluetooth: i reaches pkts_to_be_removed + 1
2009-02-25 21:58 [PATCH] Bluetooth: i reaches pkts_to_be_removed + 1 Roel Kluin
@ 2009-02-25 22:40 ` Marcel Holtmann
2009-02-25 22:53 ` Roel Kluin
2009-02-25 23:08 ` David Sainty
0 siblings, 2 replies; 6+ messages in thread
From: Marcel Holtmann @ 2009-02-25 22:40 UTC (permalink / raw)
To: Roel Kluin; +Cc: linux-bluetooth, Andrew Morton
Hi Roel,
> i reaches pkts_to_be_removed + 1
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c
> index 894b2cb..177f34b 100644
> --- a/drivers/bluetooth/hci_bcsp.c
> +++ b/drivers/bluetooth/hci_bcsp.c
> @@ -385,7 +385,7 @@ static void bcsp_pkt_cull(struct bcsp_struct *bcsp)
>
> spin_unlock_irqrestore(&bcsp->unack.lock, flags);
>
> - if (i != pkts_to_be_removed)
> + if (i <= pkts_to_be_removed)
> BT_ERR("Removed only %u out of %u pkts", i, pkts_to_be_removed);
> }
patch looks good, but can you please fill in the commit message with a
little bit more details and background.
Regards
Marcel
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] Bluetooth: i reaches pkts_to_be_removed + 1
2009-02-25 22:40 ` Marcel Holtmann
@ 2009-02-25 22:53 ` Roel Kluin
2009-02-25 23:08 ` David Sainty
1 sibling, 0 replies; 6+ messages in thread
From: Roel Kluin @ 2009-02-25 22:53 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth, Andrew Morton
>> i reaches pkts_to_be_removed + 1
> patch looks good, but can you please fill in the commit message with a
> little bit more details and background.
This was found by code inspection by the way, and not tested.
how about:
------------------------------>8-------------8<---------------------------------
When all packets are removed 'i' reaches pkts_to_be_removed + 1, so the
error message was printed upon success, and not when the last packet
wasn't removed.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c
index 894b2cb..177f34b 100644
--- a/drivers/bluetooth/hci_bcsp.c
+++ b/drivers/bluetooth/hci_bcsp.c
@@ -385,7 +385,7 @@ static void bcsp_pkt_cull(struct bcsp_struct *bcsp)
spin_unlock_irqrestore(&bcsp->unack.lock, flags);
- if (i != pkts_to_be_removed)
+ if (i <= pkts_to_be_removed)
BT_ERR("Removed only %u out of %u pkts", i, pkts_to_be_removed);
}
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] Bluetooth: i reaches pkts_to_be_removed + 1
2009-02-25 22:40 ` Marcel Holtmann
2009-02-25 22:53 ` Roel Kluin
@ 2009-02-25 23:08 ` David Sainty
2009-02-25 23:43 ` Marcel Holtmann
1 sibling, 1 reply; 6+ messages in thread
From: David Sainty @ 2009-02-25 23:08 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: Roel Kluin, linux-bluetooth, Andrew Morton
Marcel Holtmann wrote:
> Hi Roel,
>
>
>> i reaches pkts_to_be_removed + 1
>>
>> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
>> ---
>> diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c
>> index 894b2cb..177f34b 100644
>> --- a/drivers/bluetooth/hci_bcsp.c
>> +++ b/drivers/bluetooth/hci_bcsp.c
>> @@ -385,7 +385,7 @@ static void bcsp_pkt_cull(struct bcsp_struct *bcsp)
>>
>> spin_unlock_irqrestore(&bcsp->unack.lock, flags);
>>
>> - if (i != pkts_to_be_removed)
>> + if (i <= pkts_to_be_removed)
>> BT_ERR("Removed only %u out of %u pkts", i, pkts_to_be_removed);
>> }
>>
>
> patch looks good, but can you please fill in the commit message with a
> little bit more details and background.
>
Isn't there something wrong with this? The patched code looks like it
will output apparently nonsensical messages like "Removed only 10 out of
10 pkts".
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] Bluetooth: i reaches pkts_to_be_removed + 1
2009-02-25 23:08 ` David Sainty
@ 2009-02-25 23:43 ` Marcel Holtmann
2009-03-02 12:37 ` Roel Kluin
0 siblings, 1 reply; 6+ messages in thread
From: Marcel Holtmann @ 2009-02-25 23:43 UTC (permalink / raw)
To: David Sainty; +Cc: Roel Kluin, linux-bluetooth, Andrew Morton
Hi David,
> >> diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c
> >> index 894b2cb..177f34b 100644
> >> --- a/drivers/bluetooth/hci_bcsp.c
> >> +++ b/drivers/bluetooth/hci_bcsp.c
> >> @@ -385,7 +385,7 @@ static void bcsp_pkt_cull(struct bcsp_struct *bcsp)
> >>
> >> spin_unlock_irqrestore(&bcsp->unack.lock, flags);
> >>
> >> - if (i != pkts_to_be_removed)
> >> + if (i <= pkts_to_be_removed)
> >> BT_ERR("Removed only %u out of %u pkts", i, pkts_to_be_removed);
> >> }
> >>
> >
> > patch looks good, but can you please fill in the commit message with a
> > little bit more details and background.
> >
>
> Isn't there something wrong with this? The patched code looks like it
> will output apparently nonsensical messages like "Removed only 10 out of
> 10 pkts".
yeah, that would make no real sense. I actually just thought about why
we have that error message at all. We might should remove the message
all together.
Regards
Marcel
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] Bluetooth: i reaches pkts_to_be_removed + 1
2009-02-25 23:43 ` Marcel Holtmann
@ 2009-03-02 12:37 ` Roel Kluin
0 siblings, 0 replies; 6+ messages in thread
From: Roel Kluin @ 2009-03-02 12:37 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: David Sainty, linux-bluetooth, Andrew Morton
>> Isn't there something wrong with this? The patched code looks like it
>> will output apparently nonsensical messages like "Removed only 10 out of
>> 10 pkts".
>
> yeah, that would make no real sense. I actually just thought about why
> we have that error message at all. We should remove the message all together.
------------------------------>8-------------8<---------------------------------
When all packets are removed 'i' reaches pkts_to_be_removed + 1, so the error
message was printed upon success, and not when the last packet wasn't removed.
Since it results in nonsensical messages, it was decided to remove the test
altogether.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c
index 894b2cb..52c6bdc 100644
--- a/drivers/bluetooth/hci_bcsp.c
+++ b/drivers/bluetooth/hci_bcsp.c
@@ -384,9 +384,6 @@ static void bcsp_pkt_cull(struct bcsp_struct *bcsp)
del_timer(&bcsp->tbcsp);
spin_unlock_irqrestore(&bcsp->unack.lock, flags);
-
- if (i != pkts_to_be_removed)
- BT_ERR("Removed only %u out of %u pkts", i, pkts_to_be_removed);
}
/* Handle BCSP link-establishment packets. When we
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-03-02 12:37 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-25 21:58 [PATCH] Bluetooth: i reaches pkts_to_be_removed + 1 Roel Kluin
2009-02-25 22:40 ` Marcel Holtmann
2009-02-25 22:53 ` Roel Kluin
2009-02-25 23:08 ` David Sainty
2009-02-25 23:43 ` Marcel Holtmann
2009-03-02 12:37 ` Roel Kluin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox