Re: [PATCH v7 2/9] iio: ssp_sensors: factor out pending list add/remove helper(s)
From: Andy Shevchenko
Date: Mon Apr 27 2026 - 04:06:13 EST
On Sun, Apr 26, 2026 at 03:08:30PM +0100, Jonathan Cameron wrote:
> On Sun, 26 Apr 2026 14:47:03 +0530
> Sanjay Chitroda <sanjayembeddedse@xxxxxxxxx> wrote:
...
> > +static inline void ssp_pending_add(struct ssp_data *data, struct ssp_msg *msg)
> > +{
> > + /*
> > + * Check if this is a short one way message or the whole transfer has
> > + * second part after an interrupt.
> > + */
> > + if (msg->length == 0)
> > + return;
>
> I know Andy suggested your bring these into the helpers, but to me
> it's obscuring flow as it looks at the caller like it was added
> to the pending list when it wasn't.. And we end up with multiple
> checks on msg_length where we had one before.
>
> One option would be to have it return a bool to indicate whether
> it was added to the pending list or not.
>
> Andy, would that work for you?
Sure.
I have looked at the proposed use and have no objections on the approach.
> > + mutex_lock(&data->pending_lock);
> > + list_add_tail(&msg->list, &data->pending_list);
> > + mutex_unlock(&data->pending_lock);
> > +}
--
With Best Regards,
Andy Shevchenko