Commit 995a9090b2b7dc734351f3ac0ba8d913ffb87001

Authored by Richard Cochran
Committed by David S. Miller
1 parent 2173bff5dc

ptp: Add a method for obtaining the device index.

This commit adds a method that MAC drivers may call in order to find out
the device number of their associated PTP Hardware Clock.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 2 changed files with 14 additions and 0 deletions Side-by-side Diff

drivers/ptp/ptp_clock.c
... ... @@ -304,6 +304,12 @@
304 304 }
305 305 EXPORT_SYMBOL(ptp_clock_event);
306 306  
  307 +int ptp_clock_index(struct ptp_clock *ptp)
  308 +{
  309 + return ptp->index;
  310 +}
  311 +EXPORT_SYMBOL(ptp_clock_index);
  312 +
307 313 /* module operations */
308 314  
309 315 static void __exit ptp_exit(void)
include/linux/ptp_clock_kernel.h
... ... @@ -136,5 +136,13 @@
136 136 extern void ptp_clock_event(struct ptp_clock *ptp,
137 137 struct ptp_clock_event *event);
138 138  
  139 +/**
  140 + * ptp_clock_index() - obtain the device index of a PTP clock
  141 + *
  142 + * @ptp: The clock obtained from ptp_clock_register().
  143 + */
  144 +
  145 +extern int ptp_clock_index(struct ptp_clock *ptp);
  146 +
139 147 #endif