mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
drivers/rtc/rtc-x1205.c: use sign_extend32() for sign extension
Despite its name, sign_extend32() is safe to use for 8 bit types too. (See https://lkml.org/lkml/2015/1/18/289). Signed-off-by: Martin Kepplinger <[email protected]> Cc: Alessandro Zummo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
e706974dc3
commit
86e66604fc
1 changed files with 2 additions and 2 deletions
|
|
@ -22,6 +22,7 @@
|
|||
#include <linux/rtc.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/bitops.h>
|
||||
|
||||
#define DRV_VERSION "1.0.8"
|
||||
|
||||
|
|
@ -366,8 +367,7 @@ static int x1205_get_atrim(struct i2c_client *client, int *trim)
|
|||
* perform sign extension. The formula is
|
||||
* Catr = (atr * 0.25pF) + 11.00pF.
|
||||
*/
|
||||
if (atr & 0x20)
|
||||
atr |= 0xC0;
|
||||
atr = sign_extend32(atr, 5);
|
||||
|
||||
dev_dbg(&client->dev, "%s: raw atr=%x (%d)\n", __func__, atr, atr);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue