diff options
Diffstat (limited to 'drivers/dma/ioat/sysfs.c')
| -rw-r--r-- | drivers/dma/ioat/sysfs.c | 42 |
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 | ||
| 67 | static ssize_t | ||
| 68 | ioat_attr_store(struct kobject *kobj, struct attribute *attr, | ||
| 69 | const 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 | |||
| 67 | const struct sysfs_ops ioat_sysfs_ops = { | 82 | const 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 | ||
| 71 | void ioat_kobject_add(struct ioatdma_device *ioat_dma, struct kobj_type *type) | 87 | void 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 | } |
| 122 | static struct ioat_sysfs_entry ring_active_attr = __ATTR_RO(ring_active); | 138 | static struct ioat_sysfs_entry ring_active_attr = __ATTR_RO(ring_active); |
| 123 | 139 | ||
| 140 | static 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 | |||
| 147 | static ssize_t intr_coalesce_store(struct dma_chan *c, const char *page, | ||
| 148 | size_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 | |||
| 163 | static struct ioat_sysfs_entry intr_coalesce_attr = __ATTR_RW(intr_coalesce); | ||
| 164 | |||
| 124 | static struct attribute *ioat_attrs[] = { | 165 | static 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 | ||
