Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: dwc3: Drop unneeded calls to platform_get_resource_byname()

Drop unneeded calls to platform_get_resource_byname() from
dwc3_host_init(). dwc3_host_init() already calls dwc3_host_get_irq()
which gets the irq number, just use this to get the IRQ resource data
and fill the xhci_resources[1]

Reviewed-by: Roger Quadros <rogerq@kernel.org>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://lore.kernel.org/r/20211220010411.12075-4-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Lad Prabhakar and committed by
Greg Kroah-Hartman
74b39dfa 22ae6415

+26 -19
+26 -19
drivers/usb/dwc3/host.c
··· 8 8 */ 9 9 10 10 #include <linux/acpi.h> 11 + #include <linux/irq.h> 12 + #include <linux/of.h> 11 13 #include <linux/platform_device.h> 12 14 13 15 #include "core.h" 16 + 17 + static void dwc3_host_fill_xhci_irq_res(struct dwc3 *dwc, 18 + int irq, char *name) 19 + { 20 + struct platform_device *pdev = to_platform_device(dwc->dev); 21 + struct device_node *np = dev_of_node(&pdev->dev); 22 + 23 + dwc->xhci_resources[1].start = irq; 24 + dwc->xhci_resources[1].end = irq; 25 + dwc->xhci_resources[1].flags = IORESOURCE_IRQ | irq_get_trigger_type(irq); 26 + if (!name && np) 27 + dwc->xhci_resources[1].name = of_node_full_name(pdev->dev.of_node); 28 + else 29 + dwc->xhci_resources[1].name = name; 30 + } 14 31 15 32 static int dwc3_host_get_irq(struct dwc3 *dwc) 16 33 { ··· 35 18 int irq; 36 19 37 20 irq = platform_get_irq_byname_optional(dwc3_pdev, "host"); 38 - if (irq > 0) 21 + if (irq > 0) { 22 + dwc3_host_fill_xhci_irq_res(dwc, irq, "host"); 39 23 goto out; 24 + } 40 25 41 26 if (irq == -EPROBE_DEFER) 42 27 goto out; 43 28 44 29 irq = platform_get_irq_byname_optional(dwc3_pdev, "dwc_usb3"); 45 - if (irq > 0) 30 + if (irq > 0) { 31 + dwc3_host_fill_xhci_irq_res(dwc, irq, "dwc_usb3"); 46 32 goto out; 33 + } 47 34 48 35 if (irq == -EPROBE_DEFER) 49 36 goto out; 50 37 51 38 irq = platform_get_irq(dwc3_pdev, 0); 52 - if (irq > 0) 39 + if (irq > 0) { 40 + dwc3_host_fill_xhci_irq_res(dwc, irq, NULL); 53 41 goto out; 42 + } 54 43 55 44 if (!irq) 56 45 irq = -EINVAL; ··· 70 47 struct property_entry props[4]; 71 48 struct platform_device *xhci; 72 49 int ret, irq; 73 - struct resource *res; 74 - struct platform_device *dwc3_pdev = to_platform_device(dwc->dev); 75 50 int prop_idx = 0; 76 51 77 52 irq = dwc3_host_get_irq(dwc); 78 53 if (irq < 0) 79 54 return irq; 80 - 81 - res = platform_get_resource_byname(dwc3_pdev, IORESOURCE_IRQ, "host"); 82 - if (!res) 83 - res = platform_get_resource_byname(dwc3_pdev, IORESOURCE_IRQ, 84 - "dwc_usb3"); 85 - if (!res) 86 - res = platform_get_resource(dwc3_pdev, IORESOURCE_IRQ, 0); 87 - if (!res) 88 - return -ENOMEM; 89 - 90 - dwc->xhci_resources[1].start = irq; 91 - dwc->xhci_resources[1].end = irq; 92 - dwc->xhci_resources[1].flags = res->flags; 93 - dwc->xhci_resources[1].name = res->name; 94 55 95 56 xhci = platform_device_alloc("xhci-hcd", PLATFORM_DEVID_AUTO); 96 57 if (!xhci) {