Skip to contentSkip to conversation

Input: jornada720_ts - get rid of mach/irqs.h include

PATCH New Russell King 3 participants 4 messages Aug 19, 2016

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

PATCH 1/1 Input: jornada720_ts - get rid of mach/irqs.h include

Switch the jornada720 touchscreen driver to obtain its interrupt from the platform device, rather than via a hard-coded interrupt number obtained from the mach/irqs.h header.

---
 arch/arm/mach-sa1100/jornada720.c         |  6 ++++++
 drivers/input/touchscreen/jornada720_ts.c | 10 ++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)
arch/arm/mach-sa1100/jornada720.c +6 -0
index 2b96f7bc16bd..010eaea04c69 100644
@@ -228,9 +228,15 @@ static struct platform_device jornada_kbd_device = {
 	.resource	= jornada_kbd_resources,
 };
 
+static struct resource jornada_ts_resources[] = {
+	DEFINE_RES_IRQ(IRQ_GPIO9),
+};
+
 static struct platform_device jornada_ts_device = {
 	.name		= "jornada_ts",
 	.id		= -1,
+	.num_resources	= ARRAY_SIZE(jornada_ts_resources),
+	.resource	= jornada_ts_resources,
 };
 
 static struct platform_device *devices[] __initdata = {
drivers/input/touchscreen/jornada720_ts.c +6 -4
index ea3b6a5b83e6..7e196f8e5661 100644
@@ -22,7 +22,6 @@
 
 #include <mach/hardware.h>
 #include <mach/jornada720.h>
-#include <mach/irqs.h>
 
 MODULE_AUTHOR("Kristoffer Ericson <[email protected]>");
 MODULE_DESCRIPTION("HP Jornada 710/720/728 touchscreen driver");
@@ -101,7 +100,11 @@ static int jornada720_ts_probe(struct platform_device *pdev)
 {
 	struct jornada_ts *jornada_ts;
 	struct input_dev *input_dev;
-	int error;
+	int error, irq;
+
+	irq = platform_get_irq(pdev, 0);
+	if (irq <= 0)
+		return irq < 0 ? irq : -EINVAL;
 
 	jornada_ts = devm_kzalloc(&pdev->dev, sizeof(*jornada_ts), GFP_KERNEL);
 	if (!jornada_ts)
@@ -125,8 +128,7 @@ static int jornada720_ts_probe(struct platform_device *pdev)
 	input_set_abs_params(input_dev, ABS_X, 270, 3900, 0, 0);
 	input_set_abs_params(input_dev, ABS_Y, 180, 3700, 0, 0);
 
-	error = devm_request_irq(&pdev->dev, IRQ_GPIO9,
-				 jornada720_ts_interrupt,
+	error = devm_request_irq(&pdev->dev, irq, jornada720_ts_interrupt,
 				 IRQF_TRIGGER_RISING,
 				 "HP7XX Touchscreen driver", pdev);
 	if (error) {
Signature · 1 line
2.1.0
maintainer Applied
#1 lore raw

PATCH 1/1 Input: jornada720_ts - get rid of mach/irqs.h include

Quoted 5 lines · Russell King

Switch the jornada720 touchscreen driver to obtain its interrupt from the platform device, rather than via a hard-coded interrupt number obtained from the mach/irqs.h header.

Applied, thank you.

Quoted 63 lines
---
 arch/arm/mach-sa1100/jornada720.c         |  6 ++++++
 drivers/input/touchscreen/jornada720_ts.c | 10 ++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)
arch/arm/mach-sa1100/jornada720.c +6 -0
index 2b96f7bc16bd..010eaea04c69 100644
@@ -228,9 +228,15 @@ static struct platform_device jornada_kbd_device = {
 	.resource	= jornada_kbd_resources,
 };
 
+static struct resource jornada_ts_resources[] = {
+	DEFINE_RES_IRQ(IRQ_GPIO9),
+};
+
 static struct platform_device jornada_ts_device = {
 	.name		= "jornada_ts",
 	.id		= -1,
+	.num_resources	= ARRAY_SIZE(jornada_ts_resources),
+	.resource	= jornada_ts_resources,
 };
 
 static struct platform_device *devices[] __initdata = {
drivers/input/touchscreen/jornada720_ts.c +6 -4
index ea3b6a5b83e6..7e196f8e5661 100644
@@ -22,7 +22,6 @@
 
 #include <mach/hardware.h>
 #include <mach/jornada720.h>
-#include <mach/irqs.h>
 
 MODULE_AUTHOR("Kristoffer Ericson <[email protected]>");
 MODULE_DESCRIPTION("HP Jornada 710/720/728 touchscreen driver");
@@ -101,7 +100,11 @@ static int jornada720_ts_probe(struct platform_device *pdev)
 {
 	struct jornada_ts *jornada_ts;
 	struct input_dev *input_dev;
-	int error;
+	int error, irq;
+
+	irq = platform_get_irq(pdev, 0);
+	if (irq <= 0)
+		return irq < 0 ? irq : -EINVAL;
 
 	jornada_ts = devm_kzalloc(&pdev->dev, sizeof(*jornada_ts), GFP_KERNEL);
 	if (!jornada_ts)
@@ -125,8 +128,7 @@ static int jornada720_ts_probe(struct platform_device *pdev)
 	input_set_abs_params(input_dev, ABS_X, 270, 3900, 0, 0);
 	input_set_abs_params(input_dev, ABS_Y, 180, 3700, 0, 0);
 
-	error = devm_request_irq(&pdev->dev, IRQ_GPIO9,
-				 jornada720_ts_interrupt,
+	error = devm_request_irq(&pdev->dev, irq, jornada720_ts_interrupt,
 				 IRQF_TRIGGER_RISING,
 				 "HP7XX Touchscreen driver", pdev);
 	if (error) {
Signature · 1 line
2.1.0
Signature · 1 line
Dmitry
#2 lore raw

PATCH 1/1 Input: jornada720_ts - get rid of mach/irqs.h include

In reply to Russell King
Quoted 5 lines · Russell King

Switch the jornada720 touchscreen driver to obtain its interrupt from the platform device, rather than via a hard-coded interrupt number obtained from the mach/irqs.h header.

Looking deeper at this driver, this probably isn't an entirely correct way to go about this, because the interrupt handler does this:

        /* If GPIO_GPIO9 is set to high then report pen up */
        if (GPLR & GPIO_GPIO(9)) {

so we should be grabbing the GPIO via the gpio layer and testing the value there.

_However_, having discovered this, along with the interrupt handler being registered with:

        error = devm_request_irq(&pdev->dev, irq, jornada720_ts_interrupt,
                                 IRQF_TRIGGER_RISING,
                                 "HP7XX Touchscreen driver", pdev);

this brings up the question: if the trigger is always a rising edge on GPIO 9, it is very unlikely that GPLR & GPIO_GPIO(9) will be false. So how can this code have worked in the first place?

I've checked the history, and I see nothing which changes this state of affairs back to 2.6.12-rc2.

Quoted 68 lines
---
 arch/arm/mach-sa1100/jornada720.c         |  6 ++++++
 drivers/input/touchscreen/jornada720_ts.c | 10 ++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)
arch/arm/mach-sa1100/jornada720.c +6 -0
index 2b96f7bc16bd..010eaea04c69 100644
@@ -228,9 +228,15 @@ static struct platform_device jornada_kbd_device = {
 	.resource	= jornada_kbd_resources,
 };
 
+static struct resource jornada_ts_resources[] = {
+	DEFINE_RES_IRQ(IRQ_GPIO9),
+};
+
 static struct platform_device jornada_ts_device = {
 	.name		= "jornada_ts",
 	.id		= -1,
+	.num_resources	= ARRAY_SIZE(jornada_ts_resources),
+	.resource	= jornada_ts_resources,
 };
 
 static struct platform_device *devices[] __initdata = {
drivers/input/touchscreen/jornada720_ts.c +6 -4
index ea3b6a5b83e6..7e196f8e5661 100644
@@ -22,7 +22,6 @@
 
 #include <mach/hardware.h>
 #include <mach/jornada720.h>
-#include <mach/irqs.h>
 
 MODULE_AUTHOR("Kristoffer Ericson <[email protected]>");
 MODULE_DESCRIPTION("HP Jornada 710/720/728 touchscreen driver");
@@ -101,7 +100,11 @@ static int jornada720_ts_probe(struct platform_device *pdev)
 {
 	struct jornada_ts *jornada_ts;
 	struct input_dev *input_dev;
-	int error;
+	int error, irq;
+
+	irq = platform_get_irq(pdev, 0);
+	if (irq <= 0)
+		return irq < 0 ? irq : -EINVAL;
 
 	jornada_ts = devm_kzalloc(&pdev->dev, sizeof(*jornada_ts), GFP_KERNEL);
 	if (!jornada_ts)
@@ -125,8 +128,7 @@ static int jornada720_ts_probe(struct platform_device *pdev)
 	input_set_abs_params(input_dev, ABS_X, 270, 3900, 0, 0);
 	input_set_abs_params(input_dev, ABS_Y, 180, 3700, 0, 0);
 
-	error = devm_request_irq(&pdev->dev, IRQ_GPIO9,
-				 jornada720_ts_interrupt,
+	error = devm_request_irq(&pdev->dev, irq, jornada720_ts_interrupt,
 				 IRQF_TRIGGER_RISING,
 				 "HP7XX Touchscreen driver", pdev);
 	if (error) {
Signature · 7 lines
2.1.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
maintainer
#3 lore raw

PATCH 1/1 Input: jornada720_ts - get rid of mach/irqs.h include

Quoted 23 lines · Russell King - ARM Linux
Quoted 5 lines · Russell King

Switch the jornada720 touchscreen driver to obtain its interrupt from the platform device, rather than via a hard-coded interrupt number obtained from the mach/irqs.h header.

Looking deeper at this driver, this probably isn't an entirely correct way to go about this, because the interrupt handler does this:

        /* If GPIO_GPIO9 is set to high then report pen up */
        if (GPLR & GPIO_GPIO(9)) {

so we should be grabbing the GPIO via the gpio layer and testing the value there.

_However_, having discovered this, along with the interrupt handler being registered with:

        error = devm_request_irq(&pdev->dev, irq, jornada720_ts_interrupt,
                                 IRQF_TRIGGER_RISING,
                                 "HP7XX Touchscreen driver", pdev);
Quoted 6 lines

this brings up the question: if the trigger is always a rising edge on GPIO 9, it is very unlikely that GPLR & GPIO_GPIO(9) will be false. So how can this code have worked in the first place?

I've checked the history, and I see nothing which changes this state of affairs back to 2.6.12-rc2.

That would be question for Kristoffer; I have never had this hardware...

I'll hold off on this patch for now...

Quoted 74 lines
Quoted 69 lines
---
 arch/arm/mach-sa1100/jornada720.c         |  6 ++++++
 drivers/input/touchscreen/jornada720_ts.c | 10 ++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)
arch/arm/mach-sa1100/jornada720.c +6 -0
index 2b96f7bc16bd..010eaea04c69 100644
@@ -228,9 +228,15 @@ static struct platform_device jornada_kbd_device = {
 	.resource	= jornada_kbd_resources,
 };
 
+static struct resource jornada_ts_resources[] = {
+	DEFINE_RES_IRQ(IRQ_GPIO9),
+};
+
 static struct platform_device jornada_ts_device = {
 	.name		= "jornada_ts",
 	.id		= -1,
+	.num_resources	= ARRAY_SIZE(jornada_ts_resources),
+	.resource	= jornada_ts_resources,
 };
 
 static struct platform_device *devices[] __initdata = {
drivers/input/touchscreen/jornada720_ts.c +6 -4
index ea3b6a5b83e6..7e196f8e5661 100644
@@ -22,7 +22,6 @@
 
 #include <mach/hardware.h>
 #include <mach/jornada720.h>
-#include <mach/irqs.h>
 
 MODULE_AUTHOR("Kristoffer Ericson <[email protected]>");
 MODULE_DESCRIPTION("HP Jornada 710/720/728 touchscreen driver");
@@ -101,7 +100,11 @@ static int jornada720_ts_probe(struct platform_device *pdev)
 {
 	struct jornada_ts *jornada_ts;
 	struct input_dev *input_dev;
-	int error;
+	int error, irq;
+
+	irq = platform_get_irq(pdev, 0);
+	if (irq <= 0)
+		return irq < 0 ? irq : -EINVAL;
 
 	jornada_ts = devm_kzalloc(&pdev->dev, sizeof(*jornada_ts), GFP_KERNEL);
 	if (!jornada_ts)
@@ -125,8 +128,7 @@ static int jornada720_ts_probe(struct platform_device *pdev)
 	input_set_abs_params(input_dev, ABS_X, 270, 3900, 0, 0);
 	input_set_abs_params(input_dev, ABS_Y, 180, 3700, 0, 0);
 
-	error = devm_request_irq(&pdev->dev, IRQ_GPIO9,
-				 jornada720_ts_interrupt,
+	error = devm_request_irq(&pdev->dev, irq, jornada720_ts_interrupt,
 				 IRQF_TRIGGER_RISING,
 				 "HP7XX Touchscreen driver", pdev);
 	if (error) {
Signature · 7 lines
2.1.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
Signature · 1 line
Dmitry