Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1340536lqg; Sun, 3 Mar 2024 05:58:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV7cVht68+FvHa1alFGBtmaUNllOh3COlrNV9s5cfD/Eqq5aKsD6gsyDPfsoY8WXA54kCQ1pxQiIRMOO6RXSTgVVqi1Uru7teoFe8HRIA== X-Google-Smtp-Source: AGHT+IFb8W5SpWgWEasST9JvbTjKwa27guUCPiobh0qV9mf9fMIlHm+Adze6CXRn1d9qimin3nBi X-Received: by 2002:a05:6a20:daa8:b0:1a1:490f:259c with SMTP id iy40-20020a056a20daa800b001a1490f259cmr4873911pzb.7.1709474299240; Sun, 03 Mar 2024 05:58:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709474299; cv=pass; d=google.com; s=arc-20160816; b=N9EZKNmi0ySTd2lozca9WcPoV2Nj0FSE9ZXe1x8z5XOI5ATHID9yBxbNuDalotuYof F3HDoyTUSHQWDsDMiw2w/YygA8MAyBePEDwwHmB83T5k39jjRkijH1doNRKHYzc33rTU xUg31vpiWyrW9MN2bhF5OVmUG+6SVjtOJ1UiTES5d8ZbLuOtPvcYxAq1bMFRVlQiGOTp 0wlGreGByPrqTz0fliC8WkgGPLtY1wznIMzXJRpWclB8mPMbHEwBaPCoFGOMcM9J8t90 qlDSg6BnBV0mpWDR9x2phJvBrUdNrUgSPG6Ilf6PJUpHoY+REcJ5cHPdgqXeuE04k3Wm ZiLg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=IQTAYYDfskTHzhrDeHJcv+Dl9o5KSk338Ag2tST8xrg=; fh=wuM7dqyi8AE4NS04h4uaPlFJ2HVnlDVBcl4Xw+Lqbn4=; b=0a19jhTlKH+Xm+5D4GQflq9e8E++NQSEhRxKpPqEksqUbqdKkyZoA7Fp+kmGDq1Trm 8TNTlEGeMaFEsrpR/qWfboHr8JV5edBnhAy4hh5h3Tqk77Nl1mUJjjDpw10mUBYPqW8l eEX/6PCO53+zFB9Pzj+Qdh0seJ7i1RfSZnOjrxmIe4IL9zIeMGg0Pgdj5MGVuF8/xxaO PbEyvXq0AI3oUDGFqTG83Mbvt5FGKj/sfYcDnMDouuZerE1lsB/UFmV2cV3HO+D/PQVs 6gylW16j+CrCE7iTgbnalVu3/6P1OiwF2mwtNC+vwn9VF2uzjL0H1OaXg2ffu/YKBiLr z4XA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cmMAWPUZ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-89766-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89766-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id o23-20020a63fb17000000b005dbefa1fb3asi7014649pgh.578.2024.03.03.05.58.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Mar 2024 05:58:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89766-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cmMAWPUZ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-89766-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89766-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D8B07284F72 for ; Sun, 3 Mar 2024 13:58:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B99825A0F7; Sun, 3 Mar 2024 13:58:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cmMAWPUZ" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB0C3C13C; Sun, 3 Mar 2024 13:58:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709474291; cv=none; b=Ztjo5tUuQdGG5PiUgDKhyYISIM0o7ZjGJa+RyEYyCb0qPo3HotMZif0Oe7raGfk+nWJle9WxtEafmwP3Q8xl5xRLaNS4hQLeb56tnTxHMVlGROSsqVJnVmWThllvRv6YUBL6lh4tTNHDILFmtO7cFOLOfKtGFHnekpy2I69T7+4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709474291; c=relaxed/simple; bh=MjPIxpfAeiZZL4eg2s02BwA6M8J/YUQWVRVMDNpAOzU=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=D2hXcxYm3w/WVhsUeBfWfNtPZEWoluIH6roRrcovuLCkoqz9E9V5CuGtGVsMW8KqH3RX7Z5gugAcoNqbbMsdTljDfA2p3C0q3pMxH8/J60yxgfVTVmLp60+tCsTdYR03lRxH61Gt1A9EV49P1JOaU4BJP1Bj4Sb/OlyRf0r9pSc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cmMAWPUZ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CA16C433F1; Sun, 3 Mar 2024 13:58:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709474291; bh=MjPIxpfAeiZZL4eg2s02BwA6M8J/YUQWVRVMDNpAOzU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=cmMAWPUZ96qgbauU0bTEdY/wA/r+dda6+MqBGQAFKRVFwqB2ws4dV58TUD57MOPpU BfmZ4PDTrNYbD4pb2cYfKuBnX9hgbpaVNnvjU0YAWr6aWSJm+BHp0tiaOqxNSWiMhG xyRZ1EdwtNXND4TLxb2VpDWGLt3aZqQTQC0pM4YE6EpBgp6rmynXBooGO/pL7QM+Zl eCzoGlA+2QW4GB++LLPGV89e5S5TGIL4rjPWBkVDmh/g/U99qdywnToJ6p/hFuoAnA jN3DdDieChK9VYjnZ81K9RB5UhYmdwt9vzPLu3AzTHajxi6k/gMvmH6tislOVamWdX NV5QIiNeDrh4g== Date: Sun, 3 Mar 2024 13:57:58 +0000 From: Jonathan Cameron To: Andy Shevchenko Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Lars-Peter Clausen Subject: Re: [PATCH v1 1/1] iio: light: isl29018: Drop ACPI specifics from the code Message-ID: <20240303135758.2068ab7c@jic23-huawei> In-Reply-To: <20240228212746.3709512-1-andriy.shevchenko@linux.intel.com> References: <20240228212746.3709512-1-andriy.shevchenko@linux.intel.com> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 28 Feb 2024 23:27:46 +0200 Andy Shevchenko wrote: > Convert the module to be property provider agnostic. The ACPI > APIs are not required and can be replaced by respective agnostic > ones. > > Include mod_devicetable.h explicitly to replace the dropped of.h > which included mod_devicetable.h indirectly. > > Signed-off-by: Andy Shevchenko > --- > drivers/iio/light/isl29018.c | 44 +++++++++++++----------------------- > 1 file changed, 16 insertions(+), 28 deletions(-) > > diff --git a/drivers/iio/light/isl29018.c b/drivers/iio/light/isl29018.c > index 43484c18b101..fe7b9ad7ff35 100644 > --- a/drivers/iio/light/isl29018.c > +++ b/drivers/iio/light/isl29018.c > @@ -8,17 +8,19 @@ > * Copyright (c) 2010, NVIDIA Corporation. > */ > > -#include > #include > #include > +#include > +#include > #include > #include > +#include > #include > #include > #include > + > #include > #include > -#include > > #define ISL29018_CONV_TIME_MS 100 > > @@ -523,9 +525,9 @@ static const struct attribute_group isl29023_group = { > }; > > enum { > - isl29018, > - isl29023, > - isl29035, > + isl29018 = 1, > + isl29023 = 2, > + isl29035 = 3, I really don't like doing this non zero trick (I did once let a few instances of this trick in and should get round to cleaning them up properly...) I'd rather see a trivial chip_info structure with the names in it and pointers in each of the fw match tables + use of i2c_get_match_data() to deal with all the options. + get rid of the type / dev_id usage infavor of everything in a chip_info structure. I think that is just the intergration times arrays. Obviously bit mean to ask you to do this larger refactor, but I'm not going to take this avoidance of enum == 0 in the meantime. Jonathan > }; > > static int isl29018_chip_init(struct isl29018_chip *chip) > @@ -687,20 +689,6 @@ static const struct isl29018_chip_info isl29018_chip_info_tbl[] = { > }, > }; > > -static const char *isl29018_match_acpi_device(struct device *dev, int *data) > -{ > - const struct acpi_device_id *id; > - > - id = acpi_match_device(dev->driver->acpi_match_table, dev); > - > - if (!id) > - return NULL; > - > - *data = (int)id->driver_data; > - > - return dev_name(dev); > -} > - > static void isl29018_disable_regulator_action(void *_data) > { > struct isl29018_chip *chip = _data; > @@ -718,6 +706,7 @@ static int isl29018_probe(struct i2c_client *client) > struct iio_dev *indio_dev; > int err; > const char *name = NULL; > + const void *match; > int dev_id = 0; > > indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); > @@ -728,14 +717,15 @@ static int isl29018_probe(struct i2c_client *client) > > i2c_set_clientdata(client, indio_dev); > > - if (id) { > + match = device_get_match_data(dev); > + if (match) { > + name = dev_name(dev); > + dev_id = (int)(uintptr_t)match; > + } else if (id) { > name = id->name; > dev_id = id->driver_data; > } > > - if (ACPI_HANDLE(&client->dev)) > - name = isl29018_match_acpi_device(&client->dev, &dev_id); > - > mutex_init(&chip->lock); > > chip->type = dev_id; > @@ -832,15 +822,13 @@ static int isl29018_resume(struct device *dev) > static DEFINE_SIMPLE_DEV_PM_OPS(isl29018_pm_ops, isl29018_suspend, > isl29018_resume); > > -#ifdef CONFIG_ACPI > static const struct acpi_device_id isl29018_acpi_match[] = { > {"ISL29018", isl29018}, > {"ISL29023", isl29023}, > {"ISL29035", isl29035}, > - {}, > + {} > }; > MODULE_DEVICE_TABLE(acpi, isl29018_acpi_match); > -#endif > > static const struct i2c_device_id isl29018_id[] = { > {"isl29018", isl29018}, > @@ -854,14 +842,14 @@ static const struct of_device_id isl29018_of_match[] = { > { .compatible = "isil,isl29018", }, > { .compatible = "isil,isl29023", }, > { .compatible = "isil,isl29035", }, > - { }, > + {} > }; > MODULE_DEVICE_TABLE(of, isl29018_of_match); > > static struct i2c_driver isl29018_driver = { > .driver = { > .name = "isl29018", > - .acpi_match_table = ACPI_PTR(isl29018_acpi_match), > + .acpi_match_table = isl29018_acpi_match, > .pm = pm_sleep_ptr(&isl29018_pm_ops), > .of_match_table = isl29018_of_match, > },