From: Zhang Zekun <zhangzekun11@huawei.com> hulk inclusion category: feature bugzilla: https://atomgit.com/src-openeuler/kernel/issues/20607 ---------------------------------------- Since we have remove the memory topo and acls feature in hisi_hbmdev we no longer need to create sysfs. So, remove the sysfs interface. Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com> onflicts: drivers/soc/hisilicon/hisi_hbmdev.c [context conflicts] Signed-off-by: Ziming Du <duziming2@Huawei.com> --- drivers/soc/hisilicon/hisi_hbmdev.c | 46 +++++++---------------------- 1 file changed, 11 insertions(+), 35 deletions(-) diff --git a/drivers/soc/hisilicon/hisi_hbmdev.c b/drivers/soc/hisilicon/hisi_hbmdev.c index 2c8e692d20a11..1728a5859721b 100644 --- a/drivers/soc/hisilicon/hisi_hbmdev.c +++ b/drivers/soc/hisilicon/hisi_hbmdev.c @@ -19,13 +19,8 @@ struct cdev_node { struct list_head clist; }; -struct memory_dev { - struct kobject *memdev_kobj; - struct cdev_node cdev_list; -}; - static struct mutex dev_lock; -static struct memory_dev *mdev; +struct cdev_node cdev_list; static int get_pxm(struct acpi_device *acpi_device, void *arg) { @@ -201,7 +196,7 @@ static int container_add(struct device *dev, void *data) return -ENOMEM; cnode->dev = dev; - list_add_tail(&cnode->clist, &mdev->cdev_list.clist); + list_add_tail(&cnode->clist, &cdev_list.clist); return 0; } @@ -210,7 +205,7 @@ static void container_remove(void) { struct cdev_node *cnode, *tmp; - list_for_each_entry_safe(cnode, tmp, &mdev->cdev_list.clist, clist) { + list_for_each_entry_safe(cnode, tmp, &cdev_list.clist, clist) { device_remove_file(cnode->dev, &dev_attr_state); device_remove_file(cnode->dev, &dev_attr_pxms); list_del(&cnode->clist); @@ -222,17 +217,17 @@ static int container_init(void) { struct cdev_node *cnode; - INIT_LIST_HEAD(&mdev->cdev_list.clist); + INIT_LIST_HEAD(&cdev_list.clist); if (bus_for_each_dev(&container_subsys, NULL, NULL, container_add)) { container_remove(); return -ENOMEM; } - if (list_empty(&mdev->cdev_list.clist)) + if (list_empty(&cdev_list.clist)) return -ENODEV; - list_for_each_entry(cnode, &mdev->cdev_list.clist, clist) { + list_for_each_entry(cnode, &cdev_list.clist, clist) { device_create_file(cnode->dev, &dev_attr_state); device_create_file(cnode->dev, &dev_attr_pxms); } @@ -245,41 +240,22 @@ static struct acpi_platform_list hbm_plat_info[] = { { } }; -static int __init mdev_init(void) +static int __init hbmdev_init(void) { - int ret; if (acpi_match_platform_list(hbm_plat_info) < 0) return 0; - mdev = kzalloc(sizeof(struct memory_dev), GFP_KERNEL); - if (!mdev) - return -ENOMEM; mutex_init(&dev_lock); - ret = container_init(); - if (ret) { - kfree(mdev); - return ret; - } - - mdev->memdev_kobj = kobject_create_and_add("hbm_memory", kernel_kobj); - if (!mdev->memdev_kobj) { - container_remove(); - kfree(mdev); - return -ENOMEM; - } - - return ret; + return container_init(); } -module_init(mdev_init); +module_init(hbmdev_init); -static void __exit mdev_exit(void) +static void __exit hbmdev_exit(void) { container_remove(); - kobject_put(mdev->memdev_kobj); - kfree(mdev); } -module_exit(mdev_exit); +module_exit(hbmdev_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Zhang Zekun <zhangzekun11@huawei.com>"); -- 2.43.0