public inbox for accel-config@lists.linux.dev
 help / color / mirror / Atom feed
From: Ramesh Thomas <ramesh.thomas at intel.com>
To: accel-config@lists.01.org
Subject: [Accel-config] [PATCH] accel-config: Skip writing driver_name attr if not present
Date: Mon, 28 Mar 2022 18:22:27 -0700	[thread overview]
Message-ID: <20220329012227.7090-1-ramesh.thomas@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 867 bytes --]

Older drivers do not create driver_name attr. Skip writing driver_name
instead of failing if not present.

Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
 accfg/lib/libaccfg.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/accfg/lib/libaccfg.c b/accfg/lib/libaccfg.c
index b4a9725..6af5802 100644
--- a/accfg/lib/libaccfg.c
+++ b/accfg/lib/libaccfg.c
@@ -2459,7 +2459,11 @@ ACCFG_EXPORT int accfg_wq_set_str_##field( \
 			return -errno; \
 		} \
 	} \
-	if (sysfs_write_attr(ctx, path, buf) < 0) { \
+	rc = sysfs_write_attr(ctx, path, buf); \
+	if (rc < 0) { \
+		/* Silently skip attrs not supported by driver */ \
+		if (rc == -ENOENT && !strcmp(#field, "driver_name")) \
+			return 0; \
 		err(ctx, "%s: write failed: %s\n", \
 				accfg_wq_get_devname(wq), \
 				strerror(errno)); \
-- 
2.34.1

                 reply	other threads:[~2022-03-29  1:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220329012227.7090-1-ramesh.thomas@intel.com \
    --to=accel-config@lists.01.org \
    /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