Received: by 10.223.185.116 with SMTP id b49csp1031522wrg; Wed, 21 Feb 2018 10:53:29 -0800 (PST) X-Google-Smtp-Source: AH8x226S4S5Z9iWeI4WkCzNS00aoD8B1+H7Mx8Hx3zdh1WaxTDy7/lFwQLcjBGH5+DEz1Na7IQlh X-Received: by 10.99.116.22 with SMTP id p22mr3541707pgc.132.1519239209263; Wed, 21 Feb 2018 10:53:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519239209; cv=none; d=google.com; s=arc-20160816; b=iSJZ1GaQWrMoKc3KuN2pd9cp0JUmIm83WzXLib0i+qOzdY1dTrCSTXAGd7oOH4nsZg RdOmPFq+ZWqY75gNNGuENpuXSwTXqL+dVrXTlNPJ0rf9yVXGdL9IhpQ5lmRpSAE0UU8v UiIXmHUrEb93hhk1d3+bdkkh8ZM/Fqr+gU51Zkt0qUfibsy2gbHwFblnKp/bU8cd2rUY zBWvCMVl8p3D5v91I4Weq/63AechiCrRiFAHIyjeLEuimbOTi8IyKMlZ7XXFfqCXfBuo T7qs3zjKutKXxN0x6qo1YytpYoi6+ljMV0V2eTGunmRbPvF07c5pvVVu9lhdY8D6E3t2 edmg== 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:arc-authentication-results; bh=ybkXRW2bcF+DZwUkKPuil3Ev0Z937p0JFUW/m+yYgkM=; b=V/5eYOR9pmRVlqxWkZXrew9pzj8BzC/IfIl955ohHSe3AI4yR+PHnlhlF4P2hV6CJt Plpe6jCT8XdU6Y11MKz1qAp5oNEtYzwA/ZKaM2NopHQKEUqzy4n4+zOk1fdTwe+e1ecM U1AzUyxdkOwihV3vz60SGm/NSdngcp0p9HNh+GJ1VQSgNuktQUDjNXXiPVluz28HAtCM azIqM4k2ImD7oL5HzZjyPnvjpdWCz2WEbUlQJKaspbDiwecSsFNqser7FGR+j9mIAKaQ W6cOpBTHxSKsy616znZmXOXxDWMGUT/Urv1Km9Mp5HTAfNysrF/O/5oCnxM9inFGd5Um e+nw== 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 f84si265318pfe.128.2018.02.21.10.53.14; Wed, 21 Feb 2018 10:53:29 -0800 (PST) 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 S937791AbeBUOiX (ORCPT + 99 others); Wed, 21 Feb 2018 09:38:23 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:50046 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934187AbeBUOiU (ORCPT ); Wed, 21 Feb 2018 09:38:20 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 5D68D11CF; Wed, 21 Feb 2018 14:38:19 +0000 (UTC) Date: Wed, 21 Feb 2018 15:38:16 +0100 From: Greg Kroah-Hartman To: Boris Brezillon Cc: Boris Brezillon , Wolfram Sang , linux-i2c@vger.kernel.org, Jonathan Corbet , linux-doc@vger.kernel.org, Arnd Bergmann , Przemyslaw Sroka , Arkadiusz Golec , Alan Douglas , Bartosz Folta , Damian Kos , Alicja Jurasik-Urbaniak , Cyprian Wronka , Suresh Punnoose , Thomas Petazzoni , Nishanth Menon , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Vitor Soares , Geert Uytterhoeven , Linus Walleij Subject: Re: [PATCH v2 2/7] i3c: Add core I3C infrastructure Message-ID: <20180221143816.GA16308@kroah.com> References: <20171214151610.19153-1-boris.brezillon@free-electrons.com> <20171214151610.19153-3-boris.brezillon@free-electrons.com> <20171219085250.GC15010@kroah.com> <20171219100900.35c0f66e@bbrezillon> <20171219101336.337d0afc@bbrezillon> <20171219092119.GA32748@kroah.com> <20171219102858.001d4bf5@bbrezillon> <20171219093643.GA3903@kroah.com> <20180221152248.5486100d@bbrezillon> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180221152248.5486100d@bbrezillon> User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 21, 2018 at 03:22:48PM +0100, Boris Brezillon wrote: > Hi Greg, > > On Tue, 19 Dec 2017 10:36:43 +0100 > Greg Kroah-Hartman wrote: > > > On Tue, Dec 19, 2017 at 10:28:58AM +0100, Boris Brezillon wrote: > > > On Tue, 19 Dec 2017 10:21:19 +0100 > > > Greg Kroah-Hartman wrote: > > > > > > > On Tue, Dec 19, 2017 at 10:13:36AM +0100, Boris Brezillon wrote: > > > > > On Tue, 19 Dec 2017 10:09:00 +0100 > > > > > Boris Brezillon wrote: > > > > > > > > > > > On Tue, 19 Dec 2017 09:52:50 +0100 > > > > > > Greg Kroah-Hartman wrote: > > > > > > > > > > > > > On Thu, Dec 14, 2017 at 04:16:05PM +0100, Boris Brezillon wrote: > > > > > > > > +/** > > > > > > > > + * i3c_device_match_id() - Find the I3C device ID entry matching an I3C dev > > > > > > > > + * @i3cdev: the I3C device we're searching a match for > > > > > > > > + * @id_table: the I3C device ID table > > > > > > > > + * > > > > > > > > + * Return: a pointer to the first entry matching @i3cdev, or NULL if there's > > > > > > > > + * no match. > > > > > > > > + */ > > > > > > > > +const struct i3c_device_id * > > > > > > > > +i3c_device_match_id(struct i3c_device *i3cdev, > > > > > > > > + const struct i3c_device_id *id_table) > > > > > > > > +{ > > > > > > > > + const struct i3c_device_id *id; > > > > > > > > + > > > > > > > > + /* > > > > > > > > + * The lower 32bits of the provisional ID is just filled with a random > > > > > > > > + * value, try to match using DCR info. > > > > > > > > + */ > > > > > > > > + if (!I3C_PID_RND_LOWER_32BITS(i3cdev->info.pid)) { > > > > > > > > + u16 manuf = I3C_PID_MANUF_ID(i3cdev->info.pid); > > > > > > > > + u16 part = I3C_PID_PART_ID(i3cdev->info.pid); > > > > > > > > + u16 ext_info = I3C_PID_EXTRA_INFO(i3cdev->info.pid); > > > > > > > > + > > > > > > > > + /* First try to match by manufacturer/part ID. */ > > > > > > > > + for (id = id_table; id->match_flags != 0; id++) { > > > > > > > > + if ((id->match_flags & I3C_MATCH_MANUF_AND_PART) != > > > > > > > > + I3C_MATCH_MANUF_AND_PART) > > > > > > > > + continue; > > > > > > > > + > > > > > > > > + if (manuf != id->manuf_id || part != id->part_id) > > > > > > > > + continue; > > > > > > > > + > > > > > > > > + if ((id->match_flags & I3C_MATCH_EXTRA_INFO) && > > > > > > > > + ext_info != id->extra_info) > > > > > > > > + continue; > > > > > > > > + > > > > > > > > + return id; > > > > > > > > + } > > > > > > > > + } > > > > > > > > + > > > > > > > > + /* Fallback to DCR match. */ > > > > > > > > + for (id = id_table; id->match_flags != 0; id++) { > > > > > > > > + if ((id->match_flags & I3C_MATCH_DCR) && > > > > > > > > + id->dcr == i3cdev->info.dcr) > > > > > > > > + return id; > > > > > > > > + } > > > > > > > > + > > > > > > > > + return NULL; > > > > > > > > +} > > > > > > > > +EXPORT_SYMBOL_GPL(i3c_device_match_id); > > > > > > > > > > > > > > I just picked one random export here, but it feels like you are > > > > > > > exporting a bunch of symbols you don't need to. Why would something > > > > > > > outside of the i3c "core" need to call this function? > > > > > > > > > > > > Because I'm not passing the i3c_device_id to the ->probe() method, and > > > > > > if the driver is supporting different variants of the device, it may > > > > > > want to know which one is being probed. > > > > > > > > > > > > I considered retrieving this information in the core just before probing > > > > > > the driver and passing it to the ->probe() function, but it means > > > > > > having an extra i3c_device_match_id() call for everyone even those who > > > > > > don't care about the device_id information, so I thought exporting this > > > > > > function was a good alternative (device drivers can use it when they > > > > > > actually need to retrieve the device_id). > > > > > > > > > > > > Anyway, that's something I can change if you think passing the > > > > > > i3c_device_id to the ->probe() method is preferable. > > > > > > > > > > > > > Have you looked > > > > > > > to see if you really have callers for everything you are exporting? > > > > > > > > > > > > Yes, I tried to only export functions that I think will be needed by > > > > > > I3C device drivers and I3C master drivers. Note that I didn't post the > > > > > > dummy device driver I developed to test the framework (partly because > > > > > > this is > > > > > > > > > > Sorry, I hit the send button before finishing my sentence :-). > > > > > > > > > > " > > > > > Note that I didn't post the dummy device driver [1] I developed to test > > > > > the framework (partly because the quality of the code does not meet > > > > > mainline standards and I was ashamed of posting it publicly :-)), but > > > > > this driver is using some of the exported functions. > > > > > " > > > > > > > > We don't export functions that has no in-kernel users :) > > > > > > But then, I can't export device driver related functions, because > > > there's no official device driver yet :-). So what should I do? > > > > Export them when you have a driver. Or better yet, submit a driver as > > part of the patch series. Why would we want infrastructure that no one > > uses? > > I understand your point of view, it may sound odd to add a framework > for a bus that we have no slave devices for. But, as far as I can tell, > many vendors (both IP vendors and sensor manufacturers) are working > actively on creating master and slave I3C devices. Actually, I've even > been contacted privately by an IP vendor after posting this patchset. > So, I think one argument for pushing the current framework with no > users yet is that it may help others develop drivers for their device > early on, or even help them test those devices more easily than if they > had to develop baremetal code. > > The kernel community has been asking hardware vendors for a long time to > upstream their code as early as possible. And this is exactly what is > happening with I3C: even before actual devices are shipping, we have > the opportunity to start merging support for I3C in the mainline > kernel. It would be good to merge it before vendors spend time working > on competing implementations, which will take even more time to > reconcile when they will be submitted for upstream inclusion. But without real users of an api, you do not even know if it works or not at all. In reality, you need at least 3 users of an api to know if it is correct. How do you even know this works or not? Again, we don't merge "frameworks" that no one uses. > Also, we're not talking about some random bus/protocol, I3C spec is > developed and pushed by MIPI, and for once, they decided to open the > spec, so anyone can actually make sure the framework is matching the > protocol description if they want to. One might consider i3c any "random" bus, given that there are no devices for it yet :) > Now, if you still think an I3C device driver is needed to consider > merging these patches, I can provide one. As I said earlier, I > developed a driver for a dummy device to test the various features I > add support for in this series, it's just that this device will never > ever be available in real life and it's not even fitting in any of the > subsystem we have in the kernel, hence my initial decision to not > upstream it. What is stopping you from working with one of those aformentioned companies to get a driver working for their hardware? Without that type of testing, you don't even know if your framework is correct or not. Dummy drivers are nice, but those are written to fit into your framework more than they are to driver an actual device, which might require changes to the framework. So please, just work with those companies, get a real driver, and then I will be glad to merge it all, driver included. thanks, greg k-h