Lines Matching refs:mdev
14 struct hidma_mgmt_dev *mdev; member
22 int (*get)(struct hidma_mgmt_dev *mdev);
23 int (*set)(struct hidma_mgmt_dev *mdev, u64 val);
27 static int get_##name(struct hidma_mgmt_dev *mdev) \
29 return mdev->name; \
31 static int set_##name(struct hidma_mgmt_dev *mdev, u64 val) \
36 tmp = mdev->name; \
37 mdev->name = val; \
38 rc = hidma_mgmt_setup(mdev); \
40 mdev->name = tmp; \
56 static int set_priority(struct hidma_mgmt_dev *mdev, unsigned int i, u64 val) in IMPLEMENT_GETSET()
61 if (i >= mdev->dma_channels) in IMPLEMENT_GETSET()
64 tmp = mdev->priority[i]; in IMPLEMENT_GETSET()
65 mdev->priority[i] = val; in IMPLEMENT_GETSET()
66 rc = hidma_mgmt_setup(mdev); in IMPLEMENT_GETSET()
68 mdev->priority[i] = tmp; in IMPLEMENT_GETSET()
72 static int set_weight(struct hidma_mgmt_dev *mdev, unsigned int i, u64 val) in set_weight() argument
77 if (i >= mdev->dma_channels) in set_weight()
80 tmp = mdev->weight[i]; in set_weight()
81 mdev->weight[i] = val; in set_weight()
82 rc = hidma_mgmt_setup(mdev); in set_weight()
84 mdev->weight[i] = tmp; in set_weight()
102 struct hidma_mgmt_dev *mdev = dev_get_drvdata(dev); in show_values() local
109 sprintf(buf, "%d\n", hidma_mgmt_files[i].get(mdev)); in show_values()
119 struct hidma_mgmt_dev *mdev = dev_get_drvdata(dev); in set_values() local
130 rc = hidma_mgmt_files[i].set(mdev, tmp); in set_values()
144 struct hidma_mgmt_dev *mdev; in show_values_channel() local
148 mdev = chattr->mdev; in show_values_channel()
150 sprintf(buf, "%d\n", mdev->priority[chattr->index]); in show_values_channel()
152 sprintf(buf, "%d\n", mdev->weight[chattr->index]); in show_values_channel()
162 struct hidma_mgmt_dev *mdev; in set_values_channel() local
167 mdev = chattr->mdev; in set_values_channel()
174 rc = set_priority(mdev, chattr->index, tmp); in set_values_channel()
178 rc = set_weight(mdev, chattr->index, tmp); in set_values_channel()
208 static int create_sysfs_entry_channel(struct hidma_mgmt_dev *mdev, char *name, in create_sysfs_entry_channel() argument
215 chattr = devm_kmalloc(&mdev->pdev->dev, sizeof(*chattr), GFP_KERNEL); in create_sysfs_entry_channel()
219 name_copy = devm_kstrdup(&mdev->pdev->dev, name, GFP_KERNEL); in create_sysfs_entry_channel()
223 chattr->mdev = mdev; in create_sysfs_entry_channel()
234 int hidma_mgmt_init_sys(struct hidma_mgmt_dev *mdev) in hidma_mgmt_init_sys() argument
241 required = sizeof(*mdev->chroots) * mdev->dma_channels; in hidma_mgmt_init_sys()
242 mdev->chroots = devm_kmalloc(&mdev->pdev->dev, required, GFP_KERNEL); in hidma_mgmt_init_sys()
243 if (!mdev->chroots) in hidma_mgmt_init_sys()
246 chanops = kobject_create_and_add("chanops", &mdev->pdev->dev.kobj); in hidma_mgmt_init_sys()
251 for (i = 0; i < mdev->dma_channels; i++) { in hidma_mgmt_init_sys()
255 mdev->chroots[i] = kobject_create_and_add(name, chanops); in hidma_mgmt_init_sys()
256 if (!mdev->chroots[i]) in hidma_mgmt_init_sys()
262 rc = create_sysfs_entry(mdev, hidma_mgmt_files[i].name, in hidma_mgmt_init_sys()
269 for (i = 0; i < mdev->dma_channels; i++) { in hidma_mgmt_init_sys()
270 rc = create_sysfs_entry_channel(mdev, "priority", in hidma_mgmt_init_sys()
272 mdev->chroots[i]); in hidma_mgmt_init_sys()
276 rc = create_sysfs_entry_channel(mdev, "weight", in hidma_mgmt_init_sys()
278 mdev->chroots[i]); in hidma_mgmt_init_sys()