Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1395822
| From | Christian Lamparter <chunkeey@googlemail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v7 2/3] gpio: mmio: add DT support for memory-mapped GPIOs |
| Date | 2016-05-06 14:30 +0200 |
| Message-ID | <rvN3j-51u-7@gated-at.bofh.it> (permalink) |
| References | <rvLXz-3TZ-1@gated-at.bofh.it> <rvLXA-3TZ-3@gated-at.bofh.it> <rvMqC-4be-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Friday, May 06, 2016 02:44:14 PM Andy Shevchenko wrote:
> > + /* If ngpio property is not specified, of_property_read_u32
> > + * will return -EINVAL. In this case the number of GPIOs is
> > + * automatically determined by the register width. Any
> > + * other error of of_property_read_u32 is due bad data and
> > + * needs to be dealt with.
>
> Couple style issues:
> /*
> * First sentence starts here. func() are going with parens.
> */
Ack, I'm used to drivers/net. I have to remove the ngpio in a future
version, so the comment is removed as well.
> > +
> > +static struct bgpio_pdata *bgpio_parse_dt(struct platform_device *pdev,
> > + unsigned long *flags)
> > +{
> > + const int (*parse_dt)(struct platform_device *,
> > + struct bgpio_pdata *, unsigned long *);
> > + const struct device_node *node = pdev->dev.of_node;
> > + const struct of_device_id *of_id;
> > + struct bgpio_pdata *pdata;
> > + int err = -ENODEV;
>
> (1)
>
> > +
> > + of_id = of_match_node(bgpio_of_match, node);
> > + if (!of_id)
> > + return NULL;
>
> (2)
>
> Why so?
This is because of existing arch code in /arch/arm/mach-clps711x/board-p720t.c.
You remember there's a driver with a device-tree binding "cirrus,clps711x-gpio"
for it. But the current kernel arch code still registers a platform_device and
it doesn't look like it has any device tree support. So this is necessary for
those partially converted archs to co-exist with the driver. I'll update the
-ENODEV to -EINVAL.
> > +
> > + pdata = devm_kzalloc(&pdev->dev, sizeof(struct bgpio_pdata),
> > + GFP_KERNEL);
> > + if (!pdata)
> > + return ERR_PTR(-ENOMEM);
> > +
> > + parse_dt = (const void *)of_id->data;
> > + if (parse_dt)
> > + err = parse_dt(pdev, pdata, flags);
> > + if (err)
> > + return ERR_PTR(err);
> > +
> > + return pdata;
> > +}
> > +#else
> > +static struct bgpio_pdata *bgpio_parse_dt(struct platform_device *pdev,
> > + unsigned long *flags)
> > +{
> > + return NULL;
> > +}
> > +#endif /* CONFIG_OF */
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v7 0/3] gpio: add DT support for memory-mapped GPIOs Christian Lamparter <chunkeey@googlemail.com> - 2016-05-06 13:20 +0200
[PATCH v7 2/3] gpio: mmio: add DT support for memory-mapped GPIOs Christian Lamparter <chunkeey@googlemail.com> - 2016-05-06 13:20 +0200
Re: [PATCH v7 2/3] gpio: mmio: add DT support for memory-mapped GPIOs Andy Shevchenko <andy.shevchenko@gmail.com> - 2016-05-06 13:50 +0200
Re: [PATCH v7 2/3] gpio: mmio: add DT support for memory-mapped GPIOs Christian Lamparter <chunkeey@googlemail.com> - 2016-05-06 14:30 +0200
Re: [PATCH v7 2/3] gpio: mmio: add DT support for memory-mapped GPIOs Mark Rutland <mark.rutland@arm.com> - 2016-05-06 14:00 +0200
[PATCH v7 1/3] gpio: dt-bindings: add wd,mbl-gpio bindings Christian Lamparter <chunkeey@googlemail.com> - 2016-05-06 13:20 +0200
[PATCH v7 3/3] gpio: move clps711x, moxart, ts4800 and gpio-ge into gpio-mmio Christian Lamparter <chunkeey@googlemail.com> - 2016-05-06 13:20 +0200
Re: [PATCH v7 3/3] gpio: move clps711x, moxart, ts4800 and gpio-ge into gpio-mmio Andy Shevchenko <andy.shevchenko@gmail.com> - 2016-05-06 14:00 +0200
Re: [PATCH v7 3/3] gpio: move clps711x, moxart, ts4800 and gpio-ge into gpio-mmio Christian Lamparter <chunkeey@googlemail.com> - 2016-05-06 15:10 +0200
Re: [PATCH v7 3/3] gpio: move clps711x, moxart, ts4800 and gpio-ge into gpio-mmio Andy Shevchenko <andy.shevchenko@gmail.com> - 2016-05-06 15:30 +0200
csiph-web