From: Francesco Dolcini Date: Mon, 3 Jun 2024 08:35:58 +0000 (+0200) Subject: usb: typec: mux: gpio-sbu: Make enable gpio optional X-Git-Tag: v6.11-rc1~102^2~86 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df1c5d55abc118f083854ff7e5048a16c98be714;p=thirdparty%2Fkernel%2Flinux.git usb: typec: mux: gpio-sbu: Make enable gpio optional The enable gpio is not required when the SBU mux is used only for orientation, make it optional. Signed-off-by: Francesco Dolcini Reviewed-by: Dmitry Baryshkov Reviewed-by: Heikki Krogerus Link: https://lore.kernel.org/r/20240603083558.9629-3-francesco@dolcini.it Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/typec/mux/gpio-sbu-mux.c b/drivers/usb/typec/mux/gpio-sbu-mux.c index 374168482d363..8902102c05a8e 100644 --- a/drivers/usb/typec/mux/gpio-sbu-mux.c +++ b/drivers/usb/typec/mux/gpio-sbu-mux.c @@ -66,6 +66,9 @@ static int gpio_sbu_mux_set(struct typec_mux_dev *mux, { struct gpio_sbu_mux *sbu_mux = typec_mux_get_drvdata(mux); + if (!sbu_mux->enable_gpio) + return -EOPNOTSUPP; + mutex_lock(&sbu_mux->lock); switch (state->mode) { @@ -102,7 +105,8 @@ static int gpio_sbu_mux_probe(struct platform_device *pdev) mutex_init(&sbu_mux->lock); - sbu_mux->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW); + sbu_mux->enable_gpio = devm_gpiod_get_optional(dev, "enable", + GPIOD_OUT_LOW); if (IS_ERR(sbu_mux->enable_gpio)) return dev_err_probe(dev, PTR_ERR(sbu_mux->enable_gpio), "unable to acquire enable gpio\n");