Re: [PATCH V2 4/6] pinctrl: support reading pins, groups & functions from DT

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

 



On Thu, Nov 25, 2021 at 1:04 AM Rafał Miłecki <zajec5@xxxxxxxxx> wrote:
>
> From: Rafał Miłecki <rafal@xxxxxxxxxx>
>
> DT binding allows specifying pins, groups & functions now. That allows
> storing them in DT instead of hardcoding in drivers.
>
> This adds support for DT as data source to recently introduced API.

a data
the recently

...

>  int pinctrl_generic_load_pins(struct pinctrl_desc *pctldesc, struct device *dev)
>  {
> +       if (dev->of_node)

Again, it's a layering violation.

> +               return pinctrl_generic_dt_load_pins(pctldesc, dev);
> +
>         return -ENOENT;
>  }
>  EXPORT_SYMBOL_GPL(pinctrl_generic_load_pins);

>  int pinctrl_generic_load_groups(struct pinctrl_dev *pctldev)
>  {
> +       if (pctldev->dev->of_node)
> +               return pinctrl_generic_load_dt_groups(pctldev);
> +
>         return -ENOENT;
>  }
>  EXPORT_SYMBOL_GPL(pinctrl_generic_load_groups);

>  int pinmux_generic_load_functions(struct pinctrl_dev *pctldev)
>  {
> +       if (pctldev->dev->of_node)
> +               return pinmux_generic_load_dt_functions(pctldev);
> +
>         return -ENOENT;
>  }
>  EXPORT_SYMBOL_GPL(pinmux_generic_load_functions);

Have you thought about making ops structure (or ops inside existing
structure) and all above will be something like

  stuct ops *... = ...->ops;

  if (ops && ops->METHOD)
    return ops->METHOD(...);

  return -ERRNO;

-- 
With Best Regards,
Andy Shevchenko




[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