plat.c (e47c018a0ee6962fe3dd895407e2c49538cc066d) | plat.c (8e75dff56e003cdd38643024c4f5f8ba227100c8) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * AMD HSMP Platform Driver 4 * Copyright (c) 2024, AMD. 5 * All Rights Reserved. 6 * 7 * This file provides platform device implementations. 8 */ --- 42 unchanged lines hidden (view full) --- 51} 52 53int hsmp_create_non_acpi_sysfs_if(struct device *dev) 54{ 55 const struct attribute_group **hsmp_attr_grps; 56 struct attribute_group *attr_grp; 57 u16 i; 58 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * AMD HSMP Platform Driver 4 * Copyright (c) 2024, AMD. 5 * All Rights Reserved. 6 * 7 * This file provides platform device implementations. 8 */ --- 42 unchanged lines hidden (view full) --- 51} 52 53int hsmp_create_non_acpi_sysfs_if(struct device *dev) 54{ 55 const struct attribute_group **hsmp_attr_grps; 56 struct attribute_group *attr_grp; 57 u16 i; 58 |
59 hsmp_attr_grps = devm_kcalloc(dev, plat_dev.num_sockets + 1, | 59 hsmp_attr_grps = devm_kcalloc(dev, hsmp_pdev.num_sockets + 1, |
60 sizeof(*hsmp_attr_grps), 61 GFP_KERNEL); 62 if (!hsmp_attr_grps) 63 return -ENOMEM; 64 65 /* Create a sysfs directory for each socket */ | 60 sizeof(*hsmp_attr_grps), 61 GFP_KERNEL); 62 if (!hsmp_attr_grps) 63 return -ENOMEM; 64 65 /* Create a sysfs directory for each socket */ |
66 for (i = 0; i < plat_dev.num_sockets; i++) { | 66 for (i = 0; i < hsmp_pdev.num_sockets; i++) { |
67 attr_grp = devm_kzalloc(dev, sizeof(struct attribute_group), 68 GFP_KERNEL); 69 if (!attr_grp) 70 return -ENOMEM; 71 | 67 attr_grp = devm_kzalloc(dev, sizeof(struct attribute_group), 68 GFP_KERNEL); 69 if (!attr_grp) 70 return -ENOMEM; 71 |
72 snprintf(plat_dev.sock[i].name, HSMP_ATTR_GRP_NAME_SIZE, "socket%u", (u8)i); 73 attr_grp->name = plat_dev.sock[i].name; | 72 snprintf(hsmp_pdev.sock[i].name, HSMP_ATTR_GRP_NAME_SIZE, "socket%u", (u8)i); 73 attr_grp->name = hsmp_pdev.sock[i].name; |
74 attr_grp->is_bin_visible = hsmp_is_sock_attr_visible; 75 hsmp_attr_grps[i] = attr_grp; 76 77 hsmp_create_attr_list(attr_grp, dev, i); 78 } 79 80 return device_add_groups(dev, hsmp_attr_grps); 81} --- 6 unchanged lines hidden (view full) --- 88 return false; 89} 90 91int init_platform_device(struct device *dev) 92{ 93 struct hsmp_socket *sock; 94 int ret, i; 95 | 74 attr_grp->is_bin_visible = hsmp_is_sock_attr_visible; 75 hsmp_attr_grps[i] = attr_grp; 76 77 hsmp_create_attr_list(attr_grp, dev, i); 78 } 79 80 return device_add_groups(dev, hsmp_attr_grps); 81} --- 6 unchanged lines hidden (view full) --- 88 return false; 89} 90 91int init_platform_device(struct device *dev) 92{ 93 struct hsmp_socket *sock; 94 int ret, i; 95 |
96 for (i = 0; i < plat_dev.num_sockets; i++) { | 96 for (i = 0; i < hsmp_pdev.num_sockets; i++) { |
97 if (!node_to_amd_nb(i)) 98 return -ENODEV; | 97 if (!node_to_amd_nb(i)) 98 return -ENODEV; |
99 sock = &plat_dev.sock[i]; | 99 sock = &hsmp_pdev.sock[i]; |
100 sock->root = node_to_amd_nb(i)->root; 101 sock->sock_ind = i; 102 sock->dev = dev; 103 sock->mbinfo.base_addr = SMN_HSMP_BASE; 104 sock->amd_hsmp_rdwr = amd_hsmp_pci_rdwr; 105 106 /* 107 * This is a transitional change from non-ACPI to ACPI, only --- 29 unchanged lines hidden --- | 100 sock->root = node_to_amd_nb(i)->root; 101 sock->sock_ind = i; 102 sock->dev = dev; 103 sock->mbinfo.base_addr = SMN_HSMP_BASE; 104 sock->amd_hsmp_rdwr = amd_hsmp_pci_rdwr; 105 106 /* 107 * This is a transitional change from non-ACPI to ACPI, only --- 29 unchanged lines hidden --- |