All of lore.kernel.org
 help / color / mirror / Atom feed
* [Accel-config] [PATCH v1] accel-config: While initing devices also init groups
@ 2021-02-23  4:11 ramesh.thomas
  0 siblings, 0 replies; only message in thread
From: ramesh.thomas @ 2021-02-23  4:11 UTC (permalink / raw)
  To: accel-config

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

From: Ramesh Thomas <ramesh.thomas(a)intel.com>

Grouped workqueues and engines rely on state stored in structures
associated with groups. Initialize the groups at the time of device init
so they are available when workqueues are enabled. Flags are used to
ensure groups do not get initialized again if they are already
initialized once.

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

diff --git a/accfg/lib/libaccfg.c b/accfg/lib/libaccfg.c
index 316f724..ae862f8 100644
--- a/accfg/lib/libaccfg.c
+++ b/accfg/lib/libaccfg.c
@@ -911,10 +911,26 @@ static int filter_file_name_prefix(const struct dirent *d)
 	return !strncmp(filename_prefix, d->d_name, filename_prefix_len);
 }
 
+static void groups_init(struct accfg_device *device)
+{
+	struct accfg_ctx *ctx = device->ctx;
+
+	if (device->group_init) {
+		dbg(ctx, "group is initialized already\n");
+		return;
+	}
+	device->group_init = 1;
+	set_filename_prefix("group");
+	device_parse(device->ctx, device->device_path, "group",
+			filter_file_name_prefix,
+			device, add_group);
+}
+
 static void devices_init(struct accfg_ctx *ctx)
 {
 	char **accel_name;
 	char *path;
+	struct accfg_device *device;
 
 	if (ctx->devices_init) {
 		dbg(ctx, "device is initialized already\n");
@@ -933,21 +949,10 @@ static void devices_init(struct accfg_ctx *ctx)
 				filter_file_name_prefix, ctx, add_device);
 		free(path);
 	}
-}
 
-static void groups_init(struct accfg_device *device)
-{
-	struct accfg_ctx *ctx = device->ctx;
-
-	if (device->group_init) {
-		dbg(ctx, "group is intialized already\n");
-		return;
+	accfg_device_foreach(ctx, device) {
+		groups_init(device);
 	}
-	device->group_init = 1;
-	set_filename_prefix("group");
-	device_parse(device->ctx, device->device_path, "group",
-			filter_file_name_prefix,
-			device, add_group);
 }
 
 static void engines_init(struct accfg_device *device)
-- 
2.26.2

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-02-23  4:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-23  4:11 [Accel-config] [PATCH v1] accel-config: While initing devices also init groups ramesh.thomas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.