[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211122133049.mlbshta6ksck2ngo@pengutronix.de>
Date: Mon, 22 Nov 2021 14:30:49 +0100
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Aswath Govindraju <a-govindraju@...com>
Cc: Nishanth Menon <nm@...com>, Vignesh Raghavendra <vigneshr@...com>,
Peter Rosin <peda@...ntia.se>,
Rob Herring <robh+dt@...nel.org>,
Wolfgang Grandegger <wg@...ndegger.com>,
Kishon Vijay Abraham I <kishon@...com>,
Vinod Koul <vkoul@...nel.org>, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-can@...r.kernel.org,
linux-phy@...ts.infradead.org
Subject: Re: [PATCH RFC v2 4/4] phy: phy-can-transceiver: Add support for
setting mux
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;
> +}
> +EXPORT_SYMBOL_GPL(devm_mux_control_optional_get);
> +
>
> 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
is.
regards,
Marc
--
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 |
Download attachment "signature.asc" of type "application/pgp-signature" (485 bytes)
Powered by blists - more mailing lists