diff mbox series

hwmon: (lm75) Fixup tmp75b clr_mask

Message ID 20190801075324.4638-1-iker.perez@codethink.co.uk (mailing list archive)
State Accepted
Headers show
Series hwmon: (lm75) Fixup tmp75b clr_mask | expand

Commit Message

Iker Perez Aug. 1, 2019, 7:53 a.m. UTC
From: Iker Perez del Palomar Sustatxa <iker.perez@codethink.co.uk>

The configuration register of the tmp75b sensor is 16bit long, however
the first byte is reserved, so there is not no need to take care of it.

Because the order of the bytes is little endian and it is only wanted to
write one byte, the desired bits must be shifted in a 8 bit range.

Signed-off-by: Iker Perez del Palomar Sustatxa <iker.perez@codethink.co.uk>
---
 drivers/hwmon/lm75.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Guenter Roeck Aug. 1, 2019, 4:39 p.m. UTC | #1
On Thu, Aug 01, 2019 at 08:53:24AM +0100, Iker Perez wrote:
> From: Iker Perez del Palomar Sustatxa <iker.perez@codethink.co.uk>
> 
> The configuration register of the tmp75b sensor is 16bit long, however
> the first byte is reserved, so there is not no need to take care of it.
> 
> Because the order of the bytes is little endian and it is only wanted to
> write one byte, the desired bits must be shifted in a 8 bit range.
> 
> Signed-off-by: Iker Perez del Palomar Sustatxa <iker.perez@codethink.co.uk>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/lm75.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
> index 3fb9c0a2d6d0..ce5ec403ec73 100644
> --- a/drivers/hwmon/lm75.c
> +++ b/drivers/hwmon/lm75.c
> @@ -343,7 +343,7 @@ lm75_probe(struct i2c_client *client, const struct i2c_device_id *id)
>  		data->sample_time = MSEC_PER_SEC / 2;
>  		break;
>  	case tmp75b:  /* not one-shot mode, Conversion rate 37Hz */
> -		clr_mask |= 1 << 15 | 0x3 << 13;
> +		clr_mask |= 1 << 7 | 0x3 << 5;
>  		data->resolution = 12;
>  		data->sample_time = MSEC_PER_SEC / 37;
>  		break;
diff mbox series

Patch

diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
index 3fb9c0a2d6d0..ce5ec403ec73 100644
--- a/drivers/hwmon/lm75.c
+++ b/drivers/hwmon/lm75.c
@@ -343,7 +343,7 @@  lm75_probe(struct i2c_client *client, const struct i2c_device_id *id)
 		data->sample_time = MSEC_PER_SEC / 2;
 		break;
 	case tmp75b:  /* not one-shot mode, Conversion rate 37Hz */
-		clr_mask |= 1 << 15 | 0x3 << 13;
+		clr_mask |= 1 << 7 | 0x3 << 5;
 		data->resolution = 12;
 		data->sample_time = MSEC_PER_SEC / 37;
 		break;