OSDN Git Service

PCI: rpaphp: Correctly match ibm, my-drc-index to drc-name when using drc-info
authorTyrel Datwyler <tyreld@linux.ibm.com>
Mon, 11 Nov 2019 05:21:36 +0000 (23:21 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 4 Jan 2020 18:12:55 +0000 (19:12 +0100)
commit802534c0ffaeb0adb69a60c3727a66308909cd38
treef0bf25bfdebdc91737b8a464fddc66ecbe011c93
parent1dc37bd4750fa5f283fa889b648dc7b52d93f72b
PCI: rpaphp: Correctly match ibm, my-drc-index to drc-name when using drc-info

[ Upstream commit 4f9f2d3d7a434b7f882b72550194c9278f4a3925 ]

The newer ibm,drc-info property is a condensed description of the old
ibm,drc-* properties (ie. names, types, indexes, and power-domains).
When matching a drc-index to a drc-name we need to verify that the
index is within the start and last drc-index range and map it to a
drc-name using the drc-name-prefix and logical index.

Fix the mapping by checking that the index is within the range of the
current drc-info entry, and build the name from the drc-name-prefix
concatenated with the starting drc-name-suffix value and the sequential
index obtained by subtracting ibm,my-drc-index from this entries
drc-start-index.

Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/1573449697-5448-10-git-send-email-tyreld@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pci/hotplug/rpaphp_core.c