From: Michal Simek <monstr@monstr.eu>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
Grant Likely <grant.likely@linaro.org>,
Rob Herring <rob.herring@calxeda.com>,
devicetree-discuss@lists.ozlabs.org
Subject: Re: [PATCH v2 1/6] GPIO: xilinx: Simplify driver probe function
Date: Mon, 10 Jun 2013 11:02:24 +0200 [thread overview]
Message-ID: <51B59620.5030506@monstr.eu> (raw)
In-Reply-To: <d96317c2681b5feb9e058efe0bd60ff101a0e0fa.1370262666.git.michal.simek@xilinx.com>
[-- Attachment #1: Type: text/plain, Size: 2437 bytes --]
Hi Linus,
can you please look at this patchset?
Thanks,
Michal
On 06/03/2013 02:31 PM, Michal Simek wrote:
> Simplification is done by using OF helper function
> which increase readability of code and remove
> (if (var) var = be32_to_cpup;) assignment.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
> Changes in v2:
> - New patch in this series
>
> drivers/gpio/gpio-xilinx.c | 24 ++++++++++--------------
> 1 file changed, 10 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c
> index 9ae7aa8..2aad534 100644
> --- a/drivers/gpio/gpio-xilinx.c
> +++ b/drivers/gpio/gpio-xilinx.c
> @@ -170,24 +170,20 @@ static int xgpio_of_probe(struct device_node *np)
> return -ENOMEM;
>
> /* Update GPIO state shadow register with default value */
> - tree_info = of_get_property(np, "xlnx,dout-default", NULL);
> - if (tree_info)
> - chip->gpio_state = be32_to_cpup(tree_info);
> + of_property_read_u32(np, "xlnx,dout-default", &chip->gpio_state);
> +
> + /* By default, all pins are inputs */
> + chip->gpio_dir = 0xFFFFFFFF;
>
> /* Update GPIO direction shadow register with default value */
> - chip->gpio_dir = 0xFFFFFFFF; /* By default, all pins are inputs */
> - tree_info = of_get_property(np, "xlnx,tri-default", NULL);
> - if (tree_info)
> - chip->gpio_dir = be32_to_cpup(tree_info);
> + of_property_read_u32(np, "xlnx,tri-default", &chip->gpio_dir);
> +
> + /* By default assume full GPIO controller */
> + chip->mmchip.gc.ngpio = 32;
>
> /* Check device node and parent device node for device width */
> - chip->mmchip.gc.ngpio = 32; /* By default assume full GPIO controller */
> - tree_info = of_get_property(np, "xlnx,gpio-width", NULL);
> - if (!tree_info)
> - tree_info = of_get_property(np->parent,
> - "xlnx,gpio-width", NULL);
> - if (tree_info)
> - chip->mmchip.gc.ngpio = be32_to_cpup(tree_info);
> + of_property_read_u32(np, "xlnx,gpio-width",
> + (u32 *)&chip->mmchip.gc.ngpio);
>
> spin_lock_init(&chip->gpio_lock);
>
> --
> 1.8.2.3
>
--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
next prev parent reply other threads:[~2013-06-10 9:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-03 12:31 [PATCH v2 1/6] GPIO: xilinx: Simplify driver probe function Michal Simek
2013-06-03 12:31 ` [PATCH v2 2/6] GPIO: xilinx: Add support for dual channel Michal Simek
2013-06-17 5:44 ` Linus Walleij
2013-06-03 12:31 ` [PATCH v2 6/6] DT: Add documentation for gpio-xilinx Michal Simek
2013-06-17 5:50 ` Linus Walleij
2013-06-17 6:21 ` Michal Simek
2013-06-17 9:13 ` Linus Walleij
2013-06-24 11:54 ` Michal Simek
2013-06-29 23:21 ` Linus Walleij
2013-06-10 9:02 ` Michal Simek [this message]
2013-06-17 5:25 ` [PATCH v2 1/6] GPIO: xilinx: Simplify driver probe function Michal Simek
2013-06-17 5:39 ` Linus Walleij
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=51B59620.5030506@monstr.eu \
--to=monstr@monstr.eu \
--cc=arnd@arndb.de \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rob.herring@calxeda.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).