Re: [PATCH RFC v2 4/4] phy: phy-can-transceiver: Add support for setting mux
From: Marc Kleine-Budde
Date: Mon Nov 22 2021 - 08:31:06 EST
On 22.11.2021 18:50:00, Aswath Govindraju wrote:
> > What about adding a devm_mux_control_get_optional(), which doesn't
> > return a -ENODEV but a NULL pointer if the device doesn't exist?
> I tried adding it in the following manner,
> + * devm_mux_control_optional_get() - Optionally get the mux-control for a
> + * device, with resource management.
> + * @dev: The device that needs a mux-control.
> + * @mux_name: The name identifying the mux-control.
> + *
> + * This differs from devm_mux_control_get in that if the mux does not
> + * exist, it is not considered an error and -ENODEV will not be
> + * returned. Instead the NULL is returned.
> + *
> + * Return: Pointer to the mux-control, or an ERR_PTR with a negative errno.
> + */
> +struct mux_control *devm_mux_control_optional_get(struct device *dev,
> + const char *mux_name)
> + struct mux_control *mux_ctrl;
> + mux_ctrl = devm_mux_control_get(dev, mux_name);
> + if (PTR_ERR(mux_ctrl) == -ENOENT)
> + mux_ctrl = NULL;
> + return mux_ctrl;
> However the issue is that there is a print in mux_control_get()
> dev_err(dev, "%pOF: failed to get mux-control %s(%i)\n",
> which is getting printed, whenever mux-controls property is not found.
> Therefore, I was not sure about how to go about this issue and did not
> implement it.
Ok, this would require more tweaking in the mux layer. Then leave it as
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Description: PGP signature