[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <864ae6d6-4d60-4175-86a9-039b75440330@wanadoo.fr>
Date: Thu, 20 Mar 2025 20:29:16 +0900
From: Vincent Mailhol <mailhol.vincent@...adoo.fr>
To: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: linux-can@...r.kernel.org, linux-phy@...ts.infradead.org,
linux-renesas-soc@...r.kernel.org, linux-kernel@...r.kernel.org,
Rob Herring <robh@...nel.org>, Marc Kleine-Budde <mkl@...gutronix.de>,
Vinod Koul <vkoul@...nel.org>, Kishon Vijay Abraham I <kishon@...nel.org>,
Peter Rosin <peda@...ntia.se>, Aswath Govindraju <a-govindraju@...com>
Subject: Re: [PATCH] phy: can-transceiver: Re-instate "mux-states" property
presence check
On 20/03/2025 at 19:25, Geert Uytterhoeven wrote:
> Hi Vincent,
(...)
>> On 19/03/2025 at 22:27, Geert Uytterhoeven wrote:
>>> 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.
>>
>> Hmmm, I understand why you are doing this patch. But on the long term,
>> wouldn't it make more sense to have a devm_mux_state_get_optional()? Or
>> maybe add a property somewhere to inform devm_mux_state_get() that this
>> is optional?
>>
>> Regardless, just see this as an open question. I am OK with the approach
>> of your patch.
>
> Alternatively, we can be proactive and add a temporary local wrapper:
>
> /* Dummy wrapper until optional muxes are supported */
> static inline struct mux_state *
> devm_mux_state_get_optional(struct device *dev, const char *mux_name)
> {
> if (!of_property_present(dev->of_node, "mux-states"))
> return NULL;
>
> return devm_mux_state_get(dev, mux_name);
> }
>
> and call that instead? Then the probe function needs no future changes
> when the real devm_mux_state_get_optional() arrives.
This looks like a more elegant and more long term solution!
Yours sincerely,
Vincent Mailhol
Powered by blists - more mailing lists