From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Magnus Damm <magnus.damm@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
SH-Linux <linux-sh@vger.kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
Grant Likely <grant.likely@secretlab.ca>,
"Simon Horman [Horms]" <horms@verge.net.au>
Subject: Re: [PATCH] gpio: Renesas RZ GPIO driver
Date: Wed, 13 Nov 2013 23:55:16 +0000 [thread overview]
Message-ID: <3148793.m2Our7kMkU@avalon> (raw)
In-Reply-To: <CANqRtoRkMO8Xcno+ZPDPddPp3FNHT_E+6B=i7K_ixELzseRcFw@mail.gmail.com>
Hi Magnus,
On Thursday 14 November 2013 08:49:16 Magnus Damm wrote:
> On Wed, Nov 13, 2013 at 9:03 PM, Laurent Pinchart wrote:
> > Hi Magnus,
> >
> > Thank you for the patch.
> >
> > Please read below for a couple of comments in addition to Linus' review.
> >
> > On Thursday 07 November 2013 08:47:37 Magnus Damm wrote:
> >> From: Magnus Damm <damm@opensource.se>
> >>
> >> This patch adds a GPIO driver for the RZ series of SoCs from
> >> Renesas. The driver can be used as platform device with dynamic
> >> or static GPIO assignment or via DT using dynamic GPIOs.
> >>
> >> The hardware allows control of GPIOs in blocks of up to 16 pins,
> >> and once device may span multiple blocks. Interrupts are not
> >> included in this hardware block, if interrupts are needed then
> >> the PFC needs to be configured to a IRQ pin function which is
> >> handled by the GIC hardware.
> >>
> >> Tested with yet-to-be-posted platform device and DT devices on
> >> r7s72100 and Genmai using LEDs, DIP switches and I2C bitbang.
> >>
> >> Signed-off-by: Magnus Damm <damm@opensource.se>
> >> ---
> >>
> >> drivers/gpio/Kconfig | 6
> >> drivers/gpio/Makefile | 1
> >> drivers/gpio/gpio-rz.c | 241 +++++++++++++++++++++++++++
> >> include/linux/platform_data/gpio-rz.h | 13 +
> >> 4 files changed, 261 insertions(+)
[snip]
> >> --- /dev/null
> >> +++ work/drivers/gpio/gpio-rz.c 2013-11-06 14:20:02.000000000 +0900
> >> @@ -0,0 +1,241 @@
[snip]
> >> +static inline unsigned long rz_gpio_read_ppr(struct rz_gpio_priv *p, int
> >> offs)
> >> +{
> >> + unsigned long msk = BIT(offs % RZ_GPIOS_PER_PORT);
> >> + int offset = (offs / RZ_GPIOS_PER_PORT) * 4;
> >
> > offs and offset are unsigned, you can make them unsigned int.
>
> Ok!
>
> >> + return ioread32(p->io[REG_PPR] + offset) & msk;
> >
> > I believe you should return !!(...) here, or in the caller, to make sure
> > the gpio_get_value() operation returns either 0 or 1. I would do it here
> > and return a u32 instead of unsigned long.
>
> I disagree with the !! because it is just pure overhead, please see
> the __gpio_get_value() comment, it says returning zero or nonzero. So
> I left this portion as-is.
OK, good point. Linus, what's the best practice rule for GPIO drivers ? Should
they just return any non-zero value, or is any specific value preferred ?
> >> +}
[snip]
> >> +static int rz_gpio_probe(struct platform_device *pdev)
> >> +{
> >> + struct gpio_rz_config *pdata = dev_get_platdata(&pdev->dev);
> >> + struct rz_gpio_priv *p;
> >> + struct resource *io[3];
> >> + struct gpio_chip *gpio_chip;
> >> + struct device_node *np = pdev->dev.of_node;
> >> + struct of_phandle_args args;
> >> + int number_of_pins, gpio_base;
> >> + int k, nr;
> >
> > unsigned ?
>
> Ok!
>
> > By the way, what's wrong with i as a loop index ? :-)
>
> Nothing, but I left it as-is anyway! =)
Good to know it's not wrong. But it's still an int in v2 ;-)
> >> + int ret;
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2013-11-13 23:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-06 23:47 [PATCH] gpio: Renesas RZ GPIO driver Magnus Damm
2013-11-12 19:59 ` Linus Walleij
2013-11-13 6:19 ` Magnus Damm
2013-11-18 10:00 ` Linus Walleij
2013-11-18 11:35 ` Arnd Bergmann
2013-11-13 12:03 ` Laurent Pinchart
2013-11-13 23:49 ` Magnus Damm
2013-11-13 23:55 ` Laurent Pinchart [this message]
2013-11-14 9:00 ` Magnus Damm
2013-11-14 2:58 ` Simon Horman
2013-11-14 10:14 ` Geert Uytterhoeven
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=3148793.m2Our7kMkU@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=grant.likely@secretlab.ca \
--cc=horms@verge.net.au \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).