[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHp75VeCNt2nVZ4V5XXvd5iTfGjM0g2Ur-bA+B3HORiOaP5h-A@mail.gmail.com>
Date: Wed, 23 Apr 2025 21:13:03 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Andrew Ijano <andrew.ijano@...il.com>
Cc: jic23@...nel.org, andrew.lopes@...mni.usp.br, gustavobastos@....br,
dlechner@...libre.com, nuno.sa@...log.com, andy@...nel.org,
jstephan@...libre.com, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: accel: sca3000: remove duplicated code in sca3000_read_data
On Wed, Apr 23, 2025 at 8:06 PM Andrew Ijano <andrew.ijano@...il.com> wrote:
>
> Remove duplicated code between sca3000_read_data and
> sca3000_read_data_short functions.
>
> The common behavior is centralized in just one sca3000_read_data
> function and used for every case.
We refer to the functions as func() (mind the parentheses).
...
> + ret = spi_sync_transfer(st->us, xfer, ARRAY_SIZE(xfer));
> + if (ret) {
> + dev_err(&st->us->dev, "problem reading register\n");
> + return ret;
> + }
>
> - return spi_sync_transfer(st->us, xfer, ARRAY_SIZE(xfer));
> + return 0;
Simply return ret instead of 4 LoCs we get only one.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists