2024-01-31 19:42:04

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 07/22] gpio: protect the descriptor label with SRCU

On Tue, Jan 30, 2024 at 1:48 PM Bartosz Golaszewski <[email protected]> wrote:

> From: Bartosz Golaszewski <[email protected]>
>
> In order to ensure that the label is not freed while it's being
> accessed, let's protect it with SRCU and synchronize it everytime it's
> changed.
>
> Let's modify desc_set_label() to manage the memory used for the label as
> it can only be freed once synchronize_srcu() returns.
>
> Signed-off-by: Bartosz Golaszewski <[email protected]>

And this conclude the previous patches by protecting the inevitable
label with SRCU, very clever. (I wouldn't have been able to come up
with it...)
Reviewed-by: Linus Walleij <[email protected]>

> -#define gpiod_err(desc, fmt, ...) \
> - pr_err("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label ? : "?", \
> - ##__VA_ARGS__)
(...)

Now it is clear why you were minimizing these helpers.
(Maybe add to the commit message of that patch? "We do this
because all functions need to be changed later".)

Yours,
Linus Walleij