Commit be24d248 authored by Aswath Govindraju's avatar Aswath Govindraju Committed by Vinod Koul
Browse files

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: default avatarAswath Govindraju <a-govindraju@ti.com>
Acked-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
Link: https://lore.kernel.org/r/20211102112120.23637-1-a-govindraju@ti.com


Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent a4634629
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -110,14 +110,14 @@ static int can_transceiver_phy_probe(struct platform_device *pdev)
	can_transceiver_phy->generic_phy = phy;

	if (drvdata->flags & CAN_TRANSCEIVER_STB_PRESENT) {
		standby_gpio = devm_gpiod_get(dev, "standby", GPIOD_OUT_HIGH);
		standby_gpio = devm_gpiod_get_optional(dev, "standby", GPIOD_OUT_HIGH);
		if (IS_ERR(standby_gpio))
			return PTR_ERR(standby_gpio);
		can_transceiver_phy->standby_gpio = standby_gpio;
	}

	if (drvdata->flags & CAN_TRANSCEIVER_EN_PRESENT) {
		enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
		enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW);
		if (IS_ERR(enable_gpio))
			return PTR_ERR(enable_gpio);
		can_transceiver_phy->enable_gpio = enable_gpio;