Skip to contentSkip to conversation

usb: at91-udc: fix irq and iomem resource retrieval

PATCH New Jean-Jacques Hiblot 4 participants 8 messages Jan 23, 2014 – Mar 12, 2014

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

PATCH 1/1 usb: at91-udc: fix irq and iomem resource retrieval

When using dt resources retrieval (interrupts and reg properties) there is no predefined order for these resources in the platform dev resource table. Also don't expect the number of resource to be always 2.

---
 drivers/usb/gadget/at91_udc.c | 10 ----------
 1 file changed, 10 deletions(-)
drivers/usb/gadget/at91_udc.c +0 -10
index 4cc4fd6..dfd2943 100644
@@ -1710,16 +1710,6 @@ static int at91udc_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	if (pdev->num_resources != 2) {
-		DBG("invalid num_resources\n");
-		return -ENODEV;
-	}
-	if ((pdev->resource[0].flags != IORESOURCE_MEM)
-			|| (pdev->resource[1].flags != IORESOURCE_IRQ)) {
-		DBG("invalid resource type\n");
-		return -ENODEV;
-	}
-
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res)
 		return -ENXIO;
Signature · 1 line
1.8.5.2
#1 lore raw

PATCH 1/1 usb: at91-udc: fix irq and iomem resource retrieval

On 23/01/2014 15:41, Jean-Jacques Hiblot :

Quoted 5 lines

When using dt resources retrieval (interrupts and reg properties) there is no predefined order for these resources in the platform dev resource table. Also don't expect the number of resource to be always 2.

Yes, indeed.

Maybe we can also add a "stable" tag to it. Looking at the history of this file, I think that we can add a pretty old stable limit... But as it only makes sense with DT, I would advice something like this, for the 3.4-ish timeframe:

Cc stable <[email protected]> # 3.4

Bye,

Quoted 26 lines
---
 drivers/usb/gadget/at91_udc.c | 10 ----------
 1 file changed, 10 deletions(-)
drivers/usb/gadget/at91_udc.c +0 -10
index 4cc4fd6..dfd2943 100644
@@ -1710,16 +1710,6 @@ static int at91udc_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	if (pdev->num_resources != 2) {
-		DBG("invalid num_resources\n");
-		return -ENODEV;
-	}
-	if ((pdev->resource[0].flags != IORESOURCE_MEM)
-			|| (pdev->resource[1].flags != IORESOURCE_IRQ)) {
-		DBG("invalid resource type\n");
-		return -ENODEV;
-	}
-
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res)
 		return -ENXIO;
Signature · 1 line
Nicolas Ferre
#2 lore raw

PATCH 1/1 usb: at91-udc: fix irq and iomem resource retrieval

Quoted 6 lines · Nicolas Ferre

On 23/01/2014 15:41, Jean-Jacques Hiblot :

Quoted 5 lines

When using dt resources retrieval (interrupts and reg properties) there is no predefined order for these resources in the platform dev resource table. Also don't expect the number of resource to be always 2.

Quoted 40 lines

Yes, indeed.

Maybe we can also add a "stable" tag to it. Looking at the history of this file, I think that we can add a pretty old stable limit... But as it only makes sense with DT, I would advice something like this, for the 3.4-ish timeframe:

Cc stable <[email protected]> # 3.4

Bye,

Quoted 26 lines
---
  drivers/usb/gadget/at91_udc.c | 10 ----------
  1 file changed, 10 deletions(-)
drivers/usb/gadget/at91_udc.c +0 -10
index 4cc4fd6..dfd2943 100644
@@ -1710,16 +1710,6 @@ static int at91udc_probe(struct platform_device *pdev)
  		return -ENODEV;
  	}
 
-	if (pdev->num_resources != 2) {
-		DBG("invalid num_resources\n");
-		return -ENODEV;
-	}
-	if ((pdev->resource[0].flags != IORESOURCE_MEM)
-			|| (pdev->resource[1].flags != IORESOURCE_IRQ)) {
-		DBG("invalid resource type\n");
-		return -ENODEV;
-	}
-
  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  	if (!res)
  		return -ENXIO;
#3 lore raw

PATCH RESEND 1/1 usb: at91-udc: fix irq and iomem resource retrieval

In reply to Jean-Jacques Hiblot

From: Jean-Jacques Hiblot <[email protected]>

When using dt resources retrieval (interrupts and reg properties) there is no predefined order for these resources in the platform dev resource table. Also don't expect the number of resource to be always 2.

---
 drivers/usb/gadget/at91_udc.c | 10 ----------
 1 file changed, 10 deletions(-)
drivers/usb/gadget/at91_udc.c +0 -10
index cea8c20a1425..1926925a52a9 100644
@@ -1709,16 +1709,6 @@ static int at91udc_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	if (pdev->num_resources != 2) {
-		DBG("invalid num_resources\n");
-		return -ENODEV;
-	}
-	if ((pdev->resource[0].flags != IORESOURCE_MEM)
-			|| (pdev->resource[1].flags != IORESOURCE_IRQ)) {
-		DBG("invalid resource type\n");
-		return -ENODEV;
-	}
-
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res)
 		return -ENXIO;
Signature · 1 line
1.8.2.2
#4 lore raw

On 12/02/2014 14:03, Nicolas Ferre :

Quoted 10 lines

From: Jean-Jacques Hiblot <[email protected]>

When using dt resources retrieval (interrupts and reg properties) there is no predefined order for these resources in the platform dev resource table. Also don't expect the number of resource to be always 2.

Gentle ping, after having resent the patch itself.

Quoted 26 lines
---
 drivers/usb/gadget/at91_udc.c | 10 ----------
 1 file changed, 10 deletions(-)
drivers/usb/gadget/at91_udc.c +0 -10
index cea8c20a1425..1926925a52a9 100644
@@ -1709,16 +1709,6 @@ static int at91udc_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	if (pdev->num_resources != 2) {
-		DBG("invalid num_resources\n");
-		return -ENODEV;
-	}
-	if ((pdev->resource[0].flags != IORESOURCE_MEM)
-			|| (pdev->resource[1].flags != IORESOURCE_IRQ)) {
-		DBG("invalid resource type\n");
-		return -ENODEV;
-	}
-
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res)
 		return -ENXIO;
Signature · 1 line
Nicolas Ferre
#5 lore raw
Quoted 7 lines · Nicolas Ferre

On 12/02/2014 14:03, Nicolas Ferre :

Quoted 6 lines

From: Jean-Jacques Hiblot <[email protected]>

When using dt resources retrieval (interrupts and reg properties) there is no predefined order for these resources in the platform dev resource table. Also don't expect the number of resource to be always 2.

Quoted 6 lines
Quoted 4 lines

Gentle ping, after having resent the patch itself.

It helps if you send it to the correct maintainer, remember, scripts/get_maintainer.pl is your friend...

#6 lore raw

On 12/03/2014 16:31, Greg Kroah-Hartman :

Quoted 13 lines · Nicolas Ferre
Quoted 12 lines

On 12/02/2014 14:03, Nicolas Ferre :

Quoted 10 lines

From: Jean-Jacques Hiblot <[email protected]>

When using dt resources retrieval (interrupts and reg properties) there is no predefined order for these resources in the platform dev resource table. Also don't expect the number of resource to be always 2.

Quoted 4 lines
Quoted 1 line

Gentle ping, after having resent the patch itself.

It helps if you send it to the correct maintainer, remember, scripts/get_maintainer.pl is your friend...

Indeed. I add Felipe to my next attempt: sorry for the (repeated) noise.

Bye,

Signature · 1 line
Nicolas Ferre
#7 lore raw

PATCH RESEND 1/1 usb: at91-udc: fix irq and iomem resource retrieval

In reply to Jean-Jacques Hiblot

From: Jean-Jacques Hiblot <[email protected]>

When using dt resources retrieval (interrupts and reg properties) there is no predefined order for these resources in the platform dev resource table. Also don't expect the number of resource to be always 2.

---
 drivers/usb/gadget/at91_udc.c | 10 ----------
 1 file changed, 10 deletions(-)
drivers/usb/gadget/at91_udc.c +0 -10
index cea8c20a1425..1926925a52a9 100644
@@ -1709,16 +1709,6 @@ static int at91udc_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	if (pdev->num_resources != 2) {
-		DBG("invalid num_resources\n");
-		return -ENODEV;
-	}
-	if ((pdev->resource[0].flags != IORESOURCE_MEM)
-			|| (pdev->resource[1].flags != IORESOURCE_IRQ)) {
-		DBG("invalid resource type\n");
-		return -ENODEV;
-	}
-
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res)
 		return -ENXIO;
Signature · 1 line
1.8.2.2