Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1615684 > unrolled thread

[PATCH 2/2] platform/x86: silead_dmi - abort early if DMI does not match

Started byDmitry Torokhov <dmitry.torokhov@gmail.com>
First post2017-04-04 05:30 +0200
Last post2017-04-06 23:50 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] platform/x86: silead_dmi - abort early if DMI does not match Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-04-04 05:30 +0200
    Re: [PATCH 2/2] platform/x86: silead_dmi - abort early if DMI does  not match Hans de Goede <hdegoede@redhat.com> - 2017-04-04 12:00 +0200
    Re: [PATCH 2/2] platform/x86: silead_dmi - abort early if DMI does  not match Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-04-06 23:50 +0200

#1615684 — [PATCH 2/2] platform/x86: silead_dmi - abort early if DMI does not match

FromDmitry Torokhov <dmitry.torokhov@gmail.com>
Date2017-04-04 05:30 +0200
Subject[PATCH 2/2] platform/x86: silead_dmi - abort early if DMI does not match
Message-ID<tsnkm-7ED-3@gated-at.bofh.it>
There is no point in registering I2C bus notifier if DMI data does not
match.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/platform/x86/silead_dmi.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/platform/x86/silead_dmi.c b/drivers/platform/x86/silead_dmi.c
index 7f1049951d1c..0eeb49e51c43 100644
--- a/drivers/platform/x86/silead_dmi.c
+++ b/drivers/platform/x86/silead_dmi.c
@@ -75,21 +75,16 @@ static const struct dmi_system_id silead_ts_dmi_table[] = {
 	{ },
 };
 
+static const struct silead_ts_dmi_data *silead_ts_data;
+
 static void silead_ts_dmi_add_props(struct i2c_client *client)
 {
-	const struct dmi_system_id *dmi_id;
-	const struct silead_ts_dmi_data *ts_data;
 	int error;
 
-	dmi_id = dmi_first_match(silead_ts_dmi_table);
-	if (!dmi_id)
-		return;
-
-	ts_data = dmi_id->driver_data;
 	if (has_acpi_companion(&client->dev) &&
-	    !strncmp(ts_data->acpi_name, client->name, I2C_NAME_SIZE)) {
+	    !strncmp(silead_ts_data->acpi_name, client->name, I2C_NAME_SIZE)) {
 		error = device_add_properties(&client->dev,
-					      ts_data->properties);
+					      silead_ts_data->properties);
 		if (error)
 			dev_err(&client->dev,
 				"failed to add properties: %d\n", error);
@@ -122,8 +117,15 @@ static struct notifier_block silead_ts_dmi_notifier = {
 
 static int __init silead_ts_dmi_init(void)
 {
+	const struct dmi_system_id *dmi_id;
 	int error;
 
+	dmi_id = dmi_first_match(silead_ts_dmi_table);
+	if (!dmi_id)
+		return 0; /* Not an error */
+
+	silead_ts_data = dmi_id->driver_data;
+
 	error = bus_register_notifier(&i2c_bus_type, &silead_ts_dmi_notifier);
 	if (error)
 		pr_err("%s: failed to register i2c bus notifier: %d\n",
-- 
2.12.2.715.g7642488e1d-goog

[toc] | [next] | [standalone]


#1615849 — Re: [PATCH 2/2] platform/x86: silead_dmi - abort early if DMI does not match

FromHans de Goede <hdegoede@redhat.com>
Date2017-04-04 12:00 +0200
SubjectRe: [PATCH 2/2] platform/x86: silead_dmi - abort early if DMI does not match
Message-ID<tstpM-39f-27@gated-at.bofh.it>
In reply to#1615684
Hi,

On 04-04-17 05:25, Dmitry Torokhov wrote:
> There is no point in registering I2C bus notifier if DMI data does not
> match.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Good idea, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


> ---
>  drivers/platform/x86/silead_dmi.c | 20 +++++++++++---------
>  1 file changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/platform/x86/silead_dmi.c b/drivers/platform/x86/silead_dmi.c
> index 7f1049951d1c..0eeb49e51c43 100644
> --- a/drivers/platform/x86/silead_dmi.c
> +++ b/drivers/platform/x86/silead_dmi.c
> @@ -75,21 +75,16 @@ static const struct dmi_system_id silead_ts_dmi_table[] = {
>  	{ },
>  };
>
> +static const struct silead_ts_dmi_data *silead_ts_data;
> +
>  static void silead_ts_dmi_add_props(struct i2c_client *client)
>  {
> -	const struct dmi_system_id *dmi_id;
> -	const struct silead_ts_dmi_data *ts_data;
>  	int error;
>
> -	dmi_id = dmi_first_match(silead_ts_dmi_table);
> -	if (!dmi_id)
> -		return;
> -
> -	ts_data = dmi_id->driver_data;
>  	if (has_acpi_companion(&client->dev) &&
> -	    !strncmp(ts_data->acpi_name, client->name, I2C_NAME_SIZE)) {
> +	    !strncmp(silead_ts_data->acpi_name, client->name, I2C_NAME_SIZE)) {
>  		error = device_add_properties(&client->dev,
> -					      ts_data->properties);
> +					      silead_ts_data->properties);
>  		if (error)
>  			dev_err(&client->dev,
>  				"failed to add properties: %d\n", error);
> @@ -122,8 +117,15 @@ static struct notifier_block silead_ts_dmi_notifier = {
>
>  static int __init silead_ts_dmi_init(void)
>  {
> +	const struct dmi_system_id *dmi_id;
>  	int error;
>
> +	dmi_id = dmi_first_match(silead_ts_dmi_table);
> +	if (!dmi_id)
> +		return 0; /* Not an error */
> +
> +	silead_ts_data = dmi_id->driver_data;
> +
>  	error = bus_register_notifier(&i2c_bus_type, &silead_ts_dmi_notifier);
>  	if (error)
>  		pr_err("%s: failed to register i2c bus notifier: %d\n",
>

[toc] | [prev] | [next] | [standalone]


#1618364 — Re: [PATCH 2/2] platform/x86: silead_dmi - abort early if DMI does not match

FromAndy Shevchenko <andy.shevchenko@gmail.com>
Date2017-04-06 23:50 +0200
SubjectRe: [PATCH 2/2] platform/x86: silead_dmi - abort early if DMI does not match
Message-ID<ttnrX-6pk-5@gated-at.bofh.it>
In reply to#1615684
On Tue, Apr 4, 2017 at 6:25 AM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> There is no point in registering I2C bus notifier if DMI data does not
> match.
>

Both applied to testing.
Please check I didn't mess things up.

Thanks!

> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>  drivers/platform/x86/silead_dmi.c | 20 +++++++++++---------
>  1 file changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/platform/x86/silead_dmi.c b/drivers/platform/x86/silead_dmi.c
> index 7f1049951d1c..0eeb49e51c43 100644
> --- a/drivers/platform/x86/silead_dmi.c
> +++ b/drivers/platform/x86/silead_dmi.c
> @@ -75,21 +75,16 @@ static const struct dmi_system_id silead_ts_dmi_table[] = {
>         { },
>  };
>
> +static const struct silead_ts_dmi_data *silead_ts_data;
> +
>  static void silead_ts_dmi_add_props(struct i2c_client *client)
>  {
> -       const struct dmi_system_id *dmi_id;
> -       const struct silead_ts_dmi_data *ts_data;
>         int error;
>
> -       dmi_id = dmi_first_match(silead_ts_dmi_table);
> -       if (!dmi_id)
> -               return;
> -
> -       ts_data = dmi_id->driver_data;
>         if (has_acpi_companion(&client->dev) &&
> -           !strncmp(ts_data->acpi_name, client->name, I2C_NAME_SIZE)) {
> +           !strncmp(silead_ts_data->acpi_name, client->name, I2C_NAME_SIZE)) {
>                 error = device_add_properties(&client->dev,
> -                                             ts_data->properties);
> +                                             silead_ts_data->properties);
>                 if (error)
>                         dev_err(&client->dev,
>                                 "failed to add properties: %d\n", error);
> @@ -122,8 +117,15 @@ static struct notifier_block silead_ts_dmi_notifier = {
>
>  static int __init silead_ts_dmi_init(void)
>  {
> +       const struct dmi_system_id *dmi_id;
>         int error;
>
> +       dmi_id = dmi_first_match(silead_ts_dmi_table);
> +       if (!dmi_id)
> +               return 0; /* Not an error */
> +
> +       silead_ts_data = dmi_id->driver_data;
> +
>         error = bus_register_notifier(&i2c_bus_type, &silead_ts_dmi_notifier);
>         if (error)
>                 pr_err("%s: failed to register i2c bus notifier: %d\n",
> --
> 2.12.2.715.g7642488e1d-goog
>



-- 
With Best Regards,
Andy Shevchenko

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web