Re: [PATCH v3 07/10] iio: adc: ad_sigma_delta: Store information about reset sequence length

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 22, 2024 at 1:34 PM Uwe Kleine-König
<u.kleine-koenig@xxxxxxxxxxxx> wrote:
>
> The various chips can be reset using a sequence of SPI transfers with
> MOSI = 1. The length of such a sequence varies from chip to chip. Store
> that length in struct ad_sigma_delta_info and replace the respective
> parameter to ad_sd_reset() with it.
>
> Note the ad7192 used to pass 48 as length but the documentation
> specifies 40 as the required length. Assuming the latter is right.
> (Using a too long sequence doesn't hurt apart from using a longer spi
> transfer than necessary, so this is no relevant fix.)
>
> The motivation for storing this information is that this is useful to
> clear a pending RDY signal in the next change.

...

> @@ -182,14 +182,13 @@ EXPORT_SYMBOL_NS_GPL(ad_sd_read_reg, IIO_AD_SIGMA_DELTA);
>   *
>   * Returns 0 on success, an error code otherwise.

>   **/

JFYI: unneeded asterisk.

...

> +       unsigned int size = DIV_ROUND_UP(reset_length, 8);
>         uint8_t *buf;
> -       unsigned int size;
>         int ret;
>
> -       size = DIV_ROUND_UP(reset_length, 8);
>         buf = kcalloc(size, sizeof(*buf), GFP_KERNEL);
>         if (!buf)
>                 return -ENOMEM;

This is somewhat like unrelated refactoring.

I would suggest avoiding doing it here and instead add a change that
either uses BITS_TO_BYTES() or even bitmap_zalloc(), whoever the
latter might require more changes in the code.

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux