gpio: wcove: Use IRQ hardware number getter instead of direct access
IRQ framework provides special type and getter to transform Linux IRQ to the hardware pin. Use that type and getter function instead of direct access. No functional changes intended. While at it, remove unneeded check in wcove_update_irq_ctrl() since it is guaranteed that function will be called with valid parameter. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This commit is contained in:
parent
5b2d3326cd
commit
f3019092ec
|
@ -129,7 +129,7 @@ static inline int to_ireg(int gpio, enum ctrl_register type, unsigned int *mask)
|
|||
return reg;
|
||||
}
|
||||
|
||||
static void wcove_update_irq_mask(struct wcove_gpio *wg, int gpio)
|
||||
static void wcove_update_irq_mask(struct wcove_gpio *wg, irq_hw_number_t gpio)
|
||||
{
|
||||
unsigned int mask, reg = to_ireg(gpio, IRQ_MASK, &mask);
|
||||
|
||||
|
@ -139,13 +139,10 @@ static void wcove_update_irq_mask(struct wcove_gpio *wg, int gpio)
|
|||
regmap_clear_bits(wg->regmap, reg, mask);
|
||||
}
|
||||
|
||||
static void wcove_update_irq_ctrl(struct wcove_gpio *wg, int gpio)
|
||||
static void wcove_update_irq_ctrl(struct wcove_gpio *wg, irq_hw_number_t gpio)
|
||||
{
|
||||
int reg = to_reg(gpio, CTRL_IN);
|
||||
|
||||
if (reg < 0)
|
||||
return;
|
||||
|
||||
regmap_update_bits(wg->regmap, reg, CTLI_INTCNT_BE, wg->intcnt);
|
||||
}
|
||||
|
||||
|
@ -248,8 +245,9 @@ static int wcove_irq_type(struct irq_data *data, unsigned int type)
|
|||
{
|
||||
struct gpio_chip *chip = irq_data_get_irq_chip_data(data);
|
||||
struct wcove_gpio *wg = gpiochip_get_data(chip);
|
||||
irq_hw_number_t gpio = irqd_to_hwirq(data);
|
||||
|
||||
if (data->hwirq >= WCOVE_GPIO_NUM)
|
||||
if (gpio >= WCOVE_GPIO_NUM)
|
||||
return 0;
|
||||
|
||||
switch (type) {
|
||||
|
@ -286,7 +284,7 @@ static void wcove_bus_sync_unlock(struct irq_data *data)
|
|||
{
|
||||
struct gpio_chip *chip = irq_data_get_irq_chip_data(data);
|
||||
struct wcove_gpio *wg = gpiochip_get_data(chip);
|
||||
int gpio = data->hwirq;
|
||||
irq_hw_number_t gpio = irqd_to_hwirq(data);
|
||||
|
||||
if (wg->update & UPDATE_IRQ_TYPE)
|
||||
wcove_update_irq_ctrl(wg, gpio);
|
||||
|
@ -301,8 +299,9 @@ static void wcove_irq_unmask(struct irq_data *data)
|
|||
{
|
||||
struct gpio_chip *chip = irq_data_get_irq_chip_data(data);
|
||||
struct wcove_gpio *wg = gpiochip_get_data(chip);
|
||||
irq_hw_number_t gpio = irqd_to_hwirq(data);
|
||||
|
||||
if (data->hwirq >= WCOVE_GPIO_NUM)
|
||||
if (gpio >= WCOVE_GPIO_NUM)
|
||||
return;
|
||||
|
||||
wg->set_irq_mask = false;
|
||||
|
@ -313,8 +312,9 @@ static void wcove_irq_mask(struct irq_data *data)
|
|||
{
|
||||
struct gpio_chip *chip = irq_data_get_irq_chip_data(data);
|
||||
struct wcove_gpio *wg = gpiochip_get_data(chip);
|
||||
irq_hw_number_t gpio = irqd_to_hwirq(data);
|
||||
|
||||
if (data->hwirq >= WCOVE_GPIO_NUM)
|
||||
if (gpio >= WCOVE_GPIO_NUM)
|
||||
return;
|
||||
|
||||
wg->set_irq_mask = true;
|
||||
|
|
Loading…
Reference in New Issue