aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2008-02-24 12:59:55 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2008-04-18 11:55:31 -0400
commitbd7dee6311156b7cdf884344feb34628909398ad (patch)
tree669b5747c607266e495e6f1b1516663bdca1152a /drivers
parenta6ca4f7081095e3cdeb1a45d66fbe4856eca10d3 (diff)
firewire: remove superfluous reference counting
The card->kref became obsolete since patch "firewire: fix crash in automatic module unloading" added another counter of card users. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Jarod Wilson <jwilson@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/firewire/fw-card.c38
-rw-r--r--drivers/firewire/fw-ohci.c8
-rw-r--r--drivers/firewire/fw-transaction.h4
3 files changed, 4 insertions, 46 deletions
diff --git a/drivers/firewire/fw-card.c b/drivers/firewire/fw-card.c
index a03462750b95..140b34d477de 100644
--- a/drivers/firewire/fw-card.c
+++ b/drivers/firewire/fw-card.c
@@ -398,7 +398,6 @@ fw_card_initialize(struct fw_card *card, const struct fw_card_driver *driver,
398{ 398{
399 static atomic_t index = ATOMIC_INIT(-1); 399 static atomic_t index = ATOMIC_INIT(-1);
400 400
401 kref_init(&card->kref);
402 atomic_set(&card->device_count, 0); 401 atomic_set(&card->device_count, 0);
403 card->index = atomic_inc_return(&index); 402 card->index = atomic_inc_return(&index);
404 card->driver = driver; 403 card->driver = driver;
@@ -429,12 +428,6 @@ fw_card_add(struct fw_card *card,
429 card->link_speed = link_speed; 428 card->link_speed = link_speed;
430 card->guid = guid; 429 card->guid = guid;
431 430
432 /*
433 * The subsystem grabs a reference when the card is added and
434 * drops it when the driver calls fw_core_remove_card.
435 */
436 fw_card_get(card);
437
438 mutex_lock(&card_mutex); 431 mutex_lock(&card_mutex);
439 config_rom = generate_config_rom(card, &length); 432 config_rom = generate_config_rom(card, &length);
440 list_add_tail(&card->link, &card_list); 433 list_add_tail(&card->link, &card_list);
@@ -540,40 +533,9 @@ fw_core_remove_card(struct fw_card *card)
540 cancel_delayed_work_sync(&card->work); 533 cancel_delayed_work_sync(&card->work);
541 fw_flush_transactions(card); 534 fw_flush_transactions(card);
542 del_timer_sync(&card->flush_timer); 535 del_timer_sync(&card->flush_timer);
543
544 fw_card_put(card);
545} 536}
546EXPORT_SYMBOL(fw_core_remove_card); 537EXPORT_SYMBOL(fw_core_remove_card);
547 538
548struct fw_card *
549fw_card_get(struct fw_card *card)
550{
551 kref_get(&card->kref);
552
553 return card;
554}
555EXPORT_SYMBOL(fw_card_get);
556
557static void
558release_card(struct kref *kref)
559{
560 struct fw_card *card = container_of(kref, struct fw_card, kref);
561
562 kfree(card);
563}
564
565/*
566 * An assumption for fw_card_put() is that the card driver allocates
567 * the fw_card struct with kalloc and that it has been shut down
568 * before the last ref is dropped.
569 */
570void
571fw_card_put(struct fw_card *card)
572{
573 kref_put(&card->kref, release_card);
574}
575EXPORT_SYMBOL(fw_card_put);
576
577int 539int
578fw_core_initiate_bus_reset(struct fw_card *card, int short_reset) 540fw_core_initiate_bus_reset(struct fw_card *card, int short_reset)
579{ 541{
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index ca6d51efd8bb..07d6053ff57e 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -2077,7 +2077,7 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
2077 err = pci_enable_device(dev); 2077 err = pci_enable_device(dev);
2078 if (err) { 2078 if (err) {
2079 fw_error("Failed to enable OHCI hardware.\n"); 2079 fw_error("Failed to enable OHCI hardware.\n");
2080 goto fail_put_card; 2080 goto fail_free;
2081 } 2081 }
2082 2082
2083 pci_set_master(dev); 2083 pci_set_master(dev);
@@ -2173,8 +2173,8 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
2173 pci_release_region(dev, 0); 2173 pci_release_region(dev, 0);
2174 fail_disable: 2174 fail_disable:
2175 pci_disable_device(dev); 2175 pci_disable_device(dev);
2176 fail_put_card: 2176 fail_free:
2177 fw_card_put(&ohci->card); 2177 kfree(&ohci->card);
2178 2178
2179 return err; 2179 return err;
2180} 2180}
@@ -2202,7 +2202,7 @@ static void pci_remove(struct pci_dev *dev)
2202 pci_iounmap(dev, ohci->registers); 2202 pci_iounmap(dev, ohci->registers);
2203 pci_release_region(dev, 0); 2203 pci_release_region(dev, 0);
2204 pci_disable_device(dev); 2204 pci_disable_device(dev);
2205 fw_card_put(&ohci->card); 2205 kfree(&ohci->card);
2206 2206
2207#ifdef CONFIG_PPC_PMAC 2207#ifdef CONFIG_PPC_PMAC
2208 /* On UniNorth, power down the cable and turn off the chip clock 2208 /* On UniNorth, power down the cable and turn off the chip clock
diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h
index a43bb22912f9..1a22a23e4596 100644
--- a/drivers/firewire/fw-transaction.h
+++ b/drivers/firewire/fw-transaction.h
@@ -221,7 +221,6 @@ struct fw_card {
221 const struct fw_card_driver *driver; 221 const struct fw_card_driver *driver;
222 struct device *device; 222 struct device *device;
223 atomic_t device_count; 223 atomic_t device_count;
224 struct kref kref;
225 224
226 int node_id; 225 int node_id;
227 int generation; 226 int generation;
@@ -263,9 +262,6 @@ struct fw_card {
263 int bm_generation; 262 int bm_generation;
264}; 263};
265 264
266struct fw_card *fw_card_get(struct fw_card *card);
267void fw_card_put(struct fw_card *card);
268
269/* 265/*
270 * The iso packet format allows for an immediate header/payload part 266 * The iso packet format allows for an immediate header/payload part
271 * stored in 'header' immediately after the packet info plus an 267 * stored in 'header' immediately after the packet info plus an