From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: Justin Forbes <jmforbes@linuxtx.org>,
Zwane Mwaikambo <zwane@arm.linux.org.uk>,
"Theodore Ts'o" <tytso@mit.edu>,
Randy Dunlap <rdunlap@xenotime.net>,
Dave Jones <davej@redhat.com>,
Chuck Wolber <chuckw@quantumlinux.com>,
Chris Wedgwood <reviews@ml.cw.f00f.org>,
Michael Krufky <mkrufky@linuxtv.org>,
Chuck Ebbert <cebbert@redhat.com>,
Domenico Andreoli <cavokz@gmail.com>, Willy Tarreau <w@1wt.eu>,
Rodrigo Rubira Branco <rbranco@la.checkpoint.com>,
Jake Edge <jake@lwn.net>, Eugene Teo <eteo@redhat.com>,
torvalds@linux-foundation.org, akpm@linux-foundation.org,
alan@lxorguk.ukuu.org.uk, "Darrick J. Wong" <djwong@us.ibm.com>,
Corey Minyard <cminyard@mvista.com>,
Jean Delvare <khali@linux-fr.org>,
Kay Sievers <kay.sievers@vrfy.org>
Subject: [patch 09/22] Fix platform drivers that crash on suspend/resume
Date: Fri, 14 Nov 2008 21:23:13 -0800 [thread overview]
Message-ID: <20081115052313.GJ3710@kroah.com> (raw)
In-Reply-To: <20081115052220.GA3710@kroah.com>
[-- Attachment #1: fix-platform-drivers-that-crash-on-suspend-resume.patch --]
[-- Type: text/plain, Size: 6440 bytes --]
2.6.27-stable review patch. If anyone has any objections, please let us know.
------------------
From: Darrick J. Wong <djwong@us.ibm.com>
commit fe2d5ffc74a1de6a31e9fd65b65cce72d881edf7 upstream.
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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/char/ipmi/ipmi_msghandler.c | 20 +++++++++++---------
drivers/char/ipmi/ipmi_si_intf.c | 16 +++++++++-------
drivers/hwmon/ibmaem.c | 18 ++++++++++--------
3 files changed, 30 insertions(+), 24 deletions(-)
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -422,9 +422,11 @@ struct ipmi_smi {
/**
* The driver model view of the IPMI messaging driver.
*/
-static struct device_driver ipmidriver = {
- .name = "ipmi",
- .bus = &platform_bus_type
+static struct platform_driver ipmidriver = {
+ .driver = {
+ .name = "ipmi",
+ .bus = &platform_bus_type
+ }
};
static DEFINE_MUTEX(ipmidriver_mutex);
@@ -2384,9 +2386,9 @@ static int ipmi_bmc_register(ipmi_smi_t
* representing the interfaced BMC already
*/
if (bmc->guid_set)
- old_bmc = ipmi_find_bmc_guid(&ipmidriver, bmc->guid);
+ old_bmc = ipmi_find_bmc_guid(&ipmidriver.driver, bmc->guid);
else
- old_bmc = ipmi_find_bmc_prod_dev_id(&ipmidriver,
+ old_bmc = ipmi_find_bmc_prod_dev_id(&ipmidriver.driver,
bmc->id.product_id,
bmc->id.device_id);
@@ -2416,7 +2418,7 @@ static int ipmi_bmc_register(ipmi_smi_t
snprintf(name, sizeof(name),
"ipmi_bmc.%4.4x", bmc->id.product_id);
- while (ipmi_find_bmc_prod_dev_id(&ipmidriver,
+ while (ipmi_find_bmc_prod_dev_id(&ipmidriver.driver,
bmc->id.product_id,
bmc->id.device_id)) {
if (!warn_printed) {
@@ -2446,7 +2448,7 @@ static int ipmi_bmc_register(ipmi_smi_t
" Unable to allocate platform device\n");
return -ENOMEM;
}
- bmc->dev->dev.driver = &ipmidriver;
+ bmc->dev->dev.driver = &ipmidriver.driver;
dev_set_drvdata(&bmc->dev->dev, bmc);
kref_init(&bmc->refcount);
@@ -4247,7 +4249,7 @@ static int ipmi_init_msghandler(void)
if (initialized)
return 0;
- rv = driver_register(&ipmidriver);
+ rv = driver_register(&ipmidriver.driver);
if (rv) {
printk(KERN_ERR PFX "Could not register IPMI driver\n");
return rv;
@@ -4308,7 +4310,7 @@ static __exit void cleanup_ipmi(void)
remove_proc_entry(proc_ipmi_root->name, NULL);
#endif /* CONFIG_PROC_FS */
- driver_unregister(&ipmidriver);
+ driver_unregister(&ipmidriver.driver);
initialized = 0;
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -114,9 +114,11 @@ static char *si_to_str[] = { "kcs", "smi
#define DEVICE_NAME "ipmi_si"
-static struct device_driver ipmi_driver = {
- .name = DEVICE_NAME,
- .bus = &platform_bus_type
+static struct platform_driver ipmi_driver = {
+ .driver = {
+ .name = DEVICE_NAME,
+ .bus = &platform_bus_type
+ }
};
@@ -2868,7 +2870,7 @@ static int try_smi_init(struct smi_info
goto out_err;
}
new_smi->dev = &new_smi->pdev->dev;
- new_smi->dev->driver = &ipmi_driver;
+ new_smi->dev->driver = &ipmi_driver.driver;
rv = platform_device_add(new_smi->pdev);
if (rv) {
@@ -2983,7 +2985,7 @@ static __devinit int init_ipmi_si(void)
initialized = 1;
/* Register the device drivers. */
- rv = driver_register(&ipmi_driver);
+ rv = driver_register(&ipmi_driver.driver);
if (rv) {
printk(KERN_ERR
"init_ipmi_si: Unable to register driver: %d\n",
@@ -3052,7 +3054,7 @@ static __devinit int init_ipmi_si(void)
#ifdef CONFIG_PPC_OF
of_unregister_platform_driver(&ipmi_of_platform_driver);
#endif
- driver_unregister(&ipmi_driver);
+ driver_unregister(&ipmi_driver.driver);
printk(KERN_WARNING
"ipmi_si: Unable to find any System Interface(s)\n");
return -ENODEV;
@@ -3151,7 +3153,7 @@ static __exit void cleanup_ipmi_si(void)
cleanup_one_si(e);
mutex_unlock(&smi_infos_lock);
- driver_unregister(&ipmi_driver);
+ driver_unregister(&ipmi_driver.driver);
}
module_exit(cleanup_ipmi_si);
--- a/drivers/hwmon/ibmaem.c
+++ b/drivers/hwmon/ibmaem.c
@@ -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
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
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);
}
--
next prev parent reply other threads:[~2008-11-15 5:28 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20081115051732.506914008@mini.kroah.org>
2008-11-15 5:22 ` [patch 00/22] 2.6.27.7-stable review Greg KH
2008-11-15 5:22 ` [patch 01/22] touch_mnt_namespace when the mount flags change Greg KH
2008-11-15 5:22 ` [patch 02/22] iwlagn: avoid sleep in softirq context Greg KH
2008-11-15 5:22 ` [patch 03/22] ath5k: fix suspend-related oops on rmmod Greg KH
2008-11-15 5:22 ` [patch 04/22] ath5k: Fix reset sequence for AR5212 in general and RF5111 in particular Greg KH
2008-11-15 5:22 ` [patch 05/22] bnx2x: Removing the PMF indication when unloading Greg KH
2008-11-15 5:23 ` [patch 06/22] bnx2x: PCI configuration bug on big-endian Greg KH
2008-11-15 5:23 ` [patch 07/22] bnx2x: Calling netif_carrier_off at the end of the probe Greg KH
2008-11-15 5:23 ` [patch 08/22] ARM: 5329/1: Feroceon: fix feroceon_l2_inv_range Greg KH
2008-11-15 5:23 ` Greg KH [this message]
2008-11-15 5:23 ` [patch 10/22] hostap: pad the skb->cb usage in lieu of a proper fix Greg KH
2008-11-15 5:23 ` [patch 11/22] ACPI: avoid empty file name in sysfs Greg KH
2008-11-15 5:23 ` [patch 12/22] ACPI: EC: make kernel messages more useful when GPE storm is detected Greg KH
2008-11-15 5:23 ` [patch 13/22] hugetlb: make unmap_ref_private multi-size-aware Greg KH
2008-11-15 5:23 ` [patch 14/22] rtl8187: Add Abocom USB ID Greg KH
2008-11-15 5:23 ` [patch 15/22] rtl8187 : support for Sitecom WL-168 0001 v4 Greg KH
2008-11-15 5:23 ` [patch 16/22] kbuild: Fixup deb-pkg target to generate separate firmware deb Greg KH
2008-11-15 5:23 ` [patch 17/22] block: fix nr_phys_segments miscalculation bug Greg KH
2008-11-15 5:23 ` [patch 18/22] powerpc/mpic: Fix regression caused by change of default IRQ affinity Greg KH
2008-11-15 5:23 ` [patch 19/22] Input: ALPS - add signature for DualPoint found in Dell Latitude E6500 Greg KH
2008-11-15 5:23 ` [patch 20/22] memory hotplug: fix page_zone() calculation in test_pages_isolated() Greg KH
2008-11-15 5:23 ` [patch 21/22] r8169: select MII in Kconfig Greg KH
2008-11-15 5:24 ` [patch 22/22] sony-laptop: ignore missing _DIS method on pic device Greg KH
2008-11-16 10:38 ` [patch 00/22] 2.6.27.7-stable review François Valenduc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081115052313.GJ3710@kroah.com \
--to=gregkh@suse.de \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=cavokz@gmail.com \
--cc=cebbert@redhat.com \
--cc=chuckw@quantumlinux.com \
--cc=cminyard@mvista.com \
--cc=davej@redhat.com \
--cc=djwong@us.ibm.com \
--cc=eteo@redhat.com \
--cc=jake@lwn.net \
--cc=jmforbes@linuxtx.org \
--cc=kay.sievers@vrfy.org \
--cc=khali@linux-fr.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkrufky@linuxtv.org \
--cc=rbranco@la.checkpoint.com \
--cc=rdunlap@xenotime.net \
--cc=reviews@ml.cw.f00f.org \
--cc=stable@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=tytso@mit.edu \
--cc=w@1wt.eu \
--cc=zwane@arm.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox