Commit 5663bb27 authored by Jiang Liu's avatar Jiang Liu Committed by Linus Walleij

pinctrl: Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc

Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc while we
already have a pointer to corresponding irq_desc.
Signed-off-by: default avatarJiang Liu <jiang.liu@linux.intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent f66eb498
...@@ -1412,7 +1412,7 @@ static void chv_gpio_irq_handler(unsigned irq, struct irq_desc *desc) ...@@ -1412,7 +1412,7 @@ static void chv_gpio_irq_handler(unsigned irq, struct irq_desc *desc)
{ {
struct gpio_chip *gc = irq_desc_get_handler_data(desc); struct gpio_chip *gc = irq_desc_get_handler_data(desc);
struct chv_pinctrl *pctrl = gpiochip_to_pinctrl(gc); struct chv_pinctrl *pctrl = gpiochip_to_pinctrl(gc);
struct irq_chip *chip = irq_get_chip(irq); struct irq_chip *chip = irq_desc_get_chip(desc);
unsigned long pending; unsigned long pending;
u32 intr_line; u32 intr_line;
......
...@@ -840,7 +840,7 @@ static void intel_gpio_irq_handler(unsigned irq, struct irq_desc *desc) ...@@ -840,7 +840,7 @@ static void intel_gpio_irq_handler(unsigned irq, struct irq_desc *desc)
{ {
struct gpio_chip *gc = irq_desc_get_handler_data(desc); struct gpio_chip *gc = irq_desc_get_handler_data(desc);
struct intel_pinctrl *pctrl = gpiochip_to_pinctrl(gc); struct intel_pinctrl *pctrl = gpiochip_to_pinctrl(gc);
struct irq_chip *chip = irq_get_chip(irq); struct irq_chip *chip = irq_desc_get_chip(desc);
int i; int i;
chained_irq_enter(chip, desc); chained_irq_enter(chip, desc);
......
...@@ -1118,8 +1118,8 @@ mtk_eint_debounce_process(struct mtk_pinctrl *pctl, int index) ...@@ -1118,8 +1118,8 @@ mtk_eint_debounce_process(struct mtk_pinctrl *pctl, int index)
static void mtk_eint_irq_handler(unsigned irq, struct irq_desc *desc) static void mtk_eint_irq_handler(unsigned irq, struct irq_desc *desc)
{ {
struct irq_chip *chip = irq_get_chip(irq); struct irq_chip *chip = irq_desc_get_chip(desc);
struct mtk_pinctrl *pctl = irq_get_handler_data(irq); struct mtk_pinctrl *pctl = irq_desc_get_handler_data(desc);
unsigned int status, eint_num; unsigned int status, eint_num;
int offset, index, virq; int offset, index, virq;
const struct mtk_eint_offsets *eint_offsets = const struct mtk_eint_offsets *eint_offsets =
......
...@@ -843,10 +843,9 @@ static void nmk_gpio_irq_shutdown(struct irq_data *d) ...@@ -843,10 +843,9 @@ static void nmk_gpio_irq_shutdown(struct irq_data *d)
clk_disable(nmk_chip->clk); clk_disable(nmk_chip->clk);
} }
static void __nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc, static void __nmk_gpio_irq_handler(struct irq_desc *desc, u32 status)
u32 status)
{ {
struct irq_chip *host_chip = irq_get_chip(irq); struct irq_chip *host_chip = irq_desc_get_chip(desc);
struct gpio_chip *chip = irq_desc_get_handler_data(desc); struct gpio_chip *chip = irq_desc_get_handler_data(desc);
chained_irq_enter(host_chip, desc); chained_irq_enter(host_chip, desc);
...@@ -871,17 +870,16 @@ static void nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) ...@@ -871,17 +870,16 @@ static void nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
status = readl(nmk_chip->addr + NMK_GPIO_IS); status = readl(nmk_chip->addr + NMK_GPIO_IS);
clk_disable(nmk_chip->clk); clk_disable(nmk_chip->clk);
__nmk_gpio_irq_handler(irq, desc, status); __nmk_gpio_irq_handler(desc, status);
} }
static void nmk_gpio_latent_irq_handler(unsigned int irq, static void nmk_gpio_latent_irq_handler(unsigned int irq, struct irq_desc *desc)
struct irq_desc *desc)
{ {
struct gpio_chip *chip = irq_desc_get_handler_data(desc); struct gpio_chip *chip = irq_desc_get_handler_data(desc);
struct nmk_gpio_chip *nmk_chip = container_of(chip, struct nmk_gpio_chip, chip); struct nmk_gpio_chip *nmk_chip = container_of(chip, struct nmk_gpio_chip, chip);
u32 status = nmk_chip->get_latent_status(nmk_chip->bank); u32 status = nmk_chip->get_latent_status(nmk_chip->bank);
__nmk_gpio_irq_handler(irq, desc, status); __nmk_gpio_irq_handler(desc, status);
} }
/* I/O Functions */ /* I/O Functions */
......
...@@ -501,7 +501,7 @@ static void amd_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) ...@@ -501,7 +501,7 @@ static void amd_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
u64 reg64; u64 reg64;
int handled = 0; int handled = 0;
unsigned long flags; unsigned long flags;
struct irq_chip *chip = irq_get_chip(irq); struct irq_chip *chip = irq_desc_get_chip(desc);
struct gpio_chip *gc = irq_desc_get_handler_data(desc); struct gpio_chip *gc = irq_desc_get_handler_data(desc);
struct amd_gpio *gpio_dev = to_amd_gpio(gc); struct amd_gpio *gpio_dev = to_amd_gpio(gc);
......
...@@ -1596,7 +1596,7 @@ static struct irq_chip gpio_irqchip = { ...@@ -1596,7 +1596,7 @@ static struct irq_chip gpio_irqchip = {
static void gpio_irq_handler(unsigned irq, struct irq_desc *desc) static void gpio_irq_handler(unsigned irq, struct irq_desc *desc)
{ {
struct irq_chip *chip = irq_get_chip(irq); struct irq_chip *chip = irq_desc_get_chip(desc);
struct gpio_chip *gpio_chip = irq_desc_get_handler_data(desc); struct gpio_chip *gpio_chip = irq_desc_get_handler_data(desc);
struct at91_gpio_chip *at91_gpio = container_of(gpio_chip, struct at91_gpio_chip *at91_gpio = container_of(gpio_chip,
struct at91_gpio_chip, chip); struct at91_gpio_chip, chip);
......
...@@ -521,8 +521,8 @@ static struct irq_chip u300_gpio_irqchip = { ...@@ -521,8 +521,8 @@ static struct irq_chip u300_gpio_irqchip = {
static void u300_gpio_irq_handler(unsigned irq, struct irq_desc *desc) static void u300_gpio_irq_handler(unsigned irq, struct irq_desc *desc)
{ {
struct irq_chip *parent_chip = irq_get_chip(irq); struct irq_chip *parent_chip = irq_desc_get_chip(desc);
struct gpio_chip *chip = irq_get_handler_data(irq); struct gpio_chip *chip = irq_desc_get_handler_data(desc);
struct u300_gpio *gpio = to_u300_gpio(chip); struct u300_gpio *gpio = to_u300_gpio(chip);
struct u300_gpio_port *port = &gpio->ports[irq - chip->base]; struct u300_gpio_port *port = &gpio->ports[irq - chip->base];
int pinoffset = port->number << 3; /* get the right stride */ int pinoffset = port->number << 3; /* get the right stride */
......
...@@ -1471,8 +1471,8 @@ static const struct gpio_chip rockchip_gpiolib_chip = { ...@@ -1471,8 +1471,8 @@ static const struct gpio_chip rockchip_gpiolib_chip = {
static void rockchip_irq_demux(unsigned int irq, struct irq_desc *desc) static void rockchip_irq_demux(unsigned int irq, struct irq_desc *desc)
{ {
struct irq_chip *chip = irq_get_chip(irq); struct irq_chip *chip = irq_desc_get_chip(desc);
struct rockchip_pin_bank *bank = irq_get_handler_data(irq); struct rockchip_pin_bank *bank = irq_desc_get_handler_data(desc);
u32 pend; u32 pend;
dev_dbg(bank->drvdata->dev, "got irq for bank %s\n", bank->name); dev_dbg(bank->drvdata->dev, "got irq for bank %s\n", bank->name);
......
...@@ -1684,7 +1684,7 @@ static void pcs_irq_chain_handler(unsigned int irq, struct irq_desc *desc) ...@@ -1684,7 +1684,7 @@ static void pcs_irq_chain_handler(unsigned int irq, struct irq_desc *desc)
struct pcs_soc_data *pcs_soc = irq_desc_get_handler_data(desc); struct pcs_soc_data *pcs_soc = irq_desc_get_handler_data(desc);
struct irq_chip *chip; struct irq_chip *chip;
chip = irq_get_chip(irq); chip = irq_desc_get_chip(desc);
chained_irq_enter(chip, desc); chained_irq_enter(chip, desc);
pcs_irq_handle(pcs_soc); pcs_irq_handle(pcs_soc);
/* REVISIT: export and add handle_bad_irq(irq, desc)? */ /* REVISIT: export and add handle_bad_irq(irq, desc)? */
......
...@@ -1463,7 +1463,7 @@ static void __gpio_irq_handler(struct st_gpio_bank *bank) ...@@ -1463,7 +1463,7 @@ static void __gpio_irq_handler(struct st_gpio_bank *bank)
static void st_gpio_irq_handler(unsigned irq, struct irq_desc *desc) static void st_gpio_irq_handler(unsigned irq, struct irq_desc *desc)
{ {
/* interrupt dedicated per bank */ /* interrupt dedicated per bank */
struct irq_chip *chip = irq_get_chip(irq); struct irq_chip *chip = irq_desc_get_chip(desc);
struct gpio_chip *gc = irq_desc_get_handler_data(desc); struct gpio_chip *gc = irq_desc_get_handler_data(desc);
struct st_gpio_bank *bank = gpio_chip_to_bank(gc); struct st_gpio_bank *bank = gpio_chip_to_bank(gc);
...@@ -1474,8 +1474,8 @@ static void st_gpio_irq_handler(unsigned irq, struct irq_desc *desc) ...@@ -1474,8 +1474,8 @@ static void st_gpio_irq_handler(unsigned irq, struct irq_desc *desc)
static void st_gpio_irqmux_handler(unsigned irq, struct irq_desc *desc) static void st_gpio_irqmux_handler(unsigned irq, struct irq_desc *desc)
{ {
struct irq_chip *chip = irq_get_chip(irq); struct irq_chip *chip = irq_desc_get_chip(desc);
struct st_pinctrl *info = irq_get_handler_data(irq); struct st_pinctrl *info = irq_desc_get_handler_data(desc);
unsigned long status; unsigned long status;
int n; int n;
......
...@@ -770,7 +770,7 @@ static void msm_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) ...@@ -770,7 +770,7 @@ static void msm_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
struct gpio_chip *gc = irq_desc_get_handler_data(desc); struct gpio_chip *gc = irq_desc_get_handler_data(desc);
const struct msm_pingroup *g; const struct msm_pingroup *g;
struct msm_pinctrl *pctrl = to_msm_pinctrl(gc); struct msm_pinctrl *pctrl = to_msm_pinctrl(gc);
struct irq_chip *chip = irq_get_chip(irq); struct irq_chip *chip = irq_desc_get_chip(desc);
int irq_pin; int irq_pin;
int handled = 0; int handled = 0;
u32 val; u32 val;
......
...@@ -422,9 +422,9 @@ static const struct of_device_id exynos_wkup_irq_ids[] = { ...@@ -422,9 +422,9 @@ static const struct of_device_id exynos_wkup_irq_ids[] = {
/* interrupt handler for wakeup interrupts 0..15 */ /* interrupt handler for wakeup interrupts 0..15 */
static void exynos_irq_eint0_15(unsigned int irq, struct irq_desc *desc) static void exynos_irq_eint0_15(unsigned int irq, struct irq_desc *desc)
{ {
struct exynos_weint_data *eintd = irq_get_handler_data(irq); struct exynos_weint_data *eintd = irq_desc_get_handler_data(desc);
struct samsung_pin_bank *bank = eintd->bank; struct samsung_pin_bank *bank = eintd->bank;
struct irq_chip *chip = irq_get_chip(irq); struct irq_chip *chip = irq_desc_get_chip(desc);
int eint_irq; int eint_irq;
chained_irq_enter(chip, desc); chained_irq_enter(chip, desc);
...@@ -454,8 +454,8 @@ static inline void exynos_irq_demux_eint(unsigned long pend, ...@@ -454,8 +454,8 @@ static inline void exynos_irq_demux_eint(unsigned long pend,
/* interrupt handler for wakeup interrupt 16 */ /* interrupt handler for wakeup interrupt 16 */
static void exynos_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc) static void exynos_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc)
{ {
struct irq_chip *chip = irq_get_chip(irq); struct irq_chip *chip = irq_desc_get_chip(desc);
struct exynos_muxed_weint_data *eintd = irq_get_handler_data(irq); struct exynos_muxed_weint_data *eintd = irq_desc_get_handler_data(desc);
struct samsung_pinctrl_drv_data *d = eintd->banks[0]->drvdata; struct samsung_pinctrl_drv_data *d = eintd->banks[0]->drvdata;
unsigned long pend; unsigned long pend;
unsigned long mask; unsigned long mask;
......
...@@ -243,7 +243,7 @@ static struct irq_chip s3c2410_eint0_3_chip = { ...@@ -243,7 +243,7 @@ static struct irq_chip s3c2410_eint0_3_chip = {
static void s3c2410_demux_eint0_3(unsigned int irq, struct irq_desc *desc) static void s3c2410_demux_eint0_3(unsigned int irq, struct irq_desc *desc)
{ {
struct irq_data *data = irq_desc_get_irq_data(desc); struct irq_data *data = irq_desc_get_irq_data(desc);
struct s3c24xx_eint_data *eint_data = irq_get_handler_data(irq); struct s3c24xx_eint_data *eint_data = irq_desc_get_handler_data(desc);
unsigned int virq; unsigned int virq;
/* the first 4 eints have a simple 1 to 1 mapping */ /* the first 4 eints have a simple 1 to 1 mapping */
...@@ -297,9 +297,9 @@ static struct irq_chip s3c2412_eint0_3_chip = { ...@@ -297,9 +297,9 @@ static struct irq_chip s3c2412_eint0_3_chip = {
static void s3c2412_demux_eint0_3(unsigned int irq, struct irq_desc *desc) static void s3c2412_demux_eint0_3(unsigned int irq, struct irq_desc *desc)
{ {
struct irq_chip *chip = irq_get_chip(irq); struct s3c24xx_eint_data *eint_data = irq_desc_get_handler_data(desc);
struct irq_data *data = irq_desc_get_irq_data(desc); struct irq_data *data = irq_desc_get_irq_data(desc);
struct s3c24xx_eint_data *eint_data = irq_get_handler_data(irq); struct irq_chip *chip = irq_data_get_irq_chip(data);
unsigned int virq; unsigned int virq;
chained_irq_enter(chip, desc); chained_irq_enter(chip, desc);
...@@ -357,11 +357,11 @@ static struct irq_chip s3c24xx_eint_chip = { ...@@ -357,11 +357,11 @@ static struct irq_chip s3c24xx_eint_chip = {
.irq_set_type = s3c24xx_eint_type, .irq_set_type = s3c24xx_eint_type,
}; };
static inline void s3c24xx_demux_eint(unsigned int irq, struct irq_desc *desc, static inline void s3c24xx_demux_eint(struct irq_desc *desc,
u32 offset, u32 range) u32 offset, u32 range)
{ {
struct irq_chip *chip = irq_get_chip(irq); struct s3c24xx_eint_data *data = irq_desc_get_handler_data(desc);
struct s3c24xx_eint_data *data = irq_get_handler_data(irq); struct irq_chip *chip = irq_desc_get_irq_chip(desc);
struct samsung_pinctrl_drv_data *d = data->drvdata; struct samsung_pinctrl_drv_data *d = data->drvdata;
unsigned int pend, mask; unsigned int pend, mask;
...@@ -374,7 +374,7 @@ static inline void s3c24xx_demux_eint(unsigned int irq, struct irq_desc *desc, ...@@ -374,7 +374,7 @@ static inline void s3c24xx_demux_eint(unsigned int irq, struct irq_desc *desc,
pend &= range; pend &= range;
while (pend) { while (pend) {
unsigned int virq; unsigned int virq, irq;
irq = __ffs(pend); irq = __ffs(pend);
pend &= ~(1 << irq); pend &= ~(1 << irq);
...@@ -390,12 +390,12 @@ static inline void s3c24xx_demux_eint(unsigned int irq, struct irq_desc *desc, ...@@ -390,12 +390,12 @@ static inline void s3c24xx_demux_eint(unsigned int irq, struct irq_desc *desc,
static void s3c24xx_demux_eint4_7(unsigned int irq, struct irq_desc *desc) static void s3c24xx_demux_eint4_7(unsigned int irq, struct irq_desc *desc)
{ {
s3c24xx_demux_eint(irq, desc, 0, 0xf0); s3c24xx_demux_eint(desc, 0, 0xf0);
} }
static void s3c24xx_demux_eint8_23(unsigned int irq, struct irq_desc *desc) static void s3c24xx_demux_eint8_23(unsigned int irq, struct irq_desc *desc)
{ {
s3c24xx_demux_eint(irq, desc, 8, 0xffff00); s3c24xx_demux_eint(desc, 8, 0xffff00);
} }
static irq_flow_handler_t s3c2410_eint_handlers[NUM_EINT_IRQ] = { static irq_flow_handler_t s3c2410_eint_handlers[NUM_EINT_IRQ] = {
......
...@@ -410,8 +410,8 @@ static const struct irq_domain_ops s3c64xx_gpio_irqd_ops = { ...@@ -410,8 +410,8 @@ static const struct irq_domain_ops s3c64xx_gpio_irqd_ops = {
static void s3c64xx_eint_gpio_irq(unsigned int irq, struct irq_desc *desc) static void s3c64xx_eint_gpio_irq(unsigned int irq, struct irq_desc *desc)
{ {
struct irq_chip *chip = irq_get_chip(irq); struct irq_chip *chip = irq_desc_get_chip(desc);
struct s3c64xx_eint_gpio_data *data = irq_get_handler_data(irq); struct s3c64xx_eint_gpio_data *data = irq_desc_get_handler_data(desc);
struct samsung_pinctrl_drv_data *drvdata = data->drvdata; struct samsung_pinctrl_drv_data *drvdata = data->drvdata;
chained_irq_enter(chip, desc); chained_irq_enter(chip, desc);
...@@ -599,11 +599,10 @@ static struct irq_chip s3c64xx_eint0_irq_chip = { ...@@ -599,11 +599,10 @@ static struct irq_chip s3c64xx_eint0_irq_chip = {
.irq_set_type = s3c64xx_eint0_irq_set_type, .irq_set_type = s3c64xx_eint0_irq_set_type,
}; };
static inline void s3c64xx_irq_demux_eint(unsigned int irq, static inline void s3c64xx_irq_demux_eint(struct irq_desc *desc, u32 range)
struct irq_desc *desc, u32 range)
{ {
struct irq_chip *chip = irq_get_chip(irq); struct irq_chip *chip = irq_desc_get_chip(desc);
struct s3c64xx_eint0_data *data = irq_get_handler_data(irq); struct s3c64xx_eint0_data *data = irq_desc_get_handler_data(desc);
struct samsung_pinctrl_drv_data *drvdata = data->drvdata; struct samsung_pinctrl_drv_data *drvdata = data->drvdata;
unsigned int pend, mask; unsigned int pend, mask;
...@@ -616,11 +615,10 @@ static inline void s3c64xx_irq_demux_eint(unsigned int irq, ...@@ -616,11 +615,10 @@ static inline void s3c64xx_irq_demux_eint(unsigned int irq,
pend &= range; pend &= range;
while (pend) { while (pend) {
unsigned int virq; unsigned int virq, irq;
irq = fls(pend) - 1; irq = fls(pend) - 1;
pend &= ~(1 << irq); pend &= ~(1 << irq);
virq = irq_linear_revmap(data->domains[irq], data->pins[irq]); virq = irq_linear_revmap(data->domains[irq], data->pins[irq]);
/* /*
* Something must be really wrong if an unmapped EINT * Something must be really wrong if an unmapped EINT
...@@ -636,22 +634,22 @@ static inline void s3c64xx_irq_demux_eint(unsigned int irq, ...@@ -636,22 +634,22 @@ static inline void s3c64xx_irq_demux_eint(unsigned int irq,
static void s3c64xx_demux_eint0_3(unsigned int irq, struct irq_desc *desc) static void s3c64xx_demux_eint0_3(unsigned int irq, struct irq_desc *desc)
{ {
s3c64xx_irq_demux_eint(irq, desc, 0xf); s3c64xx_irq_demux_eint(desc, 0xf);
} }
static void s3c64xx_demux_eint4_11(unsigned int irq, struct irq_desc *desc) static void s3c64xx_demux_eint4_11(unsigned int irq, struct irq_desc *desc)
{ {
s3c64xx_irq_demux_eint(irq, desc, 0xff0); s3c64xx_irq_demux_eint(desc, 0xff0);
} }
static void s3c64xx_demux_eint12_19(unsigned int irq, struct irq_desc *desc) static void s3c64xx_demux_eint12_19(unsigned int irq, struct irq_desc *desc)
{ {
s3c64xx_irq_demux_eint(irq, desc, 0xff000); s3c64xx_irq_demux_eint(desc, 0xff000);
} }
static void s3c64xx_demux_eint20_27(unsigned int irq, struct irq_desc *desc) static void s3c64xx_demux_eint20_27(unsigned int irq, struct irq_desc *desc)
{ {
s3c64xx_irq_demux_eint(irq, desc, 0xff00000); s3c64xx_irq_demux_eint(desc, 0xff00000);
} }
static irq_flow_handler_t s3c64xx_eint0_handlers[NUM_EINT0_IRQ] = { static irq_flow_handler_t s3c64xx_eint0_handlers[NUM_EINT0_IRQ] = {
......
...@@ -552,7 +552,7 @@ static void sirfsoc_gpio_handle_irq(unsigned int irq, struct irq_desc *desc) ...@@ -552,7 +552,7 @@ static void sirfsoc_gpio_handle_irq(unsigned int irq, struct irq_desc *desc)
struct sirfsoc_gpio_bank *bank; struct sirfsoc_gpio_bank *bank;
u32 status, ctrl; u32 status, ctrl;
int idx = 0; int idx = 0;
struct irq_chip *chip = irq_get_chip(irq); struct irq_chip *chip = irq_desc_get_chip(desc);
int i; int i;
for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) { for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) {
......
...@@ -711,8 +711,8 @@ static struct irq_chip sunxi_pinctrl_level_irq_chip = { ...@@ -711,8 +711,8 @@ static struct irq_chip sunxi_pinctrl_level_irq_chip = {
static void sunxi_pinctrl_irq_handler(unsigned irq, struct irq_desc *desc) static void sunxi_pinctrl_irq_handler(unsigned irq, struct irq_desc *desc)
{ {
struct irq_chip *chip = irq_get_chip(irq); struct irq_chip *chip = irq_desc_get_chip(desc);
struct sunxi_pinctrl *pctl = irq_get_handler_data(irq); struct sunxi_pinctrl *pctl = irq_desc_get_handler_data(desc);
unsigned long bank, reg, val; unsigned long bank, reg, val;
for (bank = 0; bank < pctl->desc->irq_banks; bank++) for (bank = 0; bank < pctl->desc->irq_banks; bank++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment