aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@us.ibm.com>2008-11-12 16:25:00 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-11-12 20:17:16 -0500
commitfe2d5ffc74a1de6a31e9fd65b65cce72d881edf7 (patch)
treef867318d9831cfa347e1374d6f723564f235399c /drivers/hwmon
parent722faccc7eb0a9b248fba3e7020b1c3770c41aef (diff)
Fix platform drivers that crash on suspend/resume
It turns out that if one registers a struct platform_device, the platform device code expects that platform_device.device->driver points to a struct driver inside a struct platform_driver. This is not the case with the ipmi-si, ipmi-msghandler and ibmaem drivers, which causes the suspend/resume hook functions to jump off into nowhere, causing a crash. Make this assumption hold true for these three drivers. Signed-off-by: Darrick J. Wong <djwong@us.ibm.com> Acked-by: Corey Minyard <cminyard@mvista.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: Greg KH <greg@kroah.com> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/ibmaem.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c
index 7b0ed5dea399..fe74609a7feb 100644
--- a/drivers/hwmon/ibmaem.c
+++ b/drivers/hwmon/ibmaem.c
@@ -88,9 +88,11 @@
88static DEFINE_IDR(aem_idr); 88static DEFINE_IDR(aem_idr);
89static DEFINE_SPINLOCK(aem_idr_lock); 89static DEFINE_SPINLOCK(aem_idr_lock);
90 90
91static struct device_driver aem_driver = { 91static struct platform_driver aem_driver = {
92 .name = DRVNAME, 92 .driver = {
93 .bus = &platform_bus_type, 93 .name = DRVNAME,
94 .bus = &platform_bus_type,
95 }
94}; 96};
95 97
96struct aem_ipmi_data { 98struct aem_ipmi_data {
@@ -583,7 +585,7 @@ static int aem_init_aem1_inst(struct aem_ipmi_data *probe, u8 module_handle)
583 data->pdev = platform_device_alloc(DRVNAME, data->id); 585 data->pdev = platform_device_alloc(DRVNAME, data->id);
584 if (!data->pdev) 586 if (!data->pdev)
585 goto dev_err; 587 goto dev_err;
586 data->pdev->dev.driver = &aem_driver; 588 data->pdev->dev.driver = &aem_driver.driver;
587 589
588 res = platform_device_add(data->pdev); 590 res = platform_device_add(data->pdev);
589 if (res) 591 if (res)
@@ -716,7 +718,7 @@ static int aem_init_aem2_inst(struct aem_ipmi_data *probe,
716 data->pdev = platform_device_alloc(DRVNAME, data->id); 718 data->pdev = platform_device_alloc(DRVNAME, data->id);
717 if (!data->pdev) 719 if (!data->pdev)
718 goto dev_err; 720 goto dev_err;
719 data->pdev->dev.driver = &aem_driver; 721 data->pdev->dev.driver = &aem_driver.driver;
720 722
721 res = platform_device_add(data->pdev); 723 res = platform_device_add(data->pdev);
722 if (res) 724 if (res)
@@ -1085,7 +1087,7 @@ static int __init aem_init(void)
1085{ 1087{
1086 int res; 1088 int res;
1087 1089
1088 res = driver_register(&aem_driver); 1090 res = driver_register(&aem_driver.driver);
1089 if (res) { 1091 if (res) {
1090 printk(KERN_ERR "Can't register aem driver\n"); 1092 printk(KERN_ERR "Can't register aem driver\n");
1091 return res; 1093 return res;
@@ -1097,7 +1099,7 @@ static int __init aem_init(void)
1097 return 0; 1099 return 0;
1098 1100
1099ipmi_reg_err: 1101ipmi_reg_err:
1100 driver_unregister(&aem_driver); 1102 driver_unregister(&aem_driver.driver);
1101 return res; 1103 return res;
1102 1104
1103} 1105}
@@ -1107,7 +1109,7 @@ static void __exit aem_exit(void)
1107 struct aem_data *p1, *next1; 1109 struct aem_data *p1, *next1;
1108 1110
1109 ipmi_smi_watcher_unregister(&driver_data.bmc_events); 1111 ipmi_smi_watcher_unregister(&driver_data.bmc_events);
1110 driver_unregister(&aem_driver); 1112 driver_unregister(&aem_driver.driver);
1111 list_for_each_entry_safe(p1, next1, &driver_data.aem_devices, list) 1113 list_for_each_entry_safe(p1, next1, &driver_data.aem_devices, list)
1112 aem_delete(p1); 1114 aem_delete(p1);
1113} 1115}