Re: [PATCH v1 3/5] driver core: Create __fwnode_link_del() helper function

From: Saravana Kannan
Date: Tue Sep 14 2021 - 03:50:42 EST


On Tue, Sep 14, 2021 at 12:05 AM Geert Uytterhoeven
<geert@xxxxxxxxxxxxxx> wrote:
>
> Hi Saravana,
>
> On Tue, Sep 14, 2021 at 6:39 AM Saravana Kannan <saravanak@xxxxxxxxxx> wrote:
> > The same code is repeated in multiple locations. Create a helper
> > function for it.
> >
> > Signed-off-by: Saravana Kannan <saravanak@xxxxxxxxxx>
>
> Thanks for your patch!
>
> > --- a/drivers/base/core.c
> > +++ b/drivers/base/core.c
> > @@ -101,6 +101,19 @@ int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup)
> > return ret;
> > }
> >
> > +/**
> > + * __fwnode_link_del - Delete a link between two fwnode_handles.
> > + * @link: the fwnode_link to be deleted
> > + *
> > + * The fwnode_link_lock needs to be held when this function is called.
> > + */
> > +static void __fwnode_link_del(struct fwnode_link *link)
>
> Why the double underscore?

Because unlike fwnode_link_add(), this one needs the lock to be held.

-Saravana

>
> > +{
> > + list_del(&link->s_hook);
> > + list_del(&link->c_hook);
> > + kfree(link);
> > +}
>
> Apart from that:
> Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
>
> 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