ptp: Add a method for obtaining the device index.
authorRichard Cochran <richardcochran@gmail.com>
Tue, 3 Apr 2012 22:59:16 +0000 (22:59 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 4 Apr 2012 09:28:45 +0000 (05:28 -0400)
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>
drivers/ptp/ptp_clock.c
include/linux/ptp_clock_kernel.h

index f519a131238d7df6a38cd7326c36f2f2cc4369d7..1e528b539a07f202a04b9e9dbdfbffbac6656703 100644 (file)
@@ -304,6 +304,12 @@ void ptp_clock_event(struct ptp_clock *ptp, struct ptp_clock_event *event)
 }
 EXPORT_SYMBOL(ptp_clock_event);
 
+int ptp_clock_index(struct ptp_clock *ptp)
+{
+       return ptp->index;
+}
+EXPORT_SYMBOL(ptp_clock_index);
+
 /* module operations */
 
 static void __exit ptp_exit(void)
index dd2e44fba63e769ef6315d654e566f5b178193b1..945704c2ed65307bb8ec47c39cbd24d364b40fa3 100644 (file)
@@ -136,4 +136,12 @@ struct ptp_clock_event {
 extern void ptp_clock_event(struct ptp_clock *ptp,
                            struct ptp_clock_event *event);
 
+/**
+ * ptp_clock_index() - obtain the device index of a PTP clock
+ *
+ * @ptp:    The clock obtained from ptp_clock_register().
+ */
+
+extern int ptp_clock_index(struct ptp_clock *ptp);
+
 #endif