Re: [PATCH] x86, reboot: skip DMI checks if reboot set by user
From: Michael D Labriola
Date: Thu Jan 19 2012 - 10:47:46 EST
Alan Cox <alan@xxxxxxxxxxxxxxxxxxx> wrote on 01/17/2012 02:58:41 PM:
> On Tue, 17 Jan 2012 10:16:03 -0500
> Michael D Labriola <mlabriol@xxxxxxxx> wrote:
>
> > This commit causes DMI checks for vendor specific reboot
> > quirks to be skipped if the user passed in a reboot= arg
> > on the command line.
> >
> > Signed-off-by: Michael D Labriola <mlabriol@xxxxxxxx>
> > ---
> > arch/x86/kernel/reboot.c | 16 ++++++++++++++--
> > 1 files changed, 14 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
> > index 37a458b..4240d58 100644
> > --- a/arch/x86/kernel/reboot.c
> > +++ b/arch/x86/kernel/reboot.c
> > @@ -38,6 +38,7 @@ static const struct desc_ptr no_idt = {};
> > static int reboot_mode;
> > enum reboot_type reboot_type = BOOT_ACPI;
> > int reboot_force;
> > +int reboot_user;
>
> static ...
Oops, good point.
> > case 'f':
> > reboot_force = 1;
> > + reboot_user = 1;
>
> Cleaner would be to add a
>
> BOOT_ACPI_FORCE perhaps so you can tell ACPI v ACPI specified by user
>
> > break;
> > }
> >
> > @@ -316,7 +322,10 @@ static struct dmi_system_id __initdata
> > reboot_dmi_table[] = {
> >
> > static int __init reboot_init(void)
> > {
> > - dmi_check_system(reboot_dmi_table);
> > + /* Skip the DMI check if user set reboot= on the command line
*/
> > + if (!reboot_user) {
>
> then do
>
> if (reboot_type == BOOT_ACPI)
> > + dmi_check_system(reboot_dmi_table);
> > + }
This seems a little less obvious to the casual observer than the way I
implemented it... but maybe that's just me. It would indeed disable DMI
checking if reboot_type's value is anything other than BOOT_ACPI (which
is the default), but that does assume BOOT_ACPI is the default. What if
that's ever changed? Seems likely to me that whoever changes the default
in the future could very easily re-break this at that point.
Thoughts?
I'm going to resubmit this patche anyway, as Ingo pointed out I've got
line-wrap issues.
---
Michael D Labriola
Electric Boat
mlabriol@xxxxxxxx
401-848-8871 (desk)
401-848-8513 (lab)
401-316-9844 (cell)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/