Re: [PATCH net-next 5/9] ptp: Add .getmaxphase callback to ptp_clock_info
From: Richard Cochran <richardcochran@gmail.com>
Date: 2023-05-11 02:20:22
From: Richard Cochran <richardcochran@gmail.com>
Date: 2023-05-11 02:20:22
On Wed, May 10, 2023 at 01:53:02PM -0700, Rahul Rameshbabu wrote:
+#define PTP_SHOW_CB_INT(name, cb) \
+static ssize_t cb##_show(struct device *dev, \
+ struct device_attribute *attr, char *page) \
+{ \
+ struct ptp_clock *ptp = dev_get_drvdata(dev); \
+ return snprintf(page, PAGE_SIZE-1, "%d\n", \
+ ptp->info->cb(ptp->info)); \
+} \
+static DEVICE_ATTR(name, 0444, cb##_show, NULL);
+
PTP_SHOW_INT(max_adjustment, max_adj);
+PTP_SHOW_CB_INT(max_phase_adjustment, getmaxphase);Ugh, please no macro here. Just add it plainly like clock_name_show. Rest of patch LGTM. Thanks, Richard