Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3333344ybp; Sun, 13 Oct 2019 05:12:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqzvQzMA5r0+v/MRr4lNTdI1SJ6EV4QFpR1lp893xyJSvpskY/n3ay0WYn/0YbmFWHXr1t9B X-Received: by 2002:a17:906:2ccc:: with SMTP id r12mr22358324ejr.249.1570968776734; Sun, 13 Oct 2019 05:12:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570968776; cv=none; d=google.com; s=arc-20160816; b=pD6ypQP2BKLL6FmA+dRWOvjMooFVjvki9+cQzIp1Cw5CLgZ2E4sxXDgFT3rFtcx/i2 WgWYIPErQczQmfTOFHZHmVXHtbjthZ16PP0JlMLXut7ad9oNVBmrcidiZE8ycVe90zBS dpDCmk3THdxR/6yx1bK4PQTkWmHh7RGEfuE1LWmA2QAZPrMLRFoaXNK6ZZvcxcn7xX0h 1U8vTZ0OTH+zn3jDjQmKPQYn3iqytwGT4YJ59nF413uUZMkQp1cz0XpAeKWgQTEBBIOe A0Wv2Rjn1ewUOlj6g6EJuQljZ6TWRqJUJVQNjLNtcY5NsqhtrcxFlJ24joIuxX/kYW2e q/0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=URmRZB9hnuBmNB27WVRfQA8XIcxA9uy4YtTlNSXlauk=; b=zl8/yQwBTyHcozYU3ZN+1maStmdSHqt4u2O64Ag0WJG5d3x3dNGo2TTafhTN11GqtW DiPHfY1w545LeIEJ6gRnTW4EJNTLyLC4tjOCBmW78x4MV6Y0tLUhSYvuCfVrJKL+3LXU k4x0XX5JZKzQacDVn/Nw15arRDLKk5JutIpcG/boQehclMxdOA1H260qrrZmFs/fTkkA Z4z/sVREoksbmfU8pP4UPfNya14fmjADDpBk+1rp5+OA6p92eWnLSPCcydqnKZKZRuE5 pRdmNJLdhhzoLD9PWL3ZSFih5oeJ/mrXF+qrjWfWmHzIo4MDhVVyAOoxW9gwPIxh04vM IW9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id jo19si9194740ejb.271.2019.10.13.05.12.32; Sun, 13 Oct 2019 05:12:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729162AbfJMMLD (ORCPT + 99 others); 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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--