Lines Matching defs:mdev

14 	struct hidma_mgmt_dev *mdev;
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)
61 if (i >= mdev->dma_channels)
64 tmp = mdev->priority[i];
65 mdev->priority[i] = val;
66 rc = hidma_mgmt_setup(mdev);
68 mdev->priority[i] = tmp;
72 static int set_weight(struct hidma_mgmt_dev *mdev, unsigned int i, u64 val)
77 if (i >= mdev->dma_channels)
80 tmp = mdev->weight[i];
81 mdev->weight[i] = val;
82 rc = hidma_mgmt_setup(mdev);
84 mdev->weight[i] = tmp;
102 struct hidma_mgmt_dev *mdev = dev_get_drvdata(dev);
109 sprintf(buf, "%d\n", hidma_mgmt_files[i].get(mdev));
119 struct hidma_mgmt_dev *mdev = dev_get_drvdata(dev);
130 rc = hidma_mgmt_files[i].set(mdev, tmp);
144 struct hidma_mgmt_dev *mdev;
148 mdev = chattr->mdev;
150 sprintf(buf, "%d\n", mdev->priority[chattr->index]);
152 sprintf(buf, "%d\n", mdev->weight[chattr->index]);
162 struct hidma_mgmt_dev *mdev;
167 mdev = chattr->mdev;
174 rc = set_priority(mdev, chattr->index, tmp);
178 rc = set_weight(mdev, chattr->index, tmp);
208 static int create_sysfs_entry_channel(struct hidma_mgmt_dev *mdev, char *name,
215 chattr = devm_kmalloc(&mdev->pdev->dev, sizeof(*chattr), GFP_KERNEL);
219 name_copy = devm_kstrdup(&mdev->pdev->dev, name, GFP_KERNEL);
223 chattr->mdev = mdev;
234 int hidma_mgmt_init_sys(struct hidma_mgmt_dev *mdev)
241 required = sizeof(*mdev->chroots) * mdev->dma_channels;
242 mdev->chroots = devm_kmalloc(&mdev->pdev->dev, required, GFP_KERNEL);
243 if (!mdev->chroots)
246 chanops = kobject_create_and_add("chanops", &mdev->pdev->dev.kobj);
251 for (i = 0; i < mdev->dma_channels; i++) {
255 mdev->chroots[i] = kobject_create_and_add(name, chanops);
256 if (!mdev->chroots[i])
262 rc = create_sysfs_entry(mdev, hidma_mgmt_files[i].name,
269 for (i = 0; i < mdev->dma_channels; i++) {
270 rc = create_sysfs_entry_channel(mdev, "priority",
272 mdev->chroots[i]);
276 rc = create_sysfs_entry_channel(mdev, "weight",
278 mdev->chroots[i]);