2
0

0011-fotg210-udc-Get-IRQ-using-platform_get_irq.patch 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. From eda686d41e298a9d16708d2ec8d12d8e682dd7ca Mon Sep 17 00:00:00 2001
  2. From: Linus Walleij <[email protected]>
  3. Date: Mon, 14 Nov 2022 12:52:01 +0100
  4. Subject: [PATCH 11/29] fotg210-udc: Get IRQ using platform_get_irq()
  5. The platform_get_irq() is necessary to use to get dynamic
  6. IRQ resolution when instantiating the device from the
  7. device tree. IRQs are not passed as resources in that
  8. case.
  9. Signed-off-by: Linus Walleij <[email protected]>
  10. Link: https://lore.kernel.org/r/[email protected]
  11. Signed-off-by: Greg Kroah-Hartman <[email protected]>
  12. ---
  13. --- a/drivers/usb/fotg210/fotg210-udc.c
  14. +++ b/drivers/usb/fotg210/fotg210-udc.c
  15. @@ -1157,10 +1157,11 @@ int fotg210_udc_remove(struct platform_d
  16. int fotg210_udc_probe(struct platform_device *pdev)
  17. {
  18. - struct resource *res, *ires;
  19. + struct resource *res;
  20. struct fotg210_udc *fotg210 = NULL;
  21. struct fotg210_ep *_ep[FOTG210_MAX_NUM_EP];
  22. struct device *dev = &pdev->dev;
  23. + int irq;
  24. int ret = 0;
  25. int i;
  26. @@ -1170,9 +1171,9 @@ int fotg210_udc_probe(struct platform_de
  27. return -ENODEV;
  28. }
  29. - ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
  30. - if (!ires) {
  31. - pr_err("platform_get_resource IORESOURCE_IRQ error.\n");
  32. + irq = platform_get_irq(pdev, 0);
  33. + if (irq < 0) {
  34. + pr_err("could not get irq\n");
  35. return -ENODEV;
  36. }
  37. @@ -1202,7 +1203,7 @@ int fotg210_udc_probe(struct platform_de
  38. goto err;
  39. }
  40. - fotg210->phy = devm_usb_get_phy_by_phandle(dev->parent, "usb-phy", 0);
  41. + fotg210->phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0);
  42. if (IS_ERR(fotg210->phy)) {
  43. ret = PTR_ERR(fotg210->phy);
  44. if (ret == -EPROBE_DEFER)
  45. @@ -1282,7 +1283,7 @@ int fotg210_udc_probe(struct platform_de
  46. fotg210_disable_unplug(fotg210);
  47. - ret = request_irq(ires->start, fotg210_irq, IRQF_SHARED,
  48. + ret = request_irq(irq, fotg210_irq, IRQF_SHARED,
  49. udc_name, fotg210);
  50. if (ret < 0) {
  51. dev_err(dev, "request_irq error (%d)\n", ret);
  52. @@ -1303,7 +1304,7 @@ int fotg210_udc_probe(struct platform_de
  53. err_add_udc:
  54. if (!IS_ERR_OR_NULL(fotg210->phy))
  55. usb_unregister_notifier(fotg210->phy, &fotg210_phy_notifier);
  56. - free_irq(ires->start, fotg210);
  57. + free_irq(irq, fotg210);
  58. err_req:
  59. fotg210_ep_free_request(&fotg210->ep[0]->ep, fotg210->ep0_req);