mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: udc: snps_udc_plat: use platform_get_irq for IRQ lookup
@ 2026-11-11  2:32 Rosen Penev
  0 siblings, 0 replies; only message in thread
From: Rosen Penev @ 2026-11-11  2:32 UTC (permalink / raw)
  To: Neill Kapron, Greg Kroah-Hartman; +Cc: linux-usb, linux-kernel

Replace irq_of_parse_and_map() with platform_get_irq() and move the
IRQ acquisition to the top of the probe function, before any resource
allocation. This provides proper error propagation including
-EPROBE_DEFER support and removes the need for a manual error message.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/usb/gadget/udc/snps_udc_plat.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/udc/snps_udc_plat.c b/drivers/usb/gadget/udc/snps_udc_plat.c
index 3687690ca33d..38aa077a56b5 100644
--- a/drivers/usb/gadget/udc/snps_udc_plat.c
+++ b/drivers/usb/gadget/udc/snps_udc_plat.c
@@ -102,8 +102,13 @@ static int udc_plat_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct resource *res;
 	struct udc *udc;
+	int irq;
 	int ret;
 
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0)
+		return irq;
+
 	udc = devm_kzalloc_obj(dev, *udc);
 	if (!udc)
 		return -ENOMEM;
@@ -130,11 +135,7 @@ static int udc_plat_probe(struct platform_device *pdev)
 
 	udc->phys_addr = (unsigned long)res->start;
 
-	udc->irq = irq_of_parse_and_map(dev->of_node, 0);
-	if (udc->irq <= 0) {
-		dev_err(dev, "Can't parse and map interrupt\n");
-		return -EINVAL;
-	}
+	udc->irq = irq;
 
 	udc->udc_phy = devm_of_phy_get_by_index(dev, dev->of_node, 0);
 	if (IS_ERR(udc->udc_phy)) {
-- 
2.56.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-11  2:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-11  2:32 [PATCH] usb: gadget: udc: snps_udc_plat: use platform_get_irq for IRQ lookup Rosen Penev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®