From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB83A16F265; Sat, 1 Feb 2025 15:35:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738424150; cv=none; b=gQq/4WQMVly/Arr1g1EvnUw2B3arFcskAei3EryQQU9z1CMYVArMn1OgTn46jQIwWJwmA8mSiTST094O8yj2kdFAQwFW3tEgHCT5Dzl/RgPXxtILJeq2zxjpKs1le4PxE0RZqrktGvm58HZ/v2e/rhxVoGF7A02u6on+dyGF7qs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738424150; c=relaxed/simple; bh=gdaQDzjILI94jdST7ElLYSDSe1zmq6F1j9pYdNHiRh0=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GB2pTMmvJLzUlG3kYT/QU/Y4gJNsY8pcKMljW7erlBVCXi06oF2lRv28vkV86p1MBzlX5ItqRPgyrYLX9Mvj3SUvhI67A+Snp1Ni5vt1CmLAH+a9Y2RQh9e0Rk6oOyRDuCtgbruLiDWbFZbjb2adFmG9MkfHs7442tPq49gupEw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=H5dGmrwr; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="H5dGmrwr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 200F6C4CED3; Sat, 1 Feb 2025 15:35:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738424150; bh=gdaQDzjILI94jdST7ElLYSDSe1zmq6F1j9pYdNHiRh0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=H5dGmrwrVklRSs8FPZElk5LGaETVowTVK+XD01Yq8Ka8rtZTynayTqkLmoyTQUhil I8Pw1YF42M6BLQoRDqa9yvXjQRlDmtEoo+EKYcLb3o00rtn2Jdej6Nd7UlqDYdtq/n 4Xt8Cx2D7SFy3DYqeKMq4sEOm2DSaZ9WmT8pveMOsEPJP56cQdX8UDMeGjReECOZGu H3XW3nkmXIKrBDBBSHDziV+layb7BlMm9IrezoQ39dvDRw+z1+/Kw9N1XLroYTAKcW 7sU1VlpXilNGqYExsI7PKL1pbF26FWeza5BDEEehrLit4GafKm6O4MrPGccTXg73VP hsdqzuqGxSOlw== Date: Sat, 1 Feb 2025 15:35:39 +0000 From: Jonathan Cameron To: Jonathan Santos Cc: , , , Sergiu Cuciurean , , , , , , , , Subject: Re: [PATCH v2 10/16] iio: adc: ad7768-1: Move buffer allocation to a separate function Message-ID: <20250201153539.5617b5b8@jic23-huawei> In-Reply-To: References: X-Mailer: Claws Mail 4.3.0 (GTK 3.24.48; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Mon, 27 Jan 2025 12:13:19 -0300 Jonathan Santos wrote: > From: Sergiu Cuciurean > > This change moves the buffer allocation in a separate function, making > space for adding another type of iio buffer if needed. > > Signed-off-by: Sergiu Cuciurean Jonathan, this one needs your sign off to reflect that you handled the patch as part of it's path to upstream. I can't apply anything that is missing such SoB. > --- > v2 Changes: > * Interrupt and completion moved out from ad7768_triggered_buffer_alloc(). > --- > drivers/iio/adc/ad7768-1.c | 44 ++++++++++++++++++++++---------------- > 1 file changed, 26 insertions(+), 18 deletions(-) > > diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c > index 5e2093be9b92..8487b9a06609 100644 > --- a/drivers/iio/adc/ad7768-1.c > +++ b/drivers/iio/adc/ad7768-1.c > @@ -599,6 +599,31 @@ static const struct regmap_config ad7768_regmap_config = { > .max_register = AD7768_REG_MCLK_COUNTER, > }; > > +static int ad7768_triggered_buffer_alloc(struct iio_dev *indio_dev) > +{ > + struct ad7768_state *st = iio_priv(indio_dev); > + int ret; > + > + st->trig = devm_iio_trigger_alloc(indio_dev->dev.parent, "%s-dev%d", > + indio_dev->name, > + iio_device_id(indio_dev)); > + if (!st->trig) > + return -ENOMEM; > + > + st->trig->ops = &ad7768_trigger_ops; > + iio_trigger_set_drvdata(st->trig, indio_dev); > + ret = devm_iio_trigger_register(indio_dev->dev.parent, st->trig); > + if (ret) > + return ret; > + > + indio_dev->trig = iio_trigger_get(st->trig); > + > + return devm_iio_triggered_buffer_setup(indio_dev->dev.parent, indio_dev, > + &iio_pollfunc_store_time, > + &ad7768_trigger_handler, > + &ad7768_buffer_ops); > +} > + > static int ad7768_probe(struct spi_device *spi) > { > struct ad7768_state *st; > @@ -669,20 +694,6 @@ static int ad7768_probe(struct spi_device *spi) > return ret; > } > > - st->trig = devm_iio_trigger_alloc(&spi->dev, "%s-dev%d", > - indio_dev->name, > - iio_device_id(indio_dev)); > - if (!st->trig) > - return -ENOMEM; > - > - st->trig->ops = &ad7768_trigger_ops; > - iio_trigger_set_drvdata(st->trig, indio_dev); > - ret = devm_iio_trigger_register(&spi->dev, st->trig); > - if (ret) > - return ret; > - > - indio_dev->trig = iio_trigger_get(st->trig); > - > init_completion(&st->completion); > > ret = ad7768_set_channel_label(indio_dev, ARRAY_SIZE(ad7768_channels)); > @@ -696,10 +707,7 @@ static int ad7768_probe(struct spi_device *spi) > if (ret) > return ret; > > - ret = devm_iio_triggered_buffer_setup(&spi->dev, indio_dev, > - &iio_pollfunc_store_time, > - &ad7768_trigger_handler, > - &ad7768_buffer_ops); > + ret = ad7768_triggered_buffer_alloc(indio_dev); > if (ret) > return ret; >