mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 19:43:40 +02:00
cxl fixes for v7.1-rc6
cxl/test: Update mock dev array before calling platform_device_add() -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE5DAy15EJMCV1R6v9YGjFFmlTOEoFAmoZsZYACgkQYGjFFmlT OEqWGQ//dw5RvgcSxTF9+bUE/kyBJD37UfsmUXMAbC8AhVbBgQsXaWUM72azi/s2 Ht+lYgQbtyGC5RmK+A0GCOLh6UtYP3WW49eii7otbJUafdbXHwNiTxdkUXCqX2Mn voE5Sw8bClNq3g2dIQuXDAPi0AFYzpMpvqjyzB8v1BzxqrFCZm8IUIubjcPwsan1 E6vQZ0arAGBqgWsbYyOkvWHHyhKIp7ymI2yQ8xljjoPeqHvcVbpFeJUSwS1XDh0d HciWK0VQZhRvonP5xM7lJLN5RMIBXBnPk98LWQO4xgmxuKOxVkxapsHY2yfrzkE3 PFqlVgddPN/wT3XgPXP/1B2TvqqPJEUHImU8YlMNL3PT6IJhhyNcf5qbvr29rdSq T2ysQCDrBZDXe4FqvVc02JkUuY9/yJ83Z4CY6iTRCSUIuAMk5dL0Y4dOA/O1hLbc fnxbbj0bV9tgpjt2bOyPqcs/3p7eRkteJHJ8FoCyZFBdGk2hROoyD3vvCH8DI10/ kZ/ZUnLuBYxRIDwSIbv9yIsTKHz9eO58gBrf3zEm/1HuWY0e4R4CCllGKrwiBJ89 Q+TpJwCWQ7nwyf5uhI3WK2dAAZO22U+rW1noGLbbRTDX66HSFVk1dUXqPw9p7V4R AiaJksa0apPSp69wiVeBy2rVZz3lxSnRlvCvKra7qZ26N45iqFw= =a0MQ -----END PGP SIGNATURE----- Merge tag 'cxl-fixes-7.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl Pull Compute Express Link (CXL) fixes from Dave Jiang: - cxl/test: update mock dev array before calling platform_device_add() * tag 'cxl-fixes-7.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl: cxl/test: Update mock dev array before calling platform_device_add()
This commit is contained in:
commit
3101173200
|
|
@ -1523,6 +1523,23 @@ static void mock_companion(struct acpi_device *adev, struct device *dev)
|
|||
#define SZ_64G (SZ_32G * 2)
|
||||
#endif
|
||||
|
||||
static int cxl_mock_platform_device_add(struct platform_device *pdev,
|
||||
struct platform_device **ppdev)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (ppdev)
|
||||
*ppdev = pdev;
|
||||
rc = platform_device_add(pdev);
|
||||
if (rc) {
|
||||
platform_device_put(pdev);
|
||||
if (ppdev)
|
||||
*ppdev = NULL;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static __init int cxl_rch_topo_init(void)
|
||||
{
|
||||
int rc, i;
|
||||
|
|
@ -1537,13 +1554,10 @@ static __init int cxl_rch_topo_init(void)
|
|||
goto err_bridge;
|
||||
|
||||
mock_companion(adev, &pdev->dev);
|
||||
rc = platform_device_add(pdev);
|
||||
if (rc) {
|
||||
platform_device_put(pdev);
|
||||
rc = cxl_mock_platform_device_add(pdev, &cxl_rch[i]);
|
||||
if (rc)
|
||||
goto err_bridge;
|
||||
}
|
||||
|
||||
cxl_rch[i] = pdev;
|
||||
mock_pci_bus[idx].bridge = &pdev->dev;
|
||||
rc = sysfs_create_link(&pdev->dev.kobj, &pdev->dev.kobj,
|
||||
"firmware_node");
|
||||
|
|
@ -1595,13 +1609,10 @@ static __init int cxl_single_topo_init(void)
|
|||
goto err_bridge;
|
||||
|
||||
mock_companion(adev, &pdev->dev);
|
||||
rc = platform_device_add(pdev);
|
||||
if (rc) {
|
||||
platform_device_put(pdev);
|
||||
rc = cxl_mock_platform_device_add(pdev, &cxl_hb_single[i]);
|
||||
if (rc)
|
||||
goto err_bridge;
|
||||
}
|
||||
|
||||
cxl_hb_single[i] = pdev;
|
||||
mock_pci_bus[i + NR_CXL_HOST_BRIDGES].bridge = &pdev->dev;
|
||||
rc = sysfs_create_link(&pdev->dev.kobj, &pdev->dev.kobj,
|
||||
"physical_node");
|
||||
|
|
@ -1620,12 +1631,9 @@ static __init int cxl_single_topo_init(void)
|
|||
goto err_port;
|
||||
pdev->dev.parent = &bridge->dev;
|
||||
|
||||
rc = platform_device_add(pdev);
|
||||
if (rc) {
|
||||
platform_device_put(pdev);
|
||||
rc = cxl_mock_platform_device_add(pdev, &cxl_root_single[i]);
|
||||
if (rc)
|
||||
goto err_port;
|
||||
}
|
||||
cxl_root_single[i] = pdev;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(cxl_swu_single); i++) {
|
||||
|
|
@ -1638,12 +1646,9 @@ static __init int cxl_single_topo_init(void)
|
|||
goto err_uport;
|
||||
pdev->dev.parent = &root_port->dev;
|
||||
|
||||
rc = platform_device_add(pdev);
|
||||
if (rc) {
|
||||
platform_device_put(pdev);
|
||||
rc = cxl_mock_platform_device_add(pdev, &cxl_swu_single[i]);
|
||||
if (rc)
|
||||
goto err_uport;
|
||||
}
|
||||
cxl_swu_single[i] = pdev;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(cxl_swd_single); i++) {
|
||||
|
|
@ -1657,12 +1662,9 @@ static __init int cxl_single_topo_init(void)
|
|||
goto err_dport;
|
||||
pdev->dev.parent = &uport->dev;
|
||||
|
||||
rc = platform_device_add(pdev);
|
||||
if (rc) {
|
||||
platform_device_put(pdev);
|
||||
rc = cxl_mock_platform_device_add(pdev, &cxl_swd_single[i]);
|
||||
if (rc)
|
||||
goto err_dport;
|
||||
}
|
||||
cxl_swd_single[i] = pdev;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -1735,12 +1737,9 @@ static int cxl_mem_init(void)
|
|||
pdev->dev.parent = &dport->dev;
|
||||
set_dev_node(&pdev->dev, i % 2);
|
||||
|
||||
rc = platform_device_add(pdev);
|
||||
if (rc) {
|
||||
platform_device_put(pdev);
|
||||
rc = cxl_mock_platform_device_add(pdev, &cxl_mem[i]);
|
||||
if (rc)
|
||||
goto err_mem;
|
||||
}
|
||||
cxl_mem[i] = pdev;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(cxl_mem_single); i++) {
|
||||
|
|
@ -1753,12 +1752,9 @@ static int cxl_mem_init(void)
|
|||
pdev->dev.parent = &dport->dev;
|
||||
set_dev_node(&pdev->dev, i % 2);
|
||||
|
||||
rc = platform_device_add(pdev);
|
||||
if (rc) {
|
||||
platform_device_put(pdev);
|
||||
rc = cxl_mock_platform_device_add(pdev, &cxl_mem_single[i]);
|
||||
if (rc)
|
||||
goto err_single;
|
||||
}
|
||||
cxl_mem_single[i] = pdev;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(cxl_rcd); i++) {
|
||||
|
|
@ -1772,12 +1768,9 @@ static int cxl_mem_init(void)
|
|||
pdev->dev.parent = &rch->dev;
|
||||
set_dev_node(&pdev->dev, i % 2);
|
||||
|
||||
rc = platform_device_add(pdev);
|
||||
if (rc) {
|
||||
platform_device_put(pdev);
|
||||
rc = cxl_mock_platform_device_add(pdev, &cxl_rcd[i]);
|
||||
if (rc)
|
||||
goto err_rcd;
|
||||
}
|
||||
cxl_rcd[i] = pdev;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -1869,13 +1862,10 @@ static __init int cxl_test_init(void)
|
|||
goto err_bridge;
|
||||
|
||||
mock_companion(adev, &pdev->dev);
|
||||
rc = platform_device_add(pdev);
|
||||
if (rc) {
|
||||
platform_device_put(pdev);
|
||||
rc = cxl_mock_platform_device_add(pdev, &cxl_host_bridge[i]);
|
||||
if (rc)
|
||||
goto err_bridge;
|
||||
}
|
||||
|
||||
cxl_host_bridge[i] = pdev;
|
||||
mock_pci_bus[i].bridge = &pdev->dev;
|
||||
rc = sysfs_create_link(&pdev->dev.kobj, &pdev->dev.kobj,
|
||||
"physical_node");
|
||||
|
|
@ -1893,12 +1883,9 @@ static __init int cxl_test_init(void)
|
|||
goto err_port;
|
||||
pdev->dev.parent = &bridge->dev;
|
||||
|
||||
rc = platform_device_add(pdev);
|
||||
if (rc) {
|
||||
platform_device_put(pdev);
|
||||
rc = cxl_mock_platform_device_add(pdev, &cxl_root_port[i]);
|
||||
if (rc)
|
||||
goto err_port;
|
||||
}
|
||||
cxl_root_port[i] = pdev;
|
||||
}
|
||||
|
||||
BUILD_BUG_ON(ARRAY_SIZE(cxl_switch_uport) != ARRAY_SIZE(cxl_root_port));
|
||||
|
|
@ -1911,12 +1898,9 @@ static __init int cxl_test_init(void)
|
|||
goto err_uport;
|
||||
pdev->dev.parent = &root_port->dev;
|
||||
|
||||
rc = platform_device_add(pdev);
|
||||
if (rc) {
|
||||
platform_device_put(pdev);
|
||||
rc = cxl_mock_platform_device_add(pdev, &cxl_switch_uport[i]);
|
||||
if (rc)
|
||||
goto err_uport;
|
||||
}
|
||||
cxl_switch_uport[i] = pdev;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(cxl_switch_dport); i++) {
|
||||
|
|
@ -1929,12 +1913,9 @@ static __init int cxl_test_init(void)
|
|||
goto err_dport;
|
||||
pdev->dev.parent = &uport->dev;
|
||||
|
||||
rc = platform_device_add(pdev);
|
||||
if (rc) {
|
||||
platform_device_put(pdev);
|
||||
rc = cxl_mock_platform_device_add(pdev, &cxl_switch_dport[i]);
|
||||
if (rc)
|
||||
goto err_dport;
|
||||
}
|
||||
cxl_switch_dport[i] = pdev;
|
||||
}
|
||||
|
||||
rc = cxl_single_topo_init();
|
||||
|
|
@ -1953,9 +1934,9 @@ static __init int cxl_test_init(void)
|
|||
acpi0017_mock.dev.bus = &platform_bus_type;
|
||||
cxl_acpi->dev.groups = cxl_acpi_groups;
|
||||
|
||||
rc = platform_device_add(cxl_acpi);
|
||||
rc = cxl_mock_platform_device_add(cxl_acpi, NULL);
|
||||
if (rc)
|
||||
goto err_root;
|
||||
goto err_rch;
|
||||
|
||||
rc = cxl_mem_init();
|
||||
if (rc)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user