Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp7472352ybp; Wed, 16 Oct 2019 09:09:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXHms+9u4pHKx468dshJjez4KnXuZlcPMX4aUyfMIl4gjfjHHeZ2l8D0Z+HfcAN3khMX1I X-Received: by 2002:aa7:db55:: with SMTP id n21mr40093268edt.1.1571242148813; Wed, 16 Oct 2019 09:09:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571242148; cv=none; d=google.com; s=arc-20160816; b=vkYge+SVXvZiNy3E1MWJP9p5l24/Rz/96Qltm7p/Ee54xEA7grE2zZ4jPNaeVyOYt/ O8UubGPP7ah8l2Ne5d9QPKrl/wllVe67OiTeyPP0ZPlquUe3vYf6FJiLJXqmJZ1jMTSi 0jMiPv7Ov09er+0NEokDtzk5DZVdTSw4VTMs1re4QIGETTC6IoCd7RsfdWfoLnjoVton 1V6ayxRyKckBv2B/MFG78CyaiQ8ad15y02923DaOeHgg+0HbueJXmnUq/v5i5fOBVwrI 0e+skU/j+Qf/GAAoH8iNSLxN2f3E6PHiWtfP5eqzsAx/iHuved6YujZiJcwtI2O4SfQ/ STTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ncCyY5ytiHiEAR1np3tL8iphuGviQnsLSxNouTgbLyM=; b=oz5A9RYVA+y0qSGVCWUcFH7ru9zDxHY6K3nHqWP+N/2zF9D1Fo3CvzrTN9VJOksqST TNbTvyr5P9T4v9nuedDhDW/YzTImNshUSwBcH1NDsrtw7b4pGc32k67ZCuDkm3J4bv++ FP7Xa0H3CH8cV6FGPtkl/4EFr/b0+1zMpeXIjY6/qg/IQR9eF67HqAlFFTQR2kQ2gLgD OIOXIvt3wVnbVAlXjKzqErX8C3Rkqe2aCWryKetX/iVTl6hPbGPqVyE4InpF/IAWx4/W /8HPM7ZfvdOEgO17Adw2aHbDRxnnBnb8czz6t34JPLpArvghv8wGnoHvJUUXljMXk6ZZ GwXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MwNXWdee; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b22si18055516eda.194.2019.10.16.09.08.45; Wed, 16 Oct 2019 09:09:08 -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=@gmail.com header.s=20161025 header.b=MwNXWdee; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393689AbfJPNqe (ORCPT + 99 others); Wed, 16 Oct 2019 09:46:34 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:44497 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732469AbfJPNqe (ORCPT ); Wed, 16 Oct 2019 09:46:34 -0400 Received: by mail-pg1-f195.google.com with SMTP id e10so10344346pgd.11; Wed, 16 Oct 2019 06:46:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ncCyY5ytiHiEAR1np3tL8iphuGviQnsLSxNouTgbLyM=; b=MwNXWdee7Y6s3miaadCIFDLNyyt03avG08rzXRJCgbM0qQ8jjkewPCC7TOyA2SEdEm w4Q537UpPEJ97LQRLM1Zm2hEaqCcfcwfbUi7ybJEkbWSiqRA/gtyHjlbCjnk5csr+CNQ twMTTrk8JQRdHsOjyBPQwdoVL8ev1WAvoTUPJjls0blRzNWLeQtz9whid01WWG5JAm9+ ctLuVZJMQn0M4HUG35gLMAoNZDLFo9ewXziTYE/B+MiFYVN/NTNpk5zsyIIiyWzhn3y9 eOKGLN2hyZq7m4S+B3+wS1OqehaWyIZiQTJP4xBCD0aRHqHM5yoNLEkgjqWnISv8OBUT YekQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ncCyY5ytiHiEAR1np3tL8iphuGviQnsLSxNouTgbLyM=; b=G+LGVInUpo1ONmccGnJeJ9XHcHLyHIGsYCGya60wz6I9HY+fVqmCYVdnBgJz7Tyck+ 0WY5fMDuIhlzpv9Sf2Gsmb5WpdN0nK86n0rgSiForzpLNMH/PtYBh+3bQ/cDAWykuJWW SZz8zvLTs65RyXdptuByVFcd3Z8jQib7TxYKlGaH1ChZ9kDEvZ1vwbjXQCk1pH5xuYoV xlW/iV4CY13vj5B5B0xyLmdU+mybC7/vfSFxMrjr/1W7agqSGLYk9Cna+U7Le2it6rzS xiA4rK4cYVWBuCYvxwUE5HnKSdf2n2AmEA5vgOKnznMi2T68m6KKyZvyLSLIPHndaSmQ Bp2g== X-Gm-Message-State: APjAAAVnHtEPrBTCuw+IwM3pQESTmgVy5p9T6Zd32+DHC+loV5Rujyfi wJhMJZ0gRwb88c8iKwYyulw+Ckdi0vmR2j6w9ow= X-Received: by 2002:aa7:8b02:: with SMTP id f2mr43669555pfd.151.1571233593607; Wed, 16 Oct 2019 06:46:33 -0700 (PDT) MIME-Version: 1.0 References: <20191004214334.149976-1-swboyd@chromium.org> <20191004214334.149976-2-swboyd@chromium.org> <5da4e084.1c69fb81.567f9.4b9c@mx.google.com> <5da64b37.1c69fb81.fbe6e.51ad@mx.google.com> In-Reply-To: <5da64b37.1c69fb81.fbe6e.51ad@mx.google.com> From: Andy Shevchenko Date: Wed, 16 Oct 2019 16:46:22 +0300 Message-ID: Subject: Re: [PATCH 01/10] leds: pca953x: Use of_device_get_match_data() To: Stephen Boyd Cc: Wolfram Sang , Linux Kernel Mailing List , Arnd Bergmann , Geert Uytterhoeven , Riku Voipio , Rob Herring , Frank Rowand , Jacek Anaszewski , Pavel Machek , Dan Murphy , Linux LED Subsystem Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 16, 2019 at 1:42 AM Stephen Boyd wrote: > Quoting Andy Shevchenko (2019-10-15 02:02:01) > > On Mon, Oct 14, 2019 at 11:54 PM Stephen Boyd wrote: > > > Quoting Andy Shevchenko (2019-10-14 10:50:06) > > > > On Sat, Oct 5, 2019 at 12:47 AM Stephen Boyd wrote: > > > > Also, I'm thinking that following may help to clean a lot of the i2c > > > > client drivers > > > > > > > > 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); > > > > } > > > > > > > > > > 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. > > > > It will be something ugly like > > > > buses { > > #ifdef I2C > > &i2c_bus_type, > > #endif > > ... > > } > > > > in the code. I won't do this. > > > > See generic_match_buses[] for example. > > Why is it like generic_match_buses[]? I thought it would look at > struct device::of_node or struct device::fw_node and try to extract > device data out that and if that fails it would fallback to some new > function like struct bus_type::get_match_data() that does the right > thing for the bus. In the case of i2c it would extract the i2c_client's > i2c_device_id pointer and return it onwards. Can you send a patch for review? -- With Best Regards, Andy Shevchenko