mbox series

[v1,0/2] of: property: Add fw_devlink support for more props

Message ID 20210120080522.471120-1-saravanak@google.com
Headers show
Series of: property: Add fw_devlink support for more props | expand

Message

Saravana Kannan Jan. 20, 2021, 8:05 a.m. UTC
This series combines two patches [1] [2] that'd conflict.

Rob/Greg,

I think this should go into driver-core-next since Patch 1/2 fixes
issues caused by a patch in driver-core-next.

Patch 2/2 also touches the same locations. So, combining both into a
series.

Marc,

I'll add support for interrupt-map separately. It'll probably need to be
its own series because it'll need some refactor. I don't want to block
Patch 2/2 on that.

-Saravana

[1] - https://lore.kernel.org/lkml/20210115210159.3090203-1-saravanak@google.com/
[2] - https://lore.kernel.org/lkml/20201218210750.3455872-1-saravanak@google.com/

Individual -> Series:
Patch 1/2: Addressed Geert's gpio-hog problem with gpio[s] property
Patch 2/2: Switched to using of_irq_find_parent()

Saravana Kannan (2):
  of: property: Add fw_devlink support for "gpio" and "gpios" binding
  of: property: Add fw_devlink support for interrupts

 drivers/of/property.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

Comments

Thierry Reding Jan. 20, 2021, 5:24 p.m. UTC | #1
On Wed, Jan 20, 2021 at 12:05:20AM -0800, Saravana Kannan wrote:
> To provide backward compatibility for boards that use deprecated DT
> bindings, we need to add fw_devlink support for "gpio" and "gpios".
> 
> Cc: linux-tegra <linux-tegra@vger.kernel.org>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Fixes: e590474768f1 ("driver core: Set fw_devlink=on by default")
> Tested-by: Jon Hunter <jonathanh@nvidia.com>
> Signed-off-by: Saravana Kannan <saravanak@google.com>
> ---
>  drivers/of/property.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)

Reviewed-by: Thierry Reding <treding@nvidia.com>
Linus Walleij Jan. 21, 2021, 1:11 p.m. UTC | #2
On Wed, Jan 20, 2021 at 9:05 AM Saravana Kannan <saravanak@google.com> wrote:

> To provide backward compatibility for boards that use deprecated DT

> bindings, we need to add fw_devlink support for "gpio" and "gpios".


You do some more stuff in the patch so describe that too.
Especially the check for hogs and #gpio-cells.
Describe why you do that. Maybe even with a comment in
the code because I don't think everyone will understand.

> +       if (strcmp(prop_name, "gpio") && strcmp(prop_name, "gpios"))

> +               return NULL;


This part is easy to understand.

> +       if (of_find_property(np, "gpio-hog", NULL))

> +               return NULL;

> +

> +       if (of_parse_phandle_with_args(np, prop_name, "#gpio-cells", index,

> +                                      &sup_args))

> +               return NULL;


This part is hard to understand. Insert comments and tell the reader
of the code what is going on and why.

Yours,
Linus Walleij
Saravana Kannan Jan. 21, 2021, 6:29 p.m. UTC | #3
On Thu, Jan 21, 2021 at 5:11 AM Linus Walleij <linus.walleij@linaro.org> wrote:
>

> On Wed, Jan 20, 2021 at 9:05 AM Saravana Kannan <saravanak@google.com> wrote:

>

> > To provide backward compatibility for boards that use deprecated DT

> > bindings, we need to add fw_devlink support for "gpio" and "gpios".

>

> You do some more stuff in the patch so describe that too.

> Especially the check for hogs and #gpio-cells.

> Describe why you do that. Maybe even with a comment in

> the code because I don't think everyone will understand.


Ack

>

> > +       if (strcmp(prop_name, "gpio") && strcmp(prop_name, "gpios"))

> > +               return NULL;

>

> This part is easy to understand.

>

> > +       if (of_find_property(np, "gpio-hog", NULL))

> > +               return NULL;

> > +

> > +       if (of_parse_phandle_with_args(np, prop_name, "#gpio-cells", index,

> > +                                      &sup_args))

> > +               return NULL;

>

> This part is hard to understand. Insert comments and tell the reader

> of the code what is going on and why.


I assume the "hard to understand" part is the gpio-hog part? Because
the last line is pretty straightforward -- it's returning the index-th
phandle. Also, it's a copy-paste from the DEFINE_SIMPLE_PROP macro.


-Saravana