public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] hwmon: (nct6775) Set weight source to zero correctly
       [not found] <df45855d-e21c-9b29-d661-7284453241fe@roeck-us.net>
@ 2018-09-05  7:46 ` Dan Carpenter
  2018-09-05 21:48   ` Guenter Roeck
  2018-09-05  7:46 ` [PATCH 2/2] hwmon: (nct6775) Clean up a condition Dan Carpenter
  1 sibling, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2018-09-05  7:46 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Jean Delvare, linux-hwmon, kernel-janitors

This is dead code because j can never be 1 at this point.  We had
intended to just test if the bit was clear.

Fixes: bbd8decd4123 ("hwmon: (nct6775) Add support for weighted fan control")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
index 944f5b63aecd..139781ae830b 100644
--- a/drivers/hwmon/nct6775.c
+++ b/drivers/hwmon/nct6775.c
@@ -1558,7 +1558,7 @@ static void nct6775_update_pwm(struct device *dev)
 		reg = nct6775_read_value(data, data->REG_WEIGHT_TEMP_SEL[i]);
 		data->pwm_weight_temp_sel[i] = reg & 0x1f;
 		/* If weight is disabled, report weight source as 0 */
-		if (j = 1 && !(reg & 0x80))
+		if (!(reg & 0x80))
 			data->pwm_weight_temp_sel[i] = 0;
 
 		/* Weight temp data */

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] hwmon: (nct6775) Clean up a condition
       [not found] <df45855d-e21c-9b29-d661-7284453241fe@roeck-us.net>
  2018-09-05  7:46 ` [PATCH 1/2] hwmon: (nct6775) Set weight source to zero correctly Dan Carpenter
@ 2018-09-05  7:46 ` Dan Carpenter
  2018-09-05 21:49   ` Guenter Roeck
  1 sibling, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2018-09-05  7:46 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Jean Delvare, linux-hwmon, kernel-janitors

I removed the "dsw_en &&" chunk of the condition because we know that
"dsw_en" is set.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
index 139781ae830b..719effe53ceb 100644
--- a/drivers/hwmon/nct6775.c
+++ b/drivers/hwmon/nct6775.c
@@ -3533,8 +3533,7 @@ nct6775_check_fan_inputs(struct nct6775_data *data)
 
 				if (!fan6pin)
 					fan6pin = (regval_2a & BIT(4)) &&
-					  (!dsw_en ||
-					   (dsw_en && (regval_ed & BIT(4))));
+					  (!dsw_en || (regval_ed & BIT(4)));
 				if (!pwm6pin)
 					pwm6pin = (regval_2a & BIT(3)) &&
 					  (regval_ed & BIT(2));

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] hwmon: (nct6775) Set weight source to zero correctly
  2018-09-05  7:46 ` [PATCH 1/2] hwmon: (nct6775) Set weight source to zero correctly Dan Carpenter
@ 2018-09-05 21:48   ` Guenter Roeck
  0 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2018-09-05 21:48 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Jean Delvare, linux-hwmon, kernel-janitors

On Wed, Sep 05, 2018 at 10:46:27AM +0300, Dan Carpenter wrote:
> This is dead code because j can never be 1 at this point.  We had
> intended to just test if the bit was clear.
> 
> Fixes: bbd8decd4123 ("hwmon: (nct6775) Add support for weighted fan control")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.

Thanks,
Guenter

> 
> diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
> index 944f5b63aecd..139781ae830b 100644
> --- a/drivers/hwmon/nct6775.c
> +++ b/drivers/hwmon/nct6775.c
> @@ -1558,7 +1558,7 @@ static void nct6775_update_pwm(struct device *dev)
>  		reg = nct6775_read_value(data, data->REG_WEIGHT_TEMP_SEL[i]);
>  		data->pwm_weight_temp_sel[i] = reg & 0x1f;
>  		/* If weight is disabled, report weight source as 0 */
> -		if (j = 1 && !(reg & 0x80))
> +		if (!(reg & 0x80))
>  			data->pwm_weight_temp_sel[i] = 0;
>  
>  		/* Weight temp data */

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] hwmon: (nct6775) Clean up a condition
  2018-09-05  7:46 ` [PATCH 2/2] hwmon: (nct6775) Clean up a condition Dan Carpenter
@ 2018-09-05 21:49   ` Guenter Roeck
  0 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2018-09-05 21:49 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Jean Delvare, linux-hwmon, kernel-janitors

On Wed, Sep 05, 2018 at 10:46:55AM +0300, Dan Carpenter wrote:
> I removed the "dsw_en &&" chunk of the condition because we know that
> "dsw_en" is set.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied to hwmon-next.

Thanks,
Guenter

> 
> diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
> index 139781ae830b..719effe53ceb 100644
> --- a/drivers/hwmon/nct6775.c
> +++ b/drivers/hwmon/nct6775.c
> @@ -3533,8 +3533,7 @@ nct6775_check_fan_inputs(struct nct6775_data *data)
>  
>  				if (!fan6pin)
>  					fan6pin = (regval_2a & BIT(4)) &&
> -					  (!dsw_en ||
> -					   (dsw_en && (regval_ed & BIT(4))));
> +					  (!dsw_en || (regval_ed & BIT(4)));
>  				if (!pwm6pin)
>  					pwm6pin = (regval_2a & BIT(3)) &&
>  					  (regval_ed & BIT(2));

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-05 21:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <df45855d-e21c-9b29-d661-7284453241fe@roeck-us.net>
2018-09-05  7:46 ` [PATCH 1/2] hwmon: (nct6775) Set weight source to zero correctly Dan Carpenter
2018-09-05 21:48   ` Guenter Roeck
2018-09-05  7:46 ` [PATCH 2/2] hwmon: (nct6775) Clean up a condition Dan Carpenter
2018-09-05 21:49   ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox