Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5209948ybp; Mon, 14 Oct 2019 17:41:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzUDtbSZNYggF9VG0IXKQJs8DTwbHIXbMsmZz6y3k6eS5n428fi/S23N4YPKpE3XHYkx3VZ X-Received: by 2002:a17:906:1fc8:: with SMTP id e8mr27766381ejt.86.1571100103847; Mon, 14 Oct 2019 17:41:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571100103; cv=none; d=google.com; s=arc-20160816; b=OeRlXNpU2vtoQ9RMSG/bYgUdrugaoW8AW5JuK7NgAHF6Avojs9TqkOMe8d1Wnvw6O1 2lqeLo/I9bQIksZ1Nu2tDAQnl8aprjL+QO/2OW0pPTn7NVBfrVnv6BEBK4WvgOEV1IIm qUO+Oyr0Kxj89QaBTE8KTQVA+kDE1fF3EMTa/ZoWa7JM4wyTyjn6JOPZOuPwzp3WYRKO GNLTgA0qSPZWnFZTbGX9Hr358pkHnJ9vDUvDAzEtBOIWlcos1XoB9FiuvxftQ+B/Zok6 iDYEe8IxG7tD7BxzRp/aZmXdfN/s0nhUS5sRMBVwsV0T+NThjRY08GrKfd9eDkQxcjgA OXjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:user-agent:subject:cc:to:from :references:in-reply-to:content-transfer-encoding:mime-version :message-id:dkim-signature; bh=95ESZvb6hY/1oI03oQhYfYM4zdjk2hIsXx4a/gPdDg0=; b=y+KMSKqpV4nWJgH9UPnRCiZRLey9msF/5w2BrvKVto+q58Uv9VmTBhYgBT8WRe2hJu WqOdN8x9+V5GR6TVQmQu3uW+wdrzWFnnql/Uhu9b2543lZBEPx4Rk3JmPQSuiE2egU6K KhPgn+8Ss9A7F5WET/FUJeVCLI2qDEyFCA5NpKjLREvABck9wEsKtm5/KsZXprFwGer1 OIea8v/DNG4IPOUTpLq7OAExNWMslkpWxoPcpAeS6FzmfMesMiw7J0p6pYEg88JnS69g +ytyosJDGeacKZZo9HmBLBl2LVDoU/R4S5RmU+p6CPCBCogecYknR1lmj++p5VuFYPCf RVLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LDIPIlBM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j14si13606618eda.181.2019.10.14.17.41.20; Mon, 14 Oct 2019 17:41:43 -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; dkim=pass header.i=@chromium.org header.s=google header.b=LDIPIlBM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731663AbfJNUyb (ORCPT + 99 others); Mon, 14 Oct 2019 16:54:31 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:35166 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731550AbfJNUya (ORCPT ); Mon, 14 Oct 2019 16:54:30 -0400 Received: by mail-pf1-f194.google.com with SMTP id 205so11054271pfw.2 for ; Mon, 14 Oct 2019 13:54:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=message-id:mime-version:content-transfer-encoding:in-reply-to :references:from:to:cc:subject:user-agent:date; bh=95ESZvb6hY/1oI03oQhYfYM4zdjk2hIsXx4a/gPdDg0=; b=LDIPIlBMzwu89BYY277hY2x1yQ6+BbzLmB02F76DS3jp9EF27RWfpAGf6PCW/Zt6PK W3rvy9pT/uJTuI9zriXHphkOreHYFYZ/TccSgt3DupK0Z8liwntFavnqti6aJYmA3auB RT2Z7fYZyy133IoITNtgtJbGg4Nv8H/llzUuY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:mime-version :content-transfer-encoding:in-reply-to:references:from:to:cc:subject :user-agent:date; bh=95ESZvb6hY/1oI03oQhYfYM4zdjk2hIsXx4a/gPdDg0=; b=gp+/jrtSRcnoYoQsMJy2FomdeGjP9SWSk3G+pgtwiSrKY1QM5b1GqflXCuDcUD9cLc cW9Fn/7qkwsOow99LAAmW3Jq5gGn5ZxjC0uHNYFQTxbKaJvplCFpULd/OmDd4ZoJc/iJ ob7528Q//PkYAYHaW3/iUxdicVG62hRTKVXdmHgjqAkkYWVyltFbcWKMaQJrBQcthrBq 3GZUHJMiUT9UD8qwxn9Gj8CrKboD74DQHS6Il/79iso6NpjiWv1rKsc+WYajRaG/jN59 5Mp9BMRvxVLkxmIH9H86jQ7voPt/dGNsBwQRf+FD6ATmh192mLF4CV6nnASFhnxPdkf5 BxYg== X-Gm-Message-State: APjAAAX4zvLjMqQdwyPonkjj5+1pRO3WtdeuJzeqpksxrXQvVD+pg+a8 6ctQwM2D87Kl7FoHSirRRnoQlQ== X-Received: by 2002:a17:90a:5d0f:: with SMTP id s15mr37927966pji.126.1571086469798; Mon, 14 Oct 2019 13:54:29 -0700 (PDT) Received: from chromium.org ([2620:15c:202:1:fa53:7765:582b:82b9]) by smtp.gmail.com with ESMTPSA id 11sm18080943pgd.0.2019.10.14.13.54.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 13:54:28 -0700 (PDT) Message-ID: <5da4e084.1c69fb81.567f9.4b9c@mx.google.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: References: <20191004214334.149976-1-swboyd@chromium.org> <20191004214334.149976-2-swboyd@chromium.org> From: Stephen Boyd To: Andy Shevchenko , Wolfram Sang Cc: Linux Kernel Mailing List , Arnd Bergmann , Geert Uytterhoeven , Riku Voipio , Rob Herring , Frank Rowand , Jacek Anaszewski , Pavel Machek , Dan Murphy , Linux LED Subsystem Subject: Re: [PATCH 01/10] leds: pca953x: Use of_device_get_match_data() User-Agent: alot/0.8.1 Date: Mon, 14 Oct 2019 13:54:27 -0700 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Andy Shevchenko (2019-10-14 10:50:06) > On Sat, Oct 5, 2019 at 12:47 AM 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. >=20 > > + devid =3D (int)(uintptr_t)of_device_get_match_data(dev); >=20 > > + devid =3D (int)(uintptr_t)of_device_get_match_data(&cli= ent->dev); >=20 > This still leaves it OF-centric. > Better to use device_get_match_data(). >=20 > Also, I'm thinking that following may help to clean a lot of the i2c > client drivers >=20 > static inline // perhaps no > const void *i2c_device_get_match_data(struct i2c_client *client, const > struct i2c_device_id *id) > { > if (id) > return (const void *)id->driver_data; > return device_get_match_data(&client->dev); > } >=20 Looks alright to me. Maybe device_get_match_data() can look at the bus and call some bus op if the firmware match isn't present? Then we can replace a bunch of these calls with device_get_match_data() and it will "do the right thing" regardless of what bus or firmware the device is running on.