Re: [PATCH v2] staging: iio: adc: ad7816: add mutex to serialize SPI/GPIO operations
From: Dan Carpenter
Date: Mon Sep 01 2025 - 09:08:39 EST
On Mon, Sep 01, 2025 at 10:24:45AM +0330, Mohammad Amin Hosseini wrote:
> @@ -200,7 +204,9 @@ static ssize_t ad7816_store_channel(struct device *dev,
> return -EINVAL;
> }
>
> + mutex_lock(&chip->io_lock);
> chip->channel_id = data;
> + mutex_unlock(&chip->io_lock);
>
> return len;
> }
Unrelated, but what is the point of setting chip->channel_id to
AD7816_CS_MASK? The only time where that is used is in
ad7816_spi_read() when we do:
ret = spi_write(spi_dev, &chip->channel_id, sizeof(chip->channel_id));
So it's something in the hardware spec, I guess, but it isn't
documented.
regards,
dan carpenter