]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: resolver: ad2s1210: replace sprintf() with sysfs_emit()
authorNuno Sá <nuno.sa@analog.com>
Tue, 30 Sep 2025 15:33:18 +0000 (16:33 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 19 Oct 2025 10:59:18 +0000 (11:59 +0100)
Update the ad2s1210_read_label() and ad2s1210_read_event_label() functions
to use sysfs_emit() for generating labels.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/resolver/ad2s1210.c

index 9b028c8bb1db142e2afd743aa3ace1d6d3230ae5..06d9c784f93e01288b42a1b9aee36b9f84e4b7f4 100644 (file)
@@ -1132,23 +1132,23 @@ static int ad2s1210_read_label(struct iio_dev *indio_dev,
 {
        if (chan->type == IIO_ANGL) {
                if (chan->channel == 0)
-                       return sprintf(label, "position\n");
+                       return sysfs_emit(label, "position\n");
                if (chan->channel == 1)
-                       return sprintf(label, "tracking error\n");
+                       return sysfs_emit(label, "tracking error\n");
        }
        if (chan->type == IIO_ANGL_VEL)
-               return sprintf(label, "velocity\n");
+               return sysfs_emit(label, "velocity\n");
        if (chan->type == IIO_PHASE)
-               return sprintf(label, "synthetic reference\n");
+               return sysfs_emit(label, "synthetic reference\n");
        if (chan->type == IIO_ALTVOLTAGE) {
                if (chan->output)
-                       return sprintf(label, "excitation\n");
+                       return sysfs_emit(label, "excitation\n");
                if (chan->channel == 0)
-                       return sprintf(label, "monitor signal\n");
+                       return sysfs_emit(label, "monitor signal\n");
                if (chan->channel == 1)
-                       return sprintf(label, "cosine\n");
+                       return sysfs_emit(label, "cosine\n");
                if (chan->channel == 2)
-                       return sprintf(label, "sine\n");
+                       return sysfs_emit(label, "sine\n");
        }
 
        return -EINVAL;
@@ -1239,24 +1239,24 @@ static int ad2s1210_read_event_label(struct iio_dev *indio_dev,
                                     char *label)
 {
        if (chan->type == IIO_ANGL)
-               return sprintf(label, "LOT\n");
+               return sysfs_emit(label, "LOT\n");
        if (chan->type == IIO_ANGL_VEL)
-               return sprintf(label, "max tracking rate\n");
+               return sysfs_emit(label, "max tracking rate\n");
        if (chan->type == IIO_PHASE)
-               return sprintf(label, "phase lock\n");
+               return sysfs_emit(label, "phase lock\n");
        if (chan->type == IIO_ALTVOLTAGE) {
                if (chan->channel == 0) {
                        if (type == IIO_EV_TYPE_THRESH &&
                            dir == IIO_EV_DIR_FALLING)
-                               return sprintf(label, "LOS\n");
+                               return sysfs_emit(label, "LOS\n");
                        if (type == IIO_EV_TYPE_THRESH &&
                            dir == IIO_EV_DIR_RISING)
-                               return sprintf(label, "DOS overrange\n");
+                               return sysfs_emit(label, "DOS overrange\n");
                        if (type == IIO_EV_TYPE_MAG)
-                               return sprintf(label, "DOS mismatch\n");
+                               return sysfs_emit(label, "DOS mismatch\n");
                }
                if (chan->channel == 1 || chan->channel == 2)
-                       return sprintf(label, "clipped\n");
+                       return sysfs_emit(label, "clipped\n");
        }
 
        return -EINVAL;