ALSA: core: Replace scnprintf() with sysfs_emit()
authorTakashi Iwai <tiwai@suse.de>
Mon, 1 Aug 2022 16:56:36 +0000 (18:56 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 2 Aug 2022 14:03:45 +0000 (16:03 +0200)
sysfs_emit() is a new helper to simplify the sysfs string output.
Replace the open-code with this new helper.

Link: https://lore.kernel.org/r/20220801165639.26030-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/init.c

index 3ac95c6..193dae3 100644 (file)
@@ -784,7 +784,7 @@ static ssize_t id_show(struct device *dev,
                       struct device_attribute *attr, char *buf)
 {
        struct snd_card *card = container_of(dev, struct snd_card, card_dev);
-       return scnprintf(buf, PAGE_SIZE, "%s\n", card->id);
+       return sysfs_emit(buf, "%s\n", card->id);
 }
 
 static ssize_t id_store(struct device *dev, struct device_attribute *attr,
@@ -822,7 +822,7 @@ static ssize_t number_show(struct device *dev,
                           struct device_attribute *attr, char *buf)
 {
        struct snd_card *card = container_of(dev, struct snd_card, card_dev);
-       return scnprintf(buf, PAGE_SIZE, "%i\n", card->number);
+       return sysfs_emit(buf, "%i\n", card->number);
 }
 
 static DEVICE_ATTR_RO(number);