Skip to content

Commit e153fde

Browse files
geertuvinodkoul
authored andcommitted
phy: can-transceiver: Re-instate "mux-states" property presence check
On the Renesas Gray Hawk Single development board: can-transceiver-phy can-phy0: /can-phy0: failed to get mux-state (0) "mux-states" is an optional property for CAN transceivers. However, mux_get() always prints an error message in case of an error, including when the property is not present, confusing the user. Fix this by re-instating the property presence check (this time using the proper API) in a wrapper around devm_mux_state_get(). When the multiplexer subsystem gains support for optional muxes, the wrapper can just be removed. In addition, propagate all real errors upstream, instead of ignoring them. Fixes: d02dfd4 ("phy: can-transceiver: Drop unnecessary "mux-states" property presence check") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Tested-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Link: https://lore.kernel.org/r/3d7e0d723908284e8cf06ad1f7950c03173178f3.1742483710.git.geert+renesas@glider.be Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent d784552 commit e153fde

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

drivers/phy/phy-can-transceiver.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,16 @@ static const struct of_device_id can_transceiver_phy_ids[] = {
9393
};
9494
MODULE_DEVICE_TABLE(of, can_transceiver_phy_ids);
9595

96+
/* Temporary wrapper until the multiplexer subsystem supports optional muxes */
97+
static inline struct mux_state *
98+
devm_mux_state_get_optional(struct device *dev, const char *mux_name)
99+
{
100+
if (!of_property_present(dev->of_node, "mux-states"))
101+
return NULL;
102+
103+
return devm_mux_state_get(dev, mux_name);
104+
}
105+
96106
static int can_transceiver_phy_probe(struct platform_device *pdev)
97107
{
98108
struct phy_provider *phy_provider;
@@ -114,13 +124,11 @@ static int can_transceiver_phy_probe(struct platform_device *pdev)
114124
match = of_match_node(can_transceiver_phy_ids, pdev->dev.of_node);
115125
drvdata = match->data;
116126

117-
mux_state = devm_mux_state_get(dev, NULL);
118-
if (IS_ERR(mux_state)) {
119-
if (PTR_ERR(mux_state) == -EPROBE_DEFER)
120-
return PTR_ERR(mux_state);
121-
} else {
122-
can_transceiver_phy->mux_state = mux_state;
123-
}
127+
mux_state = devm_mux_state_get_optional(dev, NULL);
128+
if (IS_ERR(mux_state))
129+
return PTR_ERR(mux_state);
130+
131+
can_transceiver_phy->mux_state = mux_state;
124132

125133
phy = devm_phy_create(dev, dev->of_node,
126134
&can_transceiver_phy_ops);

0 commit comments

Comments
 (0)