aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/ioat/sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma/ioat/sysfs.c')
-rw-r--r--drivers/dma/ioat/sysfs.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/dma/ioat/sysfs.c b/drivers/dma/ioat/sysfs.c
index cb4a857ee21b..3ac677f29e8f 100644
--- a/drivers/dma/ioat/sysfs.c
+++ b/drivers/dma/ioat/sysfs.c
@@ -64,8 +64,24 @@ ioat_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
64 return entry->show(&ioat_chan->dma_chan, page); 64 return entry->show(&ioat_chan->dma_chan, page);
65} 65}
66 66
67static ssize_t
68ioat_attr_store(struct kobject *kobj, struct attribute *attr,
69const char *page, size_t count)
70{
71 struct ioat_sysfs_entry *entry;
72 struct ioatdma_chan *ioat_chan;
73
74 entry = container_of(attr, struct ioat_sysfs_entry, attr);
75 ioat_chan = container_of(kobj, struct ioatdma_chan, kobj);
76
77 if (!entry->store)
78 return -EIO;
79 return entry->store(&ioat_chan->dma_chan, page, count);
80}
81
67const struct sysfs_ops ioat_sysfs_ops = { 82const struct sysfs_ops ioat_sysfs_ops = {
68 .show = ioat_attr_show, 83 .show = ioat_attr_show,
84 .store = ioat_attr_store,
69}; 85};
70 86
71void ioat_kobject_add(struct ioatdma_device *ioat_dma, struct kobj_type *type) 87void ioat_kobject_add(struct ioatdma_device *ioat_dma, struct kobj_type *type)
@@ -121,11 +137,37 @@ static ssize_t ring_active_show(struct dma_chan *c, char *page)
121} 137}
122static struct ioat_sysfs_entry ring_active_attr = __ATTR_RO(ring_active); 138static struct ioat_sysfs_entry ring_active_attr = __ATTR_RO(ring_active);
123 139
140static ssize_t intr_coalesce_show(struct dma_chan *c, char *page)
141{
142 struct ioatdma_chan *ioat_chan = to_ioat_chan(c);
143
144 return sprintf(page, "%d\n", ioat_chan->intr_coalesce);
145}
146
147static ssize_t intr_coalesce_store(struct dma_chan *c, const char *page,
148size_t count)
149{
150 int intr_coalesce = 0;
151 struct ioatdma_chan *ioat_chan = to_ioat_chan(c);
152
153 if (sscanf(page, "%du", &intr_coalesce) != -1) {
154 if ((intr_coalesce < 0) ||
155 (intr_coalesce > IOAT_INTRDELAY_MASK))
156 return -EINVAL;
157 ioat_chan->intr_coalesce = intr_coalesce;
158 }
159
160 return count;
161}
162
163static struct ioat_sysfs_entry intr_coalesce_attr = __ATTR_RW(intr_coalesce);
164
124static struct attribute *ioat_attrs[] = { 165static struct attribute *ioat_attrs[] = {
125 &ring_size_attr.attr, 166 &ring_size_attr.attr,
126 &ring_active_attr.attr, 167 &ring_active_attr.attr,
127 &ioat_cap_attr.attr, 168 &ioat_cap_attr.attr,
128 &ioat_version_attr.attr, 169 &ioat_version_attr.attr,
170 &intr_coalesce_attr.attr,
129 NULL, 171 NULL,
130}; 172};
131 173