accel-config: Skip writing driver_name attr if not present
Ramesh Thomas
PATCH 1/1 accel-config: Skip writing driver_name attr if not present
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(-)
accfg/lib/libaccfg.c +5 -1
@@ -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)); \
Signature · 1 line
2.34.1
Dave Jiang
Reviewed-by on v1 1/1Quoted 4 lines · Ramesh Thomas
Older drivers do not create
driver_nameattr. Skip writingdriver_nameinstead of failing if not present.Signed-off-by Ramesh Thomas <ramesh.thomas(a)intel.com>
Reviewed-by Dave Jiang <dave.jiang(a)intel.com>
Quoted 21 lines
--- accfg/lib/libaccfg.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)accfg/lib/libaccfg.c +5
-1@@ -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)); \