Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] USB: Correct ohci-pxa27x suspend/resume struct confusion

The device data in ohci-pxa27x is a struct hcd, not a struct ohci_hcd.
This correct the suspend/resume calls to account for this and adds some
code to invalidate the platform data when the module is removed.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Richard Purdie and committed by
Greg Kroah-Hartman
a5e36d20 4c4c9432

+7 -4
+7 -4
drivers/usb/host/ohci-pxa27x.c
··· 309 309 struct usb_hcd *hcd = platform_get_drvdata(pdev); 310 310 311 311 usb_hcd_pxa27x_remove(hcd, pdev); 312 + platform_set_drvdata(pdev, NULL); 312 313 return 0; 313 314 } 314 315 315 316 #ifdef CONFIG_PM 316 317 static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *pdev, pm_message_t state) 317 318 { 318 - struct ohci_hcd *ohci = platform_get_drvdata(pdev); 319 + struct usb_hcd *hcd = platform_get_drvdata(pdev); 320 + struct ohci_hcd *ohci = hcd_to_ohci(hcd); 319 321 320 322 if (time_before(jiffies, ohci->next_statechange)) 321 323 msleep(5); 322 324 ohci->next_statechange = jiffies; 323 325 324 326 pxa27x_stop_hc(&pdev->dev); 325 - ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED; 327 + hcd->state = HC_STATE_SUSPENDED; 326 328 pdev->dev.power.power_state = PMSG_SUSPEND; 327 329 328 330 return 0; ··· 332 330 333 331 static int ohci_hcd_pxa27x_drv_resume(struct platform_device *pdev) 334 332 { 335 - struct ohci_hcd *ohci = platform_get_drvdata(pdev); 333 + struct usb_hcd *hcd = platform_get_drvdata(pdev); 334 + struct ohci_hcd *ohci = hcd_to_ohci(hcd); 336 335 int status; 337 336 338 337 if (time_before(jiffies, ohci->next_statechange)) ··· 344 341 return status; 345 342 346 343 pdev->dev.power.power_state = PMSG_ON; 347 - usb_hcd_resume_root_hub(platform_get_drvdata(pdev)); 344 + usb_hcd_resume_root_hub(hcd); 348 345 349 346 return 0; 350 347 }