Re: [PATCH 07/22] gpio: protect the descriptor label with SRCU
From: Linus Walleij
Date: Wed Jan 31 2024 - 14:42:03 EST
On Tue, Jan 30, 2024 at 1:48 PM Bartosz Golaszewski <brgl@xxxxxxxx> wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
>
> 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 <bartosz.golaszewski@xxxxxxxxxx>
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 <linus.walleij@xxxxxxxxxx>
> -#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