Skip to content

Commit 39e86af

Browse files
Binary-EaterBrian Maly
authored andcommitted
ptp: Make max_phase_adjustment sysfs device attribute invisible when not supported
The .adjphase operation is an operation that is implemented only by certain PHCs. The sysfs device attribute node for querying the maximum phase adjustment supported should not be exposed on devices that do not support .adjphase. Fixes: c3b60ab ("ptp: Add .getmaxphase callback to ptp_clock_info") Signed-off-by: Rahul Rameshbabu <[email protected]> Reported-by: Nathan Chancellor <[email protected]> Reported-by: Naresh Kamboju <[email protected]> Reported-by: Linux Kernel Functional Testing <[email protected]> Link: https://lore.kernel.org/netdev/[email protected]/ Link: https://lore.kernel.org/all/CA+G9fYtKCZeAUTtwe69iK8Xcz1mOKQzwcy49wd+imZrfj6ifXA@mail.gmail.com/ Tested-by: Nathan Chancellor <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Acked-by: Richard Cochran <[email protected]> Reviewed-by: Petr Vorel <[email protected]> Message-ID: <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]> Orabug: 35622106 (cherry picked from commit 2c5d234) cherry-pick-repo=kernel/git/torvalds/linux.git unmodified-from-upstream: 2c5d234 Signed-off-by: Mikhael Goikhman <[email protected]> Signed-off-by: Qing Huang <[email protected]> Reviewed-by: Devesh Sharma <[email protected]> Signed-off-by: Brian Maly <[email protected]>
1 parent dfaa54c commit 39e86af

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/ptp/ptp_sysfs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,9 @@ static umode_t ptp_is_attribute_visible(struct kobject *kobj,
356356
attr == &dev_attr_max_vclocks.attr) {
357357
if (ptp->is_virtual_clock)
358358
mode = 0;
359+
} else if (attr == &dev_attr_max_phase_adjustment.attr) {
360+
if (!info->adjphase || !info->getmaxphase)
361+
mode = 0;
359362
}
360363

361364
return mode;

0 commit comments

Comments
 (0)