[PATCH v2] gpio: Add Avionic Design N-bit GPIO expander support
Thierry Reding
thierry.reding at avionic-design.de
Fri Aug 10 06:20:54 EST 2012
On Sun, Jul 29, 2012 at 07:13:57PM +0200, Linus Walleij wrote:
> On Mon, Jul 23, 2012 at 1:59 PM, Thierry Reding
> <thierry.reding at avionic-design.de> wrote:
> > +static __devinit int adnp_i2c_probe(struct i2c_client *client,
> > + const struct i2c_device_id *id)
> > +{
> > + struct adnp *gpio;
> > + u32 num_gpios;
> > + int err;
> > +
> > + err = of_property_read_u32(client->dev.of_node, "nr-gpios",
> > + &num_gpios);
> > + if (err < 0)
> > + return err;
> > +
> > + client->irq = irq_of_parse_and_map(client->dev.of_node, 0);
> > + if (client->irq == NO_IRQ)
>
> Just if (!client->irq) since NO_IRQ is 0 nowadays.
At the risk of seeming pedantic, NO_IRQ is in fact quite often not 0.
However, irq_of_parse_and_map() returns 0 if the interrupt cannot be
parsed or mapped, so checking for !client->irq is, as you say, correct.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/devicetree-discuss/attachments/20120809/71b9d778/attachment.sig>
More information about the devicetree-discuss
mailing list