diff options
author | Kristian Høgsberg <krh@redhat.com> | 2007-03-07 12:12:37 -0500 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-03-09 22:03:06 +0100 |
commit | 49e1179b16fe54bfa070cd955a24c5ce82e21d16 (patch) | |
tree | c16d10fd3e95f43b49a8a016a4d64198f275fa50 /drivers | |
parent | 937f687969f77bfeee5efd71cadfa6f1a813665e (diff) |
firewire: Drop the unused fw_card device.
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/firewire/fw-card.c | 40 | ||||
-rw-r--r-- | drivers/firewire/fw-transaction.h | 3 |
2 files changed, 13 insertions, 30 deletions
diff --git a/drivers/firewire/fw-card.c b/drivers/firewire/fw-card.c index 8d7c12164bb..b1deb5214bd 100644 --- a/drivers/firewire/fw-card.c +++ b/drivers/firewire/fw-card.c @@ -352,15 +352,6 @@ fw_card_bm_work(struct work_struct *work) } static void -release_card(struct device *device) -{ - struct fw_card *card = - container_of(device, struct fw_card, card_device); - - kfree(card); -} - -static void flush_timer_callback(unsigned long data) { struct fw_card *card = (struct fw_card *)data; @@ -374,6 +365,7 @@ fw_card_initialize(struct fw_card *card, const struct fw_card_driver *driver, { static atomic_t index = ATOMIC_INIT(-1); + kref_init(&card->kref); card->index = atomic_inc_return(&index); card->driver = driver; card->device = device; @@ -389,14 +381,6 @@ fw_card_initialize(struct fw_card *card, const struct fw_card_driver *driver, card->local_node = NULL; INIT_DELAYED_WORK(&card->work, fw_card_bm_work); - - card->card_device.bus = &fw_bus_type; - card->card_device.release = release_card; - card->card_device.parent = card->device; - snprintf(card->card_device.bus_id, sizeof card->card_device.bus_id, - "fwcard%d", card->index); - - device_initialize(&card->card_device); } EXPORT_SYMBOL(fw_card_initialize); @@ -404,7 +388,6 @@ int fw_card_add(struct fw_card *card, u32 max_receive, u32 link_speed, u64 guid) { - int retval; u32 *config_rom; size_t length; @@ -417,12 +400,6 @@ fw_card_add(struct fw_card *card, if (card->driver->update_phy_reg(card, 4, 0, 0x80 | 0x40) < 0) return -EIO; - retval = device_add(&card->card_device); - if (retval < 0) { - fw_error("Failed to register card device."); - return retval; - } - /* The subsystem grabs a reference when the card is added and * drops it when the driver calls fw_core_remove_card. */ fw_card_get(card); @@ -520,27 +497,34 @@ fw_core_remove_card(struct fw_card *card) fw_destroy_nodes(card); - /* This also drops the subsystem reference. */ - device_unregister(&card->card_device); + fw_card_put(card); } EXPORT_SYMBOL(fw_core_remove_card); struct fw_card * fw_card_get(struct fw_card *card) { - get_device(&card->card_device); + kref_get(&card->kref); return card; } EXPORT_SYMBOL(fw_card_get); +static void +release_card(struct kref *kref) +{ + struct fw_card *card = container_of(kref, struct fw_card, kref); + + kfree(card); +} + /* An assumption for fw_card_put() is that the card driver allocates * the fw_card struct with kalloc and that it has been shut down * before the last ref is dropped. */ void fw_card_put(struct fw_card *card) { - put_device(&card->card_device); + kref_put(&card->kref, release_card); } EXPORT_SYMBOL(fw_card_put); diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h index 552e9af081e..b0d057533fb 100644 --- a/drivers/firewire/fw-transaction.h +++ b/drivers/firewire/fw-transaction.h @@ -270,6 +270,7 @@ extern struct bus_type fw_bus_type; struct fw_card { const struct fw_card_driver *driver; struct device *device; + struct kref kref; int node_id; int generation; @@ -300,8 +301,6 @@ struct fw_card { int index; - struct device card_device; - struct list_head link; /* Work struct for BM duties. */ |