mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
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 <[email protected]> Acked-by: Corey Minyard <[email protected]> Cc: Jean Delvare <[email protected]> Cc: Kay Sievers <[email protected]> Cc: Greg KH <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
722faccc7e
commit
fe2d5ffc74
3 changed files with 30 additions and 24 deletions
|
|
@ -88,9 +88,11 @@
|
|||
static DEFINE_IDR(aem_idr);
|
||||
static DEFINE_SPINLOCK(aem_idr_lock);
|
||||
|
||||
static struct device_driver aem_driver = {
|
||||
.name = DRVNAME,
|
||||
.bus = &platform_bus_type,
|
||||
static struct platform_driver aem_driver = {
|
||||
.driver = {
|
||||
.name = DRVNAME,
|
||||
.bus = &platform_bus_type,
|
||||
}
|
||||
};
|
||||
|
||||
struct aem_ipmi_data {
|
||||
|
|
@ -583,7 +585,7 @@ static int aem_init_aem1_inst(struct aem_ipmi_data *probe, u8 module_handle)
|
|||
data->pdev = platform_device_alloc(DRVNAME, data->id);
|
||||
if (!data->pdev)
|
||||
goto dev_err;
|
||||
data->pdev->dev.driver = &aem_driver;
|
||||
data->pdev->dev.driver = &aem_driver.driver;
|
||||
|
||||
res = platform_device_add(data->pdev);
|
||||
if (res)
|
||||
|
|
@ -716,7 +718,7 @@ static int aem_init_aem2_inst(struct aem_ipmi_data *probe,
|
|||
data->pdev = platform_device_alloc(DRVNAME, data->id);
|
||||
if (!data->pdev)
|
||||
goto dev_err;
|
||||
data->pdev->dev.driver = &aem_driver;
|
||||
data->pdev->dev.driver = &aem_driver.driver;
|
||||
|
||||
res = platform_device_add(data->pdev);
|
||||
if (res)
|
||||
|
|
@ -1085,7 +1087,7 @@ static int __init aem_init(void)
|
|||
{
|
||||
int res;
|
||||
|
||||
res = driver_register(&aem_driver);
|
||||
res = driver_register(&aem_driver.driver);
|
||||
if (res) {
|
||||
printk(KERN_ERR "Can't register aem driver\n");
|
||||
return res;
|
||||
|
|
@ -1097,7 +1099,7 @@ static int __init aem_init(void)
|
|||
return 0;
|
||||
|
||||
ipmi_reg_err:
|
||||
driver_unregister(&aem_driver);
|
||||
driver_unregister(&aem_driver.driver);
|
||||
return res;
|
||||
|
||||
}
|
||||
|
|
@ -1107,7 +1109,7 @@ static void __exit aem_exit(void)
|
|||
struct aem_data *p1, *next1;
|
||||
|
||||
ipmi_smi_watcher_unregister(&driver_data.bmc_events);
|
||||
driver_unregister(&aem_driver);
|
||||
driver_unregister(&aem_driver.driver);
|
||||
list_for_each_entry_safe(p1, next1, &driver_data.aem_devices, list)
|
||||
aem_delete(p1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue