Lines Matching refs:mdev
22 struct hidma_mgmt_dev *mdev; member
30 int (*get)(struct hidma_mgmt_dev *mdev);
31 int (*set)(struct hidma_mgmt_dev *mdev, u64 val);
35 static int get_##name(struct hidma_mgmt_dev *mdev) \
37 return mdev->name; \
39 static int set_##name(struct hidma_mgmt_dev *mdev, u64 val) \
44 tmp = mdev->name; \
45 mdev->name = val; \
46 rc = hidma_mgmt_setup(mdev); \
48 mdev->name = tmp; \
64 static int set_priority(struct hidma_mgmt_dev *mdev, unsigned int i, u64 val) in IMPLEMENT_GETSET()
69 if (i >= mdev->dma_channels) in IMPLEMENT_GETSET()
72 tmp = mdev->priority[i]; in IMPLEMENT_GETSET()
73 mdev->priority[i] = val; in IMPLEMENT_GETSET()
74 rc = hidma_mgmt_setup(mdev); in IMPLEMENT_GETSET()
76 mdev->priority[i] = tmp; in IMPLEMENT_GETSET()
80 static int set_weight(struct hidma_mgmt_dev *mdev, unsigned int i, u64 val) in set_weight() argument
85 if (i >= mdev->dma_channels) in set_weight()
88 tmp = mdev->weight[i]; in set_weight()
89 mdev->weight[i] = val; in set_weight()
90 rc = hidma_mgmt_setup(mdev); in set_weight()
92 mdev->weight[i] = tmp; in set_weight()
110 struct hidma_mgmt_dev *mdev = dev_get_drvdata(dev); in show_values() local
117 sprintf(buf, "%d\n", hidma_mgmt_files[i].get(mdev)); in show_values()
127 struct hidma_mgmt_dev *mdev = dev_get_drvdata(dev); in set_values() local
138 rc = hidma_mgmt_files[i].set(mdev, tmp); in set_values()
152 struct hidma_mgmt_dev *mdev; in show_values_channel() local
156 mdev = chattr->mdev; in show_values_channel()
158 sprintf(buf, "%d\n", mdev->priority[chattr->index]); in show_values_channel()
160 sprintf(buf, "%d\n", mdev->weight[chattr->index]); in show_values_channel()
170 struct hidma_mgmt_dev *mdev; in set_values_channel() local
175 mdev = chattr->mdev; in set_values_channel()
182 rc = set_priority(mdev, chattr->index, tmp); in set_values_channel()
186 rc = set_weight(mdev, chattr->index, tmp); in set_values_channel()
216 static int create_sysfs_entry_channel(struct hidma_mgmt_dev *mdev, char *name, in create_sysfs_entry_channel() argument
223 chattr = devm_kmalloc(&mdev->pdev->dev, sizeof(*chattr), GFP_KERNEL); in create_sysfs_entry_channel()
227 name_copy = devm_kstrdup(&mdev->pdev->dev, name, GFP_KERNEL); in create_sysfs_entry_channel()
231 chattr->mdev = mdev; in create_sysfs_entry_channel()
242 int hidma_mgmt_init_sys(struct hidma_mgmt_dev *mdev) in hidma_mgmt_init_sys() argument
249 required = sizeof(*mdev->chroots) * mdev->dma_channels; in hidma_mgmt_init_sys()
250 mdev->chroots = devm_kmalloc(&mdev->pdev->dev, required, GFP_KERNEL); in hidma_mgmt_init_sys()
251 if (!mdev->chroots) in hidma_mgmt_init_sys()
254 chanops = kobject_create_and_add("chanops", &mdev->pdev->dev.kobj); in hidma_mgmt_init_sys()
259 for (i = 0; i < mdev->dma_channels; i++) { in hidma_mgmt_init_sys()
263 mdev->chroots[i] = kobject_create_and_add(name, chanops); in hidma_mgmt_init_sys()
264 if (!mdev->chroots[i]) in hidma_mgmt_init_sys()
270 rc = create_sysfs_entry(mdev, hidma_mgmt_files[i].name, in hidma_mgmt_init_sys()
277 for (i = 0; i < mdev->dma_channels; i++) { in hidma_mgmt_init_sys()
278 rc = create_sysfs_entry_channel(mdev, "priority", in hidma_mgmt_init_sys()
280 mdev->chroots[i]); in hidma_mgmt_init_sys()
284 rc = create_sysfs_entry_channel(mdev, "weight", in hidma_mgmt_init_sys()
286 mdev->chroots[i]); in hidma_mgmt_init_sys()