lkml.org 
[lkml]   [2018]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 1/2] irqchip: add support for Layerscape external interrupt lines
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

\
 
 \ /
  Last update: 2018-03-01 13:17    [W:0.160 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site