linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Vincent MAILHOL <mailhol.vincent@wanadoo.fr>
Cc: Marcel Hellwig <git@cookiesoft.de>,
	Appana Durga Kedareswara rao <appana.durga.rao@xilinx.com>,
	Naga Sureshkumar Relli <naga.sureshkumar.relli@xilinx.com>,
	linux-can@vger.kernel.org, netdev@vger.kernel.org,
	Marcel Hellwig <mhellwig@mut-group.com>
Subject: Re: [PATCH] can: dev: add transceiver capabilities to xilinx_can
Date: Mon, 22 May 2023 10:03:15 +0200	[thread overview]
Message-ID: <20230522-untainted-saga-f05e02fdb66d-mkl@pengutronix.de> (raw)
In-Reply-To: <CAMZ6RqJqwyJQ17EJd0eV_8tbsC5b16nbuQj3uD38BeRzSdPc3Q@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2561 bytes --]

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@cookiesoft.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@cookiesoft.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   |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

      reply	other threads:[~2023-05-22  8:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-17  8:52 [PATCH] can: dev: add transceiver capabilities to xilinx_can Marcel Hellwig
2023-05-22  7:24 ` git
2023-05-22  8:00   ` Marc Kleine-Budde
2023-05-22  8:23     ` Marc Kleine-Budde
2023-05-22  7:58 ` Vincent MAILHOL
2023-05-22  8:03   ` Marc Kleine-Budde [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230522-untainted-saga-f05e02fdb66d-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=appana.durga.rao@xilinx.com \
    --cc=git@cookiesoft.de \
    --cc=linux-can@vger.kernel.org \
    --cc=mailhol.vincent@wanadoo.fr \
    --cc=mhellwig@mut-group.com \
    --cc=naga.sureshkumar.relli@xilinx.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).