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>
This commit is contained in:
Родитель
a6ca4f7081
Коммит
bd7dee6311
|
@ -398,7 +398,6 @@ fw_card_initialize(struct fw_card *card, const struct fw_card_driver *driver,
|
||||||
{
|
{
|
||||||
static atomic_t index = ATOMIC_INIT(-1);
|
static atomic_t index = ATOMIC_INIT(-1);
|
||||||
|
|
||||||
kref_init(&card->kref);
|
|
||||||
atomic_set(&card->device_count, 0);
|
atomic_set(&card->device_count, 0);
|
||||||
card->index = atomic_inc_return(&index);
|
card->index = atomic_inc_return(&index);
|
||||||
card->driver = driver;
|
card->driver = driver;
|
||||||
|
@ -429,12 +428,6 @@ fw_card_add(struct fw_card *card,
|
||||||
card->link_speed = link_speed;
|
card->link_speed = link_speed;
|
||||||
card->guid = guid;
|
card->guid = guid;
|
||||||
|
|
||||||
/*
|
|
||||||
* 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);
|
|
||||||
|
|
||||||
mutex_lock(&card_mutex);
|
mutex_lock(&card_mutex);
|
||||||
config_rom = generate_config_rom(card, &length);
|
config_rom = generate_config_rom(card, &length);
|
||||||
list_add_tail(&card->link, &card_list);
|
list_add_tail(&card->link, &card_list);
|
||||||
|
@ -540,40 +533,9 @@ fw_core_remove_card(struct fw_card *card)
|
||||||
cancel_delayed_work_sync(&card->work);
|
cancel_delayed_work_sync(&card->work);
|
||||||
fw_flush_transactions(card);
|
fw_flush_transactions(card);
|
||||||
del_timer_sync(&card->flush_timer);
|
del_timer_sync(&card->flush_timer);
|
||||||
|
|
||||||
fw_card_put(card);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(fw_core_remove_card);
|
EXPORT_SYMBOL(fw_core_remove_card);
|
||||||
|
|
||||||
struct fw_card *
|
|
||||||
fw_card_get(struct fw_card *card)
|
|
||||||
{
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
kref_put(&card->kref, release_card);
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(fw_card_put);
|
|
||||||
|
|
||||||
int
|
int
|
||||||
fw_core_initiate_bus_reset(struct fw_card *card, int short_reset)
|
fw_core_initiate_bus_reset(struct fw_card *card, int short_reset)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2077,7 +2077,7 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
|
||||||
err = pci_enable_device(dev);
|
err = pci_enable_device(dev);
|
||||||
if (err) {
|
if (err) {
|
||||||
fw_error("Failed to enable OHCI hardware.\n");
|
fw_error("Failed to enable OHCI hardware.\n");
|
||||||
goto fail_put_card;
|
goto fail_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
pci_set_master(dev);
|
pci_set_master(dev);
|
||||||
|
@ -2173,8 +2173,8 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
|
||||||
pci_release_region(dev, 0);
|
pci_release_region(dev, 0);
|
||||||
fail_disable:
|
fail_disable:
|
||||||
pci_disable_device(dev);
|
pci_disable_device(dev);
|
||||||
fail_put_card:
|
fail_free:
|
||||||
fw_card_put(&ohci->card);
|
kfree(&ohci->card);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -2202,7 +2202,7 @@ static void pci_remove(struct pci_dev *dev)
|
||||||
pci_iounmap(dev, ohci->registers);
|
pci_iounmap(dev, ohci->registers);
|
||||||
pci_release_region(dev, 0);
|
pci_release_region(dev, 0);
|
||||||
pci_disable_device(dev);
|
pci_disable_device(dev);
|
||||||
fw_card_put(&ohci->card);
|
kfree(&ohci->card);
|
||||||
|
|
||||||
#ifdef CONFIG_PPC_PMAC
|
#ifdef CONFIG_PPC_PMAC
|
||||||
/* On UniNorth, power down the cable and turn off the chip clock
|
/* On UniNorth, power down the cable and turn off the chip clock
|
||||||
|
|
|
@ -221,7 +221,6 @@ struct fw_card {
|
||||||
const struct fw_card_driver *driver;
|
const struct fw_card_driver *driver;
|
||||||
struct device *device;
|
struct device *device;
|
||||||
atomic_t device_count;
|
atomic_t device_count;
|
||||||
struct kref kref;
|
|
||||||
|
|
||||||
int node_id;
|
int node_id;
|
||||||
int generation;
|
int generation;
|
||||||
|
@ -263,9 +262,6 @@ struct fw_card {
|
||||||
int bm_generation;
|
int bm_generation;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct fw_card *fw_card_get(struct fw_card *card);
|
|
||||||
void fw_card_put(struct fw_card *card);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The iso packet format allows for an immediate header/payload part
|
* The iso packet format allows for an immediate header/payload part
|
||||||
* stored in 'header' immediately after the packet info plus an
|
* stored in 'header' immediately after the packet info plus an
|
||||||
|
|
Загрузка…
Ссылка в новой задаче