From: Christian Lamparter <chunkeey@googlemail.com>
To: Joachim Eastwood <manabian@gmail.com>
Cc: linux-gpio@vger.kernel.org,
devicetree <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<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>,
"Andy Shevchenko" <andy.shevchenko@gmail.com>
Subject: Re: [PATCH v8 2/3] gpio: mmio: add DT support for memory-mapped GPIOs
Date: Sun, 08 May 2016 20:27:24 +0200 [thread overview]
Message-ID: <1946866.9Xyiz0Lzsg@debian64> (raw)
In-Reply-To: <CAGhQ9VyG6yX+g=FjfB6VP0pUNYGYXo60CHkWmSiiOisjeX20cg@mail.gmail.com>
On Sunday, May 08, 2016 07:17:13 PM Joachim Eastwood wrote:
> > +#define ADD(_name, _func) { .compatible = _name, .data = _func }
>
> I don't see the point in having a macro for such a simple data
> structure, but since this v8 and Linus hasn't complained I guess it's
> fine.
>
> Using a macro here makes it impossible to grep for 'compatible'. Doing
> 'git grep compatible drivers/gpio/' is sometimes very useful to see
> which hardware the driver actually supports.
Ok. I'll definitely picking it up. I'll wait until Tuesday/Wednesday
for more comments and then release a new series.
> > +static const struct of_device_id bgpio_of_match[] = {
> > + ADD("wd,mbl-gpio", bgpio_basic_mmio_parse_dt),
> > + { }
> > +};
> > +#undef ADD
> > +MODULE_DEVICE_TABLE(of, bgpio_of_match);
> > +
> > +static struct bgpio_pdata *bgpio_parse_dt(struct platform_device *pdev,
> > + unsigned long *flags)
> > +{
[...]
> > + of_id = of_match_node(bgpio_of_match, node);
> > + if (!of_id)
> > + return NULL;
[...]
> You can retrieve OF match data using of_device_get_match_data().
> Saves you a couple of lines and better explains what your doing.
Yes thanks that's useful too since I don't need the of_id variable
anymore.
Both improvements save a total of 8 lines. so it's 328 insertions(+)
vs 380 deletions(-).
Regards,
Christian
WARNING: multiple messages have this Message-ID (diff)
From: chunkeey@googlemail.com (Christian Lamparter)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v8 2/3] gpio: mmio: add DT support for memory-mapped GPIOs
Date: Sun, 08 May 2016 20:27:24 +0200 [thread overview]
Message-ID: <1946866.9Xyiz0Lzsg@debian64> (raw)
In-Reply-To: <CAGhQ9VyG6yX+g=FjfB6VP0pUNYGYXo60CHkWmSiiOisjeX20cg@mail.gmail.com>
On Sunday, May 08, 2016 07:17:13 PM Joachim Eastwood wrote:
> > +#define ADD(_name, _func) { .compatible = _name, .data = _func }
>
> I don't see the point in having a macro for such a simple data
> structure, but since this v8 and Linus hasn't complained I guess it's
> fine.
>
> Using a macro here makes it impossible to grep for 'compatible'. Doing
> 'git grep compatible drivers/gpio/' is sometimes very useful to see
> which hardware the driver actually supports.
Ok. I'll definitely picking it up. I'll wait until Tuesday/Wednesday
for more comments and then release a new series.
> > +static const struct of_device_id bgpio_of_match[] = {
> > + ADD("wd,mbl-gpio", bgpio_basic_mmio_parse_dt),
> > + { }
> > +};
> > +#undef ADD
> > +MODULE_DEVICE_TABLE(of, bgpio_of_match);
> > +
> > +static struct bgpio_pdata *bgpio_parse_dt(struct platform_device *pdev,
> > + unsigned long *flags)
> > +{
[...]
> > + of_id = of_match_node(bgpio_of_match, node);
> > + if (!of_id)
> > + return NULL;
[...]
> You can retrieve OF match data using of_device_get_match_data().
> Saves you a couple of lines and better explains what your doing.
Yes thanks that's useful too since I don't need the of_id variable
anymore.
Both improvements save a total of 8 lines. so it's 328 insertions(+)
vs 380 deletions(-).
Regards,
Christian
next prev parent reply other threads:[~2016-05-08 18:27 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-08 13:08 [PATCH v8 0/3] gpio: add DT support for memory-mapped GPIOs Christian Lamparter
2016-05-08 13:08 ` Christian Lamparter
2016-05-08 13:08 ` Christian Lamparter
2016-05-08 13:08 ` [PATCH v8 1/3] gpio: dt-bindings: add wd,mbl-gpio bindings Christian Lamparter
2016-05-08 13:08 ` Christian Lamparter
[not found] ` <9bc9349d6e13d81c6200b0cd8fa20c76263043f6.1462543458.git.chunkeey-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2016-05-10 11:58 ` Linus Walleij
2016-05-10 11:58 ` Linus Walleij
2016-05-10 11:58 ` Linus Walleij
2016-05-08 13:08 ` [PATCH v8 2/3] gpio: mmio: add DT support for memory-mapped GPIOs Christian Lamparter
2016-05-08 13:08 ` Christian Lamparter
2016-05-08 13:08 ` Christian Lamparter
2016-05-08 17:17 ` Joachim Eastwood
2016-05-08 17:17 ` Joachim Eastwood
2016-05-08 17:17 ` Joachim Eastwood
2016-05-08 18:27 ` Christian Lamparter [this message]
2016-05-08 18:27 ` Christian Lamparter
[not found] ` <535f785bf6116c0fb6f46afbb77e6d4bd3ef5f60.1462543458.git.chunkeey-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2016-05-10 12:08 ` Linus Walleij
2016-05-10 12:08 ` Linus Walleij
2016-05-10 12:08 ` Linus Walleij
2016-05-10 19:55 ` Christian Lamparter
2016-05-10 19:55 ` Christian Lamparter
2016-05-10 19:55 ` Christian Lamparter
2016-05-11 11:05 ` Álvaro Fernández Rojas
2016-05-08 13:08 ` [PATCH v8 3/3] gpio: move clps711x, moxart, ts4800 and gpio-ge into gpio-mmio Christian Lamparter
2016-05-08 13:08 ` Christian Lamparter
2016-05-08 13:19 ` [PATCH v8 0/3] gpio: add DT support for memory-mapped GPIOs Andy Shevchenko
2016-05-08 13:19 ` Andy Shevchenko
2016-05-08 13:19 ` 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=1946866.9Xyiz0Lzsg@debian64 \
--to=chunkeey@googlemail.com \
--cc=andy.shevchenko@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=gnurou@gmail.com \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manabian@gmail.com \
--cc=mark.rutland@arm.com \
--cc=noltari@gmail.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=shc_work@mail.ru \
/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.