@@ -373,15 +373,15 @@ static ssize_t initstate_show(struct device *dev,
373373 val = init_done (zram );
374374 up_read (& zram -> init_lock );
375375
376- return scnprintf (buf , PAGE_SIZE , "%u\n" , val );
376+ return sysfs_emit (buf , "%u\n" , val );
377377}
378378
379379static ssize_t disksize_show (struct device * dev ,
380380 struct device_attribute * attr , char * buf )
381381{
382382 struct zram * zram = dev_to_zram (dev );
383383
384- return scnprintf (buf , PAGE_SIZE , "%llu\n" , zram -> disksize );
384+ return sysfs_emit (buf , "%llu\n" , zram -> disksize );
385385}
386386
387387static ssize_t mem_limit_store (struct device * dev ,
@@ -532,7 +532,7 @@ static ssize_t writeback_limit_enable_show(struct device *dev,
532532 spin_unlock (& zram -> wb_limit_lock );
533533 up_read (& zram -> init_lock );
534534
535- return scnprintf (buf , PAGE_SIZE , "%d\n" , val );
535+ return sysfs_emit (buf , "%d\n" , val );
536536}
537537
538538static ssize_t writeback_limit_store (struct device * dev ,
@@ -567,7 +567,7 @@ static ssize_t writeback_limit_show(struct device *dev,
567567 spin_unlock (& zram -> wb_limit_lock );
568568 up_read (& zram -> init_lock );
569569
570- return scnprintf (buf , PAGE_SIZE , "%llu\n" , val );
570+ return sysfs_emit (buf , "%llu\n" , val );
571571}
572572
573573static void reset_bdev (struct zram * zram )
@@ -1415,7 +1415,7 @@ static ssize_t recomp_algorithm_show(struct device *dev,
14151415 if (!zram -> comp_algs [prio ])
14161416 continue ;
14171417
1418- sz += scnprintf (buf + sz , PAGE_SIZE - sz - 2 , "#%d: " , prio );
1418+ sz += sysfs_emit_at (buf , sz , "#%d: " , prio );
14191419 sz += __comp_algorithm_show (zram , prio , buf + sz );
14201420 }
14211421
@@ -1488,7 +1488,7 @@ static ssize_t io_stat_show(struct device *dev,
14881488 ssize_t ret ;
14891489
14901490 down_read (& zram -> init_lock );
1491- ret = scnprintf (buf , PAGE_SIZE ,
1491+ ret = sysfs_emit (buf ,
14921492 "%8llu %8llu 0 %8llu\n" ,
14931493 (u64 )atomic64_read (& zram -> stats .failed_reads ),
14941494 (u64 )atomic64_read (& zram -> stats .failed_writes ),
@@ -1518,7 +1518,7 @@ static ssize_t mm_stat_show(struct device *dev,
15181518 orig_size = atomic64_read (& zram -> stats .pages_stored );
15191519 max_used = atomic_long_read (& zram -> stats .max_used_pages );
15201520
1521- ret = scnprintf (buf , PAGE_SIZE ,
1521+ ret = sysfs_emit (buf ,
15221522 "%8llu %8llu %8llu %8lu %8ld %8llu %8lu %8llu %8llu\n" ,
15231523 orig_size << PAGE_SHIFT ,
15241524 (u64 )atomic64_read (& zram -> stats .compr_data_size ),
@@ -1543,8 +1543,8 @@ static ssize_t bd_stat_show(struct device *dev,
15431543 ssize_t ret ;
15441544
15451545 down_read (& zram -> init_lock );
1546- ret = scnprintf (buf , PAGE_SIZE ,
1547- "%8llu %8llu %8llu\n" ,
1546+ ret = sysfs_emit (buf ,
1547+ "%8llu %8llu %8llu\n" ,
15481548 FOUR_K ((u64 )atomic64_read (& zram -> stats .bd_count )),
15491549 FOUR_K ((u64 )atomic64_read (& zram -> stats .bd_reads )),
15501550 FOUR_K ((u64 )atomic64_read (& zram -> stats .bd_writes )));
@@ -1562,7 +1562,7 @@ static ssize_t debug_stat_show(struct device *dev,
15621562 ssize_t ret ;
15631563
15641564 down_read (& zram -> init_lock );
1565- ret = scnprintf (buf , PAGE_SIZE ,
1565+ ret = sysfs_emit (buf ,
15661566 "version: %d\n0 %8llu\n" ,
15671567 version ,
15681568 (u64 )atomic64_read (& zram -> stats .miss_free ));
@@ -2810,7 +2810,7 @@ static ssize_t hot_add_show(const struct class *class,
28102810
28112811 if (ret < 0 )
28122812 return ret ;
2813- return scnprintf (buf , PAGE_SIZE , "%d\n" , ret );
2813+ return sysfs_emit (buf , "%d\n" , ret );
28142814}
28152815/* This attribute must be set to 0400, so CLASS_ATTR_RO() can not be used */
28162816static struct class_attribute class_attr_hot_add =
0 commit comments