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 16:03:06 -0500 |
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 8d7c12164bb3..b1deb5214bd4 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) | |||
352 | } | 352 | } |
353 | 353 | ||
354 | static void | 354 | static void |
355 | release_card(struct device *device) | ||
356 | { | ||
357 | struct fw_card *card = | ||
358 | container_of(device, struct fw_card, card_device); | ||
359 | |||
360 | kfree(card); | ||
361 | } | ||
362 | |||
363 | static void | ||
364 | flush_timer_callback(unsigned long data) | 355 | flush_timer_callback(unsigned long data) |
365 | { | 356 | { |
366 | struct fw_card *card = (struct fw_card *)data; | 357 | 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, | |||
374 | { | 365 | { |
375 | static atomic_t index = ATOMIC_INIT(-1); | 366 | static atomic_t index = ATOMIC_INIT(-1); |
376 | 367 | ||
368 | kref_init(&card->kref); | ||
377 | card->index = atomic_inc_return(&index); | 369 | card->index = atomic_inc_return(&index); |
378 | card->driver = driver; | 370 | card->driver = driver; |
379 | card->device = device; | 371 | card->device = device; |
@@ -389,14 +381,6 @@ fw_card_initialize(struct fw_card *card, const struct fw_card_driver *driver, | |||
389 | card->local_node = NULL; | 381 | card->local_node = NULL; |
390 | 382 | ||
391 | INIT_DELAYED_WORK(&card->work, fw_card_bm_work); | 383 | INIT_DELAYED_WORK(&card->work, fw_card_bm_work); |
392 | |||
393 | card->card_device.bus = &fw_bus_type; | ||
394 | card->card_device.release = release_card; | ||
395 | card->card_device.parent = card->device; | ||
396 | snprintf(card->card_device.bus_id, sizeof card->card_device.bus_id, | ||
397 | "fwcard%d", card->index); | ||
398 | |||
399 | device_initialize(&card->card_device); | ||
400 | } | 384 | } |
401 | EXPORT_SYMBOL(fw_card_initialize); | 385 | EXPORT_SYMBOL(fw_card_initialize); |
402 | 386 | ||
@@ -404,7 +388,6 @@ int | |||
404 | fw_card_add(struct fw_card *card, | 388 | fw_card_add(struct fw_card *card, |
405 | u32 max_receive, u32 link_speed, u64 guid) | 389 | u32 max_receive, u32 link_speed, u64 guid) |
406 | { | 390 | { |
407 | int retval; | ||
408 | u32 *config_rom; | 391 | u32 *config_rom; |
409 | size_t length; | 392 | size_t length; |
410 | 393 | ||
@@ -417,12 +400,6 @@ fw_card_add(struct fw_card *card, | |||
417 | if (card->driver->update_phy_reg(card, 4, 0, 0x80 | 0x40) < 0) | 400 | if (card->driver->update_phy_reg(card, 4, 0, 0x80 | 0x40) < 0) |
418 | return -EIO; | 401 | return -EIO; |
419 | 402 | ||
420 | retval = device_add(&card->card_device); | ||
421 | if (retval < 0) { | ||
422 | fw_error("Failed to register card device."); | ||
423 | return retval; | ||
424 | } | ||
425 | |||
426 | /* The subsystem grabs a reference when the card is added and | 403 | /* The subsystem grabs a reference when the card is added and |
427 | * drops it when the driver calls fw_core_remove_card. */ | 404 | * drops it when the driver calls fw_core_remove_card. */ |
428 | fw_card_get(card); | 405 | fw_card_get(card); |
@@ -520,27 +497,34 @@ fw_core_remove_card(struct fw_card *card) | |||
520 | 497 | ||
521 | fw_destroy_nodes(card); | 498 | fw_destroy_nodes(card); |
522 | 499 | ||
523 | /* This also drops the subsystem reference. */ | 500 | fw_card_put(card); |
524 | device_unregister(&card->card_device); | ||
525 | } | 501 | } |
526 | EXPORT_SYMBOL(fw_core_remove_card); | 502 | EXPORT_SYMBOL(fw_core_remove_card); |
527 | 503 | ||
528 | struct fw_card * | 504 | struct fw_card * |
529 | fw_card_get(struct fw_card *card) | 505 | fw_card_get(struct fw_card *card) |
530 | { | 506 | { |
531 | get_device(&card->card_device); | 507 | kref_get(&card->kref); |
532 | 508 | ||
533 | return card; | 509 | return card; |
534 | } | 510 | } |
535 | EXPORT_SYMBOL(fw_card_get); | 511 | EXPORT_SYMBOL(fw_card_get); |
536 | 512 | ||
513 | static void | ||
514 | release_card(struct kref *kref) | ||
515 | { | ||
516 | struct fw_card *card = container_of(kref, struct fw_card, kref); | ||
517 | |||
518 | kfree(card); | ||
519 | } | ||
520 | |||
537 | /* An assumption for fw_card_put() is that the card driver allocates | 521 | /* An assumption for fw_card_put() is that the card driver allocates |
538 | * the fw_card struct with kalloc and that it has been shut down | 522 | * the fw_card struct with kalloc and that it has been shut down |
539 | * before the last ref is dropped. */ | 523 | * before the last ref is dropped. */ |
540 | void | 524 | void |
541 | fw_card_put(struct fw_card *card) | 525 | fw_card_put(struct fw_card *card) |
542 | { | 526 | { |
543 | put_device(&card->card_device); | 527 | kref_put(&card->kref, release_card); |
544 | } | 528 | } |
545 | EXPORT_SYMBOL(fw_card_put); | 529 | EXPORT_SYMBOL(fw_card_put); |
546 | 530 | ||
diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h index 552e9af081e9..b0d057533fb0 100644 --- a/drivers/firewire/fw-transaction.h +++ b/drivers/firewire/fw-transaction.h | |||
@@ -270,6 +270,7 @@ extern struct bus_type fw_bus_type; | |||
270 | struct fw_card { | 270 | struct fw_card { |
271 | const struct fw_card_driver *driver; | 271 | const struct fw_card_driver *driver; |
272 | struct device *device; | 272 | struct device *device; |
273 | struct kref kref; | ||
273 | 274 | ||
274 | int node_id; | 275 | int node_id; |
275 | int generation; | 276 | int generation; |
@@ -300,8 +301,6 @@ struct fw_card { | |||
300 | 301 | ||
301 | int index; | 302 | int index; |
302 | 303 | ||
303 | struct device card_device; | ||
304 | |||
305 | struct list_head link; | 304 | struct list_head link; |
306 | 305 | ||
307 | /* Work struct for BM duties. */ | 306 | /* Work struct for BM duties. */ |