Commit 95f73013 authored by Christian Gromm's avatar Christian Gromm Committed by Greg Kroah-Hartman

staging: most: clean up configuration strings

This patch adds the strings 'rx', 'tx' and 'isoc' to the list of accepted
identifiers when setting up a channel configuration. To keep consistency it
removes the prefix "dir_" from strings returned by the attributes
set_direction and available_directions and it removes the suffix "_avp"
from the string "isoc_avp" returned by the attributes set_datatype and
available_datatypes.
Signed-off-by: default avatarChristian Gromm <christian.gromm@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 22ff195b
...@@ -506,7 +506,7 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx, ...@@ -506,7 +506,7 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx,
if (ccfg->data_type != MOST_CH_SYNC && if (ccfg->data_type != MOST_CH_SYNC &&
ccfg->data_type != MOST_CH_ISOC_AVP) { ccfg->data_type != MOST_CH_ISOC_AVP) {
pr_err("wrong channel type, expect sync or isoc_avp\n"); pr_err("wrong channel type, expect sync or isoc\n");
return -EINVAL; return -EINVAL;
} }
......
...@@ -83,10 +83,13 @@ struct most_inst_obj { ...@@ -83,10 +83,13 @@ struct most_inst_obj {
static const struct { static const struct {
int most_ch_data_type; int most_ch_data_type;
char *name; char *name;
} ch_data_type[] = { { MOST_CH_CONTROL, "control\n" }, } ch_data_type[] = {
{ MOST_CH_CONTROL, "control\n" },
{ MOST_CH_ASYNC, "async\n" }, { MOST_CH_ASYNC, "async\n" },
{ MOST_CH_SYNC, "sync\n" }, { MOST_CH_SYNC, "sync\n" },
{ MOST_CH_ISOC_AVP, "isoc_avp\n"} }; { MOST_CH_ISOC_AVP, "isoc\n"},
{ MOST_CH_ISOC_AVP, "isoc_avp\n"},
};
#define to_inst_obj(d) container_of(d, struct most_inst_obj, kobj) #define to_inst_obj(d) container_of(d, struct most_inst_obj, kobj)
...@@ -261,9 +264,9 @@ static ssize_t show_available_directions(struct most_c_obj *c, ...@@ -261,9 +264,9 @@ static ssize_t show_available_directions(struct most_c_obj *c,
strcpy(buf, ""); strcpy(buf, "");
if (c->iface->channel_vector[i].direction & MOST_CH_RX) if (c->iface->channel_vector[i].direction & MOST_CH_RX)
strcat(buf, "dir_rx "); strcat(buf, "rx ");
if (c->iface->channel_vector[i].direction & MOST_CH_TX) if (c->iface->channel_vector[i].direction & MOST_CH_TX)
strcat(buf, "dir_tx "); strcat(buf, "tx ");
strcat(buf, "\n"); strcat(buf, "\n");
return strlen(buf); return strlen(buf);
} }
...@@ -282,7 +285,7 @@ static ssize_t show_available_datatypes(struct most_c_obj *c, ...@@ -282,7 +285,7 @@ static ssize_t show_available_datatypes(struct most_c_obj *c,
if (c->iface->channel_vector[i].data_type & MOST_CH_SYNC) if (c->iface->channel_vector[i].data_type & MOST_CH_SYNC)
strcat(buf, "sync "); strcat(buf, "sync ");
if (c->iface->channel_vector[i].data_type & MOST_CH_ISOC_AVP) if (c->iface->channel_vector[i].data_type & MOST_CH_ISOC_AVP)
strcat(buf, "isoc_avp "); strcat(buf, "isoc ");
strcat(buf, "\n"); strcat(buf, "\n");
return strlen(buf); return strlen(buf);
} }
...@@ -392,9 +395,9 @@ static ssize_t show_set_direction(struct most_c_obj *c, ...@@ -392,9 +395,9 @@ static ssize_t show_set_direction(struct most_c_obj *c,
char *buf) char *buf)
{ {
if (c->cfg.direction & MOST_CH_TX) if (c->cfg.direction & MOST_CH_TX)
return snprintf(buf, PAGE_SIZE, "dir_tx\n"); return snprintf(buf, PAGE_SIZE, "tx\n");
else if (c->cfg.direction & MOST_CH_RX) else if (c->cfg.direction & MOST_CH_RX)
return snprintf(buf, PAGE_SIZE, "dir_rx\n"); return snprintf(buf, PAGE_SIZE, "rx\n");
return snprintf(buf, PAGE_SIZE, "unconfigured\n"); return snprintf(buf, PAGE_SIZE, "unconfigured\n");
} }
...@@ -405,8 +408,12 @@ static ssize_t store_set_direction(struct most_c_obj *c, ...@@ -405,8 +408,12 @@ static ssize_t store_set_direction(struct most_c_obj *c,
{ {
if (!strcmp(buf, "dir_rx\n")) { if (!strcmp(buf, "dir_rx\n")) {
c->cfg.direction = MOST_CH_RX; c->cfg.direction = MOST_CH_RX;
} else if (!strcmp(buf, "rx\n")) {
c->cfg.direction = MOST_CH_RX;
} else if (!strcmp(buf, "dir_tx\n")) { } else if (!strcmp(buf, "dir_tx\n")) {
c->cfg.direction = MOST_CH_TX; c->cfg.direction = MOST_CH_TX;
} else if (!strcmp(buf, "tx\n")) {
c->cfg.direction = MOST_CH_TX;
} else { } else {
pr_info("WARN: invalid attribute settings\n"); pr_info("WARN: invalid attribute settings\n");
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment