aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ptp
diff options
context:
space:
mode:
authorRichard Cochran <richardcochran@gmail.com>2012-09-22 03:02:03 -0400
committerDavid S. Miller <davem@davemloft.net>2012-09-22 15:42:38 -0400
commit1ef761582c074448bae5be97abde5934667e7710 (patch)
treefc4679a8f28897043be34fda0465562be66d7f55 /drivers/ptp
parent5c35bad5ffe5accde6b0ef4468b39e1db0806b94 (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>
Diffstat (limited to 'drivers/ptp')
-rw-r--r--drivers/ptp/ptp_clock.c5
-rw-r--r--drivers/ptp/ptp_ixp46x.c2
-rw-r--r--drivers/ptp/ptp_pch.c2
3 files changed, 5 insertions, 4 deletions
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
185struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info) 185struct 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);