diff mbox

[1/2] ACPI / battery: use callback for setting up quirks

Message ID 1401822083-4866-1-git-send-email-mezin.alexander@gmail.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Aleksandr Mezin June 3, 2014, 7:01 p.m. UTC
Use callback for setting up quirk instead of checking return code
of dmi_check_system(). This change will allow using bat_dmi_table
for other quirks.

Signed-off-by: Alexander Mezin <mezin.alexander@gmail.com>
---
 drivers/acpi/battery.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Tianyu Lan June 10, 2014, 2:13 a.m. UTC | #1
2014-06-04 3:01 GMT+08:00 Alexander Mezin <mezin.alexander@gmail.com>:
> Use callback for setting up quirk instead of checking return code
> of dmi_check_system(). This change will allow using bat_dmi_table
> for other quirks.
>

Acked-by: Lan Tianyu <tianyu.lan@intel.com>

> Signed-off-by: Alexander Mezin <mezin.alexander@gmail.com>
> ---
>  drivers/acpi/battery.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
> index 6e7b2a1..f17bc7e 100644
> --- a/drivers/acpi/battery.c
> +++ b/drivers/acpi/battery.c
> @@ -1058,8 +1058,15 @@ static int battery_notify(struct notifier_block *nb,
>         return 0;
>  }
>
> +static int battery_bix_broken_package_quirk(const struct dmi_system_id *d)
> +{
> +       battery_bix_broken_package = 1;
> +       return 0;
> +}
> +
>  static struct dmi_system_id bat_dmi_table[] = {
>         {
> +               .callback = battery_bix_broken_package_quirk,
>                 .ident = "NEC LZ750/LS",
>                 .matches = {
>                         DMI_MATCH(DMI_SYS_VENDOR, "NEC"),
> @@ -1176,8 +1183,7 @@ static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
>         if (acpi_disabled)
>                 return;
>
> -       if (dmi_check_system(bat_dmi_table))
> -               battery_bix_broken_package = 1;
> +       dmi_check_system(bat_dmi_table);
>
>  #ifdef CONFIG_ACPI_PROCFS_POWER
>         acpi_battery_dir = acpi_lock_battery_dir();
> --
> 2.0.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rafael J. Wysocki June 19, 2014, 12:08 a.m. UTC | #2
On Wednesday, June 04, 2014 02:01:22 AM Alexander Mezin wrote:
> Use callback for setting up quirk instead of checking return code
> of dmi_check_system(). This change will allow using bat_dmi_table
> for other quirks.
> 
> Signed-off-by: Alexander Mezin <mezin.alexander@gmail.com>

Both [1-2/2] applied, thanks!

> ---
>  drivers/acpi/battery.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
> index 6e7b2a1..f17bc7e 100644
> --- a/drivers/acpi/battery.c
> +++ b/drivers/acpi/battery.c
> @@ -1058,8 +1058,15 @@ static int battery_notify(struct notifier_block *nb,
>  	return 0;
>  }
>  
> +static int battery_bix_broken_package_quirk(const struct dmi_system_id *d)
> +{
> +	battery_bix_broken_package = 1;
> +	return 0;
> +}
> +
>  static struct dmi_system_id bat_dmi_table[] = {
>  	{
> +		.callback = battery_bix_broken_package_quirk,
>  		.ident = "NEC LZ750/LS",
>  		.matches = {
>  			DMI_MATCH(DMI_SYS_VENDOR, "NEC"),
> @@ -1176,8 +1183,7 @@ static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
>  	if (acpi_disabled)
>  		return;
>  
> -	if (dmi_check_system(bat_dmi_table))
> -		battery_bix_broken_package = 1;
> +	dmi_check_system(bat_dmi_table);
>  	
>  #ifdef CONFIG_ACPI_PROCFS_POWER
>  	acpi_battery_dir = acpi_lock_battery_dir();
>
diff mbox

Patch

diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 6e7b2a1..f17bc7e 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -1058,8 +1058,15 @@  static int battery_notify(struct notifier_block *nb,
 	return 0;
 }
 
+static int battery_bix_broken_package_quirk(const struct dmi_system_id *d)
+{
+	battery_bix_broken_package = 1;
+	return 0;
+}
+
 static struct dmi_system_id bat_dmi_table[] = {
 	{
+		.callback = battery_bix_broken_package_quirk,
 		.ident = "NEC LZ750/LS",
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "NEC"),
@@ -1176,8 +1183,7 @@  static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
 	if (acpi_disabled)
 		return;
 
-	if (dmi_check_system(bat_dmi_table))
-		battery_bix_broken_package = 1;
+	dmi_check_system(bat_dmi_table);
 	
 #ifdef CONFIG_ACPI_PROCFS_POWER
 	acpi_battery_dir = acpi_lock_battery_dir();