lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230522-untainted-saga-f05e02fdb66d-mkl@pengutronix.de>
Date: Mon, 22 May 2023 10:03:15 +0200
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Vincent MAILHOL <mailhol.vincent@...adoo.fr>
Cc: Marcel Hellwig <git@...kiesoft.de>,
	Appana Durga Kedareswara rao <appana.durga.rao@...inx.com>,
	Naga Sureshkumar Relli <naga.sureshkumar.relli@...inx.com>,
	linux-can@...r.kernel.org, netdev@...r.kernel.org,
	Marcel Hellwig <mhellwig@...-group.com>
Subject: Re: [PATCH] can: dev: add transceiver capabilities to xilinx_can

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@...kiesoft.de> 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@...kiesoft.de>
> > ---
> >  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   |

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ