From: Christian Lamparter <chunkeey-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
To: Andy Shevchenko
<andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
devicetree <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"linux-arm Mailing List"
<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
"Álvaro Fernández Rojas"
<noltari-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
"Kumar Gala" <galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
"Alexander Shiyan" <shc_work-JGs/UdohzUI@public.gmane.org>,
"Ian Campbell"
<ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>,
"Mark Rutland" <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
"Pawel Moll" <pawel.moll-5wv7dgnIgG8@public.gmane.org>,
"Rob Herring" <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
"Alexandre Courbot"
<gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
"Linus Walleij"
<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH v7 2/3] gpio: mmio: add DT support for memory-mapped GPIOs
Date: Fri, 06 May 2016 14:22:23 +0200 [thread overview]
Message-ID: <2264861.CW2OZaRj2L@debian64> (raw)
In-Reply-To: <CAHp75VcDPY+LbV5+j9DUMJ8Ws=O9=+KmAa9Nog-JuKkPGAM6Cw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
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 */
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: chunkeey@googlemail.com (Christian Lamparter)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v7 2/3] gpio: mmio: add DT support for memory-mapped GPIOs
Date: Fri, 06 May 2016 14:22:23 +0200 [thread overview]
Message-ID: <2264861.CW2OZaRj2L@debian64> (raw)
In-Reply-To: <CAHp75VcDPY+LbV5+j9DUMJ8Ws=O9=+KmAa9Nog-JuKkPGAM6Cw@mail.gmail.com>
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 */
WARNING: multiple messages have this Message-ID (diff)
From: Christian Lamparter <chunkeey@googlemail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
devicetree <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm Mailing List" <linux-arm-kernel@lists.infradead.org>,
"Álvaro Fernández Rojas" <noltari@gmail.com>,
"Kumar Gala" <galak@codeaurora.org>,
"Alexander Shiyan" <shc_work@mail.ru>,
"Ian Campbell" <ijc+devicetree@hellion.org.uk>,
"Mark Rutland" <mark.rutland@arm.com>,
"Pawel Moll" <pawel.moll@arm.com>,
"Rob Herring" <robh+dt@kernel.org>,
"Alexandre Courbot" <gnurou@gmail.com>,
"Linus Walleij" <linus.walleij@linaro.org>
Subject: Re: [PATCH v7 2/3] gpio: mmio: add DT support for memory-mapped GPIOs
Date: Fri, 06 May 2016 14:22:23 +0200 [thread overview]
Message-ID: <2264861.CW2OZaRj2L@debian64> (raw)
In-Reply-To: <CAHp75VcDPY+LbV5+j9DUMJ8Ws=O9=+KmAa9Nog-JuKkPGAM6Cw@mail.gmail.com>
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 */
next prev parent reply other threads:[~2016-05-06 12:22 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-06 11:10 [PATCH v7 0/3] gpio: add DT support for memory-mapped GPIOs Christian Lamparter
2016-05-06 11:10 ` Christian Lamparter
2016-05-06 11:10 ` [PATCH v7 1/3] gpio: dt-bindings: add wd,mbl-gpio bindings Christian Lamparter
2016-05-06 11:10 ` Christian Lamparter
2016-05-06 11:10 ` Christian Lamparter
[not found] ` <cover.1462372360.git.chunkeey-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2016-05-06 11:10 ` [PATCH v7 2/3] gpio: mmio: add DT support for memory-mapped GPIOs Christian Lamparter
2016-05-06 11:10 ` Christian Lamparter
2016-05-06 11:10 ` Christian Lamparter
2016-05-06 11:44 ` Andy Shevchenko
2016-05-06 11:44 ` Andy Shevchenko
2016-05-06 11:44 ` Andy Shevchenko
[not found] ` <CAHp75VcDPY+LbV5+j9DUMJ8Ws=O9=+KmAa9Nog-JuKkPGAM6Cw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-05-06 12:22 ` Christian Lamparter [this message]
2016-05-06 12:22 ` Christian Lamparter
2016-05-06 12:22 ` Christian Lamparter
2016-05-06 11:50 ` Mark Rutland
2016-05-06 11:50 ` Mark Rutland
2016-05-06 11:10 ` [PATCH v7 3/3] gpio: move clps711x, moxart, ts4800 and gpio-ge into gpio-mmio Christian Lamparter
2016-05-06 11:10 ` Christian Lamparter
2016-05-06 11:10 ` Christian Lamparter
2016-05-06 11:53 ` Andy Shevchenko
2016-05-06 11:53 ` Andy Shevchenko
[not found] ` <CAHp75VeFjcPX+f3j+h+OL2jEpfGP+aqL78ymcsj4JwUfO0RvtA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-05-06 13:06 ` Christian Lamparter
2016-05-06 13:06 ` Christian Lamparter
2016-05-06 13:06 ` Christian Lamparter
2016-05-06 13:25 ` Andy Shevchenko
2016-05-06 13:25 ` Andy Shevchenko
2016-05-06 13:25 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2264861.CW2OZaRj2L@debian64 \
--to=chunkeey-gm/ye1e23mwn+bqq9rbeug@public.gmane.org \
--cc=andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
--cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=noltari-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=shc_work-JGs/UdohzUI@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.