diff options
author | Matthew Garrett <mjg@redhat.com> | 2010-05-26 17:43:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-27 12:12:49 -0400 |
commit | d8cc5267b802003e2c67ac5254788044852ccfa9 (patch) | |
tree | 3b45ebdb73cea591cfd162ca651d374723cf3fd8 /drivers/char/ipmi | |
parent | 2407d77a1a013b88ee3b817f2b934e420e5376f5 (diff) |
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/ipmi')
-rw-r--r-- | drivers/char/ipmi/ipmi_si_intf.c | 29 |
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) | |||
3298 | 3298 | ||
3299 | hardcode_find_bmc(); | 3299 | hardcode_find_bmc(); |
3300 | 3300 | ||
3301 | /* If the user gave us a device, they presumably want us to use it */ | ||
3302 | mutex_lock(&smi_infos_lock); | ||
3303 | if (!list_empty(&smi_infos)) { | ||
3304 | mutex_unlock(&smi_infos_lock); | ||
3305 | return 0; | ||
3306 | } | ||
3307 | mutex_unlock(&smi_infos_lock); | ||
3308 | |||
3301 | #ifdef CONFIG_DMI | 3309 | #ifdef CONFIG_DMI |
3302 | dmi_find_bmc(); | 3310 | dmi_find_bmc(); |
3303 | #endif | 3311 | #endif |
@@ -3321,10 +3329,27 @@ static __devinit int init_ipmi_si(void) | |||
3321 | of_register_platform_driver(&ipmi_of_platform_driver); | 3329 | of_register_platform_driver(&ipmi_of_platform_driver); |
3322 | #endif | 3330 | #endif |
3323 | 3331 | ||
3332 | /* Try to register something with interrupts first */ | ||
3333 | |||
3324 | mutex_lock(&smi_infos_lock); | 3334 | mutex_lock(&smi_infos_lock); |
3325 | list_for_each_entry(e, &smi_infos, link) { | 3335 | list_for_each_entry(e, &smi_infos, link) { |
3326 | if (!e->si_sm) | 3336 | if (e->irq) { |
3327 | try_smi_init(e); | 3337 | if (!try_smi_init(e)) { |
3338 | mutex_unlock(&smi_infos_lock); | ||
3339 | return 0; | ||
3340 | } | ||
3341 | } | ||
3342 | } | ||
3343 | |||
3344 | /* Fall back to the preferred device */ | ||
3345 | |||
3346 | list_for_each_entry(e, &smi_infos, link) { | ||
3347 | if (!e->irq) { | ||
3348 | if (!try_smi_init(e)) { | ||
3349 | mutex_unlock(&smi_infos_lock); | ||
3350 | return 0; | ||
3351 | } | ||
3352 | } | ||
3328 | } | 3353 | } |
3329 | mutex_unlock(&smi_infos_lock); | 3354 | mutex_unlock(&smi_infos_lock); |
3330 | 3355 | ||