Re: [PATCH] ACPI: do acpisleep dmi check when CONFIG_ACPI_SLEEP is set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday, November 28, 2012 10:56:34 PM Zhang Rui wrote:
> From f730858816ceada75afeb7a0e780f2c08e5ae50a Mon Sep 17 00:00:00 2001
> From: Zhang Rui <rui.zhang@xxxxxxxxx>
> Date: Wed, 28 Nov 2012 22:26:51 +0800
> Subject: [PATCH] ACPI: do acpisleep dmi check when CONFIG_ACPI_SLEEP is set
> 
> The current acpisleep dmi checks only run when CONFIG_SUSPEND is set.
> And this may break hibernation on some platforms when CONFIG_SUSPEND
> is cleared.
> https://bugzilla.kernel.org/show_bug.cgi?id=45921
> 
> Move acpisleep dmi check into #ifdef CONFIG_ACPI_SLEEP instead.
> 
> Signed-off-by: Zhang Rui <rui.zhang@xxxxxxxxx>
> ---
>  drivers/acpi/sleep.c |  327 +++++++++++++++++++++++++-------------------------
>  1 file changed, 164 insertions(+), 163 deletions(-)
> 
> diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
> index fdcdbb6..91a3c0f 100644
> --- a/drivers/acpi/sleep.c
> +++ b/drivers/acpi/sleep.c
> @@ -109,6 +109,167 @@ void __init acpi_old_suspend_ordering(void)
>  	old_suspend_ordering = true;
>  }
>  
> +static int __init init_old_suspend_ordering(const struct dmi_system_id *d)
> +{
> +	acpi_old_suspend_ordering();
> +	return 0;
> +}
> +
> +static int __init init_nvs_nosave(const struct dmi_system_id *d)
> +{
> +	acpi_nvs_nosave();
> +	return 0;
> +}
> +
> +static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
> +	{
> +	.callback = init_old_suspend_ordering,
> +	.ident = "Abit KN9 (nForce4 variant)",
> +	.matches = {
> +		DMI_MATCH(DMI_BOARD_VENDOR, "http://www.abit.com.tw/";),
> +		DMI_MATCH(DMI_BOARD_NAME, "KN9 Series(NF-CK804)"),
> +		},
> +	},
> +	{
> +	.callback = init_old_suspend_ordering,
> +	.ident = "HP xw4600 Workstation",
> +	.matches = {
> +		DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
> +		DMI_MATCH(DMI_PRODUCT_NAME, "HP xw4600 Workstation"),
> +		},
> +	},
> +	{
> +	.callback = init_old_suspend_ordering,
> +	.ident = "Asus Pundit P1-AH2 (M2N8L motherboard)",
> +	.matches = {
> +		DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTek Computer INC."),
> +		DMI_MATCH(DMI_BOARD_NAME, "M2N8L"),
> +		},
> +	},
> +	{
> +	.callback = init_old_suspend_ordering,
> +	.ident = "Panasonic CF51-2L",
> +	.matches = {
> +		DMI_MATCH(DMI_BOARD_VENDOR,
> +				"Matsushita Electric Industrial Co.,Ltd."),
> +		DMI_MATCH(DMI_BOARD_NAME, "CF51-2L"),
> +		},
> +	},
> +	{
> +	.callback = init_nvs_nosave,
> +	.ident = "Sony Vaio VGN-FW21E",
> +	.matches = {
> +		DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
> +		DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FW21E"),
> +		},
> +	},
> +	{
> +	.callback = init_nvs_nosave,
> +	.ident = "Sony Vaio VPCEB17FX",
> +	.matches = {
> +		DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
> +		DMI_MATCH(DMI_PRODUCT_NAME, "VPCEB17FX"),
> +		},
> +	},
> +	{
> +	.callback = init_nvs_nosave,
> +	.ident = "Sony Vaio VGN-SR11M",
> +	.matches = {
> +		DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
> +		DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR11M"),
> +		},
> +	},
> +	{
> +	.callback = init_nvs_nosave,
> +	.ident = "Everex StepNote Series",
> +	.matches = {
> +		DMI_MATCH(DMI_SYS_VENDOR, "Everex Systems, Inc."),
> +		DMI_MATCH(DMI_PRODUCT_NAME, "Everex StepNote Series"),
> +		},
> +	},
> +	{
> +	.callback = init_nvs_nosave,
> +	.ident = "Sony Vaio VPCEB1Z1E",
> +	.matches = {
> +		DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
> +		DMI_MATCH(DMI_PRODUCT_NAME, "VPCEB1Z1E"),
> +		},
> +	},
> +	{
> +	.callback = init_nvs_nosave,
> +	.ident = "Sony Vaio VGN-NW130D",
> +	.matches = {
> +		DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
> +		DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NW130D"),
> +		},
> +	},
> +	{
> +	.callback = init_nvs_nosave,
> +	.ident = "Sony Vaio VPCCW29FX",
> +	.matches = {
> +		DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
> +		DMI_MATCH(DMI_PRODUCT_NAME, "VPCCW29FX"),
> +		},
> +	},
> +	{
> +	.callback = init_nvs_nosave,
> +	.ident = "Averatec AV1020-ED2",
> +	.matches = {
> +		DMI_MATCH(DMI_SYS_VENDOR, "AVERATEC"),
> +		DMI_MATCH(DMI_PRODUCT_NAME, "1000 Series"),
> +		},
> +	},
> +	{
> +	.callback = init_old_suspend_ordering,
> +	.ident = "Asus A8N-SLI DELUXE",
> +	.matches = {
> +		DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
> +		DMI_MATCH(DMI_BOARD_NAME, "A8N-SLI DELUXE"),
> +		},
> +	},
> +	{
> +	.callback = init_old_suspend_ordering,
> +	.ident = "Asus A8N-SLI Premium",
> +	.matches = {
> +		DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
> +		DMI_MATCH(DMI_BOARD_NAME, "A8N-SLI Premium"),
> +		},
> +	},
> +	{
> +	.callback = init_nvs_nosave,
> +	.ident = "Sony Vaio VGN-SR26GN_P",
> +	.matches = {
> +		DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
> +		DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR26GN_P"),
> +		},
> +	},
> +	{
> +	.callback = init_nvs_nosave,
> +	.ident = "Sony Vaio VGN-FW520F",
> +	.matches = {
> +		DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
> +		DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FW520F"),
> +		},
> +	},
> +	{
> +	.callback = init_nvs_nosave,
> +	.ident = "Asus K54C",
> +	.matches = {
> +		DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
> +		DMI_MATCH(DMI_PRODUCT_NAME, "K54C"),
> +		},
> +	},
> +	{
> +	.callback = init_nvs_nosave,
> +	.ident = "Asus K54HR",
> +	.matches = {
> +		DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
> +		DMI_MATCH(DMI_PRODUCT_NAME, "K54HR"),
> +		},
> +	},
> +	{},
> +};
> +
>  /**
>   * acpi_pm_freeze - Disable the GPEs and suspend EC transactions.
>   */
> @@ -382,167 +543,6 @@ static const struct platform_suspend_ops acpi_suspend_ops_old = {
>  	.end = acpi_pm_end,
>  	.recover = acpi_pm_finish,
>  };
> -
> -static int __init init_old_suspend_ordering(const struct dmi_system_id *d)
> -{
> -	old_suspend_ordering = true;
> -	return 0;
> -}
> -
> -static int __init init_nvs_nosave(const struct dmi_system_id *d)
> -{
> -	acpi_nvs_nosave();
> -	return 0;
> -}
> -
> -static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
> -	{
> -	.callback = init_old_suspend_ordering,
> -	.ident = "Abit KN9 (nForce4 variant)",
> -	.matches = {
> -		DMI_MATCH(DMI_BOARD_VENDOR, "http://www.abit.com.tw/";),
> -		DMI_MATCH(DMI_BOARD_NAME, "KN9 Series(NF-CK804)"),
> -		},
> -	},
> -	{
> -	.callback = init_old_suspend_ordering,
> -	.ident = "HP xw4600 Workstation",
> -	.matches = {
> -		DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
> -		DMI_MATCH(DMI_PRODUCT_NAME, "HP xw4600 Workstation"),
> -		},
> -	},
> -	{
> -	.callback = init_old_suspend_ordering,
> -	.ident = "Asus Pundit P1-AH2 (M2N8L motherboard)",
> -	.matches = {
> -		DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTek Computer INC."),
> -		DMI_MATCH(DMI_BOARD_NAME, "M2N8L"),
> -		},
> -	},
> -	{
> -	.callback = init_old_suspend_ordering,
> -	.ident = "Panasonic CF51-2L",
> -	.matches = {
> -		DMI_MATCH(DMI_BOARD_VENDOR,
> -				"Matsushita Electric Industrial Co.,Ltd."),
> -		DMI_MATCH(DMI_BOARD_NAME, "CF51-2L"),
> -		},
> -	},
> -	{
> -	.callback = init_nvs_nosave,
> -	.ident = "Sony Vaio VGN-FW21E",
> -	.matches = {
> -		DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
> -		DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FW21E"),
> -		},
> -	},
> -	{
> -	.callback = init_nvs_nosave,
> -	.ident = "Sony Vaio VPCEB17FX",
> -	.matches = {
> -		DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
> -		DMI_MATCH(DMI_PRODUCT_NAME, "VPCEB17FX"),
> -		},
> -	},
> -	{
> -	.callback = init_nvs_nosave,
> -	.ident = "Sony Vaio VGN-SR11M",
> -	.matches = {
> -		DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
> -		DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR11M"),
> -		},
> -	},
> -	{
> -	.callback = init_nvs_nosave,
> -	.ident = "Everex StepNote Series",
> -	.matches = {
> -		DMI_MATCH(DMI_SYS_VENDOR, "Everex Systems, Inc."),
> -		DMI_MATCH(DMI_PRODUCT_NAME, "Everex StepNote Series"),
> -		},
> -	},
> -	{
> -	.callback = init_nvs_nosave,
> -	.ident = "Sony Vaio VPCEB1Z1E",
> -	.matches = {
> -		DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
> -		DMI_MATCH(DMI_PRODUCT_NAME, "VPCEB1Z1E"),
> -		},
> -	},
> -	{
> -	.callback = init_nvs_nosave,
> -	.ident = "Sony Vaio VGN-NW130D",
> -	.matches = {
> -		DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
> -		DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NW130D"),
> -		},
> -	},
> -	{
> -	.callback = init_nvs_nosave,
> -	.ident = "Sony Vaio VPCCW29FX",
> -	.matches = {
> -		DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
> -		DMI_MATCH(DMI_PRODUCT_NAME, "VPCCW29FX"),
> -		},
> -	},
> -	{
> -	.callback = init_nvs_nosave,
> -	.ident = "Averatec AV1020-ED2",
> -	.matches = {
> -		DMI_MATCH(DMI_SYS_VENDOR, "AVERATEC"),
> -		DMI_MATCH(DMI_PRODUCT_NAME, "1000 Series"),
> -		},
> -	},
> -	{
> -	.callback = init_old_suspend_ordering,
> -	.ident = "Asus A8N-SLI DELUXE",
> -	.matches = {
> -		DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
> -		DMI_MATCH(DMI_BOARD_NAME, "A8N-SLI DELUXE"),
> -		},
> -	},
> -	{
> -	.callback = init_old_suspend_ordering,
> -	.ident = "Asus A8N-SLI Premium",
> -	.matches = {
> -		DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
> -		DMI_MATCH(DMI_BOARD_NAME, "A8N-SLI Premium"),
> -		},
> -	},
> -	{
> -	.callback = init_nvs_nosave,
> -	.ident = "Sony Vaio VGN-SR26GN_P",
> -	.matches = {
> -		DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
> -		DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR26GN_P"),
> -		},
> -	},
> -	{
> -	.callback = init_nvs_nosave,
> -	.ident = "Sony Vaio VGN-FW520F",
> -	.matches = {
> -		DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
> -		DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FW520F"),
> -		},
> -	},
> -	{
> -	.callback = init_nvs_nosave,
> -	.ident = "Asus K54C",
> -	.matches = {
> -		DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
> -		DMI_MATCH(DMI_PRODUCT_NAME, "K54C"),
> -		},
> -	},
> -	{
> -	.callback = init_nvs_nosave,
> -	.ident = "Asus K54HR",
> -	.matches = {
> -		DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
> -		DMI_MATCH(DMI_PRODUCT_NAME, "K54HR"),
> -		},
> -	},
> -	{},
> -};
>  #endif /* CONFIG_SUSPEND */
>  
>  #ifdef CONFIG_HIBERNATION
> @@ -873,13 +873,14 @@ int __init acpi_sleep_init(void)
>  	u8 type_a, type_b;
>  #ifdef CONFIG_SUSPEND
>  	int i = 0;
> -
> -	dmi_check_system(acpisleep_dmi_table);
>  #endif
>  
>  	if (acpi_disabled)
>  		return 0;
>  
> +#ifdef CONFIG_ACPI_SLEEP
> +	dmi_check_system(acpisleep_dmi_table);
> +#endif

Can you please define dmi_check_system() as an empty static inline if
CONFIG_ACPI_SLEEP is not set and get rid of this ugly #ifdef?

>  	sleep_states[ACPI_STATE_S0] = 1;
>  	printk(KERN_INFO PREFIX "(supports S0");

Apart from the above, looks OK.

Thanks,
Rafael


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux