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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 21, 2023 at 8:19 AM Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote:
>
> 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.

Yes, good catch.

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

We still take the of_mutex. :) I looked at it some and we're already
not consistent in usage of '__'. Not a great argument I know, but if
we're going to make things consistent I think we should do that
separately for the whole subsys.

Rob




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux