From: "Das, Nirmoy" <nirmoy.das@linux.intel.com>
To: Andi Shyti <andi.shyti@linux.intel.com>,
Nirmoy Das <nirmoy.das@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915/gt: Use sysfs_emit() and sysfs_emit_at()
Date: Tue, 31 Jan 2023 12:36:45 +0100 [thread overview]
Message-ID: <56ed86d0-9791-0b4e-407c-af2a73a4f9f4@linux.intel.com> (raw)
In-Reply-To: <Y9gr2CaE8OOWmAjk@ashyti-mobl2.lan>
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 <andi.shyti@linux.intel.com>
>> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
> 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 <andi.shyti@linux.intel.com>
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, &caps, 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 kobj_attribute *attr,
>> {
>> struct intel_engine_cs *engine = kobj_to_engine(kobj);
>>
>> - return sprintf(buf, "%lu\n", engine->props.preempt_timeout_ms);
>> + return sysfs_emit(buf, "%lu\n", engine->props.preempt_timeout_ms);
>> }
>>
>> static struct kobj_attribute preempt_timeout_attr =
>> @@ -355,7 +353,7 @@ preempt_timeout_default(struct kobject *kobj, struct kobj_attribute *attr,
>> {
>> struct intel_engine_cs *engine = kobj_to_engine(kobj);
>>
>> - return sprintf(buf, "%lu\n", engine->defaults.preempt_timeout_ms);
>> + return sysfs_emit(buf, "%lu\n", engine->defaults.preempt_timeout_ms);
>> }
>>
>> static struct kobj_attribute preempt_timeout_def =
>> @@ -399,7 +397,7 @@ heartbeat_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.heartbeat_interval_ms);
>> + return sysfs_emit(buf, "%lu\n", engine->props.heartbeat_interval_ms);
>> }
>>
>> static struct kobj_attribute heartbeat_interval_attr =
>> @@ -410,7 +408,7 @@ heartbeat_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.heartbeat_interval_ms);
>> + return sysfs_emit(buf, "%lu\n", engine->defaults.heartbeat_interval_ms);
>> }
>>
>> static struct kobj_attribute heartbeat_interval_def =
>> --
>> 2.39.0
next prev parent reply other threads:[~2023-01-31 11:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-30 13:13 [Intel-gfx] [PATCH] drm/i915/gt: Use sysfs_emit() and sysfs_emit_at() Nirmoy Das
2023-01-30 15:42 ` Rodrigo Vivi
2023-01-30 17:49 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork
2023-01-31 11:35 ` Das, Nirmoy
2023-01-30 20:43 ` [Intel-gfx] [PATCH] " Andi Shyti
2023-01-31 11:36 ` Das, Nirmoy [this message]
2023-01-30 21:39 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/gt: Use sysfs_emit() and sysfs_emit_at() (rev2) Patchwork
2023-01-31 4:26 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2023-02-02 14:59 ` [Intel-gfx] [PATCH] drm/i915/gt: Use sysfs_emit() and sysfs_emit_at() Andi Shyti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56ed86d0-9791-0b4e-407c-af2a73a4f9f4@linux.intel.com \
--to=nirmoy.das@linux.intel.com \
--cc=andi.shyti@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=nirmoy.das@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox