netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Jiawen Wu <jiawenwu@trustnetic.com>,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com,
	linux@armlinux.org.uk, horms@kernel.org,
	jacob.e.keller@intel.com, netdev@vger.kernel.org
Cc: mengyuanlou@net-swift.com
Subject: Re: [PATCH net-next v5 1/4] net: wangxun: Add support for PTP clock
Date: Fri, 17 Jan 2025 14:15:01 +0000	[thread overview]
Message-ID: <9390f920-a89f-43d3-a75f-664fd05df655@linux.dev> (raw)
In-Reply-To: <20250117062051.2257073-2-jiawenwu@trustnetic.com>

On 17/01/2025 06:20, Jiawen Wu wrote:
> Implement support for PTP clock on Wangxun NICs.
> 
> Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>

[...]

> +/**
> + * wx_ptp_create_clock
> + * @wx: the private board structure
> + *
> + * Returns 0 on success, negative value on failure
> + *
> + * This function performs setup of the user entry point function table and
> + * initalizes the PTP clock device used by userspace to access the clock-like
> + * features of the PTP core. It will be called by wx_ptp_init, and may
> + * re-use a previously initialized clock (such as during a suspend/resume
> + * cycle).
> + */
> +static long wx_ptp_create_clock(struct wx *wx)
> +{
> +	struct net_device *netdev = wx->netdev;
> +	long err;
> +
> +	/* do nothing if we already have a clock device */
> +	if (!IS_ERR_OR_NULL(wx->ptp_clock))
> +		return 0;
> +
> +	snprintf(wx->ptp_caps.name, sizeof(wx->ptp_caps.name),
> +		 "%s", netdev->name);
> +	wx->ptp_caps.owner = THIS_MODULE;
> +	wx->ptp_caps.n_alarm = 0;
> +	wx->ptp_caps.n_ext_ts = 0;
> +	wx->ptp_caps.n_per_out = 0;
> +	wx->ptp_caps.pps = 0;
> +	wx->ptp_caps.adjfine = wx_ptp_adjfine;
> +	wx->ptp_caps.adjtime = wx_ptp_adjtime;
> +	wx->ptp_caps.gettimex64 = wx_ptp_gettimex64;
> +	wx->ptp_caps.settime64 = wx_ptp_settime64;
> +	if (wx->mac.type == wx_mac_em)
> +		wx->ptp_caps.max_adj = 500000000;
> +	else
> +		wx->ptp_caps.max_adj = 250000000;
> +
> +	wx->ptp_clock = ptp_clock_register(&wx->ptp_caps, &wx->pdev->dev);
> +	if (IS_ERR(wx->ptp_clock)) {
> +		err = PTR_ERR(wx->ptp_clock);
> +		wx->ptp_clock = NULL;
> +		wx_err(wx, "ptp clock register failed\n");
> +		return err;
> +	} else if (wx->ptp_clock) {

there is no way ptp_clock_register() will return NULL, that means
this `else if` construction is always true, so it's meaning less.
Please remove it if there will be need for another version.

Otherwise LGTM,

Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>


> +		dev_info(&wx->pdev->dev, "registered PHC device on %s\n",
> +			 netdev->name);
> +	}



[...]

  reply	other threads:[~2025-01-17 14:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-17  6:20 [PATCH net-next v5 0/4] Support PTP clock for Wangxun NICs Jiawen Wu
2025-01-17  6:20 ` [PATCH net-next v5 1/4] net: wangxun: Add support for PTP clock Jiawen Wu
2025-01-17 14:15   ` Vadim Fedorenko [this message]
2025-01-17 15:51     ` Richard Cochran
2025-01-17 16:03       ` Vadim Fedorenko
2025-01-17 22:39         ` Jacob Keller
2025-01-19  1:42           ` Richard Cochran
2025-01-20 11:14   ` kernel test robot
2025-01-20 12:27   ` Vadim Fedorenko
2025-01-17  6:20 ` [PATCH net-next v5 2/4] net: wangxun: Support to get ts info Jiawen Wu
2025-01-17  6:20 ` [PATCH net-next v5 3/4] net: wangxun: Implement do_aux_work of ptp_clock_info Jiawen Wu
2025-01-17  6:20 ` [PATCH net-next v5 4/4] net: ngbe: Add support for 1PPS and TOD Jiawen Wu
2025-01-19 19:15   ` Richard Cochran
2025-01-19 19:16 ` [PATCH net-next v5 0/4] Support PTP clock for Wangxun NICs Richard Cochran

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=9390f920-a89f-43d3-a75f-664fd05df655@linux.dev \
    --to=vadim.fedorenko@linux.dev \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=jiawenwu@trustnetic.com \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mengyuanlou@net-swift.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    /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).