Signed-off-by: Abanoub Sameh <abanoubsameh@xxxxxxxxxxxxxx> --- drivers/gpio/gpio-msic.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/drivers/gpio/gpio-msic.c b/drivers/gpio/gpio-msic.c index 7e3c96e4ab2c..37664e7b3ddd 100644 --- a/drivers/gpio/gpio-msic.c +++ b/drivers/gpio/gpio-msic.c @@ -43,9 +43,9 @@ struct msic_gpio { struct mutex buslock; struct gpio_chip chip; int irq; - unsigned irq_base; + unsigned int irq_base; unsigned long trig_change_mask; - unsigned trig_type; + unsigned int trig_type; }; /* @@ -58,7 +58,7 @@ struct msic_gpio { * GPIO1HV0..GPIO1HV3: high voltage, bank 1, gpio_base + 20 */ -static int msic_gpio_to_ireg(unsigned offset) +static int msic_gpio_to_ireg(unsigned int offset) { if (offset >= MSIC_NUM_GPIO) return -EINVAL; @@ -73,7 +73,7 @@ static int msic_gpio_to_ireg(unsigned offset) return INTEL_MSIC_GPIO1HV0CTLI - offset + 20; } -static int msic_gpio_to_oreg(unsigned offset) +static int msic_gpio_to_oreg(unsigned int offset) { if (offset >= MSIC_NUM_GPIO) return -EINVAL; @@ -88,7 +88,7 @@ static int msic_gpio_to_oreg(unsigned offset) return INTEL_MSIC_GPIO1HV0CTLO - offset + 20; } -static int msic_gpio_direction_input(struct gpio_chip *chip, unsigned offset) +static int msic_gpio_direction_input(struct gpio_chip *chip, unsigned int offset) { int reg; @@ -100,10 +100,10 @@ static int msic_gpio_direction_input(struct gpio_chip *chip, unsigned offset) } static int msic_gpio_direction_output(struct gpio_chip *chip, - unsigned offset, int value) + unsigned int offset, int value) { int reg; - unsigned mask; + unsigned int mask; value = (!!value) | MSIC_GPIO_DIR_OUT; mask = MSIC_GPIO_DIR_MASK | MSIC_GPIO_DOUT_MASK; @@ -115,7 +115,7 @@ static int msic_gpio_direction_output(struct gpio_chip *chip, return intel_msic_reg_update(reg, value, mask); } -static int msic_gpio_get(struct gpio_chip *chip, unsigned offset) +static int msic_gpio_get(struct gpio_chip *chip, unsigned int offset) { u8 r; int ret; @@ -132,7 +132,7 @@ static int msic_gpio_get(struct gpio_chip *chip, unsigned offset) return !!(r & MSIC_GPIO_DIN_MASK); } -static void msic_gpio_set(struct gpio_chip *chip, unsigned offset, int value) +static void msic_gpio_set(struct gpio_chip *chip, unsigned int offset, int value) { int reg; @@ -140,7 +140,7 @@ static void msic_gpio_set(struct gpio_chip *chip, unsigned offset, int value) if (reg < 0) return; - intel_msic_reg_update(reg, !!value , MSIC_GPIO_DOUT_MASK); + intel_msic_reg_update(reg, !!value, MSIC_GPIO_DOUT_MASK); } /* @@ -148,7 +148,7 @@ static void msic_gpio_set(struct gpio_chip *chip, unsigned offset, int value) * irq_desc->lock held. We can not access the scu bus here, so we * store the change and update in the bus_sync_unlock() function below */ -static int msic_irq_type(struct irq_data *data, unsigned type) +static int msic_irq_type(struct irq_data *data, unsigned int type) { struct msic_gpio *mg = irq_data_get_irq_chip_data(data); u32 gpio = data->irq - mg->irq_base; @@ -163,15 +163,17 @@ static int msic_irq_type(struct irq_data *data, unsigned type) return 0; } -static int msic_gpio_to_irq(struct gpio_chip *chip, unsigned offset) +static int msic_gpio_to_irq(struct gpio_chip *chip, unsigned int offset) { struct msic_gpio *mg = gpiochip_get_data(chip); + return mg->irq_base + offset; } static void msic_bus_lock(struct irq_data *data) { struct msic_gpio *mg = irq_data_get_irq_chip_data(data); + mutex_lock(&mg->buslock); } @@ -183,8 +185,9 @@ static void msic_bus_sync_unlock(struct irq_data *data) u8 trig = 0; /* We can only get one change at a time as the buslock covers the - entire transaction. The irq_desc->lock is dropped before we are - called but that is fine */ + * entire transaction. The irq_desc->lock is dropped before we are + * called but that is fine + */ if (mg->trig_change_mask) { offset = __ffs(mg->trig_change_mask); -- 2.28.0.rc0