All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Miroslav Lichvar <mlichvar@redhat.com>
Cc: netdev@vger.kernel.org, Richard Cochran <richardcochran@gmail.com>
Subject: Re: [PATCH net-next] testptp: set pin function before other requests
Date: Wed, 5 Jan 2022 17:44:22 +0200	[thread overview]
Message-ID: <20220105154422.r7pkgikdiffxpl77@skbuf> (raw)
In-Reply-To: <20220105152506.3256026-1-mlichvar@redhat.com>

On Wed, Jan 05, 2022 at 04:25:06PM +0100, Miroslav Lichvar wrote:
> When the -L option of the testptp utility is specified with other
> options (e.g. -p to enable PPS output), the user probably wants to
> apply it to the pin configured by the -L option.
> 
> Reorder the code to set the pin function before other function requests
> to avoid confusing users.
> 
> Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
> Cc: Richard Cochran <richardcochran@gmail.com>
> Cc: Vladimir Oltean <olteanv@gmail.com>
> ---

This makes sense. Looking back at my logs, I was setting the pin
function via sysfs, but if the code was structured differently I could
have done it in a single command using testptp. Not sure why I didn't
think of that.

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

>  tools/testing/selftests/ptp/testptp.c | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/tools/testing/selftests/ptp/testptp.c b/tools/testing/selftests/ptp/testptp.c
> index f7911aaeb007..c0f6a062364d 100644
> --- a/tools/testing/selftests/ptp/testptp.c
> +++ b/tools/testing/selftests/ptp/testptp.c
> @@ -354,6 +354,18 @@ int main(int argc, char *argv[])
>  		}
>  	}
>  
> +	if (pin_index >= 0) {
> +		memset(&desc, 0, sizeof(desc));
> +		desc.index = pin_index;
> +		desc.func = pin_func;
> +		desc.chan = index;
> +		if (ioctl(fd, PTP_PIN_SETFUNC, &desc)) {
> +			perror("PTP_PIN_SETFUNC");
> +		} else {
> +			puts("set pin function okay");
> +		}
> +	}
> +
>  	if (extts) {
>  		memset(&extts_request, 0, sizeof(extts_request));
>  		extts_request.index = index;
> @@ -444,18 +456,6 @@ int main(int argc, char *argv[])
>  		}
>  	}
>  
> -	if (pin_index >= 0) {
> -		memset(&desc, 0, sizeof(desc));
> -		desc.index = pin_index;
> -		desc.func = pin_func;
> -		desc.chan = index;
> -		if (ioctl(fd, PTP_PIN_SETFUNC, &desc)) {
> -			perror("PTP_PIN_SETFUNC");
> -		} else {
> -			puts("set pin function okay");
> -		}
> -	}
> -
>  	if (pps != -1) {
>  		int enable = pps ? 1 : 0;
>  		if (ioctl(fd, PTP_ENABLE_PPS, enable)) {
> -- 
> 2.33.1
> 

  reply	other threads:[~2022-01-05 15:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-05 15:25 [PATCH net-next] testptp: set pin function before other requests Miroslav Lichvar
2022-01-05 15:44 ` Vladimir Oltean [this message]
2022-01-05 20:09 ` Richard Cochran
2022-01-06  1:20 ` patchwork-bot+netdevbpf

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=20220105154422.r7pkgikdiffxpl77@skbuf \
    --to=olteanv@gmail.com \
    --cc=mlichvar@redhat.com \
    --cc=netdev@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.