[PATCH v4 6/6] button: make button_get_by_label() case insensitive
Neil Armstrong
neil.armstrong at linaro.org
Tue Apr 1 10:41:14 CEST 2025
On 31/03/2025 14:23, Caleb Connolly wrote:
> This function is already doing a fuzzy match, since there are no
> guarantees that a given label is unique.
>
> Ignoring case makes it much easier to catch "Volume down" or "Volume
> Down" in board-agnostic code.
>
> Tested-by: Danila Tikhonov <danila at jiaxyga.com> # google-sunfish
> Tested-by: Jens Reidel <adrian at mainlining.org> # xiaomi-davinci
> Signed-off-by: Caleb Connolly <caleb.connolly at linaro.org>
> ---
> drivers/button/button-uclass.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/button/button-uclass.c b/drivers/button/button-uclass.c
> index 729983d58701867f7ea18e9b5f87e7404bca3dce..025917887e80f2fe9cbd3777e04035d20fa34713 100644
> --- a/drivers/button/button-uclass.c
> +++ b/drivers/button/button-uclass.c
> @@ -20,9 +20,9 @@ int button_get_by_label(const char *label, struct udevice **devp)
> uclass_id_foreach_dev(UCLASS_BUTTON, dev, uc) {
> struct button_uc_plat *uc_plat = dev_get_uclass_plat(dev);
>
> /* Ignore the top-level button node */
> - if (uc_plat->label && !strcmp(label, uc_plat->label))
> + if (uc_plat->label && !strcasecmp(label, uc_plat->label))
> return uclass_get_device_tail(dev, 0, devp);
> }
>
> return -ENODEV;
>
Reviewed-by: Neil Armstrong <neil.armstrong at linaro.org>
More information about the U-Boot
mailing list