Re: [PATCH v3 6/6] of: Refactor node and property manipulation function locking

From: Geert Uytterhoeven
Date: Mon Aug 21 2023 - 09:19:10 EST


Hi Rob,

On Fri, Aug 18, 2023 at 10:41 PM Rob Herring <robh@xxxxxxxxxx> wrote:
> All callers of __of_{add,remove,update}_property() and
> __of_{attach,detach}_node() wrap the call with the devtree_lock
> spinlock. Let's move the spinlock into the functions. This allows moving
> the sysfs update functions into those functions as well.
>
> Signed-off-by: Rob Herring <robh@xxxxxxxxxx>
> ---
> v3:
> - Rebase due to changes in prior patch

Thanks for your patch!

> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c

> @@ -1576,37 +1587,36 @@ int __of_add_property(struct device_node *np, struct property *prop)
> */
> int of_add_property(struct device_node *np, struct property *prop)
> {
> - unsigned long flags;
> int rc;
>
> mutex_lock(&of_mutex);
> -
> - raw_spin_lock_irqsave(&devtree_lock, flags);
> rc = __of_add_property(np, prop);
> - raw_spin_unlock_irqrestore(&devtree_lock, flags);
> -
> - if (!rc)
> - __of_add_property_sysfs(np, prop);
> -
> mutex_unlock(&of_mutex);
>
> - if (!rc)
> - of_property_notify(OF_RECONFIG_ADD_PROPERTY, np, prop, NULL);

The notify block should be kept.

The rest LGTM, although I have some second thoughts about more
functions with a double underscore now taking devtree_lock().

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds