Re: [PATCH 5/8] hwmon: (lm90) define maximum number of channels that are supported

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 20, 2022 at 11:32:41AM +0200, Slawomir Stepien wrote:
> From: Slawomir Stepien <slawomir.stepien@xxxxxxxxx>
> 
> Use this define in all the places where literal '3' was used in this
> context.

The literal '3' does not always reflect the number of channels.

> 
> Signed-off-by: Slawomir Stepien <slawomir.stepien@xxxxxxxxx>
> ---
>  drivers/hwmon/lm90.c | 29 ++++++++++++++++-------------
>  1 file changed, 16 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
> index 00fd5734f217..f642c6fd1641 100644
> --- a/drivers/hwmon/lm90.c
> +++ b/drivers/hwmon/lm90.c
> @@ -93,6 +93,9 @@
>  #include <linux/interrupt.h>
>  #include <linux/regulator/consumer.h>
>  
> +/* The maximum number of channels currently supported */
> +#define MAX_CHANNELS 3

#define<space>NAME<tab>value

> +
>  /*
>   * Addresses to scan
>   * Address is fully defined internally and cannot be changed except for
> @@ -521,9 +524,9 @@ enum lm90_temp11_reg_index {
>  struct lm90_data {
>  	struct i2c_client *client;
>  	struct device *hwmon_dev;
> -	u32 channel_config[4];
> +	u32 channel_config[MAX_CHANNELS + 1];
>  	struct hwmon_channel_info temp_info;
> -	const struct hwmon_channel_info *info[3];
> +	const struct hwmon_channel_info *info[MAX_CHANNELS];

This is wrong.

Guenter



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux