2727struct internal_container {
2828 struct klist_node node ;
2929 struct attribute_container * cont ;
30- struct class_device classdev ;
30+ struct device classdev ;
3131};
3232
3333static void internal_container_klist_get (struct klist_node * n )
3434{
3535 struct internal_container * ic =
3636 container_of (n , struct internal_container , node );
37- class_device_get (& ic -> classdev );
37+ get_device (& ic -> classdev );
3838}
3939
4040static void internal_container_klist_put (struct klist_node * n )
4141{
4242 struct internal_container * ic =
4343 container_of (n , struct internal_container , node );
44- class_device_put (& ic -> classdev );
44+ put_device (& ic -> classdev );
4545}
4646
4747
@@ -53,7 +53,7 @@ static void internal_container_klist_put(struct klist_node *n)
5353 * Returns the container associated with this classdev.
5454 */
5555struct attribute_container *
56- attribute_container_classdev_to_container (struct class_device * classdev )
56+ attribute_container_classdev_to_container (struct device * classdev )
5757{
5858 struct internal_container * ic =
5959 container_of (classdev , struct internal_container , classdev );
@@ -110,11 +110,11 @@ attribute_container_unregister(struct attribute_container *cont)
110110EXPORT_SYMBOL_GPL (attribute_container_unregister );
111111
112112/* private function used as class release */
113- static void attribute_container_release (struct class_device * classdev )
113+ static void attribute_container_release (struct device * classdev )
114114{
115115 struct internal_container * ic
116116 = container_of (classdev , struct internal_container , classdev );
117- struct device * dev = classdev -> dev ;
117+ struct device * dev = classdev -> parent ;
118118
119119 kfree (ic );
120120 put_device (dev );
@@ -129,20 +129,20 @@ static void attribute_container_release(struct class_device *classdev)
129129 * This function allocates storage for the class device(s) to be
130130 * attached to dev (one for each matching attribute_container). If no
131131 * fn is provided, the code will simply register the class device via
132- * class_device_add . If a function is provided, it is expected to add
132+ * device_add . If a function is provided, it is expected to add
133133 * the class device at the appropriate time. One of the things that
134134 * might be necessary is to allocate and initialise the classdev and
135135 * then add it a later time. To do this, call this routine for
136136 * allocation and initialisation and then use
137- * attribute_container_device_trigger() to call class_device_add () on
137+ * attribute_container_device_trigger() to call device_add () on
138138 * it. Note: after this, the class device contains a reference to dev
139139 * which is not relinquished until the release of the classdev.
140140 */
141141void
142142attribute_container_add_device (struct device * dev ,
143143 int (* fn )(struct attribute_container * ,
144144 struct device * ,
145- struct class_device * ))
145+ struct device * ))
146146{
147147 struct attribute_container * cont ;
148148
@@ -163,11 +163,11 @@ attribute_container_add_device(struct device *dev,
163163 }
164164
165165 ic -> cont = cont ;
166- class_device_initialize (& ic -> classdev );
167- ic -> classdev .dev = get_device (dev );
166+ device_initialize (& ic -> classdev );
167+ ic -> classdev .parent = get_device (dev );
168168 ic -> classdev .class = cont -> class ;
169- cont -> class -> release = attribute_container_release ;
170- strcpy (ic -> classdev .class_id , dev -> bus_id );
169+ cont -> class -> dev_release = attribute_container_release ;
170+ strcpy (ic -> classdev .bus_id , dev -> bus_id );
171171 if (fn )
172172 fn (cont , dev , & ic -> classdev );
173173 else
@@ -195,20 +195,19 @@ attribute_container_add_device(struct device *dev,
195195 * @fn: A function to call to remove the device
196196 *
197197 * This routine triggers device removal. If fn is NULL, then it is
198- * simply done via class_device_unregister (note that if something
198+ * simply done via device_unregister (note that if something
199199 * still has a reference to the classdev, then the memory occupied
200200 * will not be freed until the classdev is released). If you want a
201201 * two phase release: remove from visibility and then delete the
202202 * device, then you should use this routine with a fn that calls
203- * class_device_del() and then use
204- * attribute_container_device_trigger() to do the final put on the
205- * classdev.
203+ * device_del() and then use attribute_container_device_trigger()
204+ * to do the final put on the classdev.
206205 */
207206void
208207attribute_container_remove_device (struct device * dev ,
209208 void (* fn )(struct attribute_container * ,
210209 struct device * ,
211- struct class_device * ))
210+ struct device * ))
212211{
213212 struct attribute_container * cont ;
214213
@@ -224,14 +223,14 @@ attribute_container_remove_device(struct device *dev,
224223 continue ;
225224
226225 klist_for_each_entry (ic , & cont -> containers , node , & iter ) {
227- if (dev != ic -> classdev .dev )
226+ if (dev != ic -> classdev .parent )
228227 continue ;
229228 klist_del (& ic -> node );
230229 if (fn )
231230 fn (cont , dev , & ic -> classdev );
232231 else {
233232 attribute_container_remove_attrs (& ic -> classdev );
234- class_device_unregister (& ic -> classdev );
233+ device_unregister (& ic -> classdev );
235234 }
236235 }
237236 }
252251attribute_container_device_trigger (struct device * dev ,
253252 int (* fn )(struct attribute_container * ,
254253 struct device * ,
255- struct class_device * ))
254+ struct device * ))
256255{
257256 struct attribute_container * cont ;
258257
@@ -270,7 +269,7 @@ attribute_container_device_trigger(struct device *dev,
270269 }
271270
272271 klist_for_each_entry (ic , & cont -> containers , node , & iter ) {
273- if (dev == ic -> classdev .dev )
272+ if (dev == ic -> classdev .parent )
274273 fn (cont , dev , & ic -> classdev );
275274 }
276275 }
@@ -313,11 +312,11 @@ attribute_container_trigger(struct device *dev,
313312 * attributes listed in the container
314313 */
315314int
316- attribute_container_add_attrs (struct class_device * classdev )
315+ attribute_container_add_attrs (struct device * classdev )
317316{
318317 struct attribute_container * cont =
319318 attribute_container_classdev_to_container (classdev );
320- struct class_device_attribute * * attrs = cont -> attrs ;
319+ struct device_attribute * * attrs = cont -> attrs ;
321320 int i , error ;
322321
323322 BUG_ON (attrs && cont -> grp );
@@ -329,7 +328,7 @@ attribute_container_add_attrs(struct class_device *classdev)
329328 return sysfs_create_group (& classdev -> kobj , cont -> grp );
330329
331330 for (i = 0 ; attrs [i ]; i ++ ) {
332- error = class_device_create_file (classdev , attrs [i ]);
331+ error = device_create_file (classdev , attrs [i ]);
333332 if (error )
334333 return error ;
335334 }
@@ -338,18 +337,18 @@ attribute_container_add_attrs(struct class_device *classdev)
338337}
339338
340339/**
341- * attribute_container_add_class_device - same function as class_device_add
340+ * attribute_container_add_class_device - same function as device_add
342341 *
343342 * @classdev: the class device to add
344343 *
345- * This performs essentially the same function as class_device_add except for
344+ * This performs essentially the same function as device_add except for
346345 * attribute containers, namely add the classdev to the system and then
347346 * create the attribute files
348347 */
349348int
350- attribute_container_add_class_device (struct class_device * classdev )
349+ attribute_container_add_class_device (struct device * classdev )
351350{
352- int error = class_device_add (classdev );
351+ int error = device_add (classdev );
353352 if (error )
354353 return error ;
355354 return attribute_container_add_attrs (classdev );
@@ -364,7 +363,7 @@ attribute_container_add_class_device(struct class_device *classdev)
364363int
365364attribute_container_add_class_device_adapter (struct attribute_container * cont ,
366365 struct device * dev ,
367- struct class_device * classdev )
366+ struct device * classdev )
368367{
369368 return attribute_container_add_class_device (classdev );
370369}
@@ -376,11 +375,11 @@ attribute_container_add_class_device_adapter(struct attribute_container *cont,
376375 *
377376 */
378377void
379- attribute_container_remove_attrs (struct class_device * classdev )
378+ attribute_container_remove_attrs (struct device * classdev )
380379{
381380 struct attribute_container * cont =
382381 attribute_container_classdev_to_container (classdev );
383- struct class_device_attribute * * attrs = cont -> attrs ;
382+ struct device_attribute * * attrs = cont -> attrs ;
384383 int i ;
385384
386385 if (!attrs && !cont -> grp )
@@ -392,7 +391,7 @@ attribute_container_remove_attrs(struct class_device *classdev)
392391 }
393392
394393 for (i = 0 ; attrs [i ]; i ++ )
395- class_device_remove_file (classdev , attrs [i ]);
394+ device_remove_file (classdev , attrs [i ]);
396395}
397396
398397/**
@@ -401,13 +400,13 @@ attribute_container_remove_attrs(struct class_device *classdev)
401400 * @classdev: the class device
402401 *
403402 * This function simply removes all the attribute files and then calls
404- * class_device_del .
403+ * device_del .
405404 */
406405void
407- attribute_container_class_device_del (struct class_device * classdev )
406+ attribute_container_class_device_del (struct device * classdev )
408407{
409408 attribute_container_remove_attrs (classdev );
410- class_device_del (classdev );
409+ device_del (classdev );
411410}
412411
413412/**
@@ -419,16 +418,16 @@ attribute_container_class_device_del(struct class_device *classdev)
419418 * Looks up the device in the container's list of class devices and returns
420419 * the corresponding class_device.
421420 */
422- struct class_device *
421+ struct device *
423422attribute_container_find_class_device (struct attribute_container * cont ,
424423 struct device * dev )
425424{
426- struct class_device * cdev = NULL ;
425+ struct device * cdev = NULL ;
427426 struct internal_container * ic ;
428427 struct klist_iter iter ;
429428
430429 klist_for_each_entry (ic , & cont -> containers , node , & iter ) {
431- if (ic -> classdev .dev == dev ) {
430+ if (ic -> classdev .parent == dev ) {
432431 cdev = & ic -> classdev ;
433432 /* FIXME: must exit iterator then break */
434433 klist_iter_exit (& iter );
0 commit comments