From: Thierry Reding Subject: Re: [PATCH v2] gpio: Add Avionic Design N-bit GPIO expander support Date: Thu, 9 Aug 2012 22:20:54 +0200 Message-ID: <20120809202054.GA24503@avionic-0098.mockup.avionic-design.de> References: <1343044770-6591-1-git-send-email-thierry.reding@avionic-design.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5vNYLRcllDrimb99" Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Linus Walleij Cc: Grant Likely , Arnd Bergmann , linux-kernel@vger.kernel.org, devicetree-discuss@lists.ozlabs.org, Linus Walleij , Rob Herring , Wolfram Sang List-Id: devicetree@vger.kernel.org --5vNYLRcllDrimb99 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jul 29, 2012 at 07:13:57PM +0200, Linus Walleij wrote: > On Mon, Jul 23, 2012 at 1:59 PM, Thierry Reding > 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 =3D of_property_read_u32(client->dev.of_node, "nr-gpios", > > + &num_gpios); > > + if (err < 0) > > + return err; > > + > > + client->irq =3D irq_of_parse_and_map(client->dev.of_node, 0); > > + if (client->irq =3D=3D NO_IRQ) >=20 > 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 --5vNYLRcllDrimb99 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iQIcBAEBAgAGBQJQJBumAAoJEN0jrNd/PrOh1y0P/irlDC0+1fDn0uL2BEKwhQKj R2vI9jIpAzWSifYnqSJ8ivrC3//pmP1ggrPYB/fpo+BHhodPmxTqhP7dTSGMKiL3 uycQXTfHY6FgqWpziYzLCOdcisTDmseqTDzCU87CKFDQzWOU/wZX2WsHS1Z/hByN D464xLzbWi6Yhzbiu0nWhhHLKwasjo38r7/eU1WxucH7Z/74xZF8Y6rEh/GXDvER Mk72xcVkdI15jdr5gGgg7aFlwBuXQdhZrbFnX9Om4KovV2ia+B9TpfxE0BMerDFV Gonr8caeyd6qxBuSWP1qptYmpW9Zz5q0AsIPOr0ryTB00PxgBj7dEhv3uqwZMgtJ SmpKQchTdDulg5Avl1nGIC6IFkAnNi/5ciA6mF6GNn6xbXlSEoPPehfEs2G2r78B zD1eUFjbN5+jD4gWm7yqloMgr7g7XgHQ9ro6Dd+b/Za1P/tQY4MDpSp5Cno4Lnt2 B0C4p9mDUl30yr8yyHVRyF8Ng7ebDfqv/latmMuQNyQZcihlQriIAQ9ZBrTftJG1 5YgHtzqytppF9JlO/JQayqewWQ4tNG0ooM+OORagiUDpU7He7rPtlDN0BBkMHPbg kaxhtzIRIbZeocfoUymSeLw8d9U5HoQkXdZtKxO5b0thrnki2WxFvHrTO8nlr6QH z6B3rW8luv8dhoOPJZv/ =gTxF -----END PGP SIGNATURE----- --5vNYLRcllDrimb99--