DPLL_TYPE_GENERIC is the kernel device type of DPLL devices that are neither PPS nor EEC, and the ice driver registers such devices. The uapi header in iproute2 already has the value, but the tool has no name for it. Such a device is shown with "type: unknown" and "type generic" is refused both as a filter of "dpll device show" and as an argument of "dpll device id-get". Add the name to the device type helpers, to the man page and to the bash completion. The list of device type names used by the two error messages moves to a macro, as is already done for the pin types. Signed-off-by: Petr Oros --- bash-completion/dpll | 4 ++-- dpll/dpll.c | 10 ++++++++-- man/man8/dpll.8 | 6 +++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/bash-completion/dpll b/bash-completion/dpll index cfd39c5e0c7a53..0251df81159792 100644 --- a/bash-completion/dpll +++ b/bash-completion/dpll @@ -70,7 +70,7 @@ _dpll_device() return 0 ;; type) - COMPREPLY=( $( compgen -W "pps eec" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "pps eec generic" -- "$cur" ) ) return 0 ;; mode) @@ -127,7 +127,7 @@ _dpll_device() return 0 ;; type) - COMPREPLY=( $( compgen -W "pps eec" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "pps eec generic" -- "$cur" ) ) return 0 ;; *) diff --git a/dpll/dpll.c b/dpll/dpll.c index a0a5e3f9a2f152..8dc1b8f5033fea 100644 --- a/dpll/dpll.c +++ b/dpll/dpll.c @@ -806,6 +806,8 @@ static const char *dpll_type_name(__u32 type) return "pps"; case DPLL_TYPE_EEC: return "eec"; + case DPLL_TYPE_GENERIC: + return "generic"; default: return "unknown"; } @@ -817,11 +819,15 @@ static int str_to_dpll_type(const char *s, __u32 *type) *type = DPLL_TYPE_PPS; else if (!strcmp(s, "eec")) *type = DPLL_TYPE_EEC; + else if (!strcmp(s, "generic")) + *type = DPLL_TYPE_GENERIC; else return -EINVAL; return 0; } +#define DPLL_TYPE_NAMES "pps/eec/generic" + static int str_to_dpll_lock_status(const char *s, __u32 *status) { if (!strcmp(s, "unlocked")) @@ -1290,7 +1296,7 @@ static int cmd_device_show(struct dpll *dpll) &filter.present, DPLL_FILTER_DEV_TYPE, str_to_dpll_type, - "pps/eec")) + DPLL_TYPE_NAMES)) return -EINVAL; } else if (dpll_argv_match(dpll, "mode")) { if (dpll_filter_parse_enum(dpll, "mode", @@ -1421,7 +1427,7 @@ static int cmd_device_id_get(struct dpll *dpll) return -EINVAL; } if (str_to_dpll_type(str, &val)) { - pr_err("invalid type: %s (use pps/eec)\n", str); + pr_err("invalid type: %s (use " DPLL_TYPE_NAMES ")\n", str); return -EINVAL; } mnl_attr_put_u32(nlh, DPLL_A_TYPE, val); diff --git a/man/man8/dpll.8 b/man/man8/dpll.8 index 84c21e7980eb2b..c1d4a75e072dc8 100644 --- a/man/man8/dpll.8 +++ b/man/man8/dpll.8 @@ -101,7 +101,7 @@ Show only devices with the specified 64-bit clock identifier. .TP .BI type " TYPE" Show only devices of the specified type: -.BR pps " or " eec . +.BR pps ", " eec " or " generic . .TP .BI mode " MODE" @@ -133,7 +133,7 @@ Clock quality level (if supported) .IP \[bu] Temperature (if supported) .IP \[bu] -Type (PPS or EEC) +Type (PPS, EEC or generic) .IP \[bu] Supported modes .IP \[bu] @@ -198,7 +198,7 @@ Kernel module name. .TP .BI type " TYPE" Device type: -.BR pps " or " eec . +.BR pps ", " eec " or " generic . .SH PIN COMMANDS -- 2.56.1