All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Sanjay Chitroda <sanjayembeddedse@gmail.com>
Cc: dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
	tglx@kernel.org, christophe.jaillet@wanadoo.fr, mingo@kernel.org,
	kees@kernel.org, nabijaczleweli@nabijaczleweli.xyz,
	kyungmin.park@samsung.com, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v8 03/12] iio: ssp_sensors: refactor transfer logic into helper
Date: Sun, 17 May 2026 13:40:59 +0100	[thread overview]
Message-ID: <20260517134059.1141a2a0@jic23-huawei> (raw)
In-Reply-To: <20260515174017.3962168-4-sanjayembedded@gmail.com>

On Fri, 15 May 2026 23:10:08 +0530
Sanjay Chitroda <sanjayembeddedse@gmail.com> wrote:

> From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
> 
> Extract the core transfer logic under comm_lock into a new
> __ssp_do_transfer() helper. The change is preparatory for converting
> mutex usage to guard() helpers in subsequent patches.
> 
> This restructuring simplifies ssp_do_transfer() and makes the
> transfer flow easier to follow.
> 
> No functional change intended.
> 
> Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
> ---
>  drivers/iio/common/ssp_sensors/ssp_spi.c | 50 +++++++++++++++---------
>  1 file changed, 32 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/iio/common/ssp_sensors/ssp_spi.c b/drivers/iio/common/ssp_sensors/ssp_spi.c
> index 3d377a482161..ebcda6de56c4 100644
> --- a/drivers/iio/common/ssp_sensors/ssp_spi.c
> +++ b/drivers/iio/common/ssp_sensors/ssp_spi.c
> @@ -196,20 +196,13 @@ static inline void ssp_pending_del(struct ssp_data *data, struct ssp_msg *msg,
>  	mutex_unlock(&data->pending_lock);
>  }
>  
> -static int ssp_do_transfer(struct ssp_data *data, struct ssp_msg *msg,
> -			   struct completion *done, int timeout)
> +static int __ssp_do_transfer(struct ssp_data *data, struct ssp_msg *msg,
> +			     bool no_irq)
>  {
>  	int status;
> -	/*
> -	 * check if this is a short one way message or the whole transfer has
> -	 * second part after an interrupt
> -	 */
> -	const bool use_no_irq = msg->length == 0;
>  
> -	if (data->shut_down)
> -		return -EPERM;
> -
> -	msg->done = done;
> +	/* msg->done must be initialized by caller */
> +	WARN_ON(!msg->done);

Generally we avoid WARN_ON unless we don't mind the system going down hard
(which is a common configuration of the kernel)

Is returning an error (and dev_err()) not sufficient?

>  
>  	mutex_lock(&data->comm_lock);
>  



  reply	other threads:[~2026-05-17 12:41 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-15 17:40 [PATCH v8 00/12] iio: ssp_sensors: driver fixes, refactor and cleanup Sanjay Chitroda
2026-05-15 17:40 ` [PATCH v8 01/12] iio: ssp_sensors: cancel delayed work_refresh on remove Sanjay Chitroda
2026-05-17 10:31   ` Andy Shevchenko
2026-05-17 12:34     ` Jonathan Cameron
2026-05-15 17:40 ` [PATCH v8 02/12] iio: ssp_sensors: factor out pending list add/remove helpers Sanjay Chitroda
2026-05-17 10:36   ` Andy Shevchenko
2026-05-15 17:40 ` [PATCH v8 03/12] iio: ssp_sensors: refactor transfer logic into helper Sanjay Chitroda
2026-05-17 12:40   ` Jonathan Cameron [this message]
2026-05-15 17:40 ` [PATCH v8 04/12] iio: ssp_sensors: factor out MCU enable/disable helpers Sanjay Chitroda
2026-05-17 10:39   ` Andy Shevchenko
2026-05-15 17:40 ` [PATCH v8 05/12] iio: ssp_sensors: use local struct device Sanjay Chitroda
2026-05-15 17:40 ` [PATCH v8 06/12] iio: ssp_sensors: fix variable type and declaration order in probe() Sanjay Chitroda
2026-05-15 17:40 ` [PATCH v8 07/12] iio: ssp_sensors: Drop duplicated wdt timer and work cleanup Sanjay Chitroda
2026-05-15 17:40 ` [PATCH v8 08/12] iio: ssp_sensors: convert probe and teardown to devm-managed resources Sanjay Chitroda
2026-05-15 17:40 ` [PATCH v8 09/12] iio: ssp_sensors: use guard() to release mutexes Sanjay Chitroda
2026-05-17 10:42   ` Andy Shevchenko
2026-05-15 17:40 ` [PATCH v8 10/12] iio: ssp_sensors: Use dev_err_probe() Sanjay Chitroda
2026-05-15 17:40 ` [PATCH v8 11/12] iio: ssp_sensors: return errors directly from ssp_irq_msg() Sanjay Chitroda
2026-05-15 17:40 ` [PATCH v8 12/12] iio: ssp_sensors: reuse embedded RX buffer for SPI transfers Sanjay Chitroda
2026-05-17 12:50 ` [PATCH v8 00/12] iio: ssp_sensors: driver fixes, refactor and cleanup 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=20260517134059.1141a2a0@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=dlechner@baylibre.com \
    --cc=kees@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=nabijaczleweli@nabijaczleweli.xyz \
    --cc=nuno.sa@analog.com \
    --cc=sanjayembeddedse@gmail.com \
    --cc=tglx@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.