diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-25 11:34:42 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-25 11:35:13 -0500 |
commit | df8dc74e8a383eaf2d9b44b80a71ec6f0e52b42e (patch) | |
tree | bc3799a43e8b94fa84b32e37b1c124d5e4868f50 /drivers/dma/dmaengine.c | |
parent | 556a169dab38b5100df6f4a45b655dddd3db94c1 (diff) | |
parent | 4a3ad20ccd8f4d2a0535cf98fa83f7b561ba59a9 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
This can be broken down into these major areas:
- Documentation updates (language translations and fixes, as
well as kobject and kset documenatation updates.)
- major kset/kobject/ktype rework and fixes. This cleans up the
kset and kobject and ktype relationship and architecture,
making sense of things now, and good documenation and samples
are provided for others to use. Also the attributes for
kobjects are much easier to handle now. This cleaned up a LOT
of code all through the kernel, making kobjects easier to use
if you want to.
- struct bus_type has been reworked to now handle the lifetime
rules properly, as the kobject is properly dynamic.
- struct driver has also been reworked, and now the lifetime
issues are resolved.
- the block subsystem has been converted to use struct device
now, and not "raw" kobjects. This patch has been in the -mm
tree for over a year now, and finally all the issues are
worked out with it. Older distros now properly work with new
kernels, and no userspace updates are needed at all.
- nozomi driver is added. This has also been in -mm for a long
time, and many people have asked for it to go in. It is now
in good enough shape to do so.
- lots of class_device conversions to use struct device instead.
The tree is almost all cleaned up now, only SCSI and IB is the
remaining code to fix up...
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6: (196 commits)
Driver core: coding style fixes
Kobject: fix coding style issues in kobject c files
Kobject: fix coding style issues in kobject.h
Driver core: fix coding style issues in device.h
spi: use class iteration api
scsi: use class iteration api
rtc: use class iteration api
power supply : use class iteration api
ieee1394: use class iteration api
Driver Core: add class iteration api
Driver core: Cleanup get_device_parent() in device_add() and device_move()
UIO: constify function pointer tables
Driver Core: constify the name passed to platform_device_register_simple
driver core: fix build with SYSFS=n
sysfs: make SYSFS_DEPRECATED depend on SYSFS
Driver core: use LIST_HEAD instead of call to INIT_LIST_HEAD in __init
kobject: add sample code for how to use ksets/ktypes/kobjects
kobject: add sample code for how to use kobjects in a simple manner.
kobject: update the kobject/kset documentation
kobject: remove old, outdated documentation.
...
Diffstat (limited to 'drivers/dma/dmaengine.c')
-rw-r--r-- | drivers/dma/dmaengine.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index d59b2f417306..bcf52df30339 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c | |||
@@ -41,12 +41,12 @@ | |||
41 | * the definition of dma_event_callback in dmaengine.h. | 41 | * the definition of dma_event_callback in dmaengine.h. |
42 | * | 42 | * |
43 | * Each device has a kref, which is initialized to 1 when the device is | 43 | * Each device has a kref, which is initialized to 1 when the device is |
44 | * registered. A kref_get is done for each class_device registered. When the | 44 | * registered. A kref_get is done for each device registered. When the |
45 | * class_device is released, the coresponding kref_put is done in the release | 45 | * device is released, the coresponding kref_put is done in the release |
46 | * method. Every time one of the device's channels is allocated to a client, | 46 | * method. Every time one of the device's channels is allocated to a client, |
47 | * a kref_get occurs. When the channel is freed, the coresponding kref_put | 47 | * a kref_get occurs. When the channel is freed, the coresponding kref_put |
48 | * happens. The device's release function does a completion, so | 48 | * happens. The device's release function does a completion, so |
49 | * unregister_device does a remove event, class_device_unregister, a kref_put | 49 | * unregister_device does a remove event, device_unregister, a kref_put |
50 | * for the first reference, then waits on the completion for all other | 50 | * for the first reference, then waits on the completion for all other |
51 | * references to finish. | 51 | * references to finish. |
52 | * | 52 | * |
@@ -77,9 +77,9 @@ static LIST_HEAD(dma_client_list); | |||
77 | 77 | ||
78 | /* --- sysfs implementation --- */ | 78 | /* --- sysfs implementation --- */ |
79 | 79 | ||
80 | static ssize_t show_memcpy_count(struct class_device *cd, char *buf) | 80 | static ssize_t show_memcpy_count(struct device *dev, struct device_attribute *attr, char *buf) |
81 | { | 81 | { |
82 | struct dma_chan *chan = container_of(cd, struct dma_chan, class_dev); | 82 | struct dma_chan *chan = to_dma_chan(dev); |
83 | unsigned long count = 0; | 83 | unsigned long count = 0; |
84 | int i; | 84 | int i; |
85 | 85 | ||
@@ -89,9 +89,10 @@ static ssize_t show_memcpy_count(struct class_device *cd, char *buf) | |||
89 | return sprintf(buf, "%lu\n", count); | 89 | return sprintf(buf, "%lu\n", count); |
90 | } | 90 | } |
91 | 91 | ||
92 | static ssize_t show_bytes_transferred(struct class_device *cd, char *buf) | 92 | static ssize_t show_bytes_transferred(struct device *dev, struct device_attribute *attr, |
93 | char *buf) | ||
93 | { | 94 | { |
94 | struct dma_chan *chan = container_of(cd, struct dma_chan, class_dev); | 95 | struct dma_chan *chan = to_dma_chan(dev); |
95 | unsigned long count = 0; | 96 | unsigned long count = 0; |
96 | int i; | 97 | int i; |
97 | 98 | ||
@@ -101,9 +102,9 @@ static ssize_t show_bytes_transferred(struct class_device *cd, char *buf) | |||
101 | return sprintf(buf, "%lu\n", count); | 102 | return sprintf(buf, "%lu\n", count); |
102 | } | 103 | } |
103 | 104 | ||
104 | static ssize_t show_in_use(struct class_device *cd, char *buf) | 105 | static ssize_t show_in_use(struct device *dev, struct device_attribute *attr, char *buf) |
105 | { | 106 | { |
106 | struct dma_chan *chan = container_of(cd, struct dma_chan, class_dev); | 107 | struct dma_chan *chan = to_dma_chan(dev); |
107 | int in_use = 0; | 108 | int in_use = 0; |
108 | 109 | ||
109 | if (unlikely(chan->slow_ref) && | 110 | if (unlikely(chan->slow_ref) && |
@@ -119,7 +120,7 @@ static ssize_t show_in_use(struct class_device *cd, char *buf) | |||
119 | return sprintf(buf, "%d\n", in_use); | 120 | return sprintf(buf, "%d\n", in_use); |
120 | } | 121 | } |
121 | 122 | ||
122 | static struct class_device_attribute dma_class_attrs[] = { | 123 | static struct device_attribute dma_attrs[] = { |
123 | __ATTR(memcpy_count, S_IRUGO, show_memcpy_count, NULL), | 124 | __ATTR(memcpy_count, S_IRUGO, show_memcpy_count, NULL), |
124 | __ATTR(bytes_transferred, S_IRUGO, show_bytes_transferred, NULL), | 125 | __ATTR(bytes_transferred, S_IRUGO, show_bytes_transferred, NULL), |
125 | __ATTR(in_use, S_IRUGO, show_in_use, NULL), | 126 | __ATTR(in_use, S_IRUGO, show_in_use, NULL), |
@@ -128,16 +129,16 @@ static struct class_device_attribute dma_class_attrs[] = { | |||
128 | 129 | ||
129 | static void dma_async_device_cleanup(struct kref *kref); | 130 | static void dma_async_device_cleanup(struct kref *kref); |
130 | 131 | ||
131 | static void dma_class_dev_release(struct class_device *cd) | 132 | static void dma_dev_release(struct device *dev) |
132 | { | 133 | { |
133 | struct dma_chan *chan = container_of(cd, struct dma_chan, class_dev); | 134 | struct dma_chan *chan = to_dma_chan(dev); |
134 | kref_put(&chan->device->refcount, dma_async_device_cleanup); | 135 | kref_put(&chan->device->refcount, dma_async_device_cleanup); |
135 | } | 136 | } |
136 | 137 | ||
137 | static struct class dma_devclass = { | 138 | static struct class dma_devclass = { |
138 | .name = "dma", | 139 | .name = "dma", |
139 | .class_dev_attrs = dma_class_attrs, | 140 | .dev_attrs = dma_attrs, |
140 | .release = dma_class_dev_release, | 141 | .dev_release = dma_dev_release, |
141 | }; | 142 | }; |
142 | 143 | ||
143 | /* --- client and device registration --- */ | 144 | /* --- client and device registration --- */ |
@@ -377,12 +378,12 @@ int dma_async_device_register(struct dma_device *device) | |||
377 | continue; | 378 | continue; |
378 | 379 | ||
379 | chan->chan_id = chancnt++; | 380 | chan->chan_id = chancnt++; |
380 | chan->class_dev.class = &dma_devclass; | 381 | chan->dev.class = &dma_devclass; |
381 | chan->class_dev.dev = NULL; | 382 | chan->dev.parent = NULL; |
382 | snprintf(chan->class_dev.class_id, BUS_ID_SIZE, "dma%dchan%d", | 383 | snprintf(chan->dev.bus_id, BUS_ID_SIZE, "dma%dchan%d", |
383 | device->dev_id, chan->chan_id); | 384 | device->dev_id, chan->chan_id); |
384 | 385 | ||
385 | rc = class_device_register(&chan->class_dev); | 386 | rc = device_register(&chan->dev); |
386 | if (rc) { | 387 | if (rc) { |
387 | chancnt--; | 388 | chancnt--; |
388 | free_percpu(chan->local); | 389 | free_percpu(chan->local); |
@@ -411,7 +412,7 @@ err_out: | |||
411 | if (chan->local == NULL) | 412 | if (chan->local == NULL) |
412 | continue; | 413 | continue; |
413 | kref_put(&device->refcount, dma_async_device_cleanup); | 414 | kref_put(&device->refcount, dma_async_device_cleanup); |
414 | class_device_unregister(&chan->class_dev); | 415 | device_unregister(&chan->dev); |
415 | chancnt--; | 416 | chancnt--; |
416 | free_percpu(chan->local); | 417 | free_percpu(chan->local); |
417 | } | 418 | } |
@@ -445,7 +446,7 @@ void dma_async_device_unregister(struct dma_device *device) | |||
445 | 446 | ||
446 | list_for_each_entry(chan, &device->channels, device_node) { | 447 | list_for_each_entry(chan, &device->channels, device_node) { |
447 | dma_clients_notify_removed(chan); | 448 | dma_clients_notify_removed(chan); |
448 | class_device_unregister(&chan->class_dev); | 449 | device_unregister(&chan->dev); |
449 | dma_chan_release(chan); | 450 | dma_chan_release(chan); |
450 | } | 451 | } |
451 | 452 | ||