Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8cc5267 authored by Matthew Garrett's avatar Matthew Garrett Committed by Linus Torvalds
Browse files

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: default avatarMatthew Garrett <mjg@redhat.com>
Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 2407d77a
Loading
Loading
Loading
Loading
+27 −2
Original line number Original line Diff line number Diff line
@@ -3298,6 +3298,14 @@ static __devinit int init_ipmi_si(void)


	hardcode_find_bmc();
	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
#ifdef CONFIG_DMI
	dmi_find_bmc();
	dmi_find_bmc();
#endif
#endif
@@ -3321,10 +3329,27 @@ static __devinit int init_ipmi_si(void)
	of_register_platform_driver(&ipmi_of_platform_driver);
	of_register_platform_driver(&ipmi_of_platform_driver);
#endif
#endif


	/* Try to register something with interrupts first */

	mutex_lock(&smi_infos_lock);
	mutex_lock(&smi_infos_lock);
	list_for_each_entry(e, &smi_infos, link) {
	list_for_each_entry(e, &smi_infos, link) {
		if (!e->si_sm)
		if (e->irq) {
			try_smi_init(e);
			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);
	mutex_unlock(&smi_infos_lock);