testptp: set pin function before other requests
Subsystems (3)
PATCH 1/1 testptp: set pin function before other requests
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.
--- tools/testing/selftests/ptp/testptp.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
tools/testing/selftests/ptp/testptp.c +12 -12
@@ -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)) {
Signature · 1 line
2.33.1
Quoted 11 lines · Miroslav Lichvar
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 <[email protected]>Cc Richard Cochran <[email protected]>Cc Vladimir Oltean <[email protected]>---
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.
Quoted 48 lines
tools/testing/selftests/ptp/testptp.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)tools/testing/selftests/ptp/testptp.c +12
-12@@ -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)) {Signature · 1 line
2.33.1
Quoted 6 lines · Miroslav Lichvar
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.
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Wed, 5 Jan 2022 16:25:06 +0100 you 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.
[...]
Here is the summary with links:
- [net-next] testptp: set pin function before other requests
https://git.kernel.org/netdev/net-next/c/87eee9c5589e
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html