linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolaus Voss <nikolaus.voss@loewensteinmedical.de>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Xiongfeng Wang <xiongfeng.wang@linaro.org>,
	linux-iio@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] IIO: st_accel_i2c.c: Simplify access to driver data
Date: Wed, 4 Jul 2018 08:56:59 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1807040846060.6169@fox.voss.local> (raw)
In-Reply-To: <CAHp75VfjHy9=4ZMJqb-2H5iXDjMpM=vm5kvz4PVA_jTUkoSJKA@mail.gmail.com>

On Wed, 4 Jul 2018, Andy Shevchenko wrote:
> On Tue, Jul 3, 2018 at 8:41 AM, Nikolaus Voss
> <nikolaus.voss@loewensteinmedical.de> wrote:
>> Use device_get_match_data API to simplify access to driver data.
>
> ..._data()
>
> But. You actually don't use it below.

It is used, see below.

>
>> Let acpi_device_id table entries point to the same driver data as
>> of_device_id table entries and uniquify access to driver data by using
>> device_get_match_data API.
>
>>  #include <linux/acpi.h>
>>  #include <linux/i2c.h>
>>  #include <linux/iio/iio.h>
>
>> +#include <linux/of_device.h>
>
> (linux/property.h)
>
>> +       match = of_device_get_match_data(&client->dev);
>> +       if (!match)
>> +               match = acpi_device_get_match_data(&client->dev);
>
> What I meant is to simply call
>
> match = device_get_match_data(...);

Ok, this works, thank you. I will prepare a new patch version.

This is where the match data is used:

>
>> +       if (match)
>> +               strlcpy(client->name, match, sizeof(client->name));
>
>

In this driver, match data is used to map DT compatible strings/ ACPI CIDs 
to the key strings (.._ACCEL_DEV_NAME) which are used to identify the 
actual device (and are also used in i2c_device_id table).

Niko


  reply	other threads:[~2018-07-04  6:57 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-03  6:34 [PATCH v2 0/2] IIO: st_sensors_i2c: improve device enumeration Nikolaus Voss
2018-07-03  5:41 ` [PATCH v2 1/2] IIO: st_accel_i2c.c: Simplify access to driver data Nikolaus Voss
2018-07-03 21:07   ` Andy Shevchenko
2018-07-04  6:56     ` Nikolaus Voss [this message]
2018-07-04  9:00       ` Andy Shevchenko
2018-07-03  6:06 ` [PATCH v2 2/2] IIO: st_accel_i2c.c: Use probe_new() instead of probe() Nikolaus Voss
2018-07-03 22:54   ` Andy Shevchenko
2018-07-04  6:37     ` Nikolaus Voss
2018-07-04  8:58       ` Andy Shevchenko
2018-07-04  9:09         ` Nikolaus Voss
2018-07-04  9:16           ` Andy Shevchenko
2018-07-04  9:42             ` Nikolaus Voss
2018-07-04 10:19               ` Andy Shevchenko
2018-07-04 10:49                 ` Javier Martinez Canillas
2018-07-04 11:15                   ` Nikolaus Voss
2018-07-04 11:26                     ` Javier Martinez Canillas
2018-07-04 11:32                       ` Javier Martinez Canillas
2018-07-04 11:46                       ` Nikolaus Voss
2018-07-04 12:09                         ` Javier Martinez Canillas
2018-07-04 12:31                           ` Nikolaus Voss
2018-07-04 12:37                             ` Javier Martinez Canillas
2018-07-04 13:24                               ` Nikolaus Voss
2018-07-04 13:44                                 ` Javier Martinez Canillas
2018-07-04 16:11                                   ` Andy Shevchenko
2018-07-04 18:53                                     ` Javier Martinez Canillas

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=alpine.DEB.2.20.1807040846060.6169@fox.voss.local \
    --to=nikolaus.voss@loewensteinmedical.de \
    --cc=andy.shevchenko@gmail.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo.bianconi83@gmail.com \
    --cc=pmeerw@pmeerw.net \
    --cc=xiongfeng.wang@linaro.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).