mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 05:04:02 +02:00
pinctrl: airoha: remove not needed irq_type[] array
irq_type[] array inside airoha_pinctrl_gpiochip structure is not actually necessary. Use trigger type from 'struct irq_data' instead. Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Linus Walleij <linusw@kernel.org>
This commit is contained in:
parent
3de4686cdf
commit
ad1a8fd485
|
|
@ -383,8 +383,6 @@ struct airoha_pinctrl_gpiochip {
|
|||
const u32 *status;
|
||||
const u32 *level;
|
||||
const u32 *edge;
|
||||
|
||||
u32 irq_type[AIROHA_NUM_PINS];
|
||||
};
|
||||
|
||||
struct airoha_pinctrl_confs_info {
|
||||
|
|
@ -2592,11 +2590,11 @@ static void airoha_irq_unmask(struct irq_data *data)
|
|||
u32 mask = GENMASK(2 * offset + 1, 2 * offset);
|
||||
u32 val = BIT(2 * offset);
|
||||
|
||||
if (WARN_ON_ONCE(data->hwirq >= ARRAY_SIZE(gpiochip->irq_type)))
|
||||
if (WARN_ON_ONCE(data->hwirq >= AIROHA_NUM_PINS))
|
||||
return;
|
||||
|
||||
gpiochip_enable_irq(gc, irqd_to_hwirq(data));
|
||||
switch (gpiochip->irq_type[data->hwirq]) {
|
||||
switch (irqd_get_trigger_type(data)) {
|
||||
case IRQ_TYPE_LEVEL_LOW:
|
||||
val = val << 1;
|
||||
fallthrough;
|
||||
|
|
@ -2628,7 +2626,7 @@ static void airoha_irq_mask(struct irq_data *data)
|
|||
u8 index = data->hwirq / AIROHA_REG_GPIOCTRL_NUM_PIN;
|
||||
u32 mask = GENMASK(2 * offset + 1, 2 * offset);
|
||||
|
||||
if (data->hwirq >= ARRAY_SIZE(gpiochip->irq_type))
|
||||
if (data->hwirq >= AIROHA_NUM_PINS)
|
||||
return;
|
||||
|
||||
regmap_clear_bits(pinctrl->regmap, gpiochip->level[index], mask);
|
||||
|
|
@ -2644,7 +2642,7 @@ static void airoha_irq_ack(struct irq_data *data)
|
|||
u8 offset = data->hwirq % AIROHA_PIN_BANK_SIZE;
|
||||
u8 index = data->hwirq / AIROHA_PIN_BANK_SIZE;
|
||||
|
||||
if (data->hwirq >= ARRAY_SIZE(gpiochip->irq_type))
|
||||
if (data->hwirq >= AIROHA_NUM_PINS)
|
||||
return;
|
||||
|
||||
regmap_write(pinctrl->regmap, gpiochip->status[index], BIT(offset));
|
||||
|
|
@ -2652,28 +2650,24 @@ static void airoha_irq_ack(struct irq_data *data)
|
|||
|
||||
static int airoha_irq_type(struct irq_data *data, unsigned int type)
|
||||
{
|
||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
|
||||
struct airoha_pinctrl *pinctrl = gpiochip_get_data(gc);
|
||||
struct airoha_pinctrl_gpiochip *gpiochip = &pinctrl->gpiochip;
|
||||
|
||||
if (data->hwirq >= ARRAY_SIZE(gpiochip->irq_type))
|
||||
if (data->hwirq >= AIROHA_NUM_PINS)
|
||||
return -EINVAL;
|
||||
|
||||
if (type == IRQ_TYPE_NONE) {
|
||||
gpiochip->irq_type[data->hwirq] = IRQ_TYPE_NONE;
|
||||
irqd_set_trigger_type(data, type);
|
||||
irq_set_handler_locked(data, handle_bad_irq);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (type == IRQ_TYPE_PROBE) {
|
||||
if (gpiochip->irq_type[data->hwirq])
|
||||
if (irqd_get_trigger_type(data))
|
||||
return 0;
|
||||
|
||||
type = IRQ_TYPE_EDGE_BOTH;
|
||||
}
|
||||
|
||||
gpiochip->irq_type[data->hwirq] = type & IRQ_TYPE_SENSE_MASK;
|
||||
irqd_set_trigger_type(data, type);
|
||||
if (type & IRQ_TYPE_EDGE_BOTH)
|
||||
irq_set_handler_locked(data, handle_edge_irq);
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user