Thread (33 messages) 33 messages, 7 authors, 2025-02-08

Re: [PATCH v2 04/13] bus: ts-nbus: use gpiod_multi_set_value_cansleep

From: Yury Norov <yury.norov@gmail.com>
Date: 2025-02-07 15:43:09
Also in: linux-gpio, linux-iio, linux-mmc, linux-sound, lkml, netdev

On Fri, Feb 07, 2025 at 09:23:56AM -0600, David Lechner wrote:
On 2/7/25 6:17 AM, Andy Shevchenko wrote:
quoted
+Yury.

On Fri, Feb 7, 2025 at 2:15 PM Andy Shevchenko
[off-list ref] wrote:
quoted
On Fri, Feb 7, 2025 at 12:48 AM David Lechner [off-list ref] wrote:
...
quoted
quoted
 static void ts_nbus_write_byte(struct ts_nbus *ts_nbus, u8 byte)
 {
-       struct gpio_descs *gpios = ts_nbus->data;
        DECLARE_BITMAP(values, 8);

        values[0] = byte;

-       gpiod_set_array_value_cansleep(8, gpios->desc, gpios->info, values);
+       gpiod_multi_set_value_cansleep(ts_nbus->data, values);
As I said before, this is buggy code on BE64. Needs to be fixed.
Or isn't? Do we have a test case in bitmap for such a case?
quoted
quoted
 }
Maybe not the best style, but I don't think it is buggy. Bitmaps are always
handled in long-sized chunks and not cast to bytes so endianness doesn't affect
it. I didn't see an explicit test, but bitmap_read() and bitmap_write() use
array access like this so indirectly it is being tested.
Not a bug, but direct addressing to bitmap elements is discouraged.
I'd suggest using bitmap_write(values, byte, 0, 8) instead.

Thanks,
Yury

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help