@@ -22,7 +22,7 @@ static ssize_t type##_show(struct device *dev, \
2222 char *buf) \
2323{ \
2424 struct hdac_device *codec = dev_to_hdac_dev(dev); \
25- return sprintf (buf, "0x%x\n", codec->type); \
25+ return sysfs_emit (buf, "0x%x\n", codec->type); \
2626} \
2727static DEVICE_ATTR_RO(type)
2828
@@ -32,8 +32,8 @@ static ssize_t type##_show(struct device *dev, \
3232 char *buf) \
3333{ \
3434 struct hdac_device *codec = dev_to_hdac_dev(dev); \
35- return sprintf (buf, "%s\n", \
36- codec->type ? codec->type : ""); \
35+ return sysfs_emit (buf, "%s\n", \
36+ codec->type ? codec->type : ""); \
3737} \
3838static DEVICE_ATTR_RO(type)
3939
@@ -161,16 +161,16 @@ static struct kobj_type widget_ktype = {
161161static ssize_t caps_show (struct hdac_device * codec , hda_nid_t nid ,
162162 struct widget_attribute * attr , char * buf )
163163{
164- return sprintf (buf , "0x%08x\n" , get_wcaps (codec , nid ));
164+ return sysfs_emit (buf , "0x%08x\n" , get_wcaps (codec , nid ));
165165}
166166
167167static ssize_t pin_caps_show (struct hdac_device * codec , hda_nid_t nid ,
168168 struct widget_attribute * attr , char * buf )
169169{
170170 if (get_wcaps_type (get_wcaps (codec , nid )) != AC_WID_PIN )
171171 return 0 ;
172- return sprintf (buf , "0x%08x\n" ,
173- snd_hdac_read_parm (codec , nid , AC_PAR_PIN_CAP ));
172+ return sysfs_emit (buf , "0x%08x\n" ,
173+ snd_hdac_read_parm (codec , nid , AC_PAR_PIN_CAP ));
174174}
175175
176176static ssize_t pin_cfg_show (struct hdac_device * codec , hda_nid_t nid ,
@@ -182,7 +182,7 @@ static ssize_t pin_cfg_show(struct hdac_device *codec, hda_nid_t nid,
182182 return 0 ;
183183 if (snd_hdac_read (codec , nid , AC_VERB_GET_CONFIG_DEFAULT , 0 , & val ))
184184 return 0 ;
185- return sprintf (buf , "0x%08x\n" , val );
185+ return sysfs_emit (buf , "0x%08x\n" , val );
186186}
187187
188188static bool has_pcm_cap (struct hdac_device * codec , hda_nid_t nid )
@@ -203,51 +203,51 @@ static ssize_t pcm_caps_show(struct hdac_device *codec, hda_nid_t nid,
203203{
204204 if (!has_pcm_cap (codec , nid ))
205205 return 0 ;
206- return sprintf (buf , "0x%08x\n" ,
207- snd_hdac_read_parm (codec , nid , AC_PAR_PCM ));
206+ return sysfs_emit (buf , "0x%08x\n" ,
207+ snd_hdac_read_parm (codec , nid , AC_PAR_PCM ));
208208}
209209
210210static ssize_t pcm_formats_show (struct hdac_device * codec , hda_nid_t nid ,
211211 struct widget_attribute * attr , char * buf )
212212{
213213 if (!has_pcm_cap (codec , nid ))
214214 return 0 ;
215- return sprintf (buf , "0x%08x\n" ,
216- snd_hdac_read_parm (codec , nid , AC_PAR_STREAM ));
215+ return sysfs_emit (buf , "0x%08x\n" ,
216+ snd_hdac_read_parm (codec , nid , AC_PAR_STREAM ));
217217}
218218
219219static ssize_t amp_in_caps_show (struct hdac_device * codec , hda_nid_t nid ,
220220 struct widget_attribute * attr , char * buf )
221221{
222222 if (nid != codec -> afg && !(get_wcaps (codec , nid ) & AC_WCAP_IN_AMP ))
223223 return 0 ;
224- return sprintf (buf , "0x%08x\n" ,
225- snd_hdac_read_parm (codec , nid , AC_PAR_AMP_IN_CAP ));
224+ return sysfs_emit (buf , "0x%08x\n" ,
225+ snd_hdac_read_parm (codec , nid , AC_PAR_AMP_IN_CAP ));
226226}
227227
228228static ssize_t amp_out_caps_show (struct hdac_device * codec , hda_nid_t nid ,
229229 struct widget_attribute * attr , char * buf )
230230{
231231 if (nid != codec -> afg && !(get_wcaps (codec , nid ) & AC_WCAP_OUT_AMP ))
232232 return 0 ;
233- return sprintf (buf , "0x%08x\n" ,
234- snd_hdac_read_parm (codec , nid , AC_PAR_AMP_OUT_CAP ));
233+ return sysfs_emit (buf , "0x%08x\n" ,
234+ snd_hdac_read_parm (codec , nid , AC_PAR_AMP_OUT_CAP ));
235235}
236236
237237static ssize_t power_caps_show (struct hdac_device * codec , hda_nid_t nid ,
238238 struct widget_attribute * attr , char * buf )
239239{
240240 if (nid != codec -> afg && !(get_wcaps (codec , nid ) & AC_WCAP_POWER ))
241241 return 0 ;
242- return sprintf (buf , "0x%08x\n" ,
243- snd_hdac_read_parm (codec , nid , AC_PAR_POWER_STATE ));
242+ return sysfs_emit (buf , "0x%08x\n" ,
243+ snd_hdac_read_parm (codec , nid , AC_PAR_POWER_STATE ));
244244}
245245
246246static ssize_t gpio_caps_show (struct hdac_device * codec , hda_nid_t nid ,
247247 struct widget_attribute * attr , char * buf )
248248{
249- return sprintf (buf , "0x%08x\n" ,
250- snd_hdac_read_parm (codec , nid , AC_PAR_GPIO_CAP ));
249+ return sysfs_emit (buf , "0x%08x\n" ,
250+ snd_hdac_read_parm (codec , nid , AC_PAR_GPIO_CAP ));
251251}
252252
253253static ssize_t connections_show (struct hdac_device * codec , hda_nid_t nid ,
@@ -261,8 +261,8 @@ static ssize_t connections_show(struct hdac_device *codec, hda_nid_t nid,
261261 if (nconns <= 0 )
262262 return nconns ;
263263 for (i = 0 ; i < nconns ; i ++ )
264- ret += sprintf (buf + ret , "%s0x%02x" , i ? " " : "" , list [i ]);
265- ret += sprintf (buf + ret , "\n" );
264+ ret += sysfs_emit_at (buf , ret , "%s0x%02x" , i ? " " : "" , list [i ]);
265+ ret += sysfs_emit_at (buf , ret , "\n" );
266266 return ret ;
267267}
268268
0 commit comments