[PATCH v2 03/14] staging: most: core: add configfs interface functions

Dan Carpenter dan.carpenter at oracle.com
Thu Mar 28 13:53:17 UTC 2019


On Thu, Mar 28, 2019 at 02:17:31PM +0100, Christian Gromm wrote:
> +int most_set_cfg_direction(char *mdev, char *mdev_ch, char *buf)
> +{
> +	struct most_channel *c = get_channel(mdev, mdev_ch);
> +
> +	if (!c)
> +		return -ENODEV;
> +	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("Invalid direction\n");
> +		return -ENODATA;
> +	}

Please use sysfs_streq().

> +	return 0;
> +}

regards,
dan carpenter


More information about the devel mailing list