From mboxrd@z Thu Jan 1 00:00:00 1970 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 1DEF81D3565; Sat, 26 Oct 2024 11:50:47 +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=1729943448; cv=none; b=jHyeqOUUqrl2DPLZZudcBBIZ5WxOS/wKzIHwYqt0cuyNPb2o+5yfCT7IAYRqXC4wbaRamPr4QZb5u2/ZEphSRVkINZBpbHeC9awBDi5cPL3IosMZwjuSETUPyR2CHr8CUtD5wa7m+2K+gky8bZ0gBCskU0Gb0o3P+3dNYvLEMOo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729943448; c=relaxed/simple; bh=aK82E2vFaeXQFWmctQ76NuKQdJ8A74uPxIr0gxqp9MA=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=L2VPVjfObOFi/GwZh6g++lYz2+BEMC/QRoVPwX9ASWNBGomBHOZRWpyS3+07m0Yrd4WI7HXX5qpWkPRbaLs8/eHEQVtn819lmS5z9Lx2BhcJACArVps0TGkv8nebn+fjtPm+BX/jvvBonyabaSzFjPxNpZ1NsKHIhuHDbRAqtdo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=S9SmRvhi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="S9SmRvhi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90FC5C4CEC6; Sat, 26 Oct 2024 11:50:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729943447; bh=aK82E2vFaeXQFWmctQ76NuKQdJ8A74uPxIr0gxqp9MA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=S9SmRvhiyEgjI9gWgT17t2ETUCkJFTQOYIRC+dzHBIOSi3ejNztdrmncP0SqQOfay N6NkZrZ79d2sAZeYrVAtbr1ea3uVR+Cld9okR9cMWwC8zzNjapZllo6QcjWZyUvyZt XkTXzEgkm5aC8zL7+Zabd8FMKfIJeaAGX40u2QkrLKFYxslQTCQbHGPqTb9yKmYFXR MF+qDOiuAw2zxrTxRUU5UngU42JjZ3tC/ubgKL+VlmXggZNf9wN7jAaAxJwph1ELT+ NSFmesm60oxiVMmezWC2x2YcjoxcsBWUkfC4yK7BuPjLTciRmxjXbAZCoyOZ0z3i4I ga2fXxTsBilmg== Date: Sat, 26 Oct 2024 12:50:10 +0100 From: Jonathan Cameron To: Andy Shevchenko Cc: Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Lars-Peter Clausen Subject: Re: [PATCH v3 20/24] iio: light: isl29018: Replace a variant of iio_get_acpi_device_name_and_data() Message-ID: <20241026125010.651dfe50@jic23-huawei> In-Reply-To: <20241024191200.229894-21-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> <20241024191200.229894-21-andriy.shevchenko@linux.intel.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.43; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-iio@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 Thu, 24 Oct 2024 22:05:09 +0300 Andy Shevchenko wrote: > IIO core (ACPI part) provides a generic helper that may be used in > the driver. Replace a variant of iio_get_acpi_device_name_and_data(). > > Reviewed-by: Hans de Goede > Signed-off-by: Andy Shevchenko This one briefly had me confused but is indeed fine because we never get an id match for a device coming from an ACPI binding. There is no way to make such a match (unlike DT where the naming is enough). So the else is sufficient. applied. > --- > drivers/iio/light/isl29018.c | 25 ++++++------------------- > 1 file changed, 6 insertions(+), 19 deletions(-) > > diff --git a/drivers/iio/light/isl29018.c b/drivers/iio/light/isl29018.c > index 8dfc750e68c0..526ee5619d26 100644 > --- a/drivers/iio/light/isl29018.c > +++ b/drivers/iio/light/isl29018.c > @@ -687,20 +687,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; > @@ -716,9 +702,10 @@ static int isl29018_probe(struct i2c_client *client) > const struct i2c_device_id *id = i2c_client_get_device_id(client); > struct isl29018_chip *chip; > struct iio_dev *indio_dev; > + const void *ddata; > + const char *name; > + int dev_id; > int err; > - const char *name = NULL; > - int dev_id = 0; > > indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); > if (!indio_dev) > @@ -731,11 +718,11 @@ static int isl29018_probe(struct i2c_client *client) > if (id) { > name = id->name; > dev_id = id->driver_data; > + } else { > + name = iio_get_acpi_device_name_and_data(&client->dev, &ddata); > + dev_id = (intptr_t)ddata; > } > > - if (ACPI_HANDLE(&client->dev)) > - name = isl29018_match_acpi_device(&client->dev, &dev_id); > - > mutex_init(&chip->lock); > > chip->type = dev_id;