From 49e1179b16fe54bfa070cd955a24c5ce82e21d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 7 Mar 2007 12:12:37 -0500 Subject: firewire: Drop the unused fw_card device. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kristian Høgsberg Signed-off-by: Stefan Richter --- drivers/firewire/fw-card.c | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) (limited to 'drivers/firewire/fw-card.c') 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 @@ -351,15 +351,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) { @@ -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); -- cgit v1.2.3