From: Dmitry Torokhov <dtor@chromium.org>
To: Ray Jui <rjui@broadcom.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Alexandre Courbot <gnurou@gmail.com>,
Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
Grant Likely <grant.likely@linaro.org>,
Christian Daudt <bcm@fixthebug.org>,
Matt Porter <mporter@linaro.org>,
Florian Fainelli <f.fainelli@gmail.com>,
Russell King <linux@arm.linux.org.uk>,
Joe Perches <joe@perches.com>, Arnd Bergmann <arnd@arndb.de>,
Scott Branden <sbranden@broadcom.com>,
Anatol Pomazau <anatol@google.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
bcm-kernel-feedback-list@broadcom.com,
devicetree@vger.kernel.org
Subject: Re: [PATCH v8 2/4] pinctrl: cygnus: add gpio/pinconf driver
Date: Mon, 9 Feb 2015 11:20:13 -0800 [thread overview]
Message-ID: <20150209191951.GA15709@dtor-ws> (raw)
In-Reply-To: <1423070463-24483-3-git-send-email-rjui@broadcom.com>
Hi Ray,
On Wed, Feb 04, 2015 at 09:21:01AM -0800, Ray Jui wrote:
> +static int cygnus_gpio_pinmux_add_range(struct cygnus_gpio *chip)
> +{
> + struct device_node *node = chip->dev->of_node;
> + struct device_node *pinmux_node;
> + struct platform_device *pinmux_pdev;
> + struct gpio_chip *gc = &chip->gc;
> + int i, ret;
> +
> + /* parse DT to find the phandle to the pinmux controller */
> + pinmux_node = of_parse_phandle(node, "pinmux", 0);
> + if (!pinmux_node)
> + return -ENODEV;
> +
> + pinmux_pdev = of_find_device_by_node(pinmux_node);
> + if (!pinmux_pdev) {
> + dev_err(chip->dev, "failed to get pinmux device\n");
> + return -EINVAL;
> + }
> +
> + /* now need to create the mapping between local GPIO and PINMUX pins */
> + for (i = 0; i < ARRAY_SIZE(cygnus_gpio_pintable); i++) {
> + ret = gpiochip_add_pin_range(gc, dev_name(&pinmux_pdev->dev),
> + cygnus_gpio_pintable[i].offset,
> + cygnus_gpio_pintable[i].pin_base,
> + cygnus_gpio_pintable[i].num_pins);
> + if (ret) {
> + dev_err(chip->dev, "unable to add GPIO pin range\n");
> + goto err_put_device;
> + }
> + }
> +
> + chip->pinmux_is_supported = true;
> +
> + /* no need for pinmux_pdev device reference anymore */
> + put_device(&pinmux_pdev->dev);
Sorry I did not notice it before, but of_parse_phandle() takes reference
to the returned device node, so you need to "put" it here and in error
path as well. Actually you can do:
int ret = 0;
pinmux_node = of_parse_phandle(node, "pinmux", 0);
if (!pinmux_node)
return -ENODEV;
pinmux_pdev = of_find_device_by_node(pinmux_node);
/* We do not longer need pinmux node */
of_node_put(pinmux_node);
if (!pinmux_dev)
....
for (..) {
...
if (ret) {
dev_err(...);
break;
}
}
chip->pinmux_is_supported = (ret == 0);
put_device(..);
return ret;
}
This way you free resources in the same path.
...
> +
> +static struct platform_driver cygnus_gpio_driver = {
> + .driver = {
> + .name = "cygnus-gpio",
> + .of_match_table = cygnus_gpio_of_match,
> + .suppress_bind_attrs = true,
> + },
> + .probe = cygnus_gpio_probe,
> +};
> +
> +static int __init cygnus_gpio_init(void)
> +{
> + return platform_driver_probe(&cygnus_gpio_driver, cygnus_gpio_probe);
When I asked you to add ".suppress_bind_attrs = true" I missed the fact
that you were using platform_driver_probe() which already does this
internally. However platform_driver_probe() can't handle deferred
probing, which may or may not be OK. Is there a chance that any of the
resources needed by the driver return -EPROBE_DEFER? If not then it is
safe to continue using platform_driver_probe() and you can drop
suppress_bind_attrs assignment, otherwise it may be better to switch to
platform_driver_register().
Thanks.
--
Dmitry
next prev parent reply other threads:[~2015-02-09 19:20 UTC|newest]
Thread overview: 118+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Ray Jui <rjui@broadcom.com>
2014-12-04 21:56 ` [PATCH 0/4] Add pinctrl support to Broadcom Cygnus SoC Ray Jui
2014-12-04 21:56 ` [PATCH 1/4] pinctrl: Broadcom Cygnus pinctrl device tree binding Ray Jui
2014-12-04 22:16 ` Belisko Marek
2014-12-04 22:35 ` Ray Jui
2014-12-04 21:56 ` [PATCH 2/4] pinctrl: cygnus: add initial pinctrl support Ray Jui
2014-12-04 21:56 ` [PATCH 3/4] ARM: mach-bcm: enable pinctrl support for Cygnus Ray Jui
2014-12-04 21:56 ` [PATCH 4/4] ARM: dts: enable pinctrl for Broadcom Cygnus Ray Jui
2014-12-05 19:51 ` [PATCH v2 0/4] Add pinctrl support to Broadcom Cygnus SoC Ray Jui
[not found] ` <1417809069-26510-1-git-send-email-rjui-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2014-12-05 19:51 ` [PATCH v2 1/4] pinctrl: Broadcom Cygnus pinctrl device tree binding Ray Jui
2014-12-05 19:51 ` [PATCH v2 2/4] pinctrl: cygnus: add initial pinctrl support Ray Jui
2014-12-05 19:51 ` [PATCH v2 3/4] ARM: mach-bcm: enable pinctrl support for Cygnus Ray Jui
2014-12-05 19:51 ` [PATCH v2 4/4] ARM: dts: enable pinctrl for Broadcom Cygnus Ray Jui
2014-12-08 2:38 ` [PATCH v2 0/5] Add gpio support to Broadcom Cygnus SoC Ray Jui
2014-12-08 2:38 ` [PATCH v2 1/5] gpio: Cygnus: define Broadcom Cygnus GPIO binding Ray Jui
2014-12-08 11:22 ` Arnd Bergmann
2014-12-08 16:55 ` Ray Jui
2014-12-08 17:11 ` Arnd Bergmann
2014-12-08 2:38 ` [PATCH v2 2/5] gpio: Cygnus: add GPIO driver Ray Jui
2014-12-08 2:38 ` [PATCH v2 3/5] ARM: mach-bcm: Enable GPIO support for Cygnus Ray Jui
2014-12-08 2:38 ` [PATCH v2 4/5] ARM: dts: enable GPIO for Broadcom Cygnus Ray Jui
2014-12-08 2:38 ` [PATCH v2 5/5] MAINTAINERS: Entry for Cygnus GPIO driver Ray Jui
2014-12-08 18:47 ` [PATCH v3 0/5] Add gpio support to Broadcom Cygnus SoC Ray Jui
2014-12-08 18:47 ` [PATCH v2 " Ray Jui
[not found] ` <1418064468-8512-2-git-send-email-rjui-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2014-12-08 18:48 ` Ray Jui
2014-12-08 18:47 ` [PATCH v3 1/5] gpio: Cygnus: define Broadcom Cygnus GPIO binding Ray Jui
2014-12-08 19:38 ` Arnd Bergmann
2014-12-08 19:45 ` Ray Jui
[not found] ` <1418064468-8512-1-git-send-email-rjui-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2014-12-08 18:47 ` [PATCH v3 2/5] gpio: Cygnus: add GPIO driver Ray Jui
2014-12-08 18:47 ` [PATCH v3 3/5] ARM: mach-bcm: Enable GPIO support for Cygnus Ray Jui
2014-12-08 18:47 ` [PATCH v3 4/5] ARM: dts: enable GPIO for Broadcom Cygnus Ray Jui
2014-12-08 18:47 ` [PATCH v3 5/5] MAINTAINERS: Entry for Cygnus GPIO driver Ray Jui
2014-12-08 20:41 ` [PATCH v4 0/5] Add gpio support to Broadcom Cygnus SoC Ray Jui
2014-12-08 20:41 ` [PATCH v4 1/5] gpio: Cygnus: define Broadcom Cygnus GPIO binding Ray Jui
2014-12-08 20:41 ` [PATCH v4 2/5] gpio: Cygnus: add GPIO driver Ray Jui
2014-12-10 10:34 ` Alexandre Courbot
[not found] ` <CAAVeFuJ875fvEwPbnc-Eewsw4Rp7hLbv7nXWBb=OgvLwhQBVvQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-12-11 1:30 ` Ray Jui
2014-12-08 20:41 ` [PATCH v4 3/5] ARM: mach-bcm: Enable GPIO support for Cygnus Ray Jui
2014-12-08 20:41 ` [PATCH v4 4/5] ARM: dts: enable GPIO for Broadcom Cygnus Ray Jui
2014-12-08 20:41 ` [PATCH v4 5/5] MAINTAINERS: Entry for Cygnus GPIO driver Ray Jui
2014-12-12 0:05 ` [PATCH v5 0/3] Add gpio support to Broadcom Cygnus SoC Ray Jui
2014-12-12 0:05 ` [PATCH v5 1/3] gpio: Cygnus: define Broadcom Cygnus GPIO binding Ray Jui
2014-12-12 12:08 ` Arnd Bergmann
2014-12-12 13:05 ` Alexandre Courbot
2014-12-12 15:28 ` Arnd Bergmann
2014-12-15 21:35 ` Ray Jui
2014-12-15 21:57 ` Arnd Bergmann
2014-12-16 0:08 ` Ray Jui
2014-12-17 2:52 ` Alexandre Courbot
2015-01-13 8:01 ` Linus Walleij
2014-12-17 2:45 ` Alexandre Courbot
2014-12-17 10:26 ` Arnd Bergmann
2014-12-17 13:16 ` Alexandre Courbot
2014-12-17 10:44 ` Russell King - ARM Linux
2014-12-17 13:13 ` Alexandre Courbot
2015-01-13 8:06 ` Linus Walleij
[not found] ` <CACRpkdZbGjNecrggrFr_18zjobXMBpkrSjBMAUfyfs2ZCebB0w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-13 11:41 ` Russell King - ARM Linux
2015-01-16 10:18 ` Linus Walleij
2014-12-12 17:17 ` Ray Jui
2014-12-12 0:05 ` [PATCH v5 2/3] gpio: Cygnus: add GPIO driver Ray Jui
2014-12-12 0:05 ` [PATCH v5 3/3] ARM: dts: enable GPIO for Broadcom Cygnus Ray Jui
2015-02-03 2:01 ` [PATCH v3 0/4] Add pinctrl support to Broadcom Cygnus SoC Ray Jui
2015-02-03 2:01 ` [PATCH v3 1/4] pinctrl: bcm: consolidate Broadcom pinctrl drivers Ray Jui
[not found] ` <1422928894-20716-1-git-send-email-rjui-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2015-02-03 2:01 ` [PATCH v3 2/4] pinctrl: Broadcom Cygnus pinctrl device tree binding Ray Jui
2015-02-03 2:01 ` [PATCH v3 3/4] pinctrl: cygnus: add initial IOMUX driver support Ray Jui
2015-02-03 17:40 ` Dmitry Torokhov
2015-02-03 19:29 ` Ray Jui
2015-02-03 20:00 ` Dmitry Torokhov
2015-02-03 20:16 ` Ray Jui
2015-02-03 2:01 ` [PATCH v3 4/4] ARM: dts: enable IOMUX for Broadcom Cygnus Ray Jui
2015-02-04 1:09 ` [PATCH v7 0/4] Add gpio/pinconf support to Broadcom Cygnus SoC Ray Jui
[not found] ` <1423012148-22560-1-git-send-email-rjui-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2015-02-04 1:09 ` [PATCH v7 1/4] pinctrl: Cygnus: define Broadcom Cygnus GPIO/PINCONF binding Ray Jui
2015-02-04 1:09 ` [PATCH v7 2/4] pinctrl: cygnus: add gpio/pinconf driver Ray Jui
2015-02-04 1:41 ` Dmitry Torokhov
2015-02-04 2:19 ` Ray Jui
2015-02-04 1:09 ` [PATCH v7 3/4] ARM: dts: enable GPIO for Broadcom Cygnus Ray Jui
2015-02-04 1:09 ` [PATCH v7 4/4] ARM: dts: cygnus: enable GPIO based hook detection Ray Jui
[not found] ` <Ray Jui <rjui-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2014-12-06 0:40 ` [PATCH 0/5] Add gpio support to Broadcom Cygnus SoC Ray Jui
2014-12-06 0:40 ` [PATCH 1/5] gpio: Cygnus: define Broadcom Cygnus GPIO binding Ray Jui
2015-01-13 7:57 ` Linus Walleij
2015-01-13 17:07 ` Ray Jui
2014-12-06 0:40 ` [PATCH 2/5] gpio: Cygnus: add GPIO driver Ray Jui
[not found] ` <1417826408-1600-3-git-send-email-rjui-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2014-12-06 1:28 ` Joe Perches
2014-12-06 2:14 ` Ray Jui
2014-12-06 2:34 ` Joe Perches
2014-12-06 3:41 ` Ray Jui
2014-12-06 4:24 ` Joe Perches
2014-12-08 1:34 ` Ray Jui
2014-12-08 1:59 ` Ray Jui
2014-12-06 0:40 ` [PATCH 3/5] ARM: mach-bcm: Enable GPIO support for Cygnus Ray Jui
2014-12-06 0:40 ` [PATCH 4/5] ARM: dts: enable GPIO for Broadcom Cygnus Ray Jui
2014-12-06 0:40 ` [PATCH 5/5] MAINTAINERS: Entry for Cygnus GPIO driver Ray Jui
2014-12-16 2:18 ` [PATCH v6 0/3] Add gpio support to Broadcom Cygnus SoC Ray Jui
2014-12-16 2:18 ` [PATCH v6 1/3] gpio: Cygnus: define Broadcom Cygnus GPIO binding Ray Jui
2014-12-16 2:18 ` [PATCH v6 2/3] gpio: Cygnus: add GPIO driver Ray Jui
2015-01-13 8:53 ` Linus Walleij
2015-01-13 17:05 ` Ray Jui
2015-01-16 10:14 ` Linus Walleij
2015-01-17 0:11 ` Ray Jui
2015-01-20 9:53 ` Linus Walleij
2015-01-20 19:17 ` Ray Jui
2014-12-16 2:18 ` [PATCH v6 3/3] ARM: dts: enable GPIO for Broadcom Cygnus Ray Jui
2014-12-16 8:56 ` [PATCH v6 0/3] Add gpio support to Broadcom Cygnus SoC Arnd Bergmann
2014-12-17 8:06 ` Alexandre Courbot
2015-02-04 2:09 ` [PATCH v4 0/4] Add pinctrl " Ray Jui
2015-02-04 2:09 ` [PATCH v4 1/4] pinctrl: bcm: consolidate Broadcom pinctrl drivers Ray Jui
[not found] ` <1423015801-26967-2-git-send-email-rjui-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2015-03-04 9:07 ` Linus Walleij
[not found] ` <CACRpkdaiM+mqGg43BT1Kr-CNi8+_U4KgZM4iZocv9+ovHL5hLQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-04 17:31 ` Ray Jui
[not found] ` <1423015801-26967-1-git-send-email-rjui-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2015-02-04 2:09 ` [PATCH v4 2/4] pinctrl: Broadcom Cygnus pinctrl device tree binding Ray Jui
2015-02-04 2:10 ` [PATCH v4 3/4] pinctrl: cygnus: add initial IOMUX driver support Ray Jui
2015-02-04 2:10 ` [PATCH v4 4/4] ARM: dts: enable IOMUX for Broadcom Cygnus Ray Jui
2015-02-25 19:29 ` [PATCH v4 0/4] Add pinctrl support to Broadcom Cygnus SoC Dmitry Torokhov
2015-02-04 17:20 ` [PATCH v8 0/4] Add gpio/pinconf " Ray Jui
2015-02-04 17:21 ` [PATCH v8 1/4] pinctrl: Cygnus: define Broadcom Cygnus GPIO/PINCONF binding Ray Jui
2015-02-04 17:21 ` [PATCH v8 2/4] pinctrl: cygnus: add gpio/pinconf driver Ray Jui
2015-02-09 19:20 ` Dmitry Torokhov [this message]
2015-02-10 21:47 ` Ray Jui
2015-02-04 17:21 ` [PATCH v8 3/4] ARM: dts: enable GPIO for Broadcom Cygnus Ray Jui
2015-02-04 17:21 ` [PATCH v8 4/4] ARM: dts: cygnus: enable GPIO based hook detection Ray Jui
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=20150209191951.GA15709@dtor-ws \
--to=dtor@chromium.org \
--cc=anatol@google.com \
--cc=arnd@arndb.de \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=bcm@fixthebug.org \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=galak@codeaurora.org \
--cc=gnurou@gmail.com \
--cc=grant.likely@linaro.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=joe@perches.com \
--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=linux@arm.linux.org.uk \
--cc=mark.rutland@arm.com \
--cc=mporter@linaro.org \
--cc=pawel.moll@arm.com \
--cc=rjui@broadcom.com \
--cc=robh+dt@kernel.org \
--cc=sbranden@broadcom.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).