diff mbox series

soc: aspeed: uart-routing: Use __sysfs_match_string

Message ID 20230628083735.19946-2-zev@bewilderbeest.net
State New
Headers show
Series soc: aspeed: uart-routing: Use __sysfs_match_string | expand

Commit Message

Zev Weiss June 28, 2023, 8:37 a.m. UTC
The existing use of match_string() caused it to reject 'echo foo' due
to the implicitly appended newline, which was somewhat ergonomically
awkward and inconsistent with typical sysfs behavior.  Using the
__sysfs_* variant instead provides more convenient and consistent
linefeed-agnostic behavior.

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
---
 drivers/soc/aspeed/aspeed-uart-routing.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Joel Stanley July 10, 2023, 4:22 a.m. UTC | #1
On Wed, 28 Jun 2023 at 08:43, Zev Weiss <zev@bewilderbeest.net> wrote:
>
> The existing use of match_string() caused it to reject 'echo foo' due
> to the implicitly appended newline, which was somewhat ergonomically
> awkward and inconsistent with typical sysfs behavior.  Using the
> __sysfs_* variant instead provides more convenient and consistent
> linefeed-agnostic behavior.

Nice.

Fixes: c6807970c3bc ("soc: aspeed: Add UART routing support")
Reviewed-by: Joel Stanley <joel@jms.id.au>

>
> Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
> ---
>  drivers/soc/aspeed/aspeed-uart-routing.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/soc/aspeed/aspeed-uart-routing.c b/drivers/soc/aspeed/aspeed-uart-routing.c
> index ef8b24fd1851..59123e1f27ac 100644
> --- a/drivers/soc/aspeed/aspeed-uart-routing.c
> +++ b/drivers/soc/aspeed/aspeed-uart-routing.c
> @@ -524,7 +524,7 @@ static ssize_t aspeed_uart_routing_store(struct device *dev,
>         struct aspeed_uart_routing_selector *sel = to_routing_selector(attr);
>         int val;
>
> -       val = match_string(sel->options, -1, buf);
> +       val = __sysfs_match_string(sel->options, -1, buf);
>         if (val < 0) {
>                 dev_err(dev, "invalid value \"%s\"\n", buf);
>                 return -EINVAL;
> --
> 2.40.0.5.gf6e3b97ba6d2.dirty
>
diff mbox series

Patch

diff --git a/drivers/soc/aspeed/aspeed-uart-routing.c b/drivers/soc/aspeed/aspeed-uart-routing.c
index ef8b24fd1851..59123e1f27ac 100644
--- a/drivers/soc/aspeed/aspeed-uart-routing.c
+++ b/drivers/soc/aspeed/aspeed-uart-routing.c
@@ -524,7 +524,7 @@  static ssize_t aspeed_uart_routing_store(struct device *dev,
 	struct aspeed_uart_routing_selector *sel = to_routing_selector(attr);
 	int val;
 
-	val = match_string(sel->options, -1, buf);
+	val = __sysfs_match_string(sel->options, -1, buf);
 	if (val < 0) {
 		dev_err(dev, "invalid value \"%s\"\n", buf);
 		return -EINVAL;