diff options
author | Dan Williams <dan.j.williams@intel.com> | 2009-01-06 13:38:21 -0500 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2009-01-06 13:38:21 -0500 |
commit | 41d5e59c1299f27983977bcfe3b360600996051c (patch) | |
tree | f0e80b6fea3af04f266843af97f433198ad535c7 /drivers/dma/dmatest.c | |
parent | 4fac7fa57cf8001be259688468c825f836daf739 (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 'drivers/dma/dmatest.c')
-rw-r--r-- | drivers/dma/dmatest.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index c77d47c4ec5b..3603f1ea5b28 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c | |||
@@ -80,7 +80,7 @@ static bool dmatest_match_channel(struct dma_chan *chan) | |||
80 | { | 80 | { |
81 | if (test_channel[0] == '\0') | 81 | if (test_channel[0] == '\0') |
82 | return true; | 82 | return true; |
83 | return strcmp(dev_name(&chan->dev), test_channel) == 0; | 83 | return strcmp(dma_chan_name(chan), test_channel) == 0; |
84 | } | 84 | } |
85 | 85 | ||
86 | static bool dmatest_match_device(struct dma_device *device) | 86 | static bool dmatest_match_device(struct dma_device *device) |
@@ -325,7 +325,7 @@ static int dmatest_add_channel(struct dma_chan *chan) | |||
325 | 325 | ||
326 | dtc = kmalloc(sizeof(struct dmatest_chan), GFP_KERNEL); | 326 | dtc = kmalloc(sizeof(struct dmatest_chan), GFP_KERNEL); |
327 | if (!dtc) { | 327 | if (!dtc) { |
328 | pr_warning("dmatest: No memory for %s\n", dev_name(&chan->dev)); | 328 | pr_warning("dmatest: No memory for %s\n", dma_chan_name(chan)); |
329 | return -ENOMEM; | 329 | return -ENOMEM; |
330 | } | 330 | } |
331 | 331 | ||
@@ -336,16 +336,16 @@ static int dmatest_add_channel(struct dma_chan *chan) | |||
336 | thread = kzalloc(sizeof(struct dmatest_thread), GFP_KERNEL); | 336 | thread = kzalloc(sizeof(struct dmatest_thread), GFP_KERNEL); |
337 | if (!thread) { | 337 | if (!thread) { |
338 | pr_warning("dmatest: No memory for %s-test%u\n", | 338 | pr_warning("dmatest: No memory for %s-test%u\n", |
339 | dev_name(&chan->dev), i); | 339 | dma_chan_name(chan), i); |
340 | break; | 340 | break; |
341 | } | 341 | } |
342 | thread->chan = dtc->chan; | 342 | thread->chan = dtc->chan; |
343 | smp_wmb(); | 343 | smp_wmb(); |
344 | thread->task = kthread_run(dmatest_func, thread, "%s-test%u", | 344 | thread->task = kthread_run(dmatest_func, thread, "%s-test%u", |
345 | dev_name(&chan->dev), i); | 345 | dma_chan_name(chan), i); |
346 | if (IS_ERR(thread->task)) { | 346 | if (IS_ERR(thread->task)) { |
347 | pr_warning("dmatest: Failed to run thread %s-test%u\n", | 347 | pr_warning("dmatest: Failed to run thread %s-test%u\n", |
348 | dev_name(&chan->dev), i); | 348 | dma_chan_name(chan), i); |
349 | kfree(thread); | 349 | kfree(thread); |
350 | break; | 350 | break; |
351 | } | 351 | } |
@@ -355,7 +355,7 @@ static int dmatest_add_channel(struct dma_chan *chan) | |||
355 | list_add_tail(&thread->node, &dtc->threads); | 355 | list_add_tail(&thread->node, &dtc->threads); |
356 | } | 356 | } |
357 | 357 | ||
358 | pr_info("dmatest: Started %u threads using %s\n", i, dev_name(&chan->dev)); | 358 | pr_info("dmatest: Started %u threads using %s\n", i, dma_chan_name(chan)); |
359 | 359 | ||
360 | list_add_tail(&dtc->node, &dmatest_channels); | 360 | list_add_tail(&dtc->node, &dmatest_channels); |
361 | nr_channels++; | 361 | nr_channels++; |
@@ -408,7 +408,7 @@ static void __exit dmatest_exit(void) | |||
408 | list_del(&dtc->node); | 408 | list_del(&dtc->node); |
409 | dmatest_cleanup_channel(dtc); | 409 | dmatest_cleanup_channel(dtc); |
410 | pr_debug("dmatest: dropped channel %s\n", | 410 | pr_debug("dmatest: dropped channel %s\n", |
411 | dev_name(&dtc->chan->dev)); | 411 | dma_chan_name(dtc->chan)); |
412 | dma_release_channel(dtc->chan); | 412 | dma_release_channel(dtc->chan); |
413 | } | 413 | } |
414 | } | 414 | } |