staging: most: clean up configuration strings
authorChristian Gromm <christian.gromm@microchip.com>
Wed, 21 Sep 2016 12:49:09 +0000 (14:49 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Sep 2016 09:54:47 +0000 (11:54 +0200)
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: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/most/aim-v4l2/video.c
drivers/staging/most/mostcore/core.c

index 150dc895a34b36bd74e2ff0bdb4cbb7ebd310426..9173cd197debbc3a8a6bfd289971b85d5fc5cb7a 100644 (file)
@@ -506,7 +506,7 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx,
 
        if (ccfg->data_type != MOST_CH_SYNC &&
            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;
        }
 
index 29e8a1c5d3f90a98d6326ab27118ebcfd8a5b5d7..d7c3f4692060a93eb1554c7d9688982551d3ae45 100644 (file)
@@ -83,10 +83,13 @@ struct most_inst_obj {
 static const struct {
        int most_ch_data_type;
        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_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)
 
@@ -261,9 +264,9 @@ static ssize_t show_available_directions(struct most_c_obj *c,
 
        strcpy(buf, "");
        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)
-               strcat(buf, "dir_tx ");
+               strcat(buf, "tx ");
        strcat(buf, "\n");
        return strlen(buf);
 }
@@ -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)
                strcat(buf, "sync ");
        if (c->iface->channel_vector[i].data_type & MOST_CH_ISOC_AVP)
-               strcat(buf, "isoc_avp ");
+               strcat(buf, "isoc ");
        strcat(buf, "\n");
        return strlen(buf);
 }
@@ -392,9 +395,9 @@ static ssize_t show_set_direction(struct most_c_obj *c,
                                  char *buf)
 {
        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)
-               return snprintf(buf, PAGE_SIZE, "dir_rx\n");
+               return snprintf(buf, PAGE_SIZE, "rx\n");
        return snprintf(buf, PAGE_SIZE, "unconfigured\n");
 }
 
@@ -405,8 +408,12 @@ static ssize_t store_set_direction(struct most_c_obj *c,
 {
        if (!strcmp(buf, "dir_rx\n")) {
                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")) {
                c->cfg.direction = MOST_CH_TX;
+       } else if (!strcmp(buf, "tx\n")) {
+               c->cfg.direction = MOST_CH_TX;
        } else {
                pr_info("WARN: invalid attribute settings\n");
                return -EINVAL;