87 count += per_cpu_ptr(chan->local, i)->memcpy_count;
88
89 return sprintf(buf, "%lu\n", count);
90}
91
92static ssize_t show_bytes_transferred(struct device *dev, struct device_attribute *attr,
93 char *buf)
94{
95 struct dma_chan *chan = to_dma_chan(dev);
96 unsigned long count = 0;
97 int i;
98
99 for_each_possible_cpu(i)
100 count += per_cpu_ptr(chan->local, i)->bytes_transferred;
101
102 return sprintf(buf, "%lu\n", count);
103}
104
105static ssize_t show_in_use(struct device *dev, struct device_attribute *attr, char *buf)
106{
107 struct dma_chan *chan = to_dma_chan(dev);
108 int in_use = 0;
109
110 if (unlikely(chan->slow_ref) &&
111 atomic_read(&chan->refcount.refcount) > 1)
112 in_use = 1;
113 else {
114 if (local_read(&(per_cpu_ptr(chan->local,
115 get_cpu())->refcount)) > 0)
116 in_use = 1;
117 put_cpu();
118 }
119
120 return sprintf(buf, "%d\n", in_use);
121}
122
123static struct device_attribute dma_attrs[] = {
124 __ATTR(memcpy_count, S_IRUGO, show_memcpy_count, NULL),
125 __ATTR(bytes_transferred, S_IRUGO, show_bytes_transferred, NULL),
126 __ATTR(in_use, S_IRUGO, show_in_use, NULL),
127 __ATTR_NULL