From 2dde7861afa23cd59db83515cb0b810b92b220aa Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 18 Apr 2008 00:46:23 +0200 Subject: 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 include to . (Reported by Michael/Kamalesh/Andrew). Cc: Kamalesh Babulal Cc: Michael Ellerman Cc: Andrew Morton Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'drivers/ide/ide.c') diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 47c44d15ad4..a8b5b08dd6e 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) } /* Called with ide_lock held. */ -static void ide_port_unregister_devices(ide_hwif_t *hwif) +static void __ide_port_unregister_devices(ide_hwif_t *hwif) { int i; @@ -518,6 +518,18 @@ static void ide_port_unregister_devices(ide_hwif_t *hwif) } } +void ide_port_unregister_devices(ide_hwif_t *hwif) +{ + mutex_lock(&ide_cfg_mtx); + spin_lock_irq(&ide_lock); + __ide_port_unregister_devices(hwif); + hwif->present = 0; + ide_port_init_devices_data(hwif); + spin_unlock_irq(&ide_lock); + mutex_unlock(&ide_cfg_mtx); +} +EXPORT_SYMBOL_GPL(ide_port_unregister_devices); + /** * ide_unregister - free an IDE interface * @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) hwif = &ide_hwifs[index]; if (!hwif->present) goto abort; - ide_port_unregister_devices(hwif); + __ide_port_unregister_devices(hwif); hwif->present = 0; spin_unlock_irq(&ide_lock); @@ -648,8 +660,8 @@ EXPORT_SYMBOL_GPL(ide_init_port_hw); * Returns -1 on error. */ -int ide_register_hw(hw_regs_t *hw, void (*quirkproc)(ide_drive_t *), - ide_hwif_t **hwifp) +static int ide_register_hw(hw_regs_t *hw, void (*quirkproc)(ide_drive_t *), + ide_hwif_t **hwifp) { int index, retry = 1; ide_hwif_t *hwif; @@ -683,8 +695,6 @@ found: return hwif->present ? index : -1; } -EXPORT_SYMBOL(ide_register_hw); - /* * Locks for IDE setting functionality */ -- cgit v1.2.3