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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45BEDECAAA1 for ; Tue, 30 Aug 2022 16:07:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229709AbiH3QHt (ORCPT ); Tue, 30 Aug 2022 12:07:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229573AbiH3QHt (ORCPT ); Tue, 30 Aug 2022 12:07:49 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E8EBF23D1 for ; Tue, 30 Aug 2022 09:07:48 -0700 (PDT) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oT3mA-00071b-F1; Tue, 30 Aug 2022 18:07:42 +0200 Received: from ore by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1oT3m6-0004SO-0i; Tue, 30 Aug 2022 18:07:38 +0200 Date: Tue, 30 Aug 2022 18:07:37 +0200 From: Oleksij Rempel To: Jonathan Cameron Cc: devicetree@vger.kernel.org, Lars-Peter Clausen , Krzysztof Kozlowski , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Herring , kernel@pengutronix.de, Jonathan Cameron Subject: Re: [PATCH v1 3/3] iio: adc: tsc2046: silent spi_device_id warning Message-ID: <20220830160737.GC16715@pengutronix.de> References: <20220830110709.2037302-1-o.rempel@pengutronix.de> <20220830110709.2037302-3-o.rempel@pengutronix.de> <20220830140228.000013ca@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220830140228.000013ca@huawei.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: devicetree@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Tue, Aug 30, 2022 at 02:02:28PM +0100, Jonathan Cameron wrote: > On Tue, 30 Aug 2022 13:07:09 +0200 > Oleksij Rempel wrote: > > > Add spi_device_id to silent following warning: > > SPI driver tsc2046 has no spi_device_id for ti,tsc2046e-adc > > > > Signed-off-by: Oleksij Rempel > > --- > > drivers/iio/adc/ti-tsc2046.c | 17 ++++++++++++++++- > > 1 file changed, 16 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/iio/adc/ti-tsc2046.c b/drivers/iio/adc/ti-tsc2046.c > > index bbc8b4137b0b1..b9a1fac659d46 100644 > > --- a/drivers/iio/adc/ti-tsc2046.c > > +++ b/drivers/iio/adc/ti-tsc2046.c > > @@ -761,7 +761,15 @@ static int tsc2046_adc_probe(struct spi_device *spi) > > return -EINVAL; > > } > > > > - dcfg = device_get_match_data(dev); > > + if (!dev_fwnode(dev)) { > > + const struct spi_device_id *id; > > + > > + id = spi_get_device_id(spi); > > + dcfg = (const struct tsc2046_adc_dcfg *)id->driver_data; > > Driver data not set below. ..facepalm.. > Otherwise this looks good to me. An alternative more common form (I think...) > is call device_get_match_data() unconditionally and if that is null follow > the driver_data path. Either way is fine though. > > Could you add to the patch description where > the warning is coming from? Build time / runtime etc and what tool? ack. It is runtime warning in the kernel log. Regards, Oleksij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |