diff options
Diffstat (limited to 'arch/sh/drivers/dma/dma-sysfs.c')
-rw-r--r-- | arch/sh/drivers/dma/dma-sysfs.c | 81 |
1 files changed, 41 insertions, 40 deletions
diff --git a/arch/sh/drivers/dma/dma-sysfs.c b/arch/sh/drivers/dma/dma-sysfs.c index 83cc704770d7..b1cb2715ad6e 100644 --- a/arch/sh/drivers/dma/dma-sysfs.c +++ b/arch/sh/drivers/dma/dma-sysfs.c | |||
@@ -12,18 +12,19 @@ | |||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/stat.h> | 14 | #include <linux/stat.h> |
15 | #include <linux/sysdev.h> | 15 | #include <linux/device.h> |
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/err.h> | 17 | #include <linux/err.h> |
18 | #include <linux/string.h> | 18 | #include <linux/string.h> |
19 | #include <asm/dma.h> | 19 | #include <asm/dma.h> |
20 | 20 | ||
21 | static struct sysdev_class dma_sysclass = { | 21 | static struct bus_type dma_subsys = { |
22 | .name = "dma", | 22 | .name = "dma", |
23 | .dev_name = "dma", | ||
23 | }; | 24 | }; |
24 | 25 | ||
25 | static ssize_t dma_show_devices(struct sys_device *dev, | 26 | static ssize_t dma_show_devices(struct device *dev, |
26 | struct sysdev_attribute *attr, char *buf) | 27 | struct device_attribute *attr, char *buf) |
27 | { | 28 | { |
28 | ssize_t len = 0; | 29 | ssize_t len = 0; |
29 | int i; | 30 | int i; |
@@ -43,29 +44,29 @@ static ssize_t dma_show_devices(struct sys_device *dev, | |||
43 | return len; | 44 | return len; |
44 | } | 45 | } |
45 | 46 | ||
46 | static SYSDEV_ATTR(devices, S_IRUGO, dma_show_devices, NULL); | 47 | static DEVICE_ATTR(devices, S_IRUGO, dma_show_devices, NULL); |
47 | 48 | ||
48 | static int __init dma_sysclass_init(void) | 49 | static int __init dma_subsys_init(void) |
49 | { | 50 | { |
50 | int ret; | 51 | int ret; |
51 | 52 | ||
52 | ret = sysdev_class_register(&dma_sysclass); | 53 | ret = subsys_system_register(&dma_subsys, NULL); |
53 | if (unlikely(ret)) | 54 | if (unlikely(ret)) |
54 | return ret; | 55 | return ret; |
55 | 56 | ||
56 | return sysfs_create_file(&dma_sysclass.kset.kobj, &attr_devices.attr); | 57 | return device_create_file(dma_subsys.dev_root, &dev_attr_devices.attr); |
57 | } | 58 | } |
58 | postcore_initcall(dma_sysclass_init); | 59 | postcore_initcall(dma_subsys_init); |
59 | 60 | ||
60 | static ssize_t dma_show_dev_id(struct sys_device *dev, | 61 | static ssize_t dma_show_dev_id(struct device *dev, |
61 | struct sysdev_attribute *attr, char *buf) | 62 | struct device_attribute *attr, char *buf) |
62 | { | 63 | { |
63 | struct dma_channel *channel = to_dma_channel(dev); | 64 | struct dma_channel *channel = to_dma_channel(dev); |
64 | return sprintf(buf, "%s\n", channel->dev_id); | 65 | return sprintf(buf, "%s\n", channel->dev_id); |
65 | } | 66 | } |
66 | 67 | ||
67 | static ssize_t dma_store_dev_id(struct sys_device *dev, | 68 | static ssize_t dma_store_dev_id(struct device *dev, |
68 | struct sysdev_attribute *attr, | 69 | struct device_attribute *attr, |
69 | const char *buf, size_t count) | 70 | const char *buf, size_t count) |
70 | { | 71 | { |
71 | struct dma_channel *channel = to_dma_channel(dev); | 72 | struct dma_channel *channel = to_dma_channel(dev); |
@@ -73,10 +74,10 @@ static ssize_t dma_store_dev_id(struct sys_device *dev, | |||
73 | return count; | 74 | return count; |
74 | } | 75 | } |
75 | 76 | ||
76 | static SYSDEV_ATTR(dev_id, S_IRUGO | S_IWUSR, dma_show_dev_id, dma_store_dev_id); | 77 | static DEVICE_ATTR(dev_id, S_IRUGO | S_IWUSR, dma_show_dev_id, dma_store_dev_id); |
77 | 78 | ||
78 | static ssize_t dma_store_config(struct sys_device *dev, | 79 | static ssize_t dma_store_config(struct device *dev, |
79 | struct sysdev_attribute *attr, | 80 | struct device_attribute *attr, |
80 | const char *buf, size_t count) | 81 | const char *buf, size_t count) |
81 | { | 82 | { |
82 | struct dma_channel *channel = to_dma_channel(dev); | 83 | struct dma_channel *channel = to_dma_channel(dev); |
@@ -88,17 +89,17 @@ static ssize_t dma_store_config(struct sys_device *dev, | |||
88 | return count; | 89 | return count; |
89 | } | 90 | } |
90 | 91 | ||
91 | static SYSDEV_ATTR(config, S_IWUSR, NULL, dma_store_config); | 92 | static DEVICE_ATTR(config, S_IWUSR, NULL, dma_store_config); |
92 | 93 | ||
93 | static ssize_t dma_show_mode(struct sys_device *dev, | 94 | static ssize_t dma_show_mode(struct device *dev, |
94 | struct sysdev_attribute *attr, char *buf) | 95 | struct device_attribute *attr, char *buf) |
95 | { | 96 | { |
96 | struct dma_channel *channel = to_dma_channel(dev); | 97 | struct dma_channel *channel = to_dma_channel(dev); |
97 | return sprintf(buf, "0x%08x\n", channel->mode); | 98 | return sprintf(buf, "0x%08x\n", channel->mode); |
98 | } | 99 | } |
99 | 100 | ||
100 | static ssize_t dma_store_mode(struct sys_device *dev, | 101 | static ssize_t dma_store_mode(struct device *dev, |
101 | struct sysdev_attribute *attr, | 102 | struct device_attribute *attr, |
102 | const char *buf, size_t count) | 103 | const char *buf, size_t count) |
103 | { | 104 | { |
104 | struct dma_channel *channel = to_dma_channel(dev); | 105 | struct dma_channel *channel = to_dma_channel(dev); |
@@ -106,38 +107,38 @@ static ssize_t dma_store_mode(struct sys_device *dev, | |||
106 | return count; | 107 | return count; |
107 | } | 108 | } |
108 | 109 | ||
109 | static SYSDEV_ATTR(mode, S_IRUGO | S_IWUSR, dma_show_mode, dma_store_mode); | 110 | static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, dma_show_mode, dma_store_mode); |
110 | 111 | ||
111 | #define dma_ro_attr(field, fmt) \ | 112 | #define dma_ro_attr(field, fmt) \ |
112 | static ssize_t dma_show_##field(struct sys_device *dev, \ | 113 | static ssize_t dma_show_##field(struct device *dev, \ |
113 | struct sysdev_attribute *attr, char *buf)\ | 114 | struct device_attribute *attr, char *buf)\ |
114 | { \ | 115 | { \ |
115 | struct dma_channel *channel = to_dma_channel(dev); \ | 116 | struct dma_channel *channel = to_dma_channel(dev); \ |
116 | return sprintf(buf, fmt, channel->field); \ | 117 | return sprintf(buf, fmt, channel->field); \ |
117 | } \ | 118 | } \ |
118 | static SYSDEV_ATTR(field, S_IRUGO, dma_show_##field, NULL); | 119 | static DEVICE_ATTR(field, S_IRUGO, dma_show_##field, NULL); |
119 | 120 | ||
120 | dma_ro_attr(count, "0x%08x\n"); | 121 | dma_ro_attr(count, "0x%08x\n"); |
121 | dma_ro_attr(flags, "0x%08lx\n"); | 122 | dma_ro_attr(flags, "0x%08lx\n"); |
122 | 123 | ||
123 | int dma_create_sysfs_files(struct dma_channel *chan, struct dma_info *info) | 124 | int dma_create_sysfs_files(struct dma_channel *chan, struct dma_info *info) |
124 | { | 125 | { |
125 | struct sys_device *dev = &chan->dev; | 126 | struct device *dev = &chan->dev; |
126 | char name[16]; | 127 | char name[16]; |
127 | int ret; | 128 | int ret; |
128 | 129 | ||
129 | dev->id = chan->vchan; | 130 | dev->id = chan->vchan; |
130 | dev->cls = &dma_sysclass; | 131 | dev->bus = &dma_subsys; |
131 | 132 | ||
132 | ret = sysdev_register(dev); | 133 | ret = device_register(dev); |
133 | if (ret) | 134 | if (ret) |
134 | return ret; | 135 | return ret; |
135 | 136 | ||
136 | ret |= sysdev_create_file(dev, &attr_dev_id); | 137 | ret |= device_create_file(dev, &dev_attr_dev_id); |
137 | ret |= sysdev_create_file(dev, &attr_count); | 138 | ret |= device_create_file(dev, &dev_attr_count); |
138 | ret |= sysdev_create_file(dev, &attr_mode); | 139 | ret |= device_create_file(dev, &dev_attr_mode); |
139 | ret |= sysdev_create_file(dev, &attr_flags); | 140 | ret |= device_create_file(dev, &dev_attr_flags); |
140 | ret |= sysdev_create_file(dev, &attr_config); | 141 | ret |= device_create_file(dev, &dev_attr_config); |
141 | 142 | ||
142 | if (unlikely(ret)) { | 143 | if (unlikely(ret)) { |
143 | dev_err(&info->pdev->dev, "Failed creating attrs\n"); | 144 | dev_err(&info->pdev->dev, "Failed creating attrs\n"); |
@@ -150,17 +151,17 @@ int dma_create_sysfs_files(struct dma_channel *chan, struct dma_info *info) | |||
150 | 151 | ||
151 | void dma_remove_sysfs_files(struct dma_channel *chan, struct dma_info *info) | 152 | void dma_remove_sysfs_files(struct dma_channel *chan, struct dma_info *info) |
152 | { | 153 | { |
153 | struct sys_device *dev = &chan->dev; | 154 | struct device *dev = &chan->dev; |
154 | char name[16]; | 155 | char name[16]; |
155 | 156 | ||
156 | sysdev_remove_file(dev, &attr_dev_id); | 157 | device_remove_file(dev, &dev_attr_dev_id); |
157 | sysdev_remove_file(dev, &attr_count); | 158 | device_remove_file(dev, &dev_attr_count); |
158 | sysdev_remove_file(dev, &attr_mode); | 159 | device_remove_file(dev, &dev_attr_mode); |
159 | sysdev_remove_file(dev, &attr_flags); | 160 | device_remove_file(dev, &dev_attr_flags); |
160 | sysdev_remove_file(dev, &attr_config); | 161 | device_remove_file(dev, &dev_attr_config); |
161 | 162 | ||
162 | snprintf(name, sizeof(name), "dma%d", chan->chan); | 163 | snprintf(name, sizeof(name), "dma%d", chan->chan); |
163 | sysfs_remove_link(&info->pdev->dev.kobj, name); | 164 | sysfs_remove_link(&info->pdev->dev.kobj, name); |
164 | 165 | ||
165 | sysdev_unregister(dev); | 166 | device_unregister(dev); |
166 | } | 167 | } |