mdev_sysfs.c (bdef2b7896df293736330eb6eb0f43947049b828) | mdev_sysfs.c (89345d5177aa0f6d678251e1e0870b0eeb1ab510) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * File attributes for Mediated devices 4 * 5 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. 6 * Author: Neo Jia <cjia@nvidia.com> 7 * Kirti Wankhede <kwankhede@nvidia.com> 8 */ --- 67 unchanged lines hidden (view full) --- 76static MDEV_TYPE_ATTR_WO(create); 77 78static void mdev_type_release(struct kobject *kobj) 79{ 80 struct mdev_type *type = to_mdev_type(kobj); 81 82 pr_debug("Releasing group %s\n", kobj->name); 83 /* Pairs with the get in add_mdev_supported_type() */ | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * File attributes for Mediated devices 4 * 5 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. 6 * Author: Neo Jia <cjia@nvidia.com> 7 * Kirti Wankhede <kwankhede@nvidia.com> 8 */ --- 67 unchanged lines hidden (view full) --- 76static MDEV_TYPE_ATTR_WO(create); 77 78static void mdev_type_release(struct kobject *kobj) 79{ 80 struct mdev_type *type = to_mdev_type(kobj); 81 82 pr_debug("Releasing group %s\n", kobj->name); 83 /* Pairs with the get in add_mdev_supported_type() */ |
84 mdev_put_parent(type->parent); | 84 put_device(type->parent->dev); |
85 kfree(type); 86} 87 88static struct kobj_type mdev_type_ktype = { 89 .sysfs_ops = &mdev_type_sysfs_ops, 90 .release = mdev_type_release, 91}; 92 --- 12 unchanged lines hidden (view full) --- 105 106 type = kzalloc(sizeof(*type), GFP_KERNEL); 107 if (!type) 108 return ERR_PTR(-ENOMEM); 109 110 type->kobj.kset = parent->mdev_types_kset; 111 type->parent = parent; 112 /* Pairs with the put in mdev_type_release() */ | 85 kfree(type); 86} 87 88static struct kobj_type mdev_type_ktype = { 89 .sysfs_ops = &mdev_type_sysfs_ops, 90 .release = mdev_type_release, 91}; 92 --- 12 unchanged lines hidden (view full) --- 105 106 type = kzalloc(sizeof(*type), GFP_KERNEL); 107 if (!type) 108 return ERR_PTR(-ENOMEM); 109 110 type->kobj.kset = parent->mdev_types_kset; 111 type->parent = parent; 112 /* Pairs with the put in mdev_type_release() */ |
113 mdev_get_parent(parent); | 113 get_device(parent->dev); |
114 type->type_group_id = type_group_id; 115 116 ret = kobject_init_and_add(&type->kobj, &mdev_type_ktype, NULL, 117 "%s-%s", dev_driver_string(parent->dev), 118 group->name); 119 if (ret) { 120 kobject_put(&type->kobj); 121 return ERR_PTR(ret); --- 164 unchanged lines hidden --- | 114 type->type_group_id = type_group_id; 115 116 ret = kobject_init_and_add(&type->kobj, &mdev_type_ktype, NULL, 117 "%s-%s", dev_driver_string(parent->dev), 118 group->name); 119 if (ret) { 120 kobject_put(&type->kobj); 121 return ERR_PTR(ret); --- 164 unchanged lines hidden --- |