Messages in this thread | | | Date | Thu, 9 Aug 2012 22:20:54 +0200 | From | Thierry Reding <> | Subject | Re: [PATCH v2] gpio: Add Avionic Design N-bit GPIO expander support |
| |
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@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 [unhandled content-type:application/pgp-signature] | |