From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"open list:LINUX FOR POWERPC PA SEMI PWRFICIENT"
<linuxppc-dev@lists.ozlabs.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
devicetree <devicetree@vger.kernel.org>,
Albert Herranz <albert_herranz@yahoo.es>,
Segher Boessenkool <segher@kernel.crashing.org>,
Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH v2 3/6] gpio: Add GPIO driver for Nintendo Wii
Date: Sun, 28 Jan 2018 19:31:58 +0200 [thread overview]
Message-ID: <CAHp75VcWshngZFuUp4hzYdD43HF7TZ1sRE3Dh+HckB5do1=gGw@mail.gmail.com> (raw)
In-Reply-To: <20180122050411.32460-4-j.neuschaefer@gmx.net>
On Mon, Jan 22, 2018 at 7:04 AM, Jonathan Neuschäfer
<j.neuschaefer@gmx.net> wrote:
Style issues below.
> +#define HW_GPIO_OWNER 0x3c
> +
> +
> +struct hlwd_gpio {
No need extra empty line in between.
> + struct gpio_chip gpioc;
> + void __iomem *regs;
> + struct device *dev;
> +};
> +
> +static int hlwd_gpio_probe(struct platform_device *pdev)
> +{
> + struct hlwd_gpio *hlwd;
> + struct resource *regs_resource;
> + u32 ngpios;
> + int res;
> +
> + hlwd = devm_kzalloc(&pdev->dev, sizeof(*hlwd), GFP_KERNEL);
> + if (!hlwd)
> + return -ENOMEM;
> +
> + /* Save the struct device pointer so dev_info, etc. can be used. */
Useless.
> + hlwd->dev = &pdev->dev;
> +
> + regs_resource = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (IS_ERR(regs_resource))
> + return PTR_ERR(regs_resource);
> +
This is redundant. Below does it for ya.
> + hlwd->regs = devm_ioremap_resource(&pdev->dev, regs_resource);
> + if (IS_ERR(hlwd->regs))
> + return PTR_ERR(hlwd->regs);
> + res = bgpio_init(&hlwd->gpioc, &pdev->dev, 4,
> + hlwd->regs + HW_GPIOB_IN, hlwd->regs + HW_GPIOB_OUT,
> + NULL, hlwd->regs + HW_GPIOB_DIR, NULL,
> + BGPIOF_BIG_ENDIAN_BYTE_ORDER);
> +
Remove this extra line.
> + if (res < 0) {
> + dev_warn(hlwd->dev, "bgpio_init failed: %d\n", res);
> + return res;
> + }
> + if (of_property_read_u32(pdev->dev.of_node, "ngpios", &ngpios))
> + ngpios = 32;
A nit: I would rather go with
res = of_property_read(...);
if (res)
ngpios = 32;
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2018-01-28 17:31 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-22 5:04 [PATCH v2 0/6] Nintendo Wii GPIO driver Jonathan Neuschäfer
2018-01-22 5:04 ` [PATCH v2 1/6] resource: Extend the PPC32 reserved memory hack Jonathan Neuschäfer
[not found] ` <20180122050411.32460-2-j.neuschaefer-hi6Y0CQ0nG0@public.gmane.org>
2018-01-23 12:58 ` Michael Ellerman
2018-01-23 16:37 ` Jonathan Neuschäfer
2018-01-24 1:23 ` Michael Ellerman
2018-01-27 8:00 ` Jonathan Neuschäfer
2018-01-22 5:04 ` [PATCH v2 2/6] powerpc: wii: Explicitly configure GPIO owner for poweroff pin Jonathan Neuschäfer
2018-01-22 5:04 ` [PATCH v2 3/6] gpio: Add GPIO driver for Nintendo Wii Jonathan Neuschäfer
2018-01-28 17:31 ` Andy Shevchenko [this message]
2018-01-31 8:37 ` Jonathan Neuschäfer
2018-02-07 12:29 ` Linus Walleij
2018-02-07 12:54 ` Jonathan Neuschäfer
2018-01-22 5:04 ` [PATCH v2 4/6] dt-bindings: gpio: Add binding for Wii GPIO controller Jonathan Neuschäfer
2018-02-07 12:26 ` Linus Walleij
2018-01-22 5:04 ` [PATCH v2 5/6] powerpc: wii.dts: Add ngpios property Jonathan Neuschäfer
[not found] ` <20180122050411.32460-1-j.neuschaefer-hi6Y0CQ0nG0@public.gmane.org>
2018-01-22 5:04 ` [PATCH v2 6/6] powerpc: wii.dts: Add GPIO line names Jonathan Neuschäfer
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='CAHp75VcWshngZFuUp4hzYdD43HF7TZ1sRE3Dh+HckB5do1=gGw@mail.gmail.com' \
--to=andy.shevchenko@gmail.com \
--cc=albert_herranz@yahoo.es \
--cc=devicetree@vger.kernel.org \
--cc=j.neuschaefer@gmx.net \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=segher@kernel.crashing.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 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).