[PATCH v3 14/26] staging: most: core: make channel name accessible from struct most_channel
Christian Gromm
christian.gromm at microchip.com
Mon Oct 16 08:46:21 UTC 2017
This patch stores a channel's name inside the most_channel structure,
hence making it accessible outside of function most_register_interface.
Signed-off-by: Christian Gromm <christian.gromm at microchip.com>
---
v2: fix patch numeration
v3: - add cover letter
- create patches with -M switch to make file movement visible
drivers/staging/most/core.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 69d24f6..50b57de 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -57,6 +57,7 @@ struct most_channel {
atomic_t mbo_ref;
atomic_t mbo_nq_level;
u16 channel_id;
+ char name[STRING_SIZE];
bool is_poisoned;
struct mutex start_mutex;
struct mutex nq_mutex; /* nq thread synchronization */
@@ -1379,7 +1380,6 @@ int most_register_interface(struct most_interface *iface)
{
unsigned int i;
int id;
- char channel_name[STRING_SIZE];
struct most_channel *c;
if (!iface || !iface->enqueue || !iface->configure ||
@@ -1419,15 +1419,14 @@ int most_register_interface(struct most_interface *iface)
for (i = 0; i < iface->num_channels; i++) {
const char *name_suffix = iface->channel_vector[i].name_suffix;
- if (!name_suffix)
- snprintf(channel_name, STRING_SIZE, "ch%d", i);
- else
- snprintf(channel_name, STRING_SIZE, "%s", name_suffix);
-
c = kzalloc(sizeof(*c), GFP_KERNEL);
if (!c)
goto free_instance;
- c->dev.init_name = channel_name;
+ if (!name_suffix)
+ snprintf(c->name, STRING_SIZE, "ch%d", i);
+ else
+ snprintf(c->name, STRING_SIZE, "%s", name_suffix);
+ c->dev.init_name = c->name;
c->dev.parent = &iface->dev;
c->dev.groups = channel_attr_groups;
c->dev.release = release_channel;
--
1.9.1
More information about the devel
mailing list