devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Matti Vaittinen <mazziesaccount@gmail.com>
Cc: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] iio: light: bu27008: add chip info
Date: Sat, 8 Jul 2023 17:16:21 +0100	[thread overview]
Message-ID: <20230708171621.616fad8f@jic23-huawei> (raw)
In-Reply-To: <b4cdb81ef9522e94150673b3b78a4cbae5fa67f2.1688723839.git.mazziesaccount@gmail.com>

On Fri, 7 Jul 2023 14:23:03 +0300
Matti Vaittinen <mazziesaccount@gmail.com> wrote:

> The ROHM BU27010 RGB + flickering sensor is in many regards similar to
> the BU27008. Prepare for adding support for BU27010 by allowing
> chip-specific properties to be brought from the of_device_id data.
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> 
One trivial comment.

The ffs stuff is a pain.  There have been a few goes at defining
standard functions for doing that but I don' think anything ever landed
upstream.

> ---
> Revision history:
> v1 => v2:
>  - Move all generic refactoring from next patch to this one so that the
>    next one will only contain the BU27010 specific additions.
>  - reorder bu27008 chip-data assignments to match the struct member
>    placement
>  - Cleanup
> ---
>  drivers/iio/light/rohm-bu27008.c | 323 ++++++++++++++++++++-----------
>  1 file changed, 208 insertions(+), 115 deletions(-)
> 
> diff --git a/drivers/iio/light/rohm-bu27008.c b/drivers/iio/light/rohm-bu27008.c
> index b50bf8973d9a..08e2b1194bf4 100644
> --- a/drivers/iio/light/rohm-bu27008.c
> +++ b/drivers/iio/light/rohm-bu27008.c
> @@ -211,7 +211,35 @@ static const struct iio_chan_spec bu27008_channels[] = {


> @@ -993,14 +1086,14 @@ static int bu27008_probe(struct i2c_client *i2c)
>  	data->dev = dev;
>  	data->irq = i2c->irq;
>  
> -	idev->channels = bu27008_channels;
> +	idev->channels = &bu27008_channels[0];

Why?  When setting a pointer to the 'whole' array I tend to prefer
the original. Can't see a reason why this should be changed to the
second one.


>  	idev->num_channels = ARRAY_SIZE(bu27008_channels);
> -	idev->name = "bu27008";
> +	idev->name = data->cd->name;
>  	idev->info = &bu27008_info;
>  	idev->modes = INDIO_DIRECT_MODE;
>  	idev->available_scan_masks = bu27008_scan_masks;
>  
> -	ret = bu27008_chip_init(data);
> +	ret = data->cd->chip_init(data);
>  	if (ret)
>  		return ret;
>  
> @@ -1021,7 +1114,7 @@ static int bu27008_probe(struct i2c_client *i2c)
>  }
>  
>  static const struct of_device_id bu27008_of_match[] = {
> -	{ .compatible = "rohm,bu27008" },
> +	{ .compatible = "rohm,bu27008", .data = &bu27008_chip },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(of, bu27008_of_match);


  reply	other threads:[~2023-07-08 16:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-07 11:22 [PATCH v2 0/3] Support ROHM BU27010 RGBC sensor Matti Vaittinen
2023-07-07 11:22 ` [PATCH v2 1/3] dt-bindings: iio: ROHM BU27010 RGBC + flickering sensor Matti Vaittinen
2023-07-10  9:05   ` Krzysztof Kozlowski
2023-07-07 11:23 ` [PATCH v2 2/3] iio: light: bu27008: add chip info Matti Vaittinen
2023-07-08 16:16   ` Jonathan Cameron [this message]
2023-07-07 11:23 ` [PATCH v2 3/3] iio: light: bd27008: Support BD27010 RGB Matti Vaittinen
2023-07-08 16:21   ` Jonathan Cameron
2023-07-08 16:06 ` [PATCH v2 0/3] Support ROHM BU27010 RGBC sensor Jonathan Cameron

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=20230708171621.616fad8f@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    --cc=mazziesaccount@gmail.com \
    --cc=robh+dt@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).