public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: marvin24@gmx.de (Marc Dietrich)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] staging: nvec: add device tree support
Date: Mon, 31 Oct 2011 23:18:19 +0100	[thread overview]
Message-ID: <2575094.nz9Q3TTkgX@ax5200p> (raw)
In-Reply-To: <74CDBE0F657A3D45AFBB94109FB122FF173EDAB877@HQMAIL01.nvidia.com>

On Monday 31 October 2011 13:18:13 Stephen Warren wrote:
> Marc Dietrich wrote at Monday, October 31, 2011 1:59 PM:
> > This adds device tree support to the nvec driver. By using this method
> > it is no longer necessary to specify platform data through a board
> > file.
> 
> ...
> 
> > diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
> 
> ...
> 
> > +	if (pdata) {
> > +		nvec->gpio = pdata->gpio;
> > +		nvec->i2c_addr = pdata->i2c_addr;
> > +	} else if (nvec->dev->of_node) {
> > +		nvec->gpio = of_get_named_gpio(nvec->dev->of_node, "request-gpios",
> > 0); +		if (nvec->gpio < 0) {
> > +			dev_err(&pdev->dev, "no gpio specified");
> > +			goto failed;
> > +		}
> > 
> > +		prop = of_get_property(nvec->dev->of_node, "slave-addr", NULL);
> > +		if (!prop) {
> > +			dev_err(&pdev->dev, "no i2c address specified");
> > +			goto failed;
> > +		}
> > +		nvec->i2c_addr = be32_to_cpup(prop);
> 
> ----------==========----------==========----------==========----------======
> ==== Don't you want to use of_property_read_u32() here to simplify the code
> slightly? You can also get rid of at least one #include that way.

Ok, I somehow didn't found it during my quick search.

> > +	} else {
> > +		dev_err(&pdev->dev, "no platform data\n");
> > +		goto failed;
> > +	}

  reply	other threads:[~2011-10-31 22:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-31 19:58 [PATCH v3 0/3] paz00 updates for 3.3 Marc Dietrich
2011-10-31 19:58 ` [PATCH 1/3] ARM: tegra: paz00: add support for wakeup gpio key Marc Dietrich
2011-10-31 20:13   ` Stephen Warren
2011-10-31 21:36     ` Marc Dietrich
2011-10-31 19:58 ` [PATCH 2/3] staging: nvec: add device tree support Marc Dietrich
2011-10-31 20:18   ` Stephen Warren
2011-10-31 22:18     ` Marc Dietrich [this message]
2011-10-31 19:58 ` [PATCH 3/3] arm/dt: tegra: add dts file for paz00 Marc Dietrich
2011-10-31 20:14   ` Stephen Warren
2011-10-31 22:20     ` Marc Dietrich
  -- strict thread matches above, loose matches on Subject: below --
2011-11-01 20:37 [PATCH v4 0/3] paz00 updates for 3.3 Marc Dietrich
2011-11-01 20:37 ` [PATCH 2/3] staging: nvec: add device tree support Marc Dietrich
2011-11-01 22:36   ` Stephen Warren
2011-11-09 19:11     ` Olof Johansson
2011-11-09 19:57       ` Greg KH
2011-11-21 13:42         ` Marc Dietrich

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=2575094.nz9Q3TTkgX@ax5200p \
    --to=marvin24@gmx.de \
    --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