From: antoine.tenart@free-electrons.com (Antoine Ténart)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 01/12] reset: add the Berlin reset controller driver
Date: Tue, 24 Jun 2014 14:05:19 +0200 [thread overview]
Message-ID: <20140624120519.GE7368@kwain> (raw)
In-Reply-To: <1403608416.2910.15.camel@paszta.hi.pengutronix.de>
Hi Philipp,
On Tue, Jun 24, 2014 at 01:13:36PM +0200, Philipp Zabel wrote:
> Am Dienstag, den 24.06.2014, 12:35 +0200 schrieb Antoine T?nart:
> > +
> > +struct berlin_reset_priv {
> > + spinlock_t lock;
>
> lock is not used anymore.
Oops. I'll remove it.
>
> [...]
> > +static int berlin_reset_xlate(struct reset_controller_dev *rcdev,
> > + const struct of_phandle_args *reset_spec)
> > +{
> > + struct berlin_reset_priv *priv = to_berlin_reset_priv(rcdev);
> > + unsigned offset, bit;
> > +
> > + if (WARN_ON(reset_spec->args_count != rcdev->of_reset_n_cells))
> > + return -EINVAL;
> > +
> > + offset = reset_spec->args[0];
> > + bit = reset_spec->args[1];
> > +
> > + if (offset >= priv->size)
> > + return -EINVAL;
> > +
> > + if (bit >= rcdev->nr_resets)
> > + return -EINVAL;
>
> This could be considered a misuse of nr_resets, even if the core only
> ever uses nr_resets in the _xlate function. Maybe it would be more clear
> to just leave nr_resets empty if you don't know the actual number and
> hardcode 32 here.
>
> [...]
> > +static int __berlin_reset_init(struct device_node *np)
> > +{
> > + struct berlin_reset_priv *priv;
> > + struct resource res;
> > + resource_size_t size;
> > + int ret;
> > +
> > + priv = kzalloc(sizeof(*priv), GFP_KERNEL);
> > + if (!priv)
> > + return -ENOMEM;
> > +
> > + ret = of_address_to_resource(np, 0, &res);
> > + if (ret)
> > + goto err;
> > +
> > + size = resource_size(&res);
> > + priv->base = ioremap(res.start, size);
> > + if (!priv->base) {
> > + ret = -ENOMEM;
> > + goto err;
> > + }
> > + priv->size = size;
> > +
> > + priv->rcdev.owner = THIS_MODULE;
> > + priv->rcdev.nr_resets = 32;
>
> Leave nr_resets empty, use the correct value, or at least add a comment
> that this is not the number of resets in the rcdev as documented in the
> structure documentation.
Ok. I'll hardcode the value in the driver then.
>
> Other than the above, and with the understanding that this is going to
> be turned into a platform driver at some point in the future,
>
> Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Sure, that's the plan.
Antoine
--
Antoine T?nart, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
next prev parent reply other threads:[~2014-06-24 12:05 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-24 10:35 [PATCH v2 00/12] ARM: berlin: USB support Antoine Ténart
2014-06-24 10:35 ` [PATCH v2 01/12] reset: add the Berlin reset controller driver Antoine Ténart
2014-06-24 11:13 ` Philipp Zabel
2014-06-24 12:05 ` Antoine Ténart [this message]
2014-06-24 10:35 ` [PATCH v2 02/12] Documentation: bindings: add reset bindings docs for Marvell Berlin SoCs Antoine Ténart
2014-06-24 11:14 ` Philipp Zabel
2014-06-24 10:35 ` [PATCH v2 03/12] ARM: Berlin: select the reset controller Antoine Ténart
2014-06-24 10:35 ` [PATCH v2 04/12] ARM: dts: berlin: add a required reset property in the chip controller node Antoine Ténart
2014-06-24 11:14 ` Philipp Zabel
2014-06-24 10:35 ` [PATCH v2 05/12] usb: phy: add the Berlin USB PHY driver Antoine Ténart
2014-06-27 15:56 ` Felipe Balbi
2014-06-27 16:05 ` Antoine Ténart
2014-06-27 23:04 ` Felipe Balbi
2014-06-30 14:52 ` Antoine Ténart
2014-06-30 18:34 ` Felipe Balbi
2014-06-24 10:35 ` [PATCH v2 06/12] Documentation: bindings: add doc for the Berlin USB PHY Antoine Ténart
2014-06-24 10:35 ` [PATCH v2 07/12] usb: chipidea: add a generic driver Antoine Ténart
2014-06-24 10:51 ` Jingoo Han
2014-06-30 13:39 ` Antoine Ténart
2014-06-27 3:25 ` Peter Chen
2014-06-27 3:41 ` Peter Chen
2014-06-30 13:33 ` Antoine Ténart
2014-07-01 0:21 ` Peter Chen
2014-07-01 7:24 ` Antoine Ténart
2014-07-01 8:55 ` Sebastian Hesselbarth
2014-07-01 8:30 ` Peter Chen
2014-07-01 10:42 ` Alexandre Belloni
2014-07-01 15:18 ` Sergei Shtylyov
2014-07-02 1:10 ` Peter Chen
2014-07-15 15:22 ` Antoine Ténart
2014-07-16 0:32 ` Peter Chen
2014-07-03 2:47 ` punnaiah choudary kalluri
2014-07-15 15:24 ` Antoine Ténart
2014-07-16 0:44 ` Peter Chen
2014-06-24 10:35 ` [PATCH v2 08/12] Documentation: bindings: add doc for the generic ChipIdea USB driver Antoine Ténart
2014-06-24 10:35 ` [PATCH v2 09/12] ARM: dts: berlin: add BG2Q nodes for USB support Antoine Ténart
2014-06-24 10:35 ` [PATCH v2 10/12] ARM: dts: Berlin: enable USB on the BG2Q DMP Antoine Ténart
2014-06-24 10:35 ` [PATCH v2 11/12] ARM: dts: berlin: add BG2CD nodes for USB support Antoine Ténart
2014-06-24 10:35 ` [PATCH v2 12/12] ARM: dts: berlin: enable USB on the Google Chromecast Antoine Ténart
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=20140624120519.GE7368@kwain \
--to=antoine.tenart@free-electrons.com \
--cc=linux-arm-kernel@lists.infradead.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