Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

phy: phy-can-transceiver: Make devm_gpiod_get optional

In some cases the standby/enable gpio can be pulled low/high and would not
be connected to a gpio. The current driver implementation will return an
error in these cases. Therefore, make devm_gpiod_get optional.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Link: https://lore.kernel.org/r/20211102112120.23637-1-a-govindraju@ti.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Aswath Govindraju and committed by
Vinod Koul
be24d248 a4634629

+2 -2
+2 -2
drivers/phy/phy-can-transceiver.c
··· 110 110 can_transceiver_phy->generic_phy = phy; 111 111 112 112 if (drvdata->flags & CAN_TRANSCEIVER_STB_PRESENT) { 113 - standby_gpio = devm_gpiod_get(dev, "standby", GPIOD_OUT_HIGH); 113 + standby_gpio = devm_gpiod_get_optional(dev, "standby", GPIOD_OUT_HIGH); 114 114 if (IS_ERR(standby_gpio)) 115 115 return PTR_ERR(standby_gpio); 116 116 can_transceiver_phy->standby_gpio = standby_gpio; 117 117 } 118 118 119 119 if (drvdata->flags & CAN_TRANSCEIVER_EN_PRESENT) { 120 - enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW); 120 + enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW); 121 121 if (IS_ERR(enable_gpio)) 122 122 return PTR_ERR(enable_gpio); 123 123 can_transceiver_phy->enable_gpio = enable_gpio;