aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/most
diff options
context:
space:
mode:
authorChristian Gromm <christian.gromm@microchip.com>2017-11-21 15:04:57 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-11-27 09:20:35 +0100
commit845101bed867868f3c2e475341b9cd7cb1a86ab3 (patch)
tree41ea691f54a18100a598aeeabb6208199538b794 /drivers/staging/most
parentstaging: most: core: replace struct most_inst_obj (diff)
downloadlinux-dev-845101bed867868f3c2e475341b9cd7cb1a86ab3.tar.xz
linux-dev-845101bed867868f3c2e475341b9cd7cb1a86ab3.zip
staging: most: core: put channel name in struct most_channel
This patch stores a channel's name inside the most_channel structure. It is needed to have the channel attributes tied together. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/most')
-rw-r--r--drivers/staging/most/core.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 02772ce207f8..2b0c85c60c20 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -51,6 +51,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 */
@@ -1370,7 +1371,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 ||
@@ -1410,15 +1410,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;