Skip to content

Commit

Permalink
ipmi: only register one si per bmc
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Matthew Garrett authored and Linus Torvalds committed May 27, 2010
1 parent 2407d77 commit d8cc526
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions drivers/char/ipmi/ipmi_si_intf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);

Expand Down

0 comments on commit d8cc526

Please sign in to comment.