summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorMatthew Garrett <mjg@redhat.com>2010-05-26 14:43:46 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-27 09:12:49 -0700
commitd8cc5267b802003e2c67ac5254788044852ccfa9 (patch)
tree3b45ebdb73cea591cfd162ca651d374723cf3fd8 /drivers/char
parent2407d77a1a013b88ee3b817f2b934e420e5376f5 (diff)
downloadlinux-3.10-d8cc5267b802003e2c67ac5254788044852ccfa9.tar.gz
linux-3.10-d8cc5267b802003e2c67ac5254788044852ccfa9.tar.bz2
linux-3.10-d8cc5267b802003e2c67ac5254788044852ccfa9.zip
ipmi: only register one si per bmc
Only register one si per bmc. Use any user-provided devices first, followed by the first device with an irq, followed by the first device discovered. Signed-off-by: Matthew Garrett <mjg@redhat.com> Signed-off-by: Corey Minyard <cminyard@mvista.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 3f2a4900fe1..9b9e1e915cf 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -3298,6 +3298,14 @@ static __devinit int init_ipmi_si(void)
hardcode_find_bmc();
+ /* If the user gave us a device, they presumably want us to use it */
+ mutex_lock(&smi_infos_lock);
+ if (!list_empty(&smi_infos)) {
+ mutex_unlock(&smi_infos_lock);
+ return 0;
+ }
+ mutex_unlock(&smi_infos_lock);
+
#ifdef CONFIG_DMI
dmi_find_bmc();
#endif
@@ -3321,10 +3329,27 @@ static __devinit int init_ipmi_si(void)
of_register_platform_driver(&ipmi_of_platform_driver);
#endif
+ /* Try to register something with interrupts first */
+
mutex_lock(&smi_infos_lock);
list_for_each_entry(e, &smi_infos, link) {
- if (!e->si_sm)
- try_smi_init(e);
+ if (e->irq) {
+ if (!try_smi_init(e)) {
+ mutex_unlock(&smi_infos_lock);
+ return 0;
+ }
+ }
+ }
+
+ /* Fall back to the preferred device */
+
+ list_for_each_entry(e, &smi_infos, link) {
+ if (!e->irq) {
+ if (!try_smi_init(e)) {
+ mutex_unlock(&smi_infos_lock);
+ return 0;
+ }
+ }
}
mutex_unlock(&smi_infos_lock);