diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2007-10-08 15:26:13 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-09 23:03:14 -0400 |
commit | 54bd5b66c87d14e250f108aad1228b905d6882f6 (patch) | |
tree | 2ecb78046819e2c9da176a74e4e9fbc8097031be /drivers/media/video/pvrusb2 | |
parent | d4cae5a50021271b9ef4e5e39e71e177d12fa8cb (diff) |
V4L/DVB (6293): V4L: convert struct class_device to struct device
The currently used "struct class_device" will be removed from the
kernel. Here is a patch that converts all users in drivers/media/video/
to struct device.
Reviewed-by: Thierry Merle <thierry.merle@free.fr>
Reviewed-by: Mike Isely <isely@pobox.com>
Reviewed-by: Luca Risolia <luca.risolia@studio.unibo.it>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/pvrusb2')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-sysfs.c | 210 |
1 files changed, 113 insertions, 97 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c index 7ab79baa1c8c..b20dc4421d59 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c +++ b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c | |||
@@ -33,16 +33,16 @@ | |||
33 | 33 | ||
34 | struct pvr2_sysfs { | 34 | struct pvr2_sysfs { |
35 | struct pvr2_channel channel; | 35 | struct pvr2_channel channel; |
36 | struct class_device *class_dev; | 36 | struct device *class_dev; |
37 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC | 37 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC |
38 | struct pvr2_sysfs_debugifc *debugifc; | 38 | struct pvr2_sysfs_debugifc *debugifc; |
39 | #endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ | 39 | #endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ |
40 | struct pvr2_sysfs_ctl_item *item_first; | 40 | struct pvr2_sysfs_ctl_item *item_first; |
41 | struct pvr2_sysfs_ctl_item *item_last; | 41 | struct pvr2_sysfs_ctl_item *item_last; |
42 | struct class_device_attribute attr_v4l_minor_number; | 42 | struct device_attribute attr_v4l_minor_number; |
43 | struct class_device_attribute attr_v4l_radio_minor_number; | 43 | struct device_attribute attr_v4l_radio_minor_number; |
44 | struct class_device_attribute attr_unit_number; | 44 | struct device_attribute attr_unit_number; |
45 | struct class_device_attribute attr_bus_info; | 45 | struct device_attribute attr_bus_info; |
46 | int v4l_minor_number_created_ok; | 46 | int v4l_minor_number_created_ok; |
47 | int v4l_radio_minor_number_created_ok; | 47 | int v4l_radio_minor_number_created_ok; |
48 | int unit_number_created_ok; | 48 | int unit_number_created_ok; |
@@ -51,22 +51,22 @@ struct pvr2_sysfs { | |||
51 | 51 | ||
52 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC | 52 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC |
53 | struct pvr2_sysfs_debugifc { | 53 | struct pvr2_sysfs_debugifc { |
54 | struct class_device_attribute attr_debugcmd; | 54 | struct device_attribute attr_debugcmd; |
55 | struct class_device_attribute attr_debuginfo; | 55 | struct device_attribute attr_debuginfo; |
56 | int debugcmd_created_ok; | 56 | int debugcmd_created_ok; |
57 | int debuginfo_created_ok; | 57 | int debuginfo_created_ok; |
58 | }; | 58 | }; |
59 | #endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ | 59 | #endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ |
60 | 60 | ||
61 | struct pvr2_sysfs_ctl_item { | 61 | struct pvr2_sysfs_ctl_item { |
62 | struct class_device_attribute attr_name; | 62 | struct device_attribute attr_name; |
63 | struct class_device_attribute attr_type; | 63 | struct device_attribute attr_type; |
64 | struct class_device_attribute attr_min; | 64 | struct device_attribute attr_min; |
65 | struct class_device_attribute attr_max; | 65 | struct device_attribute attr_max; |
66 | struct class_device_attribute attr_enum; | 66 | struct device_attribute attr_enum; |
67 | struct class_device_attribute attr_bits; | 67 | struct device_attribute attr_bits; |
68 | struct class_device_attribute attr_val; | 68 | struct device_attribute attr_val; |
69 | struct class_device_attribute attr_custom; | 69 | struct device_attribute attr_custom; |
70 | struct pvr2_ctrl *cptr; | 70 | struct pvr2_ctrl *cptr; |
71 | struct pvr2_sysfs *chptr; | 71 | struct pvr2_sysfs *chptr; |
72 | struct pvr2_sysfs_ctl_item *item_next; | 72 | struct pvr2_sysfs_ctl_item *item_next; |
@@ -80,13 +80,13 @@ struct pvr2_sysfs_class { | |||
80 | struct class class; | 80 | struct class class; |
81 | }; | 81 | }; |
82 | 82 | ||
83 | static ssize_t show_name(int id,struct class_device *class_dev,char *buf) | 83 | static ssize_t show_name(int id,struct device *class_dev,char *buf) |
84 | { | 84 | { |
85 | struct pvr2_ctrl *cptr; | 85 | struct pvr2_ctrl *cptr; |
86 | struct pvr2_sysfs *sfp; | 86 | struct pvr2_sysfs *sfp; |
87 | const char *name; | 87 | const char *name; |
88 | 88 | ||
89 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 89 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
90 | if (!sfp) return -EINVAL; | 90 | if (!sfp) return -EINVAL; |
91 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); | 91 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); |
92 | if (!cptr) return -EINVAL; | 92 | if (!cptr) return -EINVAL; |
@@ -99,14 +99,14 @@ static ssize_t show_name(int id,struct class_device *class_dev,char *buf) | |||
99 | return scnprintf(buf,PAGE_SIZE,"%s\n",name); | 99 | return scnprintf(buf,PAGE_SIZE,"%s\n",name); |
100 | } | 100 | } |
101 | 101 | ||
102 | static ssize_t show_type(int id,struct class_device *class_dev,char *buf) | 102 | static ssize_t show_type(int id,struct device *class_dev,char *buf) |
103 | { | 103 | { |
104 | struct pvr2_ctrl *cptr; | 104 | struct pvr2_ctrl *cptr; |
105 | struct pvr2_sysfs *sfp; | 105 | struct pvr2_sysfs *sfp; |
106 | const char *name; | 106 | const char *name; |
107 | enum pvr2_ctl_type tp; | 107 | enum pvr2_ctl_type tp; |
108 | 108 | ||
109 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 109 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
110 | if (!sfp) return -EINVAL; | 110 | if (!sfp) return -EINVAL; |
111 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); | 111 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); |
112 | if (!cptr) return -EINVAL; | 112 | if (!cptr) return -EINVAL; |
@@ -126,13 +126,13 @@ static ssize_t show_type(int id,struct class_device *class_dev,char *buf) | |||
126 | return scnprintf(buf,PAGE_SIZE,"%s\n",name); | 126 | return scnprintf(buf,PAGE_SIZE,"%s\n",name); |
127 | } | 127 | } |
128 | 128 | ||
129 | static ssize_t show_min(int id,struct class_device *class_dev,char *buf) | 129 | static ssize_t show_min(int id,struct device *class_dev,char *buf) |
130 | { | 130 | { |
131 | struct pvr2_ctrl *cptr; | 131 | struct pvr2_ctrl *cptr; |
132 | struct pvr2_sysfs *sfp; | 132 | struct pvr2_sysfs *sfp; |
133 | long val; | 133 | long val; |
134 | 134 | ||
135 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 135 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
136 | if (!sfp) return -EINVAL; | 136 | if (!sfp) return -EINVAL; |
137 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); | 137 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); |
138 | if (!cptr) return -EINVAL; | 138 | if (!cptr) return -EINVAL; |
@@ -143,13 +143,13 @@ static ssize_t show_min(int id,struct class_device *class_dev,char *buf) | |||
143 | return scnprintf(buf,PAGE_SIZE,"%ld\n",val); | 143 | return scnprintf(buf,PAGE_SIZE,"%ld\n",val); |
144 | } | 144 | } |
145 | 145 | ||
146 | static ssize_t show_max(int id,struct class_device *class_dev,char *buf) | 146 | static ssize_t show_max(int id,struct device *class_dev,char *buf) |
147 | { | 147 | { |
148 | struct pvr2_ctrl *cptr; | 148 | struct pvr2_ctrl *cptr; |
149 | struct pvr2_sysfs *sfp; | 149 | struct pvr2_sysfs *sfp; |
150 | long val; | 150 | long val; |
151 | 151 | ||
152 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 152 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
153 | if (!sfp) return -EINVAL; | 153 | if (!sfp) return -EINVAL; |
154 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); | 154 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); |
155 | if (!cptr) return -EINVAL; | 155 | if (!cptr) return -EINVAL; |
@@ -160,14 +160,14 @@ static ssize_t show_max(int id,struct class_device *class_dev,char *buf) | |||
160 | return scnprintf(buf,PAGE_SIZE,"%ld\n",val); | 160 | return scnprintf(buf,PAGE_SIZE,"%ld\n",val); |
161 | } | 161 | } |
162 | 162 | ||
163 | static ssize_t show_val_norm(int id,struct class_device *class_dev,char *buf) | 163 | static ssize_t show_val_norm(int id,struct device *class_dev,char *buf) |
164 | { | 164 | { |
165 | struct pvr2_ctrl *cptr; | 165 | struct pvr2_ctrl *cptr; |
166 | struct pvr2_sysfs *sfp; | 166 | struct pvr2_sysfs *sfp; |
167 | int val,ret; | 167 | int val,ret; |
168 | unsigned int cnt = 0; | 168 | unsigned int cnt = 0; |
169 | 169 | ||
170 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 170 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
171 | if (!sfp) return -EINVAL; | 171 | if (!sfp) return -EINVAL; |
172 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); | 172 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); |
173 | if (!cptr) return -EINVAL; | 173 | if (!cptr) return -EINVAL; |
@@ -184,14 +184,14 @@ static ssize_t show_val_norm(int id,struct class_device *class_dev,char *buf) | |||
184 | return cnt+1; | 184 | return cnt+1; |
185 | } | 185 | } |
186 | 186 | ||
187 | static ssize_t show_val_custom(int id,struct class_device *class_dev,char *buf) | 187 | static ssize_t show_val_custom(int id,struct device *class_dev,char *buf) |
188 | { | 188 | { |
189 | struct pvr2_ctrl *cptr; | 189 | struct pvr2_ctrl *cptr; |
190 | struct pvr2_sysfs *sfp; | 190 | struct pvr2_sysfs *sfp; |
191 | int val,ret; | 191 | int val,ret; |
192 | unsigned int cnt = 0; | 192 | unsigned int cnt = 0; |
193 | 193 | ||
194 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 194 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
195 | if (!sfp) return -EINVAL; | 195 | if (!sfp) return -EINVAL; |
196 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); | 196 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); |
197 | if (!cptr) return -EINVAL; | 197 | if (!cptr) return -EINVAL; |
@@ -208,14 +208,14 @@ static ssize_t show_val_custom(int id,struct class_device *class_dev,char *buf) | |||
208 | return cnt+1; | 208 | return cnt+1; |
209 | } | 209 | } |
210 | 210 | ||
211 | static ssize_t show_enum(int id,struct class_device *class_dev,char *buf) | 211 | static ssize_t show_enum(int id,struct device *class_dev,char *buf) |
212 | { | 212 | { |
213 | struct pvr2_ctrl *cptr; | 213 | struct pvr2_ctrl *cptr; |
214 | struct pvr2_sysfs *sfp; | 214 | struct pvr2_sysfs *sfp; |
215 | long val; | 215 | long val; |
216 | unsigned int bcnt,ccnt,ecnt; | 216 | unsigned int bcnt,ccnt,ecnt; |
217 | 217 | ||
218 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 218 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
219 | if (!sfp) return -EINVAL; | 219 | if (!sfp) return -EINVAL; |
220 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); | 220 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); |
221 | if (!cptr) return -EINVAL; | 221 | if (!cptr) return -EINVAL; |
@@ -233,14 +233,14 @@ static ssize_t show_enum(int id,struct class_device *class_dev,char *buf) | |||
233 | return bcnt; | 233 | return bcnt; |
234 | } | 234 | } |
235 | 235 | ||
236 | static ssize_t show_bits(int id,struct class_device *class_dev,char *buf) | 236 | static ssize_t show_bits(int id,struct device *class_dev,char *buf) |
237 | { | 237 | { |
238 | struct pvr2_ctrl *cptr; | 238 | struct pvr2_ctrl *cptr; |
239 | struct pvr2_sysfs *sfp; | 239 | struct pvr2_sysfs *sfp; |
240 | int valid_bits,msk; | 240 | int valid_bits,msk; |
241 | unsigned int bcnt,ccnt; | 241 | unsigned int bcnt,ccnt; |
242 | 242 | ||
243 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 243 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
244 | if (!sfp) return -EINVAL; | 244 | if (!sfp) return -EINVAL; |
245 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); | 245 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); |
246 | if (!cptr) return -EINVAL; | 246 | if (!cptr) return -EINVAL; |
@@ -278,23 +278,23 @@ static int store_val_any(int id,int customfl,struct pvr2_sysfs *sfp, | |||
278 | return ret; | 278 | return ret; |
279 | } | 279 | } |
280 | 280 | ||
281 | static ssize_t store_val_norm(int id,struct class_device *class_dev, | 281 | static ssize_t store_val_norm(int id,struct device *class_dev, |
282 | const char *buf,size_t count) | 282 | const char *buf,size_t count) |
283 | { | 283 | { |
284 | struct pvr2_sysfs *sfp; | 284 | struct pvr2_sysfs *sfp; |
285 | int ret; | 285 | int ret; |
286 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 286 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
287 | ret = store_val_any(id,0,sfp,buf,count); | 287 | ret = store_val_any(id,0,sfp,buf,count); |
288 | if (!ret) ret = count; | 288 | if (!ret) ret = count; |
289 | return ret; | 289 | return ret; |
290 | } | 290 | } |
291 | 291 | ||
292 | static ssize_t store_val_custom(int id,struct class_device *class_dev, | 292 | static ssize_t store_val_custom(int id,struct device *class_dev, |
293 | const char *buf,size_t count) | 293 | const char *buf,size_t count) |
294 | { | 294 | { |
295 | struct pvr2_sysfs *sfp; | 295 | struct pvr2_sysfs *sfp; |
296 | int ret; | 296 | int ret; |
297 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 297 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
298 | ret = store_val_any(id,1,sfp,buf,count); | 298 | ret = store_val_any(id,1,sfp,buf,count); |
299 | if (!ret) ret = count; | 299 | if (!ret) ret = count; |
300 | return ret; | 300 | return ret; |
@@ -304,7 +304,7 @@ static ssize_t store_val_custom(int id,struct class_device *class_dev, | |||
304 | Mike Isely <isely@pobox.com> 30-April-2005 | 304 | Mike Isely <isely@pobox.com> 30-April-2005 |
305 | 305 | ||
306 | This next batch of horrible preprocessor hackery is needed because the | 306 | This next batch of horrible preprocessor hackery is needed because the |
307 | kernel's class_device_attribute mechanism fails to pass the actual | 307 | kernel's device_attribute mechanism fails to pass the actual |
308 | attribute through to the show / store functions, which means we have no | 308 | attribute through to the show / store functions, which means we have no |
309 | way to package up any attribute-specific parameters, like for example the | 309 | way to package up any attribute-specific parameters, like for example the |
310 | control id. So we work around this brain-damage by encoding the control | 310 | control id. So we work around this brain-damage by encoding the control |
@@ -314,11 +314,13 @@ static ssize_t store_val_custom(int id,struct class_device *class_dev, | |||
314 | */ | 314 | */ |
315 | 315 | ||
316 | #define CREATE_SHOW_INSTANCE(sf_name,ctl_id) \ | 316 | #define CREATE_SHOW_INSTANCE(sf_name,ctl_id) \ |
317 | static ssize_t sf_name##_##ctl_id(struct class_device *class_dev,char *buf) \ | 317 | static ssize_t sf_name##_##ctl_id(struct device *class_dev, \ |
318 | struct device_attribute *attr, char *buf) \ | ||
318 | { return sf_name(ctl_id,class_dev,buf); } | 319 | { return sf_name(ctl_id,class_dev,buf); } |
319 | 320 | ||
320 | #define CREATE_STORE_INSTANCE(sf_name,ctl_id) \ | 321 | #define CREATE_STORE_INSTANCE(sf_name,ctl_id) \ |
321 | static ssize_t sf_name##_##ctl_id(struct class_device *class_dev,const char *buf,size_t count) \ | 322 | static ssize_t sf_name##_##ctl_id(struct device *class_dev, \ |
323 | struct device_attribute *attr, const char *buf, size_t count) \ | ||
322 | { return sf_name(ctl_id,class_dev,buf,count); } | 324 | { return sf_name(ctl_id,class_dev,buf,count); } |
323 | 325 | ||
324 | #define CREATE_BATCH(ctl_id) \ | 326 | #define CREATE_BATCH(ctl_id) \ |
@@ -395,17 +397,27 @@ CREATE_BATCH(58) | |||
395 | CREATE_BATCH(59) | 397 | CREATE_BATCH(59) |
396 | 398 | ||
397 | struct pvr2_sysfs_func_set { | 399 | struct pvr2_sysfs_func_set { |
398 | ssize_t (*show_name)(struct class_device *,char *); | 400 | ssize_t (*show_name)(struct device *, |
399 | ssize_t (*show_type)(struct class_device *,char *); | 401 | struct device_attribute *attr, char *); |
400 | ssize_t (*show_min)(struct class_device *,char *); | 402 | ssize_t (*show_type)(struct device *, |
401 | ssize_t (*show_max)(struct class_device *,char *); | 403 | struct device_attribute *attr, char *); |
402 | ssize_t (*show_enum)(struct class_device *,char *); | 404 | ssize_t (*show_min)(struct device *, |
403 | ssize_t (*show_bits)(struct class_device *,char *); | 405 | struct device_attribute *attr, char *); |
404 | ssize_t (*show_val_norm)(struct class_device *,char *); | 406 | ssize_t (*show_max)(struct device *, |
405 | ssize_t (*store_val_norm)(struct class_device *, | 407 | struct device_attribute *attr, char *); |
408 | ssize_t (*show_enum)(struct device *, | ||
409 | struct device_attribute *attr, char *); | ||
410 | ssize_t (*show_bits)(struct device *, | ||
411 | struct device_attribute *attr, char *); | ||
412 | ssize_t (*show_val_norm)(struct device *, | ||
413 | struct device_attribute *attr, char *); | ||
414 | ssize_t (*store_val_norm)(struct device *, | ||
415 | struct device_attribute *attr, | ||
406 | const char *,size_t); | 416 | const char *,size_t); |
407 | ssize_t (*show_val_custom)(struct class_device *,char *); | 417 | ssize_t (*show_val_custom)(struct device *, |
408 | ssize_t (*store_val_custom)(struct class_device *, | 418 | struct device_attribute *attr, char *); |
419 | ssize_t (*store_val_custom)(struct device *, | ||
420 | struct device_attribute *attr, | ||
409 | const char *,size_t); | 421 | const char *,size_t); |
410 | }; | 422 | }; |
411 | 423 | ||
@@ -597,9 +609,9 @@ static void pvr2_sysfs_add_control(struct pvr2_sysfs *sfp,int ctl_id) | |||
597 | } | 609 | } |
598 | 610 | ||
599 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC | 611 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC |
600 | static ssize_t debuginfo_show(struct class_device *,char *); | 612 | static ssize_t debuginfo_show(struct device *,char *); |
601 | static ssize_t debugcmd_show(struct class_device *,char *); | 613 | static ssize_t debugcmd_show(struct device *,char *); |
602 | static ssize_t debugcmd_store(struct class_device *,const char *,size_t count); | 614 | static ssize_t debugcmd_store(struct device *,const char *,size_t count); |
603 | 615 | ||
604 | static void pvr2_sysfs_add_debugifc(struct pvr2_sysfs *sfp) | 616 | static void pvr2_sysfs_add_debugifc(struct pvr2_sysfs *sfp) |
605 | { | 617 | { |
@@ -616,16 +628,16 @@ static void pvr2_sysfs_add_debugifc(struct pvr2_sysfs *sfp) | |||
616 | dip->attr_debuginfo.attr.mode = S_IRUGO; | 628 | dip->attr_debuginfo.attr.mode = S_IRUGO; |
617 | dip->attr_debuginfo.show = debuginfo_show; | 629 | dip->attr_debuginfo.show = debuginfo_show; |
618 | sfp->debugifc = dip; | 630 | sfp->debugifc = dip; |
619 | ret = class_device_create_file(sfp->class_dev,&dip->attr_debugcmd); | 631 | ret = device_create_file(sfp->class_dev,&dip->attr_debugcmd); |
620 | if (ret < 0) { | 632 | if (ret < 0) { |
621 | printk(KERN_WARNING "%s: class_device_create_file error: %d\n", | 633 | printk(KERN_WARNING "%s: device_create_file error: %d\n", |
622 | __FUNCTION__, ret); | 634 | __FUNCTION__, ret); |
623 | } else { | 635 | } else { |
624 | dip->debugcmd_created_ok = !0; | 636 | dip->debugcmd_created_ok = !0; |
625 | } | 637 | } |
626 | ret = class_device_create_file(sfp->class_dev,&dip->attr_debuginfo); | 638 | ret = device_create_file(sfp->class_dev,&dip->attr_debuginfo); |
627 | if (ret < 0) { | 639 | if (ret < 0) { |
628 | printk(KERN_WARNING "%s: class_device_create_file error: %d\n", | 640 | printk(KERN_WARNING "%s: device_create_file error: %d\n", |
629 | __FUNCTION__, ret); | 641 | __FUNCTION__, ret); |
630 | } else { | 642 | } else { |
631 | dip->debuginfo_created_ok = !0; | 643 | dip->debuginfo_created_ok = !0; |
@@ -637,11 +649,11 @@ static void pvr2_sysfs_tear_down_debugifc(struct pvr2_sysfs *sfp) | |||
637 | { | 649 | { |
638 | if (!sfp->debugifc) return; | 650 | if (!sfp->debugifc) return; |
639 | if (sfp->debugifc->debuginfo_created_ok) { | 651 | if (sfp->debugifc->debuginfo_created_ok) { |
640 | class_device_remove_file(sfp->class_dev, | 652 | device_remove_file(sfp->class_dev, |
641 | &sfp->debugifc->attr_debuginfo); | 653 | &sfp->debugifc->attr_debuginfo); |
642 | } | 654 | } |
643 | if (sfp->debugifc->debugcmd_created_ok) { | 655 | if (sfp->debugifc->debugcmd_created_ok) { |
644 | class_device_remove_file(sfp->class_dev, | 656 | device_remove_file(sfp->class_dev, |
645 | &sfp->debugifc->attr_debugcmd); | 657 | &sfp->debugifc->attr_debugcmd); |
646 | } | 658 | } |
647 | kfree(sfp->debugifc); | 659 | kfree(sfp->debugifc); |
@@ -683,7 +695,7 @@ static void pvr2_sysfs_class_release(struct class *class) | |||
683 | } | 695 | } |
684 | 696 | ||
685 | 697 | ||
686 | static void pvr2_sysfs_release(struct class_device *class_dev) | 698 | static void pvr2_sysfs_release(struct device *class_dev) |
687 | { | 699 | { |
688 | pvr2_sysfs_trace("Releasing class_dev id=%p",class_dev); | 700 | pvr2_sysfs_trace("Releasing class_dev id=%p",class_dev); |
689 | kfree(class_dev); | 701 | kfree(class_dev); |
@@ -698,32 +710,33 @@ static void class_dev_destroy(struct pvr2_sysfs *sfp) | |||
698 | #endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ | 710 | #endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ |
699 | pvr2_sysfs_tear_down_controls(sfp); | 711 | pvr2_sysfs_tear_down_controls(sfp); |
700 | if (sfp->bus_info_created_ok) { | 712 | if (sfp->bus_info_created_ok) { |
701 | class_device_remove_file(sfp->class_dev, | 713 | device_remove_file(sfp->class_dev, |
702 | &sfp->attr_bus_info); | 714 | &sfp->attr_bus_info); |
703 | } | 715 | } |
704 | if (sfp->v4l_minor_number_created_ok) { | 716 | if (sfp->v4l_minor_number_created_ok) { |
705 | class_device_remove_file(sfp->class_dev, | 717 | device_remove_file(sfp->class_dev, |
706 | &sfp->attr_v4l_minor_number); | 718 | &sfp->attr_v4l_minor_number); |
707 | } | 719 | } |
708 | if (sfp->v4l_radio_minor_number_created_ok) { | 720 | if (sfp->v4l_radio_minor_number_created_ok) { |
709 | class_device_remove_file(sfp->class_dev, | 721 | device_remove_file(sfp->class_dev, |
710 | &sfp->attr_v4l_radio_minor_number); | 722 | &sfp->attr_v4l_radio_minor_number); |
711 | } | 723 | } |
712 | if (sfp->unit_number_created_ok) { | 724 | if (sfp->unit_number_created_ok) { |
713 | class_device_remove_file(sfp->class_dev, | 725 | device_remove_file(sfp->class_dev, |
714 | &sfp->attr_unit_number); | 726 | &sfp->attr_unit_number); |
715 | } | 727 | } |
716 | pvr2_sysfs_trace("Destroying class_dev id=%p",sfp->class_dev); | 728 | pvr2_sysfs_trace("Destroying class_dev id=%p",sfp->class_dev); |
717 | sfp->class_dev->class_data = NULL; | 729 | sfp->class_dev->driver_data = NULL; |
718 | class_device_unregister(sfp->class_dev); | 730 | device_unregister(sfp->class_dev); |
719 | sfp->class_dev = NULL; | 731 | sfp->class_dev = NULL; |
720 | } | 732 | } |
721 | 733 | ||
722 | 734 | ||
723 | static ssize_t v4l_minor_number_show(struct class_device *class_dev,char *buf) | 735 | static ssize_t v4l_minor_number_show(struct device *class_dev, |
736 | struct device_attribute *attr, char *buf) | ||
724 | { | 737 | { |
725 | struct pvr2_sysfs *sfp; | 738 | struct pvr2_sysfs *sfp; |
726 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 739 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
727 | if (!sfp) return -EINVAL; | 740 | if (!sfp) return -EINVAL; |
728 | return scnprintf(buf,PAGE_SIZE,"%d\n", | 741 | return scnprintf(buf,PAGE_SIZE,"%d\n", |
729 | pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, | 742 | pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, |
@@ -731,21 +744,23 @@ static ssize_t v4l_minor_number_show(struct class_device *class_dev,char *buf) | |||
731 | } | 744 | } |
732 | 745 | ||
733 | 746 | ||
734 | static ssize_t bus_info_show(struct class_device *class_dev,char *buf) | 747 | static ssize_t bus_info_show(struct device *class_dev, |
748 | struct device_attribute *attr, char *buf) | ||
735 | { | 749 | { |
736 | struct pvr2_sysfs *sfp; | 750 | struct pvr2_sysfs *sfp; |
737 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 751 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
738 | if (!sfp) return -EINVAL; | 752 | if (!sfp) return -EINVAL; |
739 | return scnprintf(buf,PAGE_SIZE,"%s\n", | 753 | return scnprintf(buf,PAGE_SIZE,"%s\n", |
740 | pvr2_hdw_get_bus_info(sfp->channel.hdw)); | 754 | pvr2_hdw_get_bus_info(sfp->channel.hdw)); |
741 | } | 755 | } |
742 | 756 | ||
743 | 757 | ||
744 | static ssize_t v4l_radio_minor_number_show(struct class_device *class_dev, | 758 | static ssize_t v4l_radio_minor_number_show(struct device *class_dev, |
759 | struct device_attribute *attr, | ||
745 | char *buf) | 760 | char *buf) |
746 | { | 761 | { |
747 | struct pvr2_sysfs *sfp; | 762 | struct pvr2_sysfs *sfp; |
748 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 763 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
749 | if (!sfp) return -EINVAL; | 764 | if (!sfp) return -EINVAL; |
750 | return scnprintf(buf,PAGE_SIZE,"%d\n", | 765 | return scnprintf(buf,PAGE_SIZE,"%d\n", |
751 | pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, | 766 | pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, |
@@ -753,10 +768,11 @@ static ssize_t v4l_radio_minor_number_show(struct class_device *class_dev, | |||
753 | } | 768 | } |
754 | 769 | ||
755 | 770 | ||
756 | static ssize_t unit_number_show(struct class_device *class_dev,char *buf) | 771 | static ssize_t unit_number_show(struct device *class_dev, |
772 | struct device_attribute *attr, char *buf) | ||
757 | { | 773 | { |
758 | struct pvr2_sysfs *sfp; | 774 | struct pvr2_sysfs *sfp; |
759 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 775 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
760 | if (!sfp) return -EINVAL; | 776 | if (!sfp) return -EINVAL; |
761 | return scnprintf(buf,PAGE_SIZE,"%d\n", | 777 | return scnprintf(buf,PAGE_SIZE,"%d\n", |
762 | pvr2_hdw_get_unit_number(sfp->channel.hdw)); | 778 | pvr2_hdw_get_unit_number(sfp->channel.hdw)); |
@@ -767,7 +783,7 @@ static void class_dev_create(struct pvr2_sysfs *sfp, | |||
767 | struct pvr2_sysfs_class *class_ptr) | 783 | struct pvr2_sysfs_class *class_ptr) |
768 | { | 784 | { |
769 | struct usb_device *usb_dev; | 785 | struct usb_device *usb_dev; |
770 | struct class_device *class_dev; | 786 | struct device *class_dev; |
771 | int ret; | 787 | int ret; |
772 | 788 | ||
773 | usb_dev = pvr2_hdw_get_dev(sfp->channel.hdw); | 789 | usb_dev = pvr2_hdw_get_dev(sfp->channel.hdw); |
@@ -779,23 +795,23 @@ static void class_dev_create(struct pvr2_sysfs *sfp, | |||
779 | 795 | ||
780 | class_dev->class = &class_ptr->class; | 796 | class_dev->class = &class_ptr->class; |
781 | if (pvr2_hdw_get_sn(sfp->channel.hdw)) { | 797 | if (pvr2_hdw_get_sn(sfp->channel.hdw)) { |
782 | snprintf(class_dev->class_id,BUS_ID_SIZE,"sn-%lu", | 798 | snprintf(class_dev->bus_id, BUS_ID_SIZE, "sn-%lu", |
783 | pvr2_hdw_get_sn(sfp->channel.hdw)); | 799 | pvr2_hdw_get_sn(sfp->channel.hdw)); |
784 | } else if (pvr2_hdw_get_unit_number(sfp->channel.hdw) >= 0) { | 800 | } else if (pvr2_hdw_get_unit_number(sfp->channel.hdw) >= 0) { |
785 | snprintf(class_dev->class_id,BUS_ID_SIZE,"unit-%c", | 801 | snprintf(class_dev->bus_id, BUS_ID_SIZE, "unit-%c", |
786 | pvr2_hdw_get_unit_number(sfp->channel.hdw) + 'a'); | 802 | pvr2_hdw_get_unit_number(sfp->channel.hdw) + 'a'); |
787 | } else { | 803 | } else { |
788 | kfree(class_dev); | 804 | kfree(class_dev); |
789 | return; | 805 | return; |
790 | } | 806 | } |
791 | 807 | ||
792 | class_dev->dev = &usb_dev->dev; | 808 | class_dev->parent = &usb_dev->dev; |
793 | 809 | ||
794 | sfp->class_dev = class_dev; | 810 | sfp->class_dev = class_dev; |
795 | class_dev->class_data = sfp; | 811 | class_dev->driver_data = sfp; |
796 | ret = class_device_register(class_dev); | 812 | ret = device_register(class_dev); |
797 | if (ret) { | 813 | if (ret) { |
798 | printk(KERN_ERR "%s: class_device_register failed\n", | 814 | printk(KERN_ERR "%s: device_register failed\n", |
799 | __FUNCTION__); | 815 | __FUNCTION__); |
800 | kfree(class_dev); | 816 | kfree(class_dev); |
801 | return; | 817 | return; |
@@ -805,10 +821,10 @@ static void class_dev_create(struct pvr2_sysfs *sfp, | |||
805 | sfp->attr_v4l_minor_number.attr.mode = S_IRUGO; | 821 | sfp->attr_v4l_minor_number.attr.mode = S_IRUGO; |
806 | sfp->attr_v4l_minor_number.show = v4l_minor_number_show; | 822 | sfp->attr_v4l_minor_number.show = v4l_minor_number_show; |
807 | sfp->attr_v4l_minor_number.store = NULL; | 823 | sfp->attr_v4l_minor_number.store = NULL; |
808 | ret = class_device_create_file(sfp->class_dev, | 824 | ret = device_create_file(sfp->class_dev, |
809 | &sfp->attr_v4l_minor_number); | 825 | &sfp->attr_v4l_minor_number); |
810 | if (ret < 0) { | 826 | if (ret < 0) { |
811 | printk(KERN_WARNING "%s: class_device_create_file error: %d\n", | 827 | printk(KERN_WARNING "%s: device_create_file error: %d\n", |
812 | __FUNCTION__, ret); | 828 | __FUNCTION__, ret); |
813 | } else { | 829 | } else { |
814 | sfp->v4l_minor_number_created_ok = !0; | 830 | sfp->v4l_minor_number_created_ok = !0; |
@@ -818,10 +834,10 @@ static void class_dev_create(struct pvr2_sysfs *sfp, | |||
818 | sfp->attr_v4l_radio_minor_number.attr.mode = S_IRUGO; | 834 | sfp->attr_v4l_radio_minor_number.attr.mode = S_IRUGO; |
819 | sfp->attr_v4l_radio_minor_number.show = v4l_radio_minor_number_show; | 835 | sfp->attr_v4l_radio_minor_number.show = v4l_radio_minor_number_show; |
820 | sfp->attr_v4l_radio_minor_number.store = NULL; | 836 | sfp->attr_v4l_radio_minor_number.store = NULL; |
821 | ret = class_device_create_file(sfp->class_dev, | 837 | ret = device_create_file(sfp->class_dev, |
822 | &sfp->attr_v4l_radio_minor_number); | 838 | &sfp->attr_v4l_radio_minor_number); |
823 | if (ret < 0) { | 839 | if (ret < 0) { |
824 | printk(KERN_WARNING "%s: class_device_create_file error: %d\n", | 840 | printk(KERN_WARNING "%s: device_create_file error: %d\n", |
825 | __FUNCTION__, ret); | 841 | __FUNCTION__, ret); |
826 | } else { | 842 | } else { |
827 | sfp->v4l_radio_minor_number_created_ok = !0; | 843 | sfp->v4l_radio_minor_number_created_ok = !0; |
@@ -831,9 +847,9 @@ static void class_dev_create(struct pvr2_sysfs *sfp, | |||
831 | sfp->attr_unit_number.attr.mode = S_IRUGO; | 847 | sfp->attr_unit_number.attr.mode = S_IRUGO; |
832 | sfp->attr_unit_number.show = unit_number_show; | 848 | sfp->attr_unit_number.show = unit_number_show; |
833 | sfp->attr_unit_number.store = NULL; | 849 | sfp->attr_unit_number.store = NULL; |
834 | ret = class_device_create_file(sfp->class_dev,&sfp->attr_unit_number); | 850 | ret = device_create_file(sfp->class_dev,&sfp->attr_unit_number); |
835 | if (ret < 0) { | 851 | if (ret < 0) { |
836 | printk(KERN_WARNING "%s: class_device_create_file error: %d\n", | 852 | printk(KERN_WARNING "%s: device_create_file error: %d\n", |
837 | __FUNCTION__, ret); | 853 | __FUNCTION__, ret); |
838 | } else { | 854 | } else { |
839 | sfp->unit_number_created_ok = !0; | 855 | sfp->unit_number_created_ok = !0; |
@@ -843,10 +859,10 @@ static void class_dev_create(struct pvr2_sysfs *sfp, | |||
843 | sfp->attr_bus_info.attr.mode = S_IRUGO; | 859 | sfp->attr_bus_info.attr.mode = S_IRUGO; |
844 | sfp->attr_bus_info.show = bus_info_show; | 860 | sfp->attr_bus_info.show = bus_info_show; |
845 | sfp->attr_bus_info.store = NULL; | 861 | sfp->attr_bus_info.store = NULL; |
846 | ret = class_device_create_file(sfp->class_dev, | 862 | ret = device_create_file(sfp->class_dev, |
847 | &sfp->attr_bus_info); | 863 | &sfp->attr_bus_info); |
848 | if (ret < 0) { | 864 | if (ret < 0) { |
849 | printk(KERN_WARNING "%s: class_device_create_file error: %d\n", | 865 | printk(KERN_WARNING "%s: device_create_file error: %d\n", |
850 | __FUNCTION__, ret); | 866 | __FUNCTION__, ret); |
851 | } else { | 867 | } else { |
852 | sfp->bus_info_created_ok = !0; | 868 | sfp->bus_info_created_ok = !0; |
@@ -886,7 +902,7 @@ struct pvr2_sysfs *pvr2_sysfs_create(struct pvr2_context *mp, | |||
886 | } | 902 | } |
887 | 903 | ||
888 | 904 | ||
889 | static int pvr2_sysfs_hotplug(struct class_device *cd,char **envp, | 905 | static int pvr2_sysfs_hotplug(struct device *cd,char **envp, |
890 | int numenvp,char *buf,int size) | 906 | int numenvp,char *buf,int size) |
891 | { | 907 | { |
892 | /* Even though we don't do anything here, we still need this function | 908 | /* Even though we don't do anything here, we still need this function |
@@ -902,8 +918,8 @@ struct pvr2_sysfs_class *pvr2_sysfs_class_create(void) | |||
902 | pvr2_sysfs_trace("Creating pvr2_sysfs_class id=%p",clp); | 918 | pvr2_sysfs_trace("Creating pvr2_sysfs_class id=%p",clp); |
903 | clp->class.name = "pvrusb2"; | 919 | clp->class.name = "pvrusb2"; |
904 | clp->class.class_release = pvr2_sysfs_class_release; | 920 | clp->class.class_release = pvr2_sysfs_class_release; |
905 | clp->class.release = pvr2_sysfs_release; | 921 | clp->class.dev_release = pvr2_sysfs_release; |
906 | clp->class.uevent = pvr2_sysfs_hotplug; | 922 | clp->class.dev_uevent = pvr2_sysfs_hotplug; |
907 | if (class_register(&clp->class)) { | 923 | if (class_register(&clp->class)) { |
908 | pvr2_sysfs_trace( | 924 | pvr2_sysfs_trace( |
909 | "Registration failed for pvr2_sysfs_class id=%p",clp); | 925 | "Registration failed for pvr2_sysfs_class id=%p",clp); |
@@ -921,32 +937,32 @@ void pvr2_sysfs_class_destroy(struct pvr2_sysfs_class *clp) | |||
921 | 937 | ||
922 | 938 | ||
923 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC | 939 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC |
924 | static ssize_t debuginfo_show(struct class_device *class_dev,char *buf) | 940 | static ssize_t debuginfo_show(struct device *class_dev,char *buf) |
925 | { | 941 | { |
926 | struct pvr2_sysfs *sfp; | 942 | struct pvr2_sysfs *sfp; |
927 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 943 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
928 | if (!sfp) return -EINVAL; | 944 | if (!sfp) return -EINVAL; |
929 | pvr2_hdw_trigger_module_log(sfp->channel.hdw); | 945 | pvr2_hdw_trigger_module_log(sfp->channel.hdw); |
930 | return pvr2_debugifc_print_info(sfp->channel.hdw,buf,PAGE_SIZE); | 946 | return pvr2_debugifc_print_info(sfp->channel.hdw,buf,PAGE_SIZE); |
931 | } | 947 | } |
932 | 948 | ||
933 | 949 | ||
934 | static ssize_t debugcmd_show(struct class_device *class_dev,char *buf) | 950 | static ssize_t debugcmd_show(struct device *class_dev,char *buf) |
935 | { | 951 | { |
936 | struct pvr2_sysfs *sfp; | 952 | struct pvr2_sysfs *sfp; |
937 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 953 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
938 | if (!sfp) return -EINVAL; | 954 | if (!sfp) return -EINVAL; |
939 | return pvr2_debugifc_print_status(sfp->channel.hdw,buf,PAGE_SIZE); | 955 | return pvr2_debugifc_print_status(sfp->channel.hdw,buf,PAGE_SIZE); |
940 | } | 956 | } |
941 | 957 | ||
942 | 958 | ||
943 | static ssize_t debugcmd_store(struct class_device *class_dev, | 959 | static ssize_t debugcmd_store(struct device *class_dev, |
944 | const char *buf,size_t count) | 960 | const char *buf, size_t count) |
945 | { | 961 | { |
946 | struct pvr2_sysfs *sfp; | 962 | struct pvr2_sysfs *sfp; |
947 | int ret; | 963 | int ret; |
948 | 964 | ||
949 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 965 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
950 | if (!sfp) return -EINVAL; | 966 | if (!sfp) return -EINVAL; |
951 | 967 | ||
952 | ret = pvr2_debugifc_docmd(sfp->channel.hdw,buf,count); | 968 | ret = pvr2_debugifc_docmd(sfp->channel.hdw,buf,count); |