lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b6054cbd-ca4e-43d1-83a8-ad6bdf89c0cf@roeck-us.net>
Date:   Sun, 10 Sep 2023 21:24:36 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Saravanan Sekar <saravanan@...umiz.com>, sravanhome@...il.com,
        lgirdwood@...il.com, broonie@...nel.org, robh+dt@...nel.org,
        krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org,
        jdelvare@...e.com
Cc:     linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
        linux-hwmon@...r.kernel.org
Subject: Re: [PATCH 1/3] hwmon: (pmbus/mpq7932) Get page count based on chip
 info

On 9/10/23 20:41, Saravanan Sekar wrote:
> Get page count using compatible match to support the series of chipsets
> which differs in number of regualator/page.
> 
> Signed-off-by: Saravanan Sekar <saravanan@...umiz.com>
> ---
>   drivers/hwmon/pmbus/mpq7932.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hwmon/pmbus/mpq7932.c b/drivers/hwmon/pmbus/mpq7932.c
> index 865d42edda1a..af3e5e9590c8 100644
> --- a/drivers/hwmon/pmbus/mpq7932.c
> +++ b/drivers/hwmon/pmbus/mpq7932.c
> @@ -105,7 +105,7 @@ static int mpq7932_probe(struct i2c_client *client)
>   		return -ENOMEM;
>   
>   	info = &data->info;
> -	info->pages = MPQ7932_NUM_PAGES;
> +	info->pages = (int)device_get_match_data(&client->dev);

I kind of doubt that this works without generating a compiler warning.

Also, does this work with CONFIG_OF=n ?

Guenter

>   	info->format[PSC_VOLTAGE_OUT] = direct;
>   	info->m[PSC_VOLTAGE_OUT] = 160;
>   	info->b[PSC_VOLTAGE_OUT] = -33;
> @@ -115,7 +115,7 @@ static int mpq7932_probe(struct i2c_client *client)
>   	}
>   
>   #if IS_ENABLED(CONFIG_SENSORS_MPQ7932_REGULATOR)
> -	info->num_regulators = ARRAY_SIZE(mpq7932_regulators_desc);
> +	info->num_regulators = info->pages;
>   	info->reg_desc = mpq7932_regulators_desc;
>   #endif
>   
> @@ -129,7 +129,7 @@ static int mpq7932_probe(struct i2c_client *client)
>   }
>   
>   static const struct of_device_id mpq7932_of_match[] = {
> -	{ .compatible = "mps,mpq7932"},
> +	{ .compatible = "mps,mpq7932", .data = (void *)MPQ7932_NUM_PAGES },
>   	{},
>   };
>   MODULE_DEVICE_TABLE(of, mpq7932_of_match);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ