From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
Darren Hart <dvhart@infradead.org>,
Andy Shevchenko <andy@infradead.org>,
Platform Driver <platform-driver-x86@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] platform/x86: silead_dmi - abort early if DMI does not match
Date: Fri, 7 Apr 2017 00:47:15 +0300 [thread overview]
Message-ID: <CAHp75VeZo-+x3azoZa005fkYSnDQ5dViitdqKAiobEv4cW7JFQ@mail.gmail.com> (raw)
In-Reply-To: <20170404032514.31832-2-dmitry.torokhov@gmail.com>
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
next prev parent reply other threads:[~2017-04-06 21:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-04 3:25 [PATCH 1/2] platform/x86: silead_dmi - do not treat all devices as i2c_clients Dmitry Torokhov
2017-04-04 3:25 ` [PATCH 2/2] platform/x86: silead_dmi - abort early if DMI does not match Dmitry Torokhov
2017-04-04 9:54 ` Hans de Goede
2017-04-06 21:47 ` Andy Shevchenko [this message]
2017-04-04 9:54 ` [PATCH 1/2] platform/x86: silead_dmi - do not treat all devices as i2c_clients Hans de Goede
2017-04-04 13:45 ` Andy Shevchenko
2017-04-04 16:05 ` Darren Hart
2017-04-04 16:08 ` Andy Shevchenko
2017-04-04 16:31 ` Darren Hart
2017-04-04 16:33 ` Andy Shevchenko
2017-04-04 17:12 ` Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAHp75VeZo-+x3azoZa005fkYSnDQ5dViitdqKAiobEv4cW7JFQ@mail.gmail.com \
--to=andy.shevchenko@gmail.com \
--cc=andy@infradead.org \
--cc=dmitry.torokhov@gmail.com \
--cc=dvhart@infradead.org \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).