diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2008-03-24 15:56:40 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2009-01-20 13:29:51 -0500 |
commit | 8cd0bbbdff7471163cc6a058be8b8610ddd01d6b (patch) | |
tree | de25f60d599ddef9a0ee88357dc418dbdf95b51d /drivers/firewire | |
parent | a5c7f4710fba334bf613d705f97b4471b36446f8 (diff) |
firewire: unnecessary BM delay after generation rollover
Noticed by Jarod Wilson: The bus manager work was unnecessarily delayed
each time the bus generation counter rolled over.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Jarod Wilson <jwilson@redhat.com>
Diffstat (limited to 'drivers/firewire')
-rw-r--r-- | drivers/firewire/fw-card.c | 2 | ||||
-rw-r--r-- | drivers/firewire/fw-topology.c | 2 | ||||
-rw-r--r-- | drivers/firewire/fw-transaction.h | 9 |
3 files changed, 11 insertions, 2 deletions
diff --git a/drivers/firewire/fw-card.c b/drivers/firewire/fw-card.c index 6bd91a15d5e6..17a80cecdc14 100644 --- a/drivers/firewire/fw-card.c +++ b/drivers/firewire/fw-card.c | |||
@@ -232,7 +232,7 @@ fw_card_bm_work(struct work_struct *work) | |||
232 | root_id = root_node->node_id; | 232 | root_id = root_node->node_id; |
233 | grace = time_after(jiffies, card->reset_jiffies + DIV_ROUND_UP(HZ, 10)); | 233 | grace = time_after(jiffies, card->reset_jiffies + DIV_ROUND_UP(HZ, 10)); |
234 | 234 | ||
235 | if (card->bm_generation + 1 == generation || | 235 | if (is_next_generation(generation, card->bm_generation) || |
236 | (card->bm_generation != generation && grace)) { | 236 | (card->bm_generation != generation && grace)) { |
237 | /* | 237 | /* |
238 | * This first step is to figure out who is IRM and | 238 | * This first step is to figure out who is IRM and |
diff --git a/drivers/firewire/fw-topology.c b/drivers/firewire/fw-topology.c index e7520e4bd6bc..8dd6703b55cd 100644 --- a/drivers/firewire/fw-topology.c +++ b/drivers/firewire/fw-topology.c | |||
@@ -523,7 +523,7 @@ fw_core_handle_bus_reset(struct fw_card *card, | |||
523 | * previously processed one, we cannot reliably compare the | 523 | * previously processed one, we cannot reliably compare the |
524 | * old and new topologies. | 524 | * old and new topologies. |
525 | */ | 525 | */ |
526 | if ((generation & 0xff) != ((card->generation + 1) & 0xff) && | 526 | if (!is_next_generation(generation, card->generation) && |
527 | card->local_node != NULL) { | 527 | card->local_node != NULL) { |
528 | fw_notify("skipped bus generations, destroying all nodes\n"); | 528 | fw_notify("skipped bus generations, destroying all nodes\n"); |
529 | fw_destroy_nodes(card); | 529 | fw_destroy_nodes(card); |
diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h index c9ab12a15f6e..1d78e9cc5940 100644 --- a/drivers/firewire/fw-transaction.h +++ b/drivers/firewire/fw-transaction.h | |||
@@ -276,6 +276,15 @@ static inline void fw_card_put(struct fw_card *card) | |||
276 | extern void fw_schedule_bm_work(struct fw_card *card, unsigned long delay); | 276 | extern void fw_schedule_bm_work(struct fw_card *card, unsigned long delay); |
277 | 277 | ||
278 | /* | 278 | /* |
279 | * Check whether new_generation is the immediate successor of old_generation. | ||
280 | * Take counter roll-over at 255 (as per to OHCI) into account. | ||
281 | */ | ||
282 | static inline bool is_next_generation(int new_generation, int old_generation) | ||
283 | { | ||
284 | return (new_generation & 0xff) == ((old_generation + 1) & 0xff); | ||
285 | } | ||
286 | |||
287 | /* | ||
279 | * The iso packet format allows for an immediate header/payload part | 288 | * The iso packet format allows for an immediate header/payload part |
280 | * stored in 'header' immediately after the packet info plus an | 289 | * stored in 'header' immediately after the packet info plus an |
281 | * indirect payload part that is pointer to by the 'payload' field. | 290 | * indirect payload part that is pointer to by the 'payload' field. |