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

PCI: designware-plat: Prefer of_device_get_match_data()

The designware-plat driver only needs the device data, not the whole struct
of_device_id. Use of_device_get_match_data() instead of of_match_device().
No functional change intended.

[bhelgaas: commit log]
Link: https://lore.kernel.org/r/20211223011054.1227810-5-helgaas@kernel.org
Signed-off-by: Fan Fei <ffclaire1224@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com>

authored by

Fan Fei and committed by
Bjorn Helgaas
5c204204 131748ad

+2 -4
+2 -4
drivers/pci/controller/dwc/pcie-designware-plat.c
··· 122 122 struct dw_plat_pcie *dw_plat_pcie; 123 123 struct dw_pcie *pci; 124 124 int ret; 125 - const struct of_device_id *match; 126 125 const struct dw_plat_pcie_of_data *data; 127 126 enum dw_pcie_device_mode mode; 128 127 129 - match = of_match_device(dw_plat_pcie_of_match, dev); 130 - if (!match) 128 + data = of_device_get_match_data(dev); 129 + if (!data) 131 130 return -EINVAL; 132 131 133 - data = (struct dw_plat_pcie_of_data *)match->data; 134 132 mode = (enum dw_pcie_device_mode)data->mode; 135 133 136 134 dw_plat_pcie = devm_kzalloc(dev, sizeof(*dw_plat_pcie), GFP_KERNEL);