@@ -73,7 +73,7 @@ EXPORT_SYMBOL(framebuffer_alloc);
7373 *
7474 * @info: frame buffer info structure
7575 *
76- * Drop the reference count of the class_device embedded in the
76+ * Drop the reference count of the device embedded in the
7777 * framebuffer info structure.
7878 *
7979 */
@@ -120,10 +120,10 @@ static int mode_string(char *buf, unsigned int offset,
120120 m , mode -> xres , mode -> yres , v , mode -> refresh );
121121}
122122
123- static ssize_t store_mode (struct class_device * class_device , const char * buf ,
124- size_t count )
123+ static ssize_t store_mode (struct device * device , struct device_attribute * attr ,
124+ const char * buf , size_t count )
125125{
126- struct fb_info * fb_info = class_get_devdata ( class_device );
126+ struct fb_info * fb_info = dev_get_drvdata ( device );
127127 char mstr [100 ];
128128 struct fb_var_screeninfo var ;
129129 struct fb_modelist * modelist ;
@@ -151,20 +151,22 @@ static ssize_t store_mode(struct class_device *class_device, const char * buf,
151151 return - EINVAL ;
152152}
153153
154- static ssize_t show_mode (struct class_device * class_device , char * buf )
154+ static ssize_t show_mode (struct device * device , struct device_attribute * attr ,
155+ char * buf )
155156{
156- struct fb_info * fb_info = class_get_devdata ( class_device );
157+ struct fb_info * fb_info = dev_get_drvdata ( device );
157158
158159 if (!fb_info -> mode )
159160 return 0 ;
160161
161162 return mode_string (buf , 0 , fb_info -> mode );
162163}
163164
164- static ssize_t store_modes (struct class_device * class_device , const char * buf ,
165- size_t count )
165+ static ssize_t store_modes (struct device * device ,
166+ struct device_attribute * attr ,
167+ const char * buf , size_t count )
166168{
167- struct fb_info * fb_info = class_get_devdata ( class_device );
169+ struct fb_info * fb_info = dev_get_drvdata ( device );
168170 LIST_HEAD (old_list );
169171 int i = count / sizeof (struct fb_videomode );
170172
@@ -186,9 +188,10 @@ static ssize_t store_modes(struct class_device *class_device, const char * buf,
186188 return 0 ;
187189}
188190
189- static ssize_t show_modes (struct class_device * class_device , char * buf )
191+ static ssize_t show_modes (struct device * device , struct device_attribute * attr ,
192+ char * buf )
190193{
191- struct fb_info * fb_info = class_get_devdata ( class_device );
194+ struct fb_info * fb_info = dev_get_drvdata ( device );
192195 unsigned int i ;
193196 struct list_head * pos ;
194197 struct fb_modelist * modelist ;
@@ -203,10 +206,10 @@ static ssize_t show_modes(struct class_device *class_device, char *buf)
203206 return i ;
204207}
205208
206- static ssize_t store_bpp (struct class_device * class_device , const char * buf ,
207- size_t count )
209+ static ssize_t store_bpp (struct device * device , struct device_attribute * attr ,
210+ const char * buf , size_t count )
208211{
209- struct fb_info * fb_info = class_get_devdata ( class_device );
212+ struct fb_info * fb_info = dev_get_drvdata ( device );
210213 struct fb_var_screeninfo var ;
211214 char * * last = NULL ;
212215 int err ;
@@ -218,16 +221,18 @@ static ssize_t store_bpp(struct class_device *class_device, const char * buf,
218221 return count ;
219222}
220223
221- static ssize_t show_bpp (struct class_device * class_device , char * buf )
224+ static ssize_t show_bpp (struct device * device , struct device_attribute * attr ,
225+ char * buf )
222226{
223- struct fb_info * fb_info = class_get_devdata ( class_device );
227+ struct fb_info * fb_info = dev_get_drvdata ( device );
224228 return snprintf (buf , PAGE_SIZE , "%d\n" , fb_info -> var .bits_per_pixel );
225229}
226230
227- static ssize_t store_rotate (struct class_device * class_device , const char * buf ,
228- size_t count )
231+ static ssize_t store_rotate (struct device * device ,
232+ struct device_attribute * attr ,
233+ const char * buf , size_t count )
229234{
230- struct fb_info * fb_info = class_get_devdata ( class_device );
235+ struct fb_info * fb_info = dev_get_drvdata ( device );
231236 struct fb_var_screeninfo var ;
232237 char * * last = NULL ;
233238 int err ;
@@ -242,17 +247,19 @@ static ssize_t store_rotate(struct class_device *class_device, const char *buf,
242247}
243248
244249
245- static ssize_t show_rotate (struct class_device * class_device , char * buf )
250+ static ssize_t show_rotate (struct device * device ,
251+ struct device_attribute * attr , char * buf )
246252{
247- struct fb_info * fb_info = class_get_devdata ( class_device );
253+ struct fb_info * fb_info = dev_get_drvdata ( device );
248254
249255 return snprintf (buf , PAGE_SIZE , "%d\n" , fb_info -> var .rotate );
250256}
251257
252- static ssize_t store_virtual (struct class_device * class_device ,
253- const char * buf , size_t count )
258+ static ssize_t store_virtual (struct device * device ,
259+ struct device_attribute * attr ,
260+ const char * buf , size_t count )
254261{
255- struct fb_info * fb_info = class_get_devdata ( class_device );
262+ struct fb_info * fb_info = dev_get_drvdata ( device );
256263 struct fb_var_screeninfo var ;
257264 char * last = NULL ;
258265 int err ;
@@ -269,23 +276,26 @@ static ssize_t store_virtual(struct class_device *class_device,
269276 return count ;
270277}
271278
272- static ssize_t show_virtual (struct class_device * class_device , char * buf )
279+ static ssize_t show_virtual (struct device * device ,
280+ struct device_attribute * attr , char * buf )
273281{
274- struct fb_info * fb_info = class_get_devdata ( class_device );
282+ struct fb_info * fb_info = dev_get_drvdata ( device );
275283 return snprintf (buf , PAGE_SIZE , "%d,%d\n" , fb_info -> var .xres_virtual ,
276284 fb_info -> var .yres_virtual );
277285}
278286
279- static ssize_t show_stride (struct class_device * class_device , char * buf )
287+ static ssize_t show_stride (struct device * device ,
288+ struct device_attribute * attr , char * buf )
280289{
281- struct fb_info * fb_info = class_get_devdata ( class_device );
290+ struct fb_info * fb_info = dev_get_drvdata ( device );
282291 return snprintf (buf , PAGE_SIZE , "%d\n" , fb_info -> fix .line_length );
283292}
284293
285- static ssize_t store_blank (struct class_device * class_device , const char * buf ,
286- size_t count )
294+ static ssize_t store_blank (struct device * device ,
295+ struct device_attribute * attr ,
296+ const char * buf , size_t count )
287297{
288- struct fb_info * fb_info = class_get_devdata ( class_device );
298+ struct fb_info * fb_info = dev_get_drvdata ( device );
289299 char * last = NULL ;
290300 int err ;
291301
@@ -299,42 +309,48 @@ static ssize_t store_blank(struct class_device *class_device, const char * buf,
299309 return count ;
300310}
301311
302- static ssize_t show_blank (struct class_device * class_device , char * buf )
312+ static ssize_t show_blank (struct device * device ,
313+ struct device_attribute * attr , char * buf )
303314{
304- // struct fb_info *fb_info = class_get_devdata(class_device );
315+ // struct fb_info *fb_info = dev_get_drvdata(device );
305316 return 0 ;
306317}
307318
308- static ssize_t store_console (struct class_device * class_device ,
309- const char * buf , size_t count )
319+ static ssize_t store_console (struct device * device ,
320+ struct device_attribute * attr ,
321+ const char * buf , size_t count )
310322{
311- // struct fb_info *fb_info = class_get_devdata(class_device );
323+ // struct fb_info *fb_info = dev_get_drvdata(device );
312324 return 0 ;
313325}
314326
315- static ssize_t show_console (struct class_device * class_device , char * buf )
327+ static ssize_t show_console (struct device * device ,
328+ struct device_attribute * attr , char * buf )
316329{
317- // struct fb_info *fb_info = class_get_devdata(class_device );
330+ // struct fb_info *fb_info = dev_get_drvdata(device );
318331 return 0 ;
319332}
320333
321- static ssize_t store_cursor (struct class_device * class_device ,
322- const char * buf , size_t count )
334+ static ssize_t store_cursor (struct device * device ,
335+ struct device_attribute * attr ,
336+ const char * buf , size_t count )
323337{
324- // struct fb_info *fb_info = class_get_devdata(class_device );
338+ // struct fb_info *fb_info = dev_get_drvdata(device );
325339 return 0 ;
326340}
327341
328- static ssize_t show_cursor (struct class_device * class_device , char * buf )
342+ static ssize_t show_cursor (struct device * device ,
343+ struct device_attribute * attr , char * buf )
329344{
330- // struct fb_info *fb_info = class_get_devdata(class_device );
345+ // struct fb_info *fb_info = dev_get_drvdata(device );
331346 return 0 ;
332347}
333348
334- static ssize_t store_pan (struct class_device * class_device , const char * buf ,
335- size_t count )
349+ static ssize_t store_pan (struct device * device ,
350+ struct device_attribute * attr ,
351+ const char * buf , size_t count )
336352{
337- struct fb_info * fb_info = class_get_devdata ( class_device );
353+ struct fb_info * fb_info = dev_get_drvdata ( device );
338354 struct fb_var_screeninfo var ;
339355 char * last = NULL ;
340356 int err ;
@@ -355,24 +371,27 @@ static ssize_t store_pan(struct class_device *class_device, const char * buf,
355371 return count ;
356372}
357373
358- static ssize_t show_pan (struct class_device * class_device , char * buf )
374+ static ssize_t show_pan (struct device * device ,
375+ struct device_attribute * attr , char * buf )
359376{
360- struct fb_info * fb_info = class_get_devdata ( class_device );
377+ struct fb_info * fb_info = dev_get_drvdata ( device );
361378 return snprintf (buf , PAGE_SIZE , "%d,%d\n" , fb_info -> var .xoffset ,
362379 fb_info -> var .xoffset );
363380}
364381
365- static ssize_t show_name (struct class_device * class_device , char * buf )
382+ static ssize_t show_name (struct device * device ,
383+ struct device_attribute * attr , char * buf )
366384{
367- struct fb_info * fb_info = class_get_devdata ( class_device );
385+ struct fb_info * fb_info = dev_get_drvdata ( device );
368386
369387 return snprintf (buf , PAGE_SIZE , "%s\n" , fb_info -> fix .id );
370388}
371389
372- static ssize_t store_fbstate (struct class_device * class_device ,
373- const char * buf , size_t count )
390+ static ssize_t store_fbstate (struct device * device ,
391+ struct device_attribute * attr ,
392+ const char * buf , size_t count )
374393{
375- struct fb_info * fb_info = class_get_devdata ( class_device );
394+ struct fb_info * fb_info = dev_get_drvdata ( device );
376395 u32 state ;
377396 char * last = NULL ;
378397
@@ -385,17 +404,19 @@ static ssize_t store_fbstate(struct class_device *class_device,
385404 return count ;
386405}
387406
388- static ssize_t show_fbstate (struct class_device * class_device , char * buf )
407+ static ssize_t show_fbstate (struct device * device ,
408+ struct device_attribute * attr , char * buf )
389409{
390- struct fb_info * fb_info = class_get_devdata ( class_device );
410+ struct fb_info * fb_info = dev_get_drvdata ( device );
391411 return snprintf (buf , PAGE_SIZE , "%d\n" , fb_info -> state );
392412}
393413
394414#ifdef CONFIG_FB_BACKLIGHT
395- static ssize_t store_bl_curve (struct class_device * class_device ,
396- const char * buf , size_t count )
415+ static ssize_t store_bl_curve (struct device * device ,
416+ struct device_attribute * attr ,
417+ const char * buf , size_t count )
397418{
398- struct fb_info * fb_info = class_get_devdata ( class_device );
419+ struct fb_info * fb_info = dev_get_drvdata ( device );
399420 u8 tmp_curve [FB_BACKLIGHT_LEVELS ];
400421 unsigned int i ;
401422
@@ -432,9 +453,10 @@ static ssize_t store_bl_curve(struct class_device *class_device,
432453 return count ;
433454}
434455
435- static ssize_t show_bl_curve (struct class_device * class_device , char * buf )
456+ static ssize_t show_bl_curve (struct device * device ,
457+ struct device_attribute * attr , char * buf )
436458{
437- struct fb_info * fb_info = class_get_devdata ( class_device );
459+ struct fb_info * fb_info = dev_get_drvdata ( device );
438460 ssize_t len = 0 ;
439461 unsigned int i ;
440462
@@ -465,7 +487,7 @@ static ssize_t show_bl_curve(struct class_device *class_device, char *buf)
465487/* When cmap is added back in it should be a binary attribute
466488 * not a text one. Consideration should also be given to converting
467489 * fbdev to use configfs instead of sysfs */
468- static struct class_device_attribute class_device_attrs [] = {
490+ static struct device_attribute device_attrs [] = {
469491 __ATTR (bits_per_pixel , S_IRUGO |S_IWUSR , show_bpp , store_bpp ),
470492 __ATTR (blank , S_IRUGO |S_IWUSR , show_blank , store_blank ),
471493 __ATTR (console , S_IRUGO |S_IWUSR , show_console , store_console ),
@@ -483,40 +505,37 @@ static struct class_device_attribute class_device_attrs[] = {
483505#endif
484506};
485507
486- int fb_init_class_device (struct fb_info * fb_info )
508+ int fb_init_device (struct fb_info * fb_info )
487509{
488510 int i , error = 0 ;
489511
490- class_set_devdata (fb_info -> class_device , fb_info );
512+ dev_set_drvdata (fb_info -> dev , fb_info );
491513
492514 fb_info -> class_flag |= FB_SYSFS_FLAG_ATTR ;
493515
494- for (i = 0 ; i < ARRAY_SIZE (class_device_attrs ); i ++ ) {
495- error = class_device_create_file (fb_info -> class_device ,
496- & class_device_attrs [i ]);
516+ for (i = 0 ; i < ARRAY_SIZE (device_attrs ); i ++ ) {
517+ error = device_create_file (fb_info -> dev , & device_attrs [i ]);
497518
498519 if (error )
499520 break ;
500521 }
501522
502523 if (error ) {
503524 while (-- i >= 0 )
504- class_device_remove_file (fb_info -> class_device ,
505- & class_device_attrs [i ]);
525+ device_remove_file (fb_info -> dev , & device_attrs [i ]);
506526 fb_info -> class_flag &= ~FB_SYSFS_FLAG_ATTR ;
507527 }
508528
509529 return 0 ;
510530}
511531
512- void fb_cleanup_class_device (struct fb_info * fb_info )
532+ void fb_cleanup_device (struct fb_info * fb_info )
513533{
514534 unsigned int i ;
515535
516536 if (fb_info -> class_flag & FB_SYSFS_FLAG_ATTR ) {
517- for (i = 0 ; i < ARRAY_SIZE (class_device_attrs ); i ++ )
518- class_device_remove_file (fb_info -> class_device ,
519- & class_device_attrs [i ]);
537+ for (i = 0 ; i < ARRAY_SIZE (device_attrs ); i ++ )
538+ device_remove_file (fb_info -> dev , & device_attrs [i ]);
520539
521540 fb_info -> class_flag &= ~FB_SYSFS_FLAG_ATTR ;
522541 }
0 commit comments