From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30643C4360C for ; Sun, 13 Oct 2019 12:11:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 109E82053B for ; Sun, 13 Oct 2019 12:11:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728620AbfJMMLD (ORCPT ); Sun, 13 Oct 2019 08:11:03 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:41990 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729143AbfJMMLD (ORCPT ); Sun, 13 Oct 2019 08:11:03 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 144198025D; Sun, 13 Oct 2019 14:10:44 +0200 (CEST) Date: Sun, 13 Oct 2019 14:10:55 +0200 From: Pavel Machek To: Stephen Boyd Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Geert Uytterhoeven , Riku Voipio , Rob Herring , Frank Rowand , Jacek Anaszewski , Dan Murphy , linux-leds@vger.kernel.org Subject: Re: [PATCH 01/10] leds: pca953x: Use of_device_get_match_data() Message-ID: <20191013121055.GO5653@amd> References: <20191004214334.149976-1-swboyd@chromium.org> <20191004214334.149976-2-swboyd@chromium.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Ck22u5fw4m2k6hx2" Content-Disposition: inline In-Reply-To: <20191004214334.149976-2-swboyd@chromium.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org --Ck22u5fw4m2k6hx2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri 2019-10-04 14:43:25, Stephen Boyd wrote: > This driver can use the of_device_get_match_data() API to simplify the > code. Replace calls to of_match_device() with this newer API under the > assumption that where it is called will be when we know the device is > backed by a DT node. This nicely avoids referencing the match table when > it is undefined with configurations where CONFIG_OF=3Dn. Thanks, applied. Pavel > Cc: Arnd Bergmann > Cc: Geert Uytterhoeven > Cc: Riku Voipio > Cc: Rob Herring > Cc: Frank Rowand > Cc: Jacek Anaszewski > Cc: Pavel Machek > Cc: Dan Murphy > Cc: > Signed-off-by: Stephen Boyd > --- >=20 > Please ack or pick for immediate merge so the last patch can be merged. >=20 > drivers/leds/leds-pca9532.c | 14 ++------------ > 1 file changed, 2 insertions(+), 12 deletions(-) >=20 > diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c > index c7c7199e8ebd..7d515d5e57bd 100644 > --- a/drivers/leds/leds-pca9532.c > +++ b/drivers/leds/leds-pca9532.c > @@ -467,16 +467,11 @@ pca9532_of_populate_pdata(struct device *dev, struc= t device_node *np) > { > struct pca9532_platform_data *pdata; > struct device_node *child; > - const struct of_device_id *match; > int devid, maxleds; > int i =3D 0; > const char *state; > =20 > - match =3D of_match_device(of_pca9532_leds_match, dev); > - if (!match) > - return ERR_PTR(-ENODEV); > - > - devid =3D (int)(uintptr_t)match->data; > + devid =3D (int)(uintptr_t)of_device_get_match_data(dev); > maxleds =3D pca9532_chip_info_tbl[devid].num_leds; > =20 > pdata =3D devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); > @@ -509,7 +504,6 @@ static int pca9532_probe(struct i2c_client *client, > const struct i2c_device_id *id) > { > int devid; > - const struct of_device_id *of_id; > struct pca9532_data *data =3D i2c_get_clientdata(client); > struct pca9532_platform_data *pca9532_pdata =3D > dev_get_platdata(&client->dev); > @@ -525,11 +519,7 @@ static int pca9532_probe(struct i2c_client *client, > dev_err(&client->dev, "no platform data\n"); > return -EINVAL; > } > - of_id =3D of_match_device(of_pca9532_leds_match, > - &client->dev); > - if (unlikely(!of_id)) > - return -EINVAL; > - devid =3D (int)(uintptr_t) of_id->data; > + devid =3D (int)(uintptr_t)of_device_get_match_data(&client->dev); > } else { > devid =3D id->driver_data; > } --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --Ck22u5fw4m2k6hx2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl2jFE8ACgkQMOfwapXb+vIMRgCfUGz2BiRVoRY4urcPw8LTSyxq E+UAnjXZMxG56LJLaiqiK6kWf9dWNBaI =Q5tE -----END PGP SIGNATURE----- --Ck22u5fw4m2k6hx2--