diff mbox series

[v1,1/1] iio: light: cm32181: Remove duplicate ACPI handle check

Message ID 20240904183646.1219485-1-andy.shevchenko@gmail.com (mailing list archive)
State Accepted
Headers show
Series [v1,1/1] iio: light: cm32181: Remove duplicate ACPI handle check | expand

Commit Message

Andy Shevchenko Sept. 4, 2024, 6:36 p.m. UTC
cm32181_acpi_parse_cpm_tables() is a no-op if ACPI handle
is not available. Remove duplicate ACPI handle check at
the caller side.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/iio/light/cm32181.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Jonathan Cameron Sept. 7, 2024, 5:17 p.m. UTC | #1
On Wed,  4 Sep 2024 21:36:46 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> cm32181_acpi_parse_cpm_tables() is a no-op if ACPI handle
> is not available. Remove duplicate ACPI handle check at
> the caller side.
> 
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Hmmm. Not the most obvious code give it relies on an error
being definitely less than the header size, but indeed it
will error out if the handle isn't there.

Applied.

Jonathan

> ---
>  drivers/iio/light/cm32181.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/light/cm32181.c b/drivers/iio/light/cm32181.c
> index 9df85b3999fa..aeae0566ec12 100644
> --- a/drivers/iio/light/cm32181.c
> +++ b/drivers/iio/light/cm32181.c
> @@ -217,8 +217,7 @@ static int cm32181_reg_init(struct cm32181_chip *cm32181)
>  	cm32181->lux_per_bit = CM32181_LUX_PER_BIT;
>  	cm32181->lux_per_bit_base_it = CM32181_LUX_PER_BIT_BASE_IT;
>  
> -	if (ACPI_HANDLE(cm32181->dev))
> -		cm32181_acpi_parse_cpm_tables(cm32181);
> +	cm32181_acpi_parse_cpm_tables(cm32181);
>  
>  	/* Initialize registers*/
>  	for_each_set_bit(i, &cm32181->init_regs_bitmap, CM32181_CONF_REG_NUM) {
diff mbox series

Patch

diff --git a/drivers/iio/light/cm32181.c b/drivers/iio/light/cm32181.c
index 9df85b3999fa..aeae0566ec12 100644
--- a/drivers/iio/light/cm32181.c
+++ b/drivers/iio/light/cm32181.c
@@ -217,8 +217,7 @@  static int cm32181_reg_init(struct cm32181_chip *cm32181)
 	cm32181->lux_per_bit = CM32181_LUX_PER_BIT;
 	cm32181->lux_per_bit_base_it = CM32181_LUX_PER_BIT_BASE_IT;
 
-	if (ACPI_HANDLE(cm32181->dev))
-		cm32181_acpi_parse_cpm_tables(cm32181);
+	cm32181_acpi_parse_cpm_tables(cm32181);
 
 	/* Initialize registers*/
 	for_each_set_bit(i, &cm32181->init_regs_bitmap, CM32181_CONF_REG_NUM) {