This patch removes the constraint that user space data has to be terminated
with a new line character. It is needed to let the user choose how the data
is formatted.

Signed-off-by: Christian Gromm <christian.gr...@microchip.com>
---
 drivers/staging/most/configfs.c |  4 ++++
 drivers/staging/most/core.c     | 18 +++++++++---------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/most/configfs.c b/drivers/staging/most/configfs.c
index 64c65c2..c06cf84 100644
--- a/drivers/staging/most/configfs.c
+++ b/drivers/staging/most/configfs.c
@@ -164,6 +164,7 @@ static ssize_t mdev_link_direction_store(struct config_item 
*item,
            !sysfs_streq(page, "dir_tx") && !sysfs_streq(page, "tx"))
                return -EINVAL;
        strcpy(mdev_link->direction, page);
+       strim(mdev_link->direction);
        return count;
 }
 
@@ -182,6 +183,7 @@ static ssize_t mdev_link_datatype_store(struct config_item 
*item,
            !sysfs_streq(page, "isoc_avp"))
                return -EINVAL;
        strcpy(mdev_link->datatype, page);
+       strim(mdev_link->datatype);
        return count;
 }
 
@@ -196,6 +198,7 @@ static ssize_t mdev_link_device_store(struct config_item 
*item,
        struct mdev_link *mdev_link = to_mdev_link(item);
 
        strcpy(mdev_link->device, page);
+       strim(mdev_link->device);
        return count;
 }
 
@@ -210,6 +213,7 @@ static ssize_t mdev_link_channel_store(struct config_item 
*item,
        struct mdev_link *mdev_link = to_mdev_link(item);
 
        strcpy(mdev_link->channel, page);
+       strim(mdev_link->channel);
        return count;
 }
 
diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 8e9a0b6..f7d2c78 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -84,11 +84,11 @@ static const struct {
        int most_ch_data_type;
        const char *name;
 } ch_data_type[] = {
-       { MOST_CH_CONTROL, "control\n" },
-       { MOST_CH_ASYNC, "async\n" },
-       { MOST_CH_SYNC, "sync\n" },
-       { MOST_CH_ISOC, "isoc\n"},
-       { MOST_CH_ISOC, "isoc_avp\n"},
+       { MOST_CH_CONTROL, "control" },
+       { MOST_CH_ASYNC, "async" },
+       { MOST_CH_SYNC, "sync" },
+       { MOST_CH_ISOC, "isoc"},
+       { MOST_CH_ISOC, "isoc_avp"},
 };
 
 /**
@@ -675,13 +675,13 @@ int most_set_cfg_direction(char *mdev, char *mdev_ch, 
char *buf)
 
        if (!c)
                return -ENODEV;
-       if (!strcmp(buf, "dir_rx\n")) {
+       if (!strcmp(buf, "dir_rx")) {
                c->cfg.direction = MOST_CH_RX;
-       } else if (!strcmp(buf, "rx\n")) {
+       } else if (!strcmp(buf, "rx")) {
                c->cfg.direction = MOST_CH_RX;
-       } else if (!strcmp(buf, "dir_tx\n")) {
+       } else if (!strcmp(buf, "dir_tx")) {
                c->cfg.direction = MOST_CH_TX;
-       } else if (!strcmp(buf, "tx\n")) {
+       } else if (!strcmp(buf, "tx")) {
                c->cfg.direction = MOST_CH_TX;
        } else {
                pr_info("Invalid direction\n");
-- 
2.7.4

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to