History

ptp: replace snprintf with sysfs_emit

coccinelle report: ./drivers/ptp/ptp_sysfs.c:17:8-16: WARNING: use scnprintf or sprintf ./drivers/ptp/ptp_sysfs.c:390:8-16: WARNING: use scnprintf or sprintf Use sysfs_emit instead of scnprintf or sprintf makes more sense.

Yang Guang committed 4 years ago

Commit e2cf0761 parent c217ab71 file · +2 −2Browse files

Unified · Split

drivers/ptp/ptp_sysfs.c+2−2
@@ -14,7 +14,7 @@ static ssize_t clock_name_show(struct device *dev, · 13 unmodified lines
14 struct device_attribute *attr, char *page)14 struct device_attribute *attr, char *page)
15{15{
16 struct ptp_clock *ptp = dev_get_drvdata(dev);16 struct ptp_clock *ptp = dev_get_drvdata(dev);
17 return snprintf(page, PAGE_SIZE-1, "%s\n", ptp->info->name);17 return sysfs_emit(page, "%s\n", ptp->info->name);
18}18}
19static DEVICE_ATTR_RO(clock_name);19static DEVICE_ATTR_RO(clock_name);
20 20
@@ -387,7 +387,7 @@ static ssize_t ptp_pin_show(struct device *dev, struct device_attribute *attr, · 366 unmodified lines
387 387
388 mutex_unlock(&ptp->pincfg_mux);388 mutex_unlock(&ptp->pincfg_mux);
389 389
390 return snprintf(page, PAGE_SIZE, "%u %u\n", func, chan);390 return sysfs_emit(page, "%u %u\n", func, chan);
391}391}
392 392
393static ssize_t ptp_pin_store(struct device *dev, struct device_attribute *attr,393static ssize_t ptp_pin_store(struct device *dev, struct device_attribute *attr,