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)
commit7dd3876205df92e07d824fe2264b38e0b8a9eec1
tree7e0ba019123eff817fd5ade7fe67a07cb780e3aa
parent053ca37c87af65f41f5842070c68aa53c3d035f5
PCI: kirin: Add dev struct for of_device_get_match_data()

Bean reported that a622435fbe1a ("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: a622435fbe1a ("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