Skip to content

Commit f801556

Browse files
andy-shevlag-linaro
authored andcommitted
mfd: intel_soc_pmic_bxtwc: Use bits.h macros for all masks
Currently we are using BIT(), but GENMASK(). Make use of the latter one as well (far less error-prone, far more concise). Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Lee Jones <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent cd58c84 commit f801556

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

drivers/mfd/intel_soc_pmic_bxtwc.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
#include <linux/acpi.h>
9+
#include <linux/bits.h>
910
#include <linux/delay.h>
1011
#include <linux/err.h>
1112
#include <linux/interrupt.h>
@@ -18,9 +19,9 @@
1819
#include <asm/intel_scu_ipc.h>
1920

2021
/* PMIC device registers */
21-
#define REG_ADDR_MASK 0xFF00
22+
#define REG_ADDR_MASK GENMASK(15, 8)
2223
#define REG_ADDR_SHIFT 8
23-
#define REG_OFFSET_MASK 0xFF
24+
#define REG_OFFSET_MASK GENMASK(7, 0)
2425

2526
/* Interrupt Status Registers */
2627
#define BXTWC_IRQLVL1 0x4E02
@@ -112,29 +113,29 @@ static const struct regmap_irq bxtwc_regmap_irqs[] = {
112113
};
113114

114115
static const struct regmap_irq bxtwc_regmap_irqs_pwrbtn[] = {
115-
REGMAP_IRQ_REG(BXTWC_PWRBTN_IRQ, 0, 0x01),
116+
REGMAP_IRQ_REG(BXTWC_PWRBTN_IRQ, 0, BIT(0)),
116117
};
117118

118119
static const struct regmap_irq bxtwc_regmap_irqs_bcu[] = {
119-
REGMAP_IRQ_REG(BXTWC_BCU_IRQ, 0, 0x1f),
120+
REGMAP_IRQ_REG(BXTWC_BCU_IRQ, 0, GENMASK(4, 0)),
120121
};
121122

122123
static const struct regmap_irq bxtwc_regmap_irqs_adc[] = {
123-
REGMAP_IRQ_REG(BXTWC_ADC_IRQ, 0, 0xff),
124+
REGMAP_IRQ_REG(BXTWC_ADC_IRQ, 0, GENMASK(7, 0)),
124125
};
125126

126127
static const struct regmap_irq bxtwc_regmap_irqs_chgr[] = {
127-
REGMAP_IRQ_REG(BXTWC_USBC_IRQ, 0, 0x20),
128-
REGMAP_IRQ_REG(BXTWC_CHGR0_IRQ, 0, 0x1f),
129-
REGMAP_IRQ_REG(BXTWC_CHGR1_IRQ, 1, 0x1f),
128+
REGMAP_IRQ_REG(BXTWC_USBC_IRQ, 0, BIT(5)),
129+
REGMAP_IRQ_REG(BXTWC_CHGR0_IRQ, 0, GENMASK(4, 0)),
130+
REGMAP_IRQ_REG(BXTWC_CHGR1_IRQ, 1, GENMASK(4, 0)),
130131
};
131132

132133
static const struct regmap_irq bxtwc_regmap_irqs_tmu[] = {
133-
REGMAP_IRQ_REG(BXTWC_TMU_IRQ, 0, 0x06),
134+
REGMAP_IRQ_REG(BXTWC_TMU_IRQ, 0, GENMASK(2, 1)),
134135
};
135136

136137
static const struct regmap_irq bxtwc_regmap_irqs_crit[] = {
137-
REGMAP_IRQ_REG(BXTWC_CRIT_IRQ, 0, 0x03),
138+
REGMAP_IRQ_REG(BXTWC_CRIT_IRQ, 0, GENMASK(1, 0)),
138139
};
139140

140141
static struct regmap_irq_chip bxtwc_regmap_irq_chip = {

0 commit comments

Comments
 (0)