diff options
author | Richard Cochran <richardcochran@gmail.com> | 2012-09-22 03:02:03 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-09-22 15:42:38 -0400 |
commit | 1ef761582c074448bae5be97abde5934667e7710 (patch) | |
tree | fc4679a8f28897043be34fda0465562be66d7f55 | |
parent | 5c35bad5ffe5accde6b0ef4468b39e1db0806b94 (diff) |
ptp: link the phc device to its parent device
PTP Hardware Clock devices appear as class devices in sysfs. This patch
changes the registration API to use the parent device, clarifying the
clock's relationship to the underlying device.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Ben Hutchings <bhutchings@solarflare.com>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/freescale/gianfar_ptp.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb_ptp.c | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/ptp.c | 3 | ||||
-rw-r--r-- | drivers/net/phy/dp83640.c | 2 | ||||
-rw-r--r-- | drivers/ptp/ptp_clock.c | 5 | ||||
-rw-r--r-- | drivers/ptp/ptp_ixp46x.c | 2 | ||||
-rw-r--r-- | drivers/ptp/ptp_pch.c | 2 | ||||
-rw-r--r-- | include/linux/ptp_clock_kernel.h | 7 |
9 files changed, 18 insertions, 11 deletions
diff --git a/drivers/net/ethernet/freescale/gianfar_ptp.c b/drivers/net/ethernet/freescale/gianfar_ptp.c index c08e5d40fecb..18762a3ccce4 100644 --- a/drivers/net/ethernet/freescale/gianfar_ptp.c +++ b/drivers/net/ethernet/freescale/gianfar_ptp.c | |||
@@ -510,7 +510,7 @@ static int gianfar_ptp_probe(struct platform_device *dev) | |||
510 | 510 | ||
511 | spin_unlock_irqrestore(&etsects->lock, flags); | 511 | spin_unlock_irqrestore(&etsects->lock, flags); |
512 | 512 | ||
513 | etsects->clock = ptp_clock_register(&etsects->caps); | 513 | etsects->clock = ptp_clock_register(&etsects->caps, &dev->dev); |
514 | if (IS_ERR(etsects->clock)) { | 514 | if (IS_ERR(etsects->clock)) { |
515 | err = PTR_ERR(etsects->clock); | 515 | err = PTR_ERR(etsects->clock); |
516 | goto no_clock; | 516 | goto no_clock; |
diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c index e13ba1d5369f..ee21445157a3 100644 --- a/drivers/net/ethernet/intel/igb/igb_ptp.c +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c | |||
@@ -752,7 +752,8 @@ void igb_ptp_init(struct igb_adapter *adapter) | |||
752 | wr32(E1000_IMS, E1000_IMS_TS); | 752 | wr32(E1000_IMS, E1000_IMS_TS); |
753 | } | 753 | } |
754 | 754 | ||
755 | adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps); | 755 | adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps, |
756 | &adapter->pdev->dev); | ||
756 | if (IS_ERR(adapter->ptp_clock)) { | 757 | if (IS_ERR(adapter->ptp_clock)) { |
757 | adapter->ptp_clock = NULL; | 758 | adapter->ptp_clock = NULL; |
758 | dev_err(&adapter->pdev->dev, "ptp_clock_register failed\n"); | 759 | dev_err(&adapter->pdev->dev, "ptp_clock_register failed\n"); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c index 3456d5617143..39881cb17a4b 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | |||
@@ -960,7 +960,8 @@ void ixgbe_ptp_init(struct ixgbe_adapter *adapter) | |||
960 | /* (Re)start the overflow check */ | 960 | /* (Re)start the overflow check */ |
961 | adapter->flags2 |= IXGBE_FLAG2_OVERFLOW_CHECK_ENABLED; | 961 | adapter->flags2 |= IXGBE_FLAG2_OVERFLOW_CHECK_ENABLED; |
962 | 962 | ||
963 | adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps); | 963 | adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps, |
964 | &adapter->pdev->dev); | ||
964 | if (IS_ERR(adapter->ptp_clock)) { | 965 | if (IS_ERR(adapter->ptp_clock)) { |
965 | adapter->ptp_clock = NULL; | 966 | adapter->ptp_clock = NULL; |
966 | e_dev_err("ptp_clock_register failed\n"); | 967 | e_dev_err("ptp_clock_register failed\n"); |
diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c index 2b07a4eae07e..5b3dd028ce85 100644 --- a/drivers/net/ethernet/sfc/ptp.c +++ b/drivers/net/ethernet/sfc/ptp.c | |||
@@ -931,7 +931,8 @@ static int efx_ptp_probe_channel(struct efx_channel *channel) | |||
931 | ptp->phc_clock_info.settime = efx_phc_settime; | 931 | ptp->phc_clock_info.settime = efx_phc_settime; |
932 | ptp->phc_clock_info.enable = efx_phc_enable; | 932 | ptp->phc_clock_info.enable = efx_phc_enable; |
933 | 933 | ||
934 | ptp->phc_clock = ptp_clock_register(&ptp->phc_clock_info); | 934 | ptp->phc_clock = ptp_clock_register(&ptp->phc_clock_info, |
935 | &efx->pci_dev->dev); | ||
935 | if (!ptp->phc_clock) | 936 | if (!ptp->phc_clock) |
936 | goto fail3; | 937 | goto fail3; |
937 | 938 | ||
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index b0da0226661f..24e05c43bff8 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c | |||
@@ -980,7 +980,7 @@ static int dp83640_probe(struct phy_device *phydev) | |||
980 | 980 | ||
981 | if (choose_this_phy(clock, phydev)) { | 981 | if (choose_this_phy(clock, phydev)) { |
982 | clock->chosen = dp83640; | 982 | clock->chosen = dp83640; |
983 | clock->ptp_clock = ptp_clock_register(&clock->caps); | 983 | clock->ptp_clock = ptp_clock_register(&clock->caps, &phydev->dev); |
984 | if (IS_ERR(clock->ptp_clock)) { | 984 | if (IS_ERR(clock->ptp_clock)) { |
985 | err = PTR_ERR(clock->ptp_clock); | 985 | err = PTR_ERR(clock->ptp_clock); |
986 | goto no_register; | 986 | goto no_register; |
diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c index c470ddf1a6fa..79f4bce061bd 100644 --- a/drivers/ptp/ptp_clock.c +++ b/drivers/ptp/ptp_clock.c | |||
@@ -182,7 +182,8 @@ static void delete_ptp_clock(struct posix_clock *pc) | |||
182 | 182 | ||
183 | /* public interface */ | 183 | /* public interface */ |
184 | 184 | ||
185 | struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info) | 185 | struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, |
186 | struct device *parent) | ||
186 | { | 187 | { |
187 | struct ptp_clock *ptp; | 188 | struct ptp_clock *ptp; |
188 | int err = 0, index, major = MAJOR(ptp_devt); | 189 | int err = 0, index, major = MAJOR(ptp_devt); |
@@ -215,7 +216,7 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info) | |||
215 | init_waitqueue_head(&ptp->tsev_wq); | 216 | init_waitqueue_head(&ptp->tsev_wq); |
216 | 217 | ||
217 | /* Create a new device in our class. */ | 218 | /* Create a new device in our class. */ |
218 | ptp->dev = device_create(ptp_class, NULL, ptp->devid, ptp, | 219 | ptp->dev = device_create(ptp_class, parent, ptp->devid, ptp, |
219 | "ptp%d", ptp->index); | 220 | "ptp%d", ptp->index); |
220 | if (IS_ERR(ptp->dev)) | 221 | if (IS_ERR(ptp->dev)) |
221 | goto no_device; | 222 | goto no_device; |
diff --git a/drivers/ptp/ptp_ixp46x.c b/drivers/ptp/ptp_ixp46x.c index e03c40692b00..d49b85164fd2 100644 --- a/drivers/ptp/ptp_ixp46x.c +++ b/drivers/ptp/ptp_ixp46x.c | |||
@@ -298,7 +298,7 @@ static int __init ptp_ixp_init(void) | |||
298 | 298 | ||
299 | ixp_clock.caps = ptp_ixp_caps; | 299 | ixp_clock.caps = ptp_ixp_caps; |
300 | 300 | ||
301 | ixp_clock.ptp_clock = ptp_clock_register(&ixp_clock.caps); | 301 | ixp_clock.ptp_clock = ptp_clock_register(&ixp_clock.caps, NULL); |
302 | 302 | ||
303 | if (IS_ERR(ixp_clock.ptp_clock)) | 303 | if (IS_ERR(ixp_clock.ptp_clock)) |
304 | return PTR_ERR(ixp_clock.ptp_clock); | 304 | return PTR_ERR(ixp_clock.ptp_clock); |
diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c index 3a9c17eced10..e624e4dd2abb 100644 --- a/drivers/ptp/ptp_pch.c +++ b/drivers/ptp/ptp_pch.c | |||
@@ -627,7 +627,7 @@ pch_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
627 | } | 627 | } |
628 | 628 | ||
629 | chip->caps = ptp_pch_caps; | 629 | chip->caps = ptp_pch_caps; |
630 | chip->ptp_clock = ptp_clock_register(&chip->caps); | 630 | chip->ptp_clock = ptp_clock_register(&chip->caps, &pdev->dev); |
631 | 631 | ||
632 | if (IS_ERR(chip->ptp_clock)) | 632 | if (IS_ERR(chip->ptp_clock)) |
633 | return PTR_ERR(chip->ptp_clock); | 633 | return PTR_ERR(chip->ptp_clock); |
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h index a644b29f1161..56c71b27112e 100644 --- a/include/linux/ptp_clock_kernel.h +++ b/include/linux/ptp_clock_kernel.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #ifndef _PTP_CLOCK_KERNEL_H_ | 21 | #ifndef _PTP_CLOCK_KERNEL_H_ |
22 | #define _PTP_CLOCK_KERNEL_H_ | 22 | #define _PTP_CLOCK_KERNEL_H_ |
23 | 23 | ||
24 | #include <linux/device.h> | ||
24 | #include <linux/pps_kernel.h> | 25 | #include <linux/pps_kernel.h> |
25 | #include <linux/ptp_clock.h> | 26 | #include <linux/ptp_clock.h> |
26 | 27 | ||
@@ -93,10 +94,12 @@ struct ptp_clock; | |||
93 | /** | 94 | /** |
94 | * ptp_clock_register() - register a PTP hardware clock driver | 95 | * ptp_clock_register() - register a PTP hardware clock driver |
95 | * | 96 | * |
96 | * @info: Structure describing the new clock. | 97 | * @info: Structure describing the new clock. |
98 | * @parent: Pointer to the parent device of the new clock. | ||
97 | */ | 99 | */ |
98 | 100 | ||
99 | extern struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info); | 101 | extern struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, |
102 | struct device *parent); | ||
100 | 103 | ||
101 | /** | 104 | /** |
102 | * ptp_clock_unregister() - unregister a PTP hardware clock driver | 105 | * ptp_clock_unregister() - unregister a PTP hardware clock driver |