[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 7 Jul 2014 14:38:37 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Houcheng Lin <houcheng@...il.com>
Cc: Alexandre Courbot <gnurou@...il.com>,
Grant Likely <grant.likely@...aro.org>,
Rob Herring <robh+dt@...nel.org>,
Dmitry Eremin-Solenikov <dbaryshkov@...il.com>,
David Woodhouse <dwmw2@...radead.org>,
Philipp Zabel <p.zabel@...gutronix.de>,
Stephen Gallimore <stephen.gallimore@...com>,
Srinivas KANDAGATLA <srinivas.kandagatla@...com>,
Maxime Ripard <maxime.ripard@...e-electrons.com>,
Ulf Hansson <ulf.hansson@...aro.org>, sre@...nel.org,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>
Subject: Re: [RFC PATCH v3] reset: Add a defer reset object to send board
specific reset
On Wed, Jun 18, 2014 at 3:37 PM, Houcheng Lin <houcheng@...il.com> wrote:
(...)
> +static DEFINE_MUTEX(deferred_reset_mutex);
> +static LIST_HEAD(deferred_reset_list);
> +
> +struct defer_reset_private {
> + struct list_head lnode;
> + struct device_node *node; /* defer_reset device */
Isn't it better if you get the gpio descriptor(s) in probe() and store that
inside defer_reset_private instead of storing the device_node?
struct gpio_desc *gpiod;
(Then you need not include <linux/of_gpio.h>)
> +};
> +static int gdr_issue_reset_line(
> + struct device_node *of_node, int index, int val)
> +{
> + enum of_gpio_flags flags = 0;
> + struct gpio_desc *gpiod;
> + gpiod = of_get_named_gpiod_flags(of_node, "reset-gpios", index, &flags);
> + if (IS_ERR(gpiod))
> + return -PTR_ERR(gpiod);
> + gdr_issue_reset_gpio(gpiod, val, flags);
So here just use the gpiod from the private struct instead
of looking it up in the last minute.
> +static int gdr_probe(struct platform_device *pdev_gdr)
> +{
> + struct list_head *pos, *n;
> +
> + pr_debug("gpio defer reset probe\n");
> +
> + mutex_lock(&deferred_reset_mutex);
> + list_for_each_safe(pos, n, &deferred_reset_list) {
> + struct defer_reset_private *pdata;
> + struct platform_device *pdev;
> + pdata = list_entry(pos, struct defer_reset_private, lnode);
> + pdev = of_find_device_by_node(pdata->node->parent);
So in this iteration I would get the gpio descriptor for each one using
something like:
pdata->gpiod = gpiod_get_index(&pdev->dev, ...);
Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists