All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Stephan Gerhold <stephan@gerhold.net>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Rob Herring <robh+dt@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Peter Meerwald <pmeerw@pmeerw.net>,
	linux-iio <linux-iio@vger.kernel.org>,
	devicetree <devicetree@vger.kernel.org>,
	Bastien Nocera <hadess@hadess.net>,
	Laurentiu Palcu <laurentiu.palcu@intel.com>,
	Hans de Goede <hdegoede@redhat.com>
Subject: Re: [PATCH 1/6] iio: accel: bmc150: Drop misleading/duplicate chip identifiers
Date: Thu, 10 Jun 2021 13:24:27 +0300	[thread overview]
Message-ID: <CAHp75Ve_uDeNM+TPEDc-w6tV+rSoF1sAPXo5rKjqC2+3vjDgHQ@mail.gmail.com> (raw)
In-Reply-To: <20210610095300.3613-2-stephan@gerhold.net>

On Thu, Jun 10, 2021 at 12:56 PM Stephan Gerhold <stephan@gerhold.net> wrote:
>
> Commit 0ad4bf370176 ("iio:accel:bmc150-accel: Use the chip ID to detect
> sensor variant") stopped using the I2C/ACPI match data to look up the
> bmc150_accel_chip_info. However, the bmc150_accel_chip_info_tbl remained
> as-is, with multiple entries with the same chip_id (e.g. 0xFA for
> BMC150/BMI055/BMA255). This is redundant now because actually the driver
> will always select the first entry with a matching chip_id.
>
> So even if a device probes e.g. with BMA0255 it will end up using the
> chip_info for BMC150. And in general that's fine for now, the entries
> for BMC150/BMI055/BMA255 were exactly the same anyway (except for the
> name, which is replaced with the more accurate one later).
>
> But in this case it's misleading because it suggests that one should
> add even more entries with the same chip_id when adding support for
> new variants. Let's make that more clear by removing the enum with
> the chip identifiers entirely and instead have only one entry per
> chip_id.
>
> Note that we may need to bring back some mechanism to differentiate
> between different chips with the same chip_id in the future.
> For example, BMA250 (currently supported by the bma180 driver) has the
> same chip_id = 0x03 as BMA222 even though they have different channel
> sizes (8 bits vs 10 bits). But in any case, that mechanism would
> need to look quite different from what we have right now.

...

>  static const struct bmc150_accel_chip_info bmc150_accel_chip_info_tbl[] = {

Perhaps sort this by chip_id value?

...

>  static const struct acpi_device_id bmc150_accel_acpi_match[] = {
> -       {"BSBA0150",    bmc150},
> -       {"BMC150A",     bmc150},
> -       {"BMI055A",     bmi055},
> -       {"BMA0255",     bma255},
> -       {"BMA250E",     bma250e},
> -       {"BMA222",      bma222},
> -       {"BMA222E",     bma222e},
> -       {"BMA0280",     bma280},
> +       {"BSBA0150"},
> +       {"BMC150A"},
> +       {"BMI055A"},
> +       {"BMA0255"},
> +       {"BMA250E"},
> +       {"BMA222"},
> +       {"BMA222E"},
> +       {"BMA0280"},
>         {"BOSC0200"},
>         {"DUAL250E"},

I have noticed during review patch 3 that the arrays are unsorted, can
we at the same time sort them by ID, please?

...

>  static const struct i2c_device_id bmc150_accel_id[] = {

Ditto.

>         {}
>  };

...

>  static const struct acpi_device_id bmc150_accel_acpi_match[] = {

Ditto.

>         { },
>  };

...

>  static const struct spi_device_id bmc150_accel_id[] = {

Ditto.

>         {}
>  };

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2021-06-10 10:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10  9:52 [PATCH 0/6] iio: accel: bmc150: Add support for BMA253/BMA254 Stephan Gerhold
2021-06-10  9:52 ` [PATCH 1/6] iio: accel: bmc150: Drop misleading/duplicate chip identifiers Stephan Gerhold
2021-06-10 10:24   ` Andy Shevchenko [this message]
2021-06-10  9:52 ` [PATCH 2/6] dt-bindings: iio: accel: bma255: Document bosch,bma253 Stephan Gerhold
2021-06-10  9:52 ` [PATCH 3/6] iio: accel: bmc150: Add device IDs for BMA253 Stephan Gerhold
2021-06-10  9:52 ` [PATCH 4/6] dt-bindings: iio: bma255: Allow multiple interrupts Stephan Gerhold
2021-06-10  9:52 ` [PATCH 5/6] dt-bindings: iio: accel: bma180/bma255: Move bma254 to bma255 schema Stephan Gerhold
2021-06-10  9:53 ` [PATCH 6/6] iio: accel: bma180/bmc150: Move BMA254 to bmc150-accel driver Stephan Gerhold
2021-06-10 10:17 ` [PATCH 0/6] iio: accel: bmc150: Add support for BMA253/BMA254 Hans de Goede
2021-06-10 10:29 ` Andy Shevchenko
2021-06-10 10:47   ` Stephan Gerhold
2021-06-10 10:51     ` Andy Shevchenko
2021-06-10 11:25       ` Stephan Gerhold

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=CAHp75Ve_uDeNM+TPEDc-w6tV+rSoF1sAPXo5rKjqC2+3vjDgHQ@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=hadess@hadess.net \
    --cc=hdegoede@redhat.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=laurentiu.palcu@intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=robh+dt@kernel.org \
    --cc=stephan@gerhold.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.