Re: [PATCH v5 1/2] irqchip: add support for Layerscape external interrupt lines

From: Thomas Gleixner
Date: Thu Mar 01 2018 - 07:17:01 EST


On Fri, 23 Feb 2018, Rasmus Villemoes wrote:
> +#include <linux/irq.h>
> +#include <linux/irqchip.h>
> +#include <linux/irqdomain.h>
> +#include <linux/of.h>

of.h is already included from of_irq.h and of_address.h

> +#include <linux/of_irq.h>
> +#include <linux/of_address.h>
> +static int
> +ls_extirq_set_type(struct irq_data *data, unsigned int type)
> +{
> + irq_hw_number_t hwirq = data->hwirq;
> + struct extirq_chip_data *chip_data = data->chip_data;
> + u32 value, mask;

Please order local variables in reverse fir tree fashion whenever
possible. That's way simpler to read:

struct extirq_chip_data *chip_data = data->chip_data;
irq_hw_number_t hwirq = data->hwirq;
u32 value, mask;

> +
> + if (chip_data->bit_reverse)
> + mask = 1U << (31 - hwirq);
> + else
> + mask = 1U << hwirq;
> +
> + switch (type) {
> + case IRQ_TYPE_LEVEL_LOW:
> + type = IRQ_TYPE_LEVEL_HIGH;
> + value = mask;
> + break;
> + case IRQ_TYPE_EDGE_FALLING:
> + type = IRQ_TYPE_EDGE_RISING;
> + value = mask;
> + break;
> + case IRQ_TYPE_LEVEL_HIGH:
> + case IRQ_TYPE_EDGE_RISING:
> + value = 0;
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + regmap_update_bits(chip_data->syscon, chip_data->intpcr, mask, value);
> +
> + data = data->parent_data;
> + return data->chip->irq_set_type(data, type);

irq_chip_set_type_parent()

Thanks,

tglx