]> git.baikalelectronics.ru Git - kernel.git/commit
PCI: kirin: Add dev struct for of_device_get_match_data()
authorBjorn Helgaas <bhelgaas@google.com>
Wed, 2 Feb 2022 15:52:41 +0000 (09:52 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 4 Feb 2022 21:14:26 +0000 (15:14 -0600)
commit0d7f8edfe68759f41cf1aa155942a1166f31a4a7
tree7e0ba019123eff817fd5ade7fe67a07cb780e3aa
parent2a69046b39d1c8e0f4e6a65a2e6c23e28ffd3174
PCI: kirin: Add dev struct for of_device_get_match_data()

Bean reported that 757b95d2cc8f ("PCI: kirin: Prefer
of_device_get_match_data()") broke kirin_pcie_probe() because it assumed
match data of 0 was a failure when in fact, it meant the match data was
"(void *)PCIE_KIRIN_INTERNAL_PHY".

Therefore, probing of "hisilicon,kirin960-pcie" devices failed with -EINVAL
and an "OF data missing" message.

Add a struct kirin_pcie_data to encode the PHY type.  Then the result of
of_device_get_match_data() should always be a non-NULL pointer to a struct
kirin_pcie_data that contains the PHY type.

Fixes: 757b95d2cc8f ("PCI: kirin: Prefer of_device_get_match_data()")
Link: https://lore.kernel.org/r/20220202162659.GA12603@bhelgaas
Link: https://lore.kernel.org/r/20220201215941.1203155-1-huobean@gmail.com
Reported-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/controller/dwc/pcie-kirin.c