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 5D863C38A2D for ; Mon, 24 Oct 2022 08:40:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229890AbiJXIkD (ORCPT ); Mon, 24 Oct 2022 04:40:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230097AbiJXIj7 (ORCPT ); Mon, 24 Oct 2022 04:39:59 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C221A24087 for ; Mon, 24 Oct 2022 01:39:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666600797; x=1698136797; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=P7Ekk70wZK5L+S9pwrodOdwFkyQD8yeF5wU42rUSWgM=; b=hKIoS/fwaPPCtGkjfTQncr5EAXGL74W+2YUpoOxDbls1bEHML6Q/Qj3l r09wKFYVzOj0ZlKYwg3lf2PJV/c+FYuWAr1B2CYLHYDF+9/O+dND1HtKk TvolUwHgKzHuf/Aevo67k8VetvhBEMRiGRlGHnJK9CPtsB7noj5pxqtYV s+RcR4QQOCvlL+lltIphEtK+VA2an8NnpTL9t7fY7rWcjrCZRXFSgH/sp I7dnKswD+mMpC+KkMSHyaAUtksluX2hUvSdaWwfwcTFUu0BxMMVX8H8JG xQ7WxqIqR88JgM8/zmSQZ+RlaEgPNNRDMuGx1KL3CMenNgvRU+sRO/XwN g==; X-IronPort-AV: E=McAfee;i="6500,9779,10509"; a="309054546" X-IronPort-AV: E=Sophos;i="5.95,207,1661842800"; d="scan'208";a="309054546" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2022 01:39:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10509"; a="736333107" X-IronPort-AV: E=Sophos;i="5.95,207,1661842800"; d="scan'208";a="736333107" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga002.fm.intel.com with ESMTP; 24 Oct 2022 01:39:54 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1omszv-001LvX-33; Mon, 24 Oct 2022 11:39:51 +0300 Date: Mon, 24 Oct 2022 11:39:51 +0300 From: Andy Shevchenko To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Cc: Miaoqian Lin , Lars-Peter Clausen , Dmitry Rokosov , linux-iio@vger.kernel.org, Gwendal Grignou , Wolfram Sang , kernel@pengutronix.de, Yang Yingliang , wangjianli , Vladimir Oltean , Jonathan Cameron Subject: Re: [PATCH 10/23] iio: accel: kxcjk-1013: Convert to i2c's .probe_new Message-ID: References: <20221023132302.911644-1-u.kleine-koenig@pengutronix.de> <20221023132302.911644-11-u.kleine-koenig@pengutronix.de> <20221024070518.dnrhsijfphbhs2la@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20221024070518.dnrhsijfphbhs2la@pengutronix.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org On Mon, Oct 24, 2022 at 09:05:18AM +0200, Uwe Kleine-König wrote: > On Sun, Oct 23, 2022 at 10:06:11PM +0300, Andy Shevchenko wrote: > > On Sun, Oct 23, 2022 at 03:22:49PM +0200, Uwe Kleine-König wrote: ... > > > +static const struct i2c_device_id kxcjk1013_id[] = { > > > + {"kxcjk1013", KXCJK1013}, > > > + {"kxcj91008", KXCJ91008}, > > > + {"kxtj21009", KXTJ21009}, > > > + {"kxtf9", KXTF9}, > > > + {"kx023-1025", KX0231025}, > > > + {"SMO8500", KXCJ91008}, > > > + {} > > > +}; > > > +MODULE_DEVICE_TABLE(i2c, kxcjk1013_id); > > > > I don't like this part. Can we, please, find a way how to dereference this > > table via struct i2c_client, please? > > It would be possible to do (on top of my patch here as PoC): > > diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c > index e043dd698747..00269b25af99 100644 > --- a/drivers/iio/accel/kxcjk-1013.c > +++ b/drivers/iio/accel/kxcjk-1013.c > @@ -1445,7 +1445,7 @@ MODULE_DEVICE_TABLE(i2c, kxcjk1013_id); > > static int kxcjk1013_probe(struct i2c_client *client) > { > - const struct i2c_device_id *id = i2c_match_id(kxcjk1013_id, client); > + const struct i2c_device_id *id = i2c_match_id(to_i2c_driver(client->dev.driver)->id_table, client); > struct kxcjk1013_data *data; > struct iio_dev *indio_dev; > struct kxcjk_1013_platform_data *pdata; > > (only compile tested), you could even create a function or macro to make > this a bit prettier on the source level. For the compiler loading the > address from a local symbol instead of from two pointer dereferences is > (I guess) a bit more effective and IMHO more natural. > > *shrug*, I don't care much, but I don't like to have to rework this > series just because you don't like this part. You even didn't give a > rationale, I can imagine several different ones: And I don't want to have ping-ponging the pieces of code (ID tables) because some API has to be fixes or so. > [ ] it makes the patch bigger > [ ] it results in an unnatural order of symbols in the driver > [ ] it's some kind of duplication > [ ] something else > please elaborate: ________________________________ It adds a burden to the future work with no good justification along with a churn in _this_ series. While I like the rest of the series, these things I would rather postpone or rework. -- With Best Regards, Andy Shevchenko