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

Configure Feed

Select the types of activity you want to include in your feed.

usb: Use device_get_match_data()

Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20231009211356.3242037-16-robh@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Rob Herring and committed by
Greg Kroah-Hartman
14485de4 c19473d2

+15 -34
+5 -6
drivers/usb/chipidea/ci_hdrc_usb2.c
··· 9 9 #include <linux/dma-mapping.h> 10 10 #include <linux/module.h> 11 11 #include <linux/of.h> 12 - #include <linux/of_platform.h> 13 12 #include <linux/phy/phy.h> 14 13 #include <linux/platform_device.h> 14 + #include <linux/property.h> 15 15 #include <linux/usb/chipidea.h> 16 16 #include <linux/usb/hcd.h> 17 17 #include <linux/usb/ulpi.h> ··· 51 51 struct device *dev = &pdev->dev; 52 52 struct ci_hdrc_usb2_priv *priv; 53 53 struct ci_hdrc_platform_data *ci_pdata = dev_get_platdata(dev); 54 + const struct ci_hdrc_platform_data *data; 54 55 int ret; 55 - const struct of_device_id *match; 56 56 57 57 if (!ci_pdata) { 58 58 ci_pdata = devm_kmalloc(dev, sizeof(*ci_pdata), GFP_KERNEL); ··· 61 61 *ci_pdata = ci_default_pdata; /* struct copy */ 62 62 } 63 63 64 - match = of_match_device(ci_hdrc_usb2_of_match, &pdev->dev); 65 - if (match && match->data) { 64 + data = device_get_match_data(&pdev->dev); 65 + if (data) 66 66 /* struct copy */ 67 - *ci_pdata = *(struct ci_hdrc_platform_data *)match->data; 68 - } 67 + *ci_pdata = *data; 69 68 70 69 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 71 70 if (!priv)
+6 -15
drivers/usb/dwc2/params.c
··· 5 5 6 6 #include <linux/kernel.h> 7 7 #include <linux/module.h> 8 - #include <linux/of_device.h> 8 + #include <linux/of.h> 9 9 #include <linux/usb/of.h> 10 10 #include <linux/pci_ids.h> 11 11 #include <linux/pci.h> ··· 968 968 969 969 int dwc2_init_params(struct dwc2_hsotg *hsotg) 970 970 { 971 - const struct of_device_id *match; 972 971 set_params_cb set_params; 973 972 974 973 dwc2_set_default_params(hsotg); 975 974 dwc2_get_device_properties(hsotg); 976 975 977 - match = of_match_device(dwc2_of_match_table, hsotg->dev); 978 - if (match && match->data) { 979 - set_params = match->data; 976 + set_params = device_get_match_data(hsotg->dev); 977 + if (set_params) { 980 978 set_params(hsotg); 981 - } else if (!match) { 982 - const struct acpi_device_id *amatch; 983 - const struct pci_device_id *pmatch = NULL; 984 - 985 - amatch = acpi_match_device(dwc2_acpi_match, hsotg->dev); 986 - if (amatch && amatch->driver_data) { 987 - set_params = (set_params_cb)amatch->driver_data; 988 - set_params(hsotg); 989 - } else if (!amatch) 990 - pmatch = pci_match_id(dwc2_pci_ids, to_pci_dev(hsotg->dev->parent)); 979 + } else { 980 + const struct pci_device_id *pmatch = 981 + pci_match_id(dwc2_pci_ids, to_pci_dev(hsotg->dev->parent)); 991 982 992 983 if (pmatch && pmatch->driver_data) { 993 984 set_params = (set_params_cb)pmatch->driver_data;
+3 -7
drivers/usb/gadget/udc/fsl_qe_udc.c
··· 27 27 #include <linux/interrupt.h> 28 28 #include <linux/io.h> 29 29 #include <linux/moduleparam.h> 30 + #include <linux/of.h> 30 31 #include <linux/of_address.h> 31 32 #include <linux/of_irq.h> 32 - #include <linux/of_platform.h> 33 + #include <linux/platform_device.h> 33 34 #include <linux/dma-mapping.h> 34 35 #include <linux/usb/ch9.h> 35 36 #include <linux/usb/gadget.h> ··· 2472 2471 static int qe_udc_probe(struct platform_device *ofdev) 2473 2472 { 2474 2473 struct qe_udc *udc; 2475 - const struct of_device_id *match; 2476 2474 struct device_node *np = ofdev->dev.of_node; 2477 2475 struct qe_ep *ep; 2478 2476 unsigned int ret = 0; 2479 2477 unsigned int i; 2480 2478 const void *prop; 2481 - 2482 - match = of_match_device(qe_udc_match, &ofdev->dev); 2483 - if (!match) 2484 - return -EINVAL; 2485 2479 2486 2480 prop = of_get_property(np, "mode", NULL); 2487 2481 if (!prop || strcmp(prop, "peripheral")) ··· 2489 2493 return -ENOMEM; 2490 2494 } 2491 2495 2492 - udc->soc_type = (unsigned long)match->data; 2496 + udc->soc_type = (unsigned long)device_get_match_data(&ofdev->dev); 2493 2497 udc->usb_regs = of_iomap(np, 0); 2494 2498 if (!udc->usb_regs) { 2495 2499 ret = -ENOMEM;
+1 -6
drivers/usb/misc/onboard_usb_hub.c
··· 240 240 241 241 static int onboard_hub_probe(struct platform_device *pdev) 242 242 { 243 - const struct of_device_id *of_id; 244 243 struct device *dev = &pdev->dev; 245 244 struct onboard_hub *hub; 246 245 unsigned int i; ··· 249 250 if (!hub) 250 251 return -ENOMEM; 251 252 252 - of_id = of_match_device(onboard_hub_match, &pdev->dev); 253 - if (!of_id) 254 - return -ENODEV; 255 - 256 - hub->pdata = of_id->data; 253 + hub->pdata = device_get_match_data(&pdev->dev); 257 254 if (!hub->pdata) 258 255 return -EINVAL; 259 256