Skip to contentSkip to conversation

gpio: msm: Fix irq mask/unmask by writing bits instead of numbers

PATCH In review Stephen Boyd 4 participants 6 messages Dec 10, 2013 – Dec 19, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 gpio: msm: Fix irq mask/unmask by writing bits instead of numbers

We should be writing bits here but instead we're writing the numbers that correspond to the bits we want to write. Fix it by wrapping the numbers in the BIT() macro. This fixes gpios acting as interrupts.

---
 drivers/gpio/gpio-msm-v2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-msm-v2.c +2 -2
index f7a0cc4..00a0978 100644
@@ -252,7 +252,7 @@ static void msm_gpio_irq_mask(struct irq_data *d)
 
 	spin_lock_irqsave(&tlmm_lock, irq_flags);
 	writel(TARGET_PROC_NONE, GPIO_INTR_CFG_SU(gpio));
-	clear_gpio_bits(INTR_RAW_STATUS_EN | INTR_ENABLE, GPIO_INTR_CFG(gpio));
+	clear_gpio_bits(BIT(INTR_RAW_STATUS_EN) | BIT(INTR_ENABLE), GPIO_INTR_CFG(gpio));
 	__clear_bit(gpio, msm_gpio.enabled_irqs);
 	spin_unlock_irqrestore(&tlmm_lock, irq_flags);
 }
@@ -264,7 +264,7 @@ static void msm_gpio_irq_unmask(struct irq_data *d)
 
 	spin_lock_irqsave(&tlmm_lock, irq_flags);
 	__set_bit(gpio, msm_gpio.enabled_irqs);
-	set_gpio_bits(INTR_RAW_STATUS_EN | INTR_ENABLE, GPIO_INTR_CFG(gpio));
+	set_gpio_bits(BIT(INTR_RAW_STATUS_EN) | BIT(INTR_ENABLE), GPIO_INTR_CFG(gpio));
 	writel(TARGET_PROC_SCORPION, GPIO_INTR_CFG_SU(gpio));
 	spin_unlock_irqrestore(&tlmm_lock, irq_flags);
 }
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#1 lore raw

PATCH 2/2 gpio: msm: Add module device table and mark table const

This allows the module to be loaded automatically.

---
 drivers/gpio/gpio-msm-v2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpio-msm-v2.c +2 -1
index 00a0978..a4dcbe4 100644
@@ -430,10 +430,11 @@ static int msm_gpio_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static struct of_device_id msm_gpio_of_match[] = {
+static const struct of_device_id msm_gpio_of_match[] = {
 	{ .compatible = "qcom,msm-gpio", },
 	{ },
 };
+MODULE_DEVICE_TABLE(of, msm_gpio_of_match);
 
 static int msm_gpio_remove(struct platform_device *dev)
 {
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#3 lore raw
In reply to Stephen Boyd
Quoted 6 lines · Stephen Boyd

We should be writing bits here but instead we're writing the numbers that correspond to the bits we want to write. Fix it by wrapping the numbers in the BIT() macro. This fixes gpios acting as interrupts.

I've applied this for fixes and tagged for stable. Bj?rn, Rohit: OK?

Yours,
Linus Walleij

#4 lore raw
In reply to Linus Walleij
Quoted 11 lines · Linus Walleij
Quoted 6 lines · Stephen Boyd

We should be writing bits here but instead we're writing the numbers that correspond to the bits we want to write. Fix it by wrapping the numbers in the BIT() macro. This fixes gpios acting as interrupts.

I've applied this for fixes and tagged for stable. Björn, Rohit: OK?

This looks good.

JFYI; the pinctrl-msm is written with gpio-msm-v2 in mind as well, so replacing it with pinctrl is on my todo list...

Regards,
Bjorn

Acked-by
#5 lore raw
In reply to Linus Walleij
Quoted 7 lines · Linus Walleij
Quoted 5 lines · Stephen Boyd

We should be writing bits here but instead we're writing the numbers that correspond to the bits we want to write. Fix it by wrapping the numbers in the BIT() macro. This fixes gpios acting as interrupts.

Quoted 6 lines
Quoted 1 line

I've applied this for fixes and tagged for stable. Bj?rn, Rohit: OK?

Yours,
Linus Walleij

Thanks,
Rohit Vaswani

Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation