Commit b11b6f2c authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Linus Torvalds

[PATCH] call setup_driver_defaults() only once for each driver

parent b3e5c1ef
...@@ -216,7 +216,7 @@ EXPORT_SYMBOL(idetape); ...@@ -216,7 +216,7 @@ EXPORT_SYMBOL(idetape);
EXPORT_SYMBOL(idescsi); EXPORT_SYMBOL(idescsi);
extern ide_driver_t idedefault_driver; extern ide_driver_t idedefault_driver;
static void setup_driver_defaults (ide_drive_t *drive); static void setup_driver_defaults(ide_driver_t *driver);
/* /*
* Do not even *think* about calling this! * Do not even *think* about calling this!
...@@ -275,7 +275,6 @@ static void init_hwif_data (unsigned int index) ...@@ -275,7 +275,6 @@ static void init_hwif_data (unsigned int index)
drive->using_dma = 0; drive->using_dma = 0;
drive->is_flash = 0; drive->is_flash = 0;
drive->driver = &idedefault_driver; drive->driver = &idedefault_driver;
setup_driver_defaults(drive);
drive->vdma = 0; drive->vdma = 0;
INIT_LIST_HEAD(&drive->list); INIT_LIST_HEAD(&drive->list);
} }
...@@ -308,6 +307,8 @@ static void __init init_ide_data (void) ...@@ -308,6 +307,8 @@ static void __init init_ide_data (void)
return; /* already initialized */ return; /* already initialized */
magic_cookie = 0; magic_cookie = 0;
setup_driver_defaults(&idedefault_driver);
/* Initialise all interface structures */ /* Initialise all interface structures */
for (index = 0; index < MAX_HWIFS; ++index) for (index = 0; index < MAX_HWIFS; ++index)
init_hwif_data(index); init_hwif_data(index);
...@@ -2344,10 +2345,8 @@ static ide_startstop_t default_abort (ide_drive_t *drive, const char *msg) ...@@ -2344,10 +2345,8 @@ static ide_startstop_t default_abort (ide_drive_t *drive, const char *msg)
return ide_abort(drive, msg); return ide_abort(drive, msg);
} }
static void setup_driver_defaults (ide_drive_t *drive) static void setup_driver_defaults (ide_driver_t *d)
{ {
ide_driver_t *d = drive->driver;
if (d->cleanup == NULL) d->cleanup = default_cleanup; if (d->cleanup == NULL) d->cleanup = default_cleanup;
if (d->shutdown == NULL) d->shutdown = default_shutdown; if (d->shutdown == NULL) d->shutdown = default_shutdown;
if (d->flushcache == NULL) d->flushcache = default_flushcache; if (d->flushcache == NULL) d->flushcache = default_flushcache;
...@@ -2375,7 +2374,6 @@ int ide_register_subdriver (ide_drive_t *drive, ide_driver_t *driver, int versio ...@@ -2375,7 +2374,6 @@ int ide_register_subdriver (ide_drive_t *drive, ide_driver_t *driver, int versio
return 1; return 1;
} }
drive->driver = driver; drive->driver = driver;
setup_driver_defaults(drive);
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
spin_lock(&drives_lock); spin_lock(&drives_lock);
list_add_tail(&drive->list, &driver->drives); list_add_tail(&drive->list, &driver->drives);
...@@ -2422,7 +2420,6 @@ int ide_unregister_subdriver (ide_drive_t *drive) ...@@ -2422,7 +2420,6 @@ int ide_unregister_subdriver (ide_drive_t *drive)
#endif #endif
auto_remove_settings(drive); auto_remove_settings(drive);
drive->driver = &idedefault_driver; drive->driver = &idedefault_driver;
setup_driver_defaults(drive);
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
up(&ide_setting_sem); up(&ide_setting_sem);
spin_lock(&drives_lock); spin_lock(&drives_lock);
...@@ -2447,6 +2444,8 @@ int ide_register_driver(ide_driver_t *driver) ...@@ -2447,6 +2444,8 @@ int ide_register_driver(ide_driver_t *driver)
struct list_head *list_loop; struct list_head *list_loop;
struct list_head *tmp_storage; struct list_head *tmp_storage;
setup_driver_defaults(driver);
spin_lock(&drivers_lock); spin_lock(&drivers_lock);
list_add(&driver->drivers, &drivers); list_add(&driver->drivers, &drivers);
spin_unlock(&drivers_lock); spin_unlock(&drivers_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment