Re: [Intel-gfx] [PATCH] drm/i915/gt: Use sysfs_emit() and sysfs_emit_at()
Hi Nirmoy, On Mon, Jan 30, 2023 at 02:13:58PM +0100, Nirmoy Das wrote: > Use sysfs_emit() and sysfs_emit_at() in show() callback > as recommended by Documentation/filesystems/sysfs.rst > > Cc: Andi Shyti > Signed-off-by: Nirmoy Das Pushed in drm-intel-gt-next. Thank you, Andi > --- > drivers/gpu/drm/i915/gt/sysfs_engines.c | 34 - > 1 file changed, 16 insertions(+), 18 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gt/sysfs_engines.c > b/drivers/gpu/drm/i915/gt/sysfs_engines.c > index f2d9858d827c..323cead181b8 100644 > --- a/drivers/gpu/drm/i915/gt/sysfs_engines.c > +++ b/drivers/gpu/drm/i915/gt/sysfs_engines.c > @@ -24,7 +24,7 @@ static struct intel_engine_cs *kobj_to_engine(struct > kobject *kobj) > static ssize_t > name_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) > { > - return sprintf(buf, "%s\n", kobj_to_engine(kobj)->name); > + return sysfs_emit(buf, "%s\n", kobj_to_engine(kobj)->name); > } > > static struct kobj_attribute name_attr = > @@ -33,7 +33,7 @@ __ATTR(name, 0444, name_show, NULL); > static ssize_t > class_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) > { > - return sprintf(buf, "%d\n", kobj_to_engine(kobj)->uabi_class); > + return sysfs_emit(buf, "%d\n", kobj_to_engine(kobj)->uabi_class); > } > > static struct kobj_attribute class_attr = > @@ -42,7 +42,7 @@ __ATTR(class, 0444, class_show, NULL); > static ssize_t > inst_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) > { > - return sprintf(buf, "%d\n", kobj_to_engine(kobj)->uabi_instance); > + return sysfs_emit(buf, "%d\n", kobj_to_engine(kobj)->uabi_instance); > } > > static struct kobj_attribute inst_attr = > @@ -51,7 +51,7 @@ __ATTR(instance, 0444, inst_show, NULL); > static ssize_t > mmio_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) > { > - return sprintf(buf, "0x%x\n", kobj_to_engine(kobj)->mmio_base); > + return sysfs_emit(buf, "0x%x\n", kobj_to_engine(kobj)->mmio_base); > } > > static struct kobj_attribute mmio_attr = > @@ -107,11 +107,9 @@ __caps_show(struct intel_engine_cs *engine, > for_each_set_bit(n, , show_unknown ? BITS_PER_LONG : count) { > if (n >= count || !repr[n]) { > if (GEM_WARN_ON(show_unknown)) > - len += snprintf(buf + len, PAGE_SIZE - len, > - "[%x] ", n); > + len += sysfs_emit_at(buf, len, "[%x] ", n); > } else { > - len += snprintf(buf + len, PAGE_SIZE - len, > - "%s ", repr[n]); > + len += sysfs_emit_at(buf, len, "%s ", repr[n]); > } > if (GEM_WARN_ON(len >= PAGE_SIZE)) > break; > @@ -182,7 +180,7 @@ max_spin_show(struct kobject *kobj, struct kobj_attribute > *attr, char *buf) > { > struct intel_engine_cs *engine = kobj_to_engine(kobj); > > - return sprintf(buf, "%lu\n", engine->props.max_busywait_duration_ns); > + return sysfs_emit(buf, "%lu\n", engine->props.max_busywait_duration_ns); > } > > static struct kobj_attribute max_spin_attr = > @@ -193,7 +191,7 @@ max_spin_default(struct kobject *kobj, struct > kobj_attribute *attr, char *buf) > { > struct intel_engine_cs *engine = kobj_to_engine(kobj); > > - return sprintf(buf, "%lu\n", engine->defaults.max_busywait_duration_ns); > + return sysfs_emit(buf, "%lu\n", > engine->defaults.max_busywait_duration_ns); > } > > static struct kobj_attribute max_spin_def = > @@ -236,7 +234,7 @@ timeslice_show(struct kobject *kobj, struct > kobj_attribute *attr, char *buf) > { > struct intel_engine_cs *engine = kobj_to_engine(kobj); > > - return sprintf(buf, "%lu\n", engine->props.timeslice_duration_ms); > + return sysfs_emit(buf, "%lu\n", engine->props.timeslice_duration_ms); > } > > static struct kobj_attribute timeslice_duration_attr = > @@ -247,7 +245,7 @@ timeslice_default(struct kobject *kobj, struct > kobj_attribute *attr, char *buf) > { > struct intel_engine_cs *engine = kobj_to_engine(kobj); > > - return sprintf(buf, "%lu\n", engine->defaults.timeslice_duration_ms); > + return sysfs_emit(buf, "%lu\n", engine->defaults.timeslice_duration_ms); > } > > static struct kobj_attribute timeslice_duration_def = > @@ -287,7 +285,7 @@ stop_show(struct kobject *kobj, struct kobj_attribute > *attr, char *buf) > { > struct intel_engine_cs *engine = kobj_to_engine(kobj); > > - return sprintf(buf, "%lu\n", engine->props.stop_timeout_ms); > + return sysfs_emit(buf, "%lu\n", engine->props.stop_timeout_ms); > } > > static struct kobj_attribute stop_timeout_attr = > @@ -298,7 +296,7 @@ stop_default(struct kobject *kobj, struct kobj_attribute > *attr, char *buf) > { > struct intel_engine_cs *engine =
Re: [Intel-gfx] [PATCH] drm/i915/gt: Use sysfs_emit() and sysfs_emit_at()
On 1/30/2023 9:43 PM, Andi Shyti wrote: Hi Nirmoy, On Mon, Jan 30, 2023 at 02:13:58PM +0100, Nirmoy Das wrote: Use sysfs_emit() and sysfs_emit_at() in show() callback as recommended by Documentation/filesystems/sysfs.rst Cc: Andi Shyti Signed-off-by: Nirmoy Das I thought we didn't have anymore of those... Yes, I was surprise to see just only this file. Rest are okay. Reviewed-by: Andi Shyti Thanks, Nirmoy Thanks, Andi --- drivers/gpu/drm/i915/gt/sysfs_engines.c | 34 - 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/sysfs_engines.c b/drivers/gpu/drm/i915/gt/sysfs_engines.c index f2d9858d827c..323cead181b8 100644 --- a/drivers/gpu/drm/i915/gt/sysfs_engines.c +++ b/drivers/gpu/drm/i915/gt/sysfs_engines.c @@ -24,7 +24,7 @@ static struct intel_engine_cs *kobj_to_engine(struct kobject *kobj) static ssize_t name_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - return sprintf(buf, "%s\n", kobj_to_engine(kobj)->name); + return sysfs_emit(buf, "%s\n", kobj_to_engine(kobj)->name); } static struct kobj_attribute name_attr = @@ -33,7 +33,7 @@ __ATTR(name, 0444, name_show, NULL); static ssize_t class_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - return sprintf(buf, "%d\n", kobj_to_engine(kobj)->uabi_class); + return sysfs_emit(buf, "%d\n", kobj_to_engine(kobj)->uabi_class); } static struct kobj_attribute class_attr = @@ -42,7 +42,7 @@ __ATTR(class, 0444, class_show, NULL); static ssize_t inst_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - return sprintf(buf, "%d\n", kobj_to_engine(kobj)->uabi_instance); + return sysfs_emit(buf, "%d\n", kobj_to_engine(kobj)->uabi_instance); } static struct kobj_attribute inst_attr = @@ -51,7 +51,7 @@ __ATTR(instance, 0444, inst_show, NULL); static ssize_t mmio_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - return sprintf(buf, "0x%x\n", kobj_to_engine(kobj)->mmio_base); + return sysfs_emit(buf, "0x%x\n", kobj_to_engine(kobj)->mmio_base); } static struct kobj_attribute mmio_attr = @@ -107,11 +107,9 @@ __caps_show(struct intel_engine_cs *engine, for_each_set_bit(n, , show_unknown ? BITS_PER_LONG : count) { if (n >= count || !repr[n]) { if (GEM_WARN_ON(show_unknown)) - len += snprintf(buf + len, PAGE_SIZE - len, - "[%x] ", n); + len += sysfs_emit_at(buf, len, "[%x] ", n); } else { - len += snprintf(buf + len, PAGE_SIZE - len, - "%s ", repr[n]); + len += sysfs_emit_at(buf, len, "%s ", repr[n]); } if (GEM_WARN_ON(len >= PAGE_SIZE)) break; @@ -182,7 +180,7 @@ max_spin_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { struct intel_engine_cs *engine = kobj_to_engine(kobj); - return sprintf(buf, "%lu\n", engine->props.max_busywait_duration_ns); + return sysfs_emit(buf, "%lu\n", engine->props.max_busywait_duration_ns); } static struct kobj_attribute max_spin_attr = @@ -193,7 +191,7 @@ max_spin_default(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { struct intel_engine_cs *engine = kobj_to_engine(kobj); - return sprintf(buf, "%lu\n", engine->defaults.max_busywait_duration_ns); + return sysfs_emit(buf, "%lu\n", engine->defaults.max_busywait_duration_ns); } static struct kobj_attribute max_spin_def = @@ -236,7 +234,7 @@ timeslice_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { struct intel_engine_cs *engine = kobj_to_engine(kobj); - return sprintf(buf, "%lu\n", engine->props.timeslice_duration_ms); + return sysfs_emit(buf, "%lu\n", engine->props.timeslice_duration_ms); } static struct kobj_attribute timeslice_duration_attr = @@ -247,7 +245,7 @@ timeslice_default(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { struct intel_engine_cs *engine = kobj_to_engine(kobj); - return sprintf(buf, "%lu\n", engine->defaults.timeslice_duration_ms); + return sysfs_emit(buf, "%lu\n", engine->defaults.timeslice_duration_ms); } static struct kobj_attribute timeslice_duration_def = @@ -287,7 +285,7 @@ stop_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { struct intel_engine_cs *engine = kobj_to_engine(kobj); - return sprintf(buf, "%lu\n", engine->props.stop_timeout_ms); + return sysfs_emit(buf, "%lu\n", engine->props.stop_timeout_ms); } static struct kobj_attribute stop_timeout_attr = @@ -298,7 +296,7 @@ stop_default(struct kobject *kobj, struct kobj_attribute *attr, char *buf) {
Re: [Intel-gfx] [PATCH] drm/i915/gt: Use sysfs_emit() and sysfs_emit_at()
Hi Nirmoy, On Mon, Jan 30, 2023 at 02:13:58PM +0100, Nirmoy Das wrote: > Use sysfs_emit() and sysfs_emit_at() in show() callback > as recommended by Documentation/filesystems/sysfs.rst > > Cc: Andi Shyti > Signed-off-by: Nirmoy Das I thought we didn't have anymore of those... Reviewed-by: Andi Shyti Thanks, Andi > --- > drivers/gpu/drm/i915/gt/sysfs_engines.c | 34 - > 1 file changed, 16 insertions(+), 18 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gt/sysfs_engines.c > b/drivers/gpu/drm/i915/gt/sysfs_engines.c > index f2d9858d827c..323cead181b8 100644 > --- a/drivers/gpu/drm/i915/gt/sysfs_engines.c > +++ b/drivers/gpu/drm/i915/gt/sysfs_engines.c > @@ -24,7 +24,7 @@ static struct intel_engine_cs *kobj_to_engine(struct > kobject *kobj) > static ssize_t > name_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) > { > - return sprintf(buf, "%s\n", kobj_to_engine(kobj)->name); > + return sysfs_emit(buf, "%s\n", kobj_to_engine(kobj)->name); > } > > static struct kobj_attribute name_attr = > @@ -33,7 +33,7 @@ __ATTR(name, 0444, name_show, NULL); > static ssize_t > class_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) > { > - return sprintf(buf, "%d\n", kobj_to_engine(kobj)->uabi_class); > + return sysfs_emit(buf, "%d\n", kobj_to_engine(kobj)->uabi_class); > } > > static struct kobj_attribute class_attr = > @@ -42,7 +42,7 @@ __ATTR(class, 0444, class_show, NULL); > static ssize_t > inst_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) > { > - return sprintf(buf, "%d\n", kobj_to_engine(kobj)->uabi_instance); > + return sysfs_emit(buf, "%d\n", kobj_to_engine(kobj)->uabi_instance); > } > > static struct kobj_attribute inst_attr = > @@ -51,7 +51,7 @@ __ATTR(instance, 0444, inst_show, NULL); > static ssize_t > mmio_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) > { > - return sprintf(buf, "0x%x\n", kobj_to_engine(kobj)->mmio_base); > + return sysfs_emit(buf, "0x%x\n", kobj_to_engine(kobj)->mmio_base); > } > > static struct kobj_attribute mmio_attr = > @@ -107,11 +107,9 @@ __caps_show(struct intel_engine_cs *engine, > for_each_set_bit(n, , show_unknown ? BITS_PER_LONG : count) { > if (n >= count || !repr[n]) { > if (GEM_WARN_ON(show_unknown)) > - len += snprintf(buf + len, PAGE_SIZE - len, > - "[%x] ", n); > + len += sysfs_emit_at(buf, len, "[%x] ", n); > } else { > - len += snprintf(buf + len, PAGE_SIZE - len, > - "%s ", repr[n]); > + len += sysfs_emit_at(buf, len, "%s ", repr[n]); > } > if (GEM_WARN_ON(len >= PAGE_SIZE)) > break; > @@ -182,7 +180,7 @@ max_spin_show(struct kobject *kobj, struct kobj_attribute > *attr, char *buf) > { > struct intel_engine_cs *engine = kobj_to_engine(kobj); > > - return sprintf(buf, "%lu\n", engine->props.max_busywait_duration_ns); > + return sysfs_emit(buf, "%lu\n", engine->props.max_busywait_duration_ns); > } > > static struct kobj_attribute max_spin_attr = > @@ -193,7 +191,7 @@ max_spin_default(struct kobject *kobj, struct > kobj_attribute *attr, char *buf) > { > struct intel_engine_cs *engine = kobj_to_engine(kobj); > > - return sprintf(buf, "%lu\n", engine->defaults.max_busywait_duration_ns); > + return sysfs_emit(buf, "%lu\n", > engine->defaults.max_busywait_duration_ns); > } > > static struct kobj_attribute max_spin_def = > @@ -236,7 +234,7 @@ timeslice_show(struct kobject *kobj, struct > kobj_attribute *attr, char *buf) > { > struct intel_engine_cs *engine = kobj_to_engine(kobj); > > - return sprintf(buf, "%lu\n", engine->props.timeslice_duration_ms); > + return sysfs_emit(buf, "%lu\n", engine->props.timeslice_duration_ms); > } > > static struct kobj_attribute timeslice_duration_attr = > @@ -247,7 +245,7 @@ timeslice_default(struct kobject *kobj, struct > kobj_attribute *attr, char *buf) > { > struct intel_engine_cs *engine = kobj_to_engine(kobj); > > - return sprintf(buf, "%lu\n", engine->defaults.timeslice_duration_ms); > + return sysfs_emit(buf, "%lu\n", engine->defaults.timeslice_duration_ms); > } > > static struct kobj_attribute timeslice_duration_def = > @@ -287,7 +285,7 @@ stop_show(struct kobject *kobj, struct kobj_attribute > *attr, char *buf) > { > struct intel_engine_cs *engine = kobj_to_engine(kobj); > > - return sprintf(buf, "%lu\n", engine->props.stop_timeout_ms); > + return sysfs_emit(buf, "%lu\n", engine->props.stop_timeout_ms); > } > > static struct kobj_attribute stop_timeout_attr = > @@ -298,7 +296,7 @@ stop_default(struct kobject *kobj, struct kobj_attribute > *attr, char *buf) > { > struct
Re: [Intel-gfx] [PATCH] drm/i915/gt: Use sysfs_emit() and sysfs_emit_at()
On Mon, Jan 30, 2023 at 02:13:58PM +0100, Nirmoy Das wrote: > Use sysfs_emit() and sysfs_emit_at() in show() callback > as recommended by Documentation/filesystems/sysfs.rst > > Cc: Andi Shyti > Signed-off-by: Nirmoy Das Reviewed-by: Rodrigo Vivi > --- > drivers/gpu/drm/i915/gt/sysfs_engines.c | 34 - > 1 file changed, 16 insertions(+), 18 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gt/sysfs_engines.c > b/drivers/gpu/drm/i915/gt/sysfs_engines.c > index f2d9858d827c..323cead181b8 100644 > --- a/drivers/gpu/drm/i915/gt/sysfs_engines.c > +++ b/drivers/gpu/drm/i915/gt/sysfs_engines.c > @@ -24,7 +24,7 @@ static struct intel_engine_cs *kobj_to_engine(struct > kobject *kobj) > static ssize_t > name_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) > { > - return sprintf(buf, "%s\n", kobj_to_engine(kobj)->name); > + return sysfs_emit(buf, "%s\n", kobj_to_engine(kobj)->name); > } > > static struct kobj_attribute name_attr = > @@ -33,7 +33,7 @@ __ATTR(name, 0444, name_show, NULL); > static ssize_t > class_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) > { > - return sprintf(buf, "%d\n", kobj_to_engine(kobj)->uabi_class); > + return sysfs_emit(buf, "%d\n", kobj_to_engine(kobj)->uabi_class); > } > > static struct kobj_attribute class_attr = > @@ -42,7 +42,7 @@ __ATTR(class, 0444, class_show, NULL); > static ssize_t > inst_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) > { > - return sprintf(buf, "%d\n", kobj_to_engine(kobj)->uabi_instance); > + return sysfs_emit(buf, "%d\n", kobj_to_engine(kobj)->uabi_instance); > } > > static struct kobj_attribute inst_attr = > @@ -51,7 +51,7 @@ __ATTR(instance, 0444, inst_show, NULL); > static ssize_t > mmio_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) > { > - return sprintf(buf, "0x%x\n", kobj_to_engine(kobj)->mmio_base); > + return sysfs_emit(buf, "0x%x\n", kobj_to_engine(kobj)->mmio_base); > } > > static struct kobj_attribute mmio_attr = > @@ -107,11 +107,9 @@ __caps_show(struct intel_engine_cs *engine, > for_each_set_bit(n, , show_unknown ? BITS_PER_LONG : count) { > if (n >= count || !repr[n]) { > if (GEM_WARN_ON(show_unknown)) > - len += snprintf(buf + len, PAGE_SIZE - len, > - "[%x] ", n); > + len += sysfs_emit_at(buf, len, "[%x] ", n); > } else { > - len += snprintf(buf + len, PAGE_SIZE - len, > - "%s ", repr[n]); > + len += sysfs_emit_at(buf, len, "%s ", repr[n]); > } > if (GEM_WARN_ON(len >= PAGE_SIZE)) > break; > @@ -182,7 +180,7 @@ max_spin_show(struct kobject *kobj, struct kobj_attribute > *attr, char *buf) > { > struct intel_engine_cs *engine = kobj_to_engine(kobj); > > - return sprintf(buf, "%lu\n", engine->props.max_busywait_duration_ns); > + return sysfs_emit(buf, "%lu\n", engine->props.max_busywait_duration_ns); > } > > static struct kobj_attribute max_spin_attr = > @@ -193,7 +191,7 @@ max_spin_default(struct kobject *kobj, struct > kobj_attribute *attr, char *buf) > { > struct intel_engine_cs *engine = kobj_to_engine(kobj); > > - return sprintf(buf, "%lu\n", engine->defaults.max_busywait_duration_ns); > + return sysfs_emit(buf, "%lu\n", > engine->defaults.max_busywait_duration_ns); > } > > static struct kobj_attribute max_spin_def = > @@ -236,7 +234,7 @@ timeslice_show(struct kobject *kobj, struct > kobj_attribute *attr, char *buf) > { > struct intel_engine_cs *engine = kobj_to_engine(kobj); > > - return sprintf(buf, "%lu\n", engine->props.timeslice_duration_ms); > + return sysfs_emit(buf, "%lu\n", engine->props.timeslice_duration_ms); > } > > static struct kobj_attribute timeslice_duration_attr = > @@ -247,7 +245,7 @@ timeslice_default(struct kobject *kobj, struct > kobj_attribute *attr, char *buf) > { > struct intel_engine_cs *engine = kobj_to_engine(kobj); > > - return sprintf(buf, "%lu\n", engine->defaults.timeslice_duration_ms); > + return sysfs_emit(buf, "%lu\n", engine->defaults.timeslice_duration_ms); > } > > static struct kobj_attribute timeslice_duration_def = > @@ -287,7 +285,7 @@ stop_show(struct kobject *kobj, struct kobj_attribute > *attr, char *buf) > { > struct intel_engine_cs *engine = kobj_to_engine(kobj); > > - return sprintf(buf, "%lu\n", engine->props.stop_timeout_ms); > + return sysfs_emit(buf, "%lu\n", engine->props.stop_timeout_ms); > } > > static struct kobj_attribute stop_timeout_attr = > @@ -298,7 +296,7 @@ stop_default(struct kobject *kobj, struct kobj_attribute > *attr, char *buf) > { > struct intel_engine_cs *engine = kobj_to_engine(kobj); > > - return
[Intel-gfx] [PATCH] drm/i915/gt: Use sysfs_emit() and sysfs_emit_at()
Use sysfs_emit() and sysfs_emit_at() in show() callback as recommended by Documentation/filesystems/sysfs.rst Cc: Andi Shyti Signed-off-by: Nirmoy Das --- drivers/gpu/drm/i915/gt/sysfs_engines.c | 34 - 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/sysfs_engines.c b/drivers/gpu/drm/i915/gt/sysfs_engines.c index f2d9858d827c..323cead181b8 100644 --- a/drivers/gpu/drm/i915/gt/sysfs_engines.c +++ b/drivers/gpu/drm/i915/gt/sysfs_engines.c @@ -24,7 +24,7 @@ static struct intel_engine_cs *kobj_to_engine(struct kobject *kobj) static ssize_t name_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - return sprintf(buf, "%s\n", kobj_to_engine(kobj)->name); + return sysfs_emit(buf, "%s\n", kobj_to_engine(kobj)->name); } static struct kobj_attribute name_attr = @@ -33,7 +33,7 @@ __ATTR(name, 0444, name_show, NULL); static ssize_t class_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - return sprintf(buf, "%d\n", kobj_to_engine(kobj)->uabi_class); + return sysfs_emit(buf, "%d\n", kobj_to_engine(kobj)->uabi_class); } static struct kobj_attribute class_attr = @@ -42,7 +42,7 @@ __ATTR(class, 0444, class_show, NULL); static ssize_t inst_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - return sprintf(buf, "%d\n", kobj_to_engine(kobj)->uabi_instance); + return sysfs_emit(buf, "%d\n", kobj_to_engine(kobj)->uabi_instance); } static struct kobj_attribute inst_attr = @@ -51,7 +51,7 @@ __ATTR(instance, 0444, inst_show, NULL); static ssize_t mmio_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - return sprintf(buf, "0x%x\n", kobj_to_engine(kobj)->mmio_base); + return sysfs_emit(buf, "0x%x\n", kobj_to_engine(kobj)->mmio_base); } static struct kobj_attribute mmio_attr = @@ -107,11 +107,9 @@ __caps_show(struct intel_engine_cs *engine, for_each_set_bit(n, , show_unknown ? BITS_PER_LONG : count) { if (n >= count || !repr[n]) { if (GEM_WARN_ON(show_unknown)) - len += snprintf(buf + len, PAGE_SIZE - len, - "[%x] ", n); + len += sysfs_emit_at(buf, len, "[%x] ", n); } else { - len += snprintf(buf + len, PAGE_SIZE - len, - "%s ", repr[n]); + len += sysfs_emit_at(buf, len, "%s ", repr[n]); } if (GEM_WARN_ON(len >= PAGE_SIZE)) break; @@ -182,7 +180,7 @@ max_spin_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { struct intel_engine_cs *engine = kobj_to_engine(kobj); - return sprintf(buf, "%lu\n", engine->props.max_busywait_duration_ns); + return sysfs_emit(buf, "%lu\n", engine->props.max_busywait_duration_ns); } static struct kobj_attribute max_spin_attr = @@ -193,7 +191,7 @@ max_spin_default(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { struct intel_engine_cs *engine = kobj_to_engine(kobj); - return sprintf(buf, "%lu\n", engine->defaults.max_busywait_duration_ns); + return sysfs_emit(buf, "%lu\n", engine->defaults.max_busywait_duration_ns); } static struct kobj_attribute max_spin_def = @@ -236,7 +234,7 @@ timeslice_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { struct intel_engine_cs *engine = kobj_to_engine(kobj); - return sprintf(buf, "%lu\n", engine->props.timeslice_duration_ms); + return sysfs_emit(buf, "%lu\n", engine->props.timeslice_duration_ms); } static struct kobj_attribute timeslice_duration_attr = @@ -247,7 +245,7 @@ timeslice_default(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { struct intel_engine_cs *engine = kobj_to_engine(kobj); - return sprintf(buf, "%lu\n", engine->defaults.timeslice_duration_ms); + return sysfs_emit(buf, "%lu\n", engine->defaults.timeslice_duration_ms); } static struct kobj_attribute timeslice_duration_def = @@ -287,7 +285,7 @@ stop_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { struct intel_engine_cs *engine = kobj_to_engine(kobj); - return sprintf(buf, "%lu\n", engine->props.stop_timeout_ms); + return sysfs_emit(buf, "%lu\n", engine->props.stop_timeout_ms); } static struct kobj_attribute stop_timeout_attr = @@ -298,7 +296,7 @@ stop_default(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { struct intel_engine_cs *engine = kobj_to_engine(kobj); - return sprintf(buf, "%lu\n", engine->defaults.stop_timeout_ms); + return sysfs_emit(buf, "%lu\n", engine->defaults.stop_timeout_ms); } static struct kobj_attribute stop_timeout_def = @@ -343,7 +341,7 @@ preempt_timeout_show(struct kobject *kobj, struct