On 22.05.2023 16:58:02, Vincent MAILHOL wrote: > Hi Marcel, > > Style check only (I am not yet familiar enough with the devicetree). > > On Mon. 17 Apr. 2023 at 18:01, Marcel Hellwig <git@xxxxxxxxxxxxx> wrote: > > Currently the xilinx_can driver does not support adding a phy like the > > "ti,tcan1043" to its devicetree. > > > > This code makes it possible to add such phy, so that the kernel makes > > sure that the PHY is in operational state, when the link is set to an > > "up" state. > > > > Signed-off-by: Marcel Hellwig <git@xxxxxxxxxxxxx> > > --- > > drivers/net/can/xilinx_can.c | 20 ++++++++++++++++++++ > > 1 file changed, 20 insertions(+) > > > > diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c > > index 43c812ea1de0..6a5b805d579a 100644 > > --- a/drivers/net/can/xilinx_can.c > > +++ b/drivers/net/can/xilinx_can.c > > @@ -28,6 +28,7 @@ > > #include <linux/types.h> > > #include <linux/can/dev.h> > > #include <linux/can/error.h> > > +#include <linux/phy/phy.h> > > #include <linux/pm_runtime.h> > > > > #define DRIVER_NAME "xilinx_can" > > @@ -215,6 +216,7 @@ struct xcan_priv { > > struct clk *bus_clk; > > struct clk *can_clk; > > struct xcan_devtype_data devtype; > > + struct phy *transceiver; > > }; > > > > /* CAN Bittiming constants as per Xilinx CAN specs */ > > @@ -1419,6 +1421,12 @@ static int xcan_open(struct net_device *ndev) > > struct xcan_priv *priv = netdev_priv(ndev); > > int ret; > > > > + ret = phy_power_on(priv->transceiver); > > + if (ret) { > > + netdev_err(ndev, "%s: phy_power_on failed(%d)\n", __func__, ret); > > From the Linux kernel coding style: > > Printing numbers in parentheses (%d) adds no value and should be avoided. > Link: https://www.kernel.org/doc/html/latest/process/coding-style.html#printing-kernel-messages > > Also consider %pe to print the mnemotechnic instead of the value: > > netdev_err(ndev, "%s: phy_power_on failed: %pe\n", __func__, > ERR_PTR(ret)); Good point. phy_power_on() already writes an error message: | https://elixir.bootlin.com/linux/v6.3/source/drivers/phy/phy-core.c#L343 I'll remove that from this patch. Marc -- Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung Nürnberg | Phone: +49-5121-206917-129 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
Attachment:
signature.asc
Description: PGP signature