summary refs log tree commit diff
path: root/drivers/usb
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2005-11-28 22:15:46 +0000
committerGreg Kroah-Hartman <gregkh@suse.de>2006-01-04 13:51:40 -0800
commita5e36d20897ff8317e722fceb4d9eea3e4a5906b (patch)
treece2d7906a3980c0d31cf848d7f227409d4713092 /drivers/usb
parent4c4c9432a6c916729c7296c47fe93b053a73e20c (diff)
downloadlinux-a5e36d20897ff8317e722fceb4d9eea3e4a5906b.tar.gz
[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>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/ohci-pxa27x.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index 3b1cfe939483..acde8868da21 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -309,20 +309,22 @@ static int ohci_hcd_pxa27x_drv_remove(struct platform_device *pdev)
 	struct usb_hcd *hcd = platform_get_drvdata(pdev);
 
 	usb_hcd_pxa27x_remove(hcd, pdev);
+	platform_set_drvdata(pdev, NULL);
 	return 0;
 }
 
 #ifdef	CONFIG_PM
 static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *pdev, pm_message_t state)
 {
-	struct ohci_hcd *ohci = platform_get_drvdata(pdev);
+	struct usb_hcd *hcd = platform_get_drvdata(pdev);
+	struct ohci_hcd *ohci = hcd_to_ohci(hcd);
 
 	if (time_before(jiffies, ohci->next_statechange))
 		msleep(5);
 	ohci->next_statechange = jiffies;
 
 	pxa27x_stop_hc(&pdev->dev);
-	ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED;
+	hcd->state = HC_STATE_SUSPENDED;
 	pdev->dev.power.power_state = PMSG_SUSPEND;
 
 	return 0;
@@ -330,7 +332,8 @@ static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *pdev, pm_message_
 
 static int ohci_hcd_pxa27x_drv_resume(struct platform_device *pdev)
 {
-	struct ohci_hcd	*ohci = platform_get_drvdata(pdev);
+	struct usb_hcd *hcd = platform_get_drvdata(pdev);
+	struct ohci_hcd *ohci = hcd_to_ohci(hcd);
 	int status;
 
 	if (time_before(jiffies, ohci->next_statechange))
@@ -341,7 +344,7 @@ static int ohci_hcd_pxa27x_drv_resume(struct platform_device *pdev)
 		return status;
 
 	pdev->dev.power.power_state = PMSG_ON;
-	usb_hcd_resume_root_hub(platform_get_drvdata(pdev));
+	usb_hcd_resume_root_hub(hcd);
 
 	return 0;
 }