From: Benjamin Herrenschmidt Subdrivers may not have a real ->start_power_step() drivers/ide/ide-io.c | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletion(-) diff -puN drivers/ide/ide-io.c~ide-pm-oops-fix drivers/ide/ide-io.c --- 25/drivers/ide/ide-io.c~ide-pm-oops-fix 2003-09-01 15:29:24.000000000 -0700 +++ 25-akpm/drivers/ide/ide-io.c 2003-09-01 17:07:39.000000000 -0700 @@ -609,6 +609,22 @@ done: EXPORT_SYMBOL(execute_drive_cmd); /** + * do_start_power_step - wrapper on subdriver start_power_step() + * + * This is called by start_request instead of directly calling + * the subdriver's start_power_step() to deal with either no + * subdriver or no start_power_step method in the subdriver + * properly. + */ +static ide_startstop_t do_start_power_step(ide_drive_t *drive, struct request *rq) +{ + if (DRIVER(drive) && DRIVER(drive)->start_power_step) + return DRIVER(drive)->start_power_step(drive, rq); + rq->pm->pm_step = ide_pm_state_completed; + return ide_stopped; +} + +/** * start_request - start of I/O and command issuing for IDE * * start_request() initiates handling of a new I/O request. It @@ -700,7 +716,7 @@ ide_startstop_t start_request (ide_drive printk("%s: start_power_step(step: %d)\n", drive->name, rq->pm->pm_step); #endif - startstop = DRIVER(drive)->start_power_step(drive, rq); + startstop = do_start_power_step(drive, rq); if (startstop == ide_stopped && rq->pm->pm_step == ide_pm_state_completed) ide_complete_pm_request(drive, rq); _