|
@@ -221,16 +221,17 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
|
|
|
mutex_init(&ptp->pincfg_mux);
|
|
|
init_waitqueue_head(&ptp->tsev_wq);
|
|
|
|
|
|
+ err = ptp_populate_pin_groups(ptp);
|
|
|
+ if (err)
|
|
|
+ goto no_pin_groups;
|
|
|
+
|
|
|
/* Create a new device in our class. */
|
|
|
- ptp->dev = device_create(ptp_class, parent, ptp->devid, ptp,
|
|
|
- "ptp%d", ptp->index);
|
|
|
+ ptp->dev = device_create_with_groups(ptp_class, parent, ptp->devid,
|
|
|
+ ptp, ptp->pin_attr_groups,
|
|
|
+ "ptp%d", ptp->index);
|
|
|
if (IS_ERR(ptp->dev))
|
|
|
goto no_device;
|
|
|
|
|
|
- err = ptp_populate_sysfs(ptp);
|
|
|
- if (err)
|
|
|
- goto no_sysfs;
|
|
|
-
|
|
|
/* Register a new PPS source. */
|
|
|
if (info->pps) {
|
|
|
struct pps_source_info pps;
|
|
@@ -258,10 +259,10 @@ no_clock:
|
|
|
if (ptp->pps_source)
|
|
|
pps_unregister_source(ptp->pps_source);
|
|
|
no_pps:
|
|
|
- ptp_cleanup_sysfs(ptp);
|
|
|
-no_sysfs:
|
|
|
device_destroy(ptp_class, ptp->devid);
|
|
|
no_device:
|
|
|
+ ptp_cleanup_pin_groups(ptp);
|
|
|
+no_pin_groups:
|
|
|
mutex_destroy(&ptp->tsevq_mux);
|
|
|
mutex_destroy(&ptp->pincfg_mux);
|
|
|
ida_simple_remove(&ptp_clocks_map, index);
|
|
@@ -280,8 +281,9 @@ int ptp_clock_unregister(struct ptp_clock *ptp)
|
|
|
/* Release the clock's resources. */
|
|
|
if (ptp->pps_source)
|
|
|
pps_unregister_source(ptp->pps_source);
|
|
|
- ptp_cleanup_sysfs(ptp);
|
|
|
+
|
|
|
device_destroy(ptp_class, ptp->devid);
|
|
|
+ ptp_cleanup_pin_groups(ptp);
|
|
|
|
|
|
posix_clock_unregister(&ptp->clock);
|
|
|
return 0;
|