All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcus Folkesson <marcus.folkesson@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Kent Gustavsson <kent@minoris.se>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, Stephen Boyd <sboyd@kernel.org>
Subject: Re: [PATCH v2 04/10] iio: adc: mcp3911: add support for interrupts
Date: Sun, 3 Jul 2022 21:18:46 +0200	[thread overview]
Message-ID: <YsHrlmfxOkwzVvfO@gmail.com> (raw)
In-Reply-To: <20220625130637.223180f2@jic23-huawei>

[-- Attachment #1: Type: text/plain, Size: 2213 bytes --]

On Sat, Jun 25, 2022 at 01:06:37PM +0100, Jonathan Cameron wrote:
> 
> ...
> 
> > >  static int mcp3911_probe(struct spi_device *spi)
> > >  {
> > >  	struct iio_dev *indio_dev;
> > > @@ -352,6 +382,15 @@ static int mcp3911_probe(struct spi_device *spi)
> > >  	if (ret)
> > >  		goto clk_disable;
> > >  
> > > +	if (device_property_read_bool(&adc->spi->dev, "microchip,data-ready-hiz"))
> > > +		ret = mcp3911_update(adc, MCP3911_REG_STATUSCOM, MCP3911_STATUSCOM_DRHIZ,
> > > +				0, 2);
> > > +	else
> > > +		ret = mcp3911_update(adc, MCP3911_REG_STATUSCOM, MCP3911_STATUSCOM_DRHIZ,
> > > +				MCP3911_STATUSCOM_DRHIZ, 2);
> > > +	if (ret < 0)
> > > +		goto clk_disable;
> > > +
> > >  	indio_dev->name = spi_get_device_id(spi)->name;
> > >  	indio_dev->modes = INDIO_DIRECT_MODE | INDIO_BUFFER_TRIGGERED;
> > >  	indio_dev->info = &mcp3911_info;
> > > @@ -362,6 +401,32 @@ static int mcp3911_probe(struct spi_device *spi)
> > >  
> > >  	mutex_init(&adc->lock);
> > >  
> > > +	if (spi->irq > 0) {
> > > +		adc->trig = devm_iio_trigger_alloc(&spi->dev, "%s-dev%d",
> > > +				indio_dev->name,
> > > +				iio_device_id(indio_dev));
> > > +		if (!adc->trig)
> > > +			goto clk_disable;  
> > You definitely want to use devm managed cleanup for these.
> > 
> > There is a patch set that adds these as standard functions, but I haven't
> > yet seen it being picked up for this cycle (reviews have been slow coming).
> > 
> > https://lore.kernel.org/all/20220520075737.758761-1-u.kleine-koenig@pengutronix.de/
> 
> Ah, elsewhere in my unread email was a thread that says it's in clk-next so
> will be in the next merge window.  I haven't confirmed, but looks like Stephen
> put up an immutable branch so I could pull it into the IIO togreg branch if you
> want to transition directly to that new code. @Stephen, would you be fine
> with me pulling your clk-devm-enable branch into IIO (with the fix which
> got posted earlier in the week presumably also going on that branch when
> you push out?)

Please do, thanks

> 
> Thanks,
> 
> Jonathan
> 
> 
> 
> > 
> > In meantime role your own with devm_add_action_or_reset()

Best regards,
Marcus Folkesson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2022-07-03 19:15 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-25 10:38 [PATCH v2 01/10] iio: adc: mcp3911: correct "microchip,device-addr" property Marcus Folkesson
2022-06-25 10:38 ` [PATCH v2 02/10] iio: adc: mcp3911: use resource-managed version of iio_device_register Marcus Folkesson
2022-06-25 11:30   ` Jonathan Cameron
2022-06-25 10:38 ` [PATCH v2 03/10] iio: adc: mcp3911: add support for buffers Marcus Folkesson
2022-06-25 11:45   ` Jonathan Cameron
2022-06-30  8:32     ` Marcus Folkesson
2022-07-07 17:57       ` Jonathan Cameron
2022-06-25 10:38 ` [PATCH v2 04/10] iio: adc: mcp3911: add support for interrupts Marcus Folkesson
2022-06-25 11:56   ` Jonathan Cameron
2022-06-25 12:06     ` Jonathan Cameron
2022-06-29  7:44       ` Stephen Boyd
2022-07-03 19:18       ` Marcus Folkesson [this message]
2022-06-25 10:38 ` [PATCH v2 05/10] dt-bindings: iio: adc: mcp3911: add microchip,data-ready-hiz entry Marcus Folkesson
2022-06-25 20:06   ` Krzysztof Kozlowski
2022-06-25 10:38 ` [PATCH v2 06/10] iio: adc: mcp3911: add support for oversampling ratio Marcus Folkesson
2022-06-25 12:14   ` Jonathan Cameron
2022-06-25 10:38 ` [PATCH v2 07/10] iio: adc: mcp3911: use correct formula for AD conversion Marcus Folkesson
2022-06-25 12:16   ` Jonathan Cameron
2022-06-25 10:38 ` [PATCH v2 08/10] iio: adc: mcp3911: add support for phase Marcus Folkesson
2022-06-25 12:47   ` Jonathan Cameron
2022-06-25 10:38 ` [PATCH v2 09/10] iio: adc: mcp3911: make use of the sign bit Marcus Folkesson
2022-06-25 12:48   ` Jonathan Cameron
2022-06-25 10:38 ` [PATCH v2 10/10] iio: adc: mcp3911: add support to set PGA Marcus Folkesson
2022-06-25 12:08   ` kernel test robot
2022-06-25 12:54   ` Jonathan Cameron
2022-06-25 11:26 ` [PATCH v2 01/10] iio: adc: mcp3911: correct "microchip,device-addr" property Jonathan Cameron
2022-06-25 11:29 ` 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=YsHrlmfxOkwzVvfO@gmail.com \
    --to=marcus.folkesson@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=kent@minoris.se \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@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 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.