diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-17 18:46:23 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-17 18:46:23 -0400 |
commit | 2dde7861afa23cd59db83515cb0b810b92b220aa (patch) | |
tree | e2cfda1c75d2157fde3801d29e2bcbebf1d5a129 /drivers/ide | |
parent | 26042d058ba21305aeb8ac92e4b1483dbec642ac (diff) |
ide: rework PowerMac media-bay support (take 2)
Rework PowerMac media-bay support in such way that instead of
un/registering the IDE interface we un/register IDE devices:
* Add ide_port_scan() helper for probing+registerering devices on a port.
* Rename ide_port_unregister_devices() to __ide_port_unregister_devices().
* Add ide_port_unregister_devices() helper for unregistering devices on a port.
* Add 'ide_hwif_t *cd_port' to 'struct media_bay_info', pass 'hwif' instead
of hwif->index to media_bay_set_ide_infos() and use it to setup 'cd_port'.
* Use ide_port_unregister_devices() instead of ide_unregister()
and ide_port_scan() instead of ide_register_hw() in media_bay_step().
* Unexport ide_register_hw() and make it static.
v2:
* Fix build by adding <linux/ide.h> include to <asm-powerpc/mediabay.h>.
(Reported by Michael/Kamalesh/Andrew).
Cc: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Cc: Michael Ellerman <michael@ellerman.id.au>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/ide-probe.c | 18 | ||||
-rw-r--r-- | drivers/ide/ide.c | 22 | ||||
-rw-r--r-- | drivers/ide/ppc/pmac.c | 3 |
3 files changed, 36 insertions, 7 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index f3ee098b69c7..468c4ac4181d 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -1494,3 +1494,21 @@ int ide_device_add(u8 idx[4], const struct ide_port_info *d) | |||
1494 | return ide_device_add_all(idx_all, d); | 1494 | return ide_device_add_all(idx_all, d); |
1495 | } | 1495 | } |
1496 | EXPORT_SYMBOL_GPL(ide_device_add); | 1496 | EXPORT_SYMBOL_GPL(ide_device_add); |
1497 | |||
1498 | void ide_port_scan(ide_hwif_t *hwif) | ||
1499 | { | ||
1500 | ide_port_cable_detect(hwif); | ||
1501 | ide_port_init_devices(hwif); | ||
1502 | |||
1503 | if (ide_probe_port(hwif) < 0) | ||
1504 | return; | ||
1505 | |||
1506 | hwif->present = 1; | ||
1507 | |||
1508 | ide_port_tune_devices(hwif); | ||
1509 | ide_acpi_port_init_devices(hwif); | ||
1510 | ide_port_setup_devices(hwif); | ||
1511 | hwif_register_devices(hwif); | ||
1512 | ide_proc_port_register_devices(hwif); | ||
1513 | } | ||
1514 | EXPORT_SYMBOL_GPL(ide_port_scan); | ||
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 47c44d15ad4a..a8b5b08dd6e2 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -502,7 +502,7 @@ void ide_remove_port_from_hwgroup(ide_hwif_t *hwif) | |||
502 | } | 502 | } |
503 | 503 | ||
504 | /* Called with ide_lock held. */ | 504 | /* Called with ide_lock held. */ |
505 | static void ide_port_unregister_devices(ide_hwif_t *hwif) | 505 | static void __ide_port_unregister_devices(ide_hwif_t *hwif) |
506 | { | 506 | { |
507 | int i; | 507 | int i; |
508 | 508 | ||
@@ -518,6 +518,18 @@ static void ide_port_unregister_devices(ide_hwif_t *hwif) | |||
518 | } | 518 | } |
519 | } | 519 | } |
520 | 520 | ||
521 | void ide_port_unregister_devices(ide_hwif_t *hwif) | ||
522 | { | ||
523 | mutex_lock(&ide_cfg_mtx); | ||
524 | spin_lock_irq(&ide_lock); | ||
525 | __ide_port_unregister_devices(hwif); | ||
526 | hwif->present = 0; | ||
527 | ide_port_init_devices_data(hwif); | ||
528 | spin_unlock_irq(&ide_lock); | ||
529 | mutex_unlock(&ide_cfg_mtx); | ||
530 | } | ||
531 | EXPORT_SYMBOL_GPL(ide_port_unregister_devices); | ||
532 | |||
521 | /** | 533 | /** |
522 | * ide_unregister - free an IDE interface | 534 | * ide_unregister - free an IDE interface |
523 | * @index: index of interface (will change soon to a pointer) | 535 | * @index: index of interface (will change soon to a pointer) |
@@ -558,7 +570,7 @@ void ide_unregister(unsigned int index, int init_default, int restore) | |||
558 | hwif = &ide_hwifs[index]; | 570 | hwif = &ide_hwifs[index]; |
559 | if (!hwif->present) | 571 | if (!hwif->present) |
560 | goto abort; | 572 | goto abort; |
561 | ide_port_unregister_devices(hwif); | 573 | __ide_port_unregister_devices(hwif); |
562 | hwif->present = 0; | 574 | hwif->present = 0; |
563 | 575 | ||
564 | spin_unlock_irq(&ide_lock); | 576 | spin_unlock_irq(&ide_lock); |
@@ -648,8 +660,8 @@ EXPORT_SYMBOL_GPL(ide_init_port_hw); | |||
648 | * Returns -1 on error. | 660 | * Returns -1 on error. |
649 | */ | 661 | */ |
650 | 662 | ||
651 | int ide_register_hw(hw_regs_t *hw, void (*quirkproc)(ide_drive_t *), | 663 | static int ide_register_hw(hw_regs_t *hw, void (*quirkproc)(ide_drive_t *), |
652 | ide_hwif_t **hwifp) | 664 | ide_hwif_t **hwifp) |
653 | { | 665 | { |
654 | int index, retry = 1; | 666 | int index, retry = 1; |
655 | ide_hwif_t *hwif; | 667 | ide_hwif_t *hwif; |
@@ -683,8 +695,6 @@ found: | |||
683 | return hwif->present ? index : -1; | 695 | return hwif->present ? index : -1; |
684 | } | 696 | } |
685 | 697 | ||
686 | EXPORT_SYMBOL(ide_register_hw); | ||
687 | |||
688 | /* | 698 | /* |
689 | * Locks for IDE setting functionality | 699 | * Locks for IDE setting functionality |
690 | */ | 700 | */ |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index d9ca52e6cdab..7889f5f5c49a 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -1088,7 +1088,8 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw) | |||
1088 | if (np->parent && np->parent->name | 1088 | if (np->parent && np->parent->name |
1089 | && strcasecmp(np->parent->name, "media-bay") == 0) { | 1089 | && strcasecmp(np->parent->name, "media-bay") == 0) { |
1090 | #ifdef CONFIG_PMAC_MEDIABAY | 1090 | #ifdef CONFIG_PMAC_MEDIABAY |
1091 | media_bay_set_ide_infos(np->parent, pmif->regbase, pmif->irq, hwif->index); | 1091 | media_bay_set_ide_infos(np->parent, pmif->regbase, pmif->irq, |
1092 | hwif); | ||
1092 | #endif /* CONFIG_PMAC_MEDIABAY */ | 1093 | #endif /* CONFIG_PMAC_MEDIABAY */ |
1093 | pmif->mediabay = 1; | 1094 | pmif->mediabay = 1; |
1094 | if (!bidp) | 1095 | if (!bidp) |