aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/dmaengine.h
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2009-01-06 13:38:21 -0500
committerDan Williams <dan.j.williams@intel.com>2009-01-06 13:38:21 -0500
commit41d5e59c1299f27983977bcfe3b360600996051c (patch)
treef0e80b6fea3af04f266843af97f433198ad535c7 /include/linux/dmaengine.h
parent4fac7fa57cf8001be259688468c825f836daf739 (diff)
dmaengine: add a release for dma class devices and dependent infrastructure
Resolves: WARNING: at drivers/base/core.c:122 device_release+0x4d/0x52() Device 'dma0chan0' does not have a release() function, it is broken and must be fixed. The dma_chan_dev object is introduced to gear-match sysfs kobject and dmaengine channel lifetimes. When a channel is removed access to the sysfs entries return -ENODEV until the kobject can be released. The bulk of the change is updates to existing code to handle the extra layer of indirection between a dma_chan and its struct device. Reported-by: Alexander Beregalov <a.beregalov@gmail.com> Acked-by: Stephen Hemminger <shemminger@vyatta.com> Cc: Haavard Skinnemoen <haavard.skinnemoen@atmel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'include/linux/dmaengine.h')
-rw-r--r--include/linux/dmaengine.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 1419a5094478..d6b6bff355f4 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -113,7 +113,7 @@ struct dma_chan_percpu {
113 * @device: ptr to the dma device who supplies this channel, always !%NULL 113 * @device: ptr to the dma device who supplies this channel, always !%NULL
114 * @cookie: last cookie value returned to client 114 * @cookie: last cookie value returned to client
115 * @chan_id: channel ID for sysfs 115 * @chan_id: channel ID for sysfs
116 * @class_dev: class device for sysfs 116 * @dev: class device for sysfs
117 * @refcount: kref, used in "bigref" slow-mode 117 * @refcount: kref, used in "bigref" slow-mode
118 * @slow_ref: indicates that the DMA channel is free 118 * @slow_ref: indicates that the DMA channel is free
119 * @rcu: the DMA channel's RCU head 119 * @rcu: the DMA channel's RCU head
@@ -128,7 +128,7 @@ struct dma_chan {
128 128
129 /* sysfs */ 129 /* sysfs */
130 int chan_id; 130 int chan_id;
131 struct device dev; 131 struct dma_chan_dev *dev;
132 132
133 struct list_head device_node; 133 struct list_head device_node;
134 struct dma_chan_percpu *local; 134 struct dma_chan_percpu *local;
@@ -136,7 +136,20 @@ struct dma_chan {
136 int table_count; 136 int table_count;
137}; 137};
138 138
139#define to_dma_chan(p) container_of(p, struct dma_chan, dev) 139/**
140 * struct dma_chan_dev - relate sysfs device node to backing channel device
141 * @chan - driver channel device
142 * @device - sysfs device
143 */
144struct dma_chan_dev {
145 struct dma_chan *chan;
146 struct device device;
147};
148
149static inline const char *dma_chan_name(struct dma_chan *chan)
150{
151 return dev_name(&chan->dev->device);
152}
140 153
141void dma_chan_cleanup(struct kref *kref); 154void dma_chan_cleanup(struct kref *kref);
142 155