Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: iqs269a - use sysfs_emit() instead of scnprintf()

Replace calls to scnprintf() in the methods showing device attributes
with sysfs_emit() to simplify the code.

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
Link: https://lore.kernel.org/r/202212011548387254492@zte.com.cn
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

ye xingchen and committed by
Dmitry Torokhov
7c732265 3e39104b

+11 -12
+11 -12
drivers/input/misc/iqs269a.c
··· 1286 1286 if (error) 1287 1287 return error; 1288 1288 1289 - return scnprintf(buf, PAGE_SIZE, "%u\n", le16_to_cpu(counts)); 1289 + return sysfs_emit(buf, "%u\n", le16_to_cpu(counts)); 1290 1290 } 1291 1291 1292 1292 static ssize_t hall_bin_show(struct device *dev, ··· 1324 1324 return -EINVAL; 1325 1325 } 1326 1326 1327 - return scnprintf(buf, PAGE_SIZE, "%u\n", val); 1327 + return sysfs_emit(buf, "%u\n", val); 1328 1328 } 1329 1329 1330 1330 static ssize_t hall_enable_show(struct device *dev, ··· 1332 1332 { 1333 1333 struct iqs269_private *iqs269 = dev_get_drvdata(dev); 1334 1334 1335 - return scnprintf(buf, PAGE_SIZE, "%u\n", iqs269->hall_enable); 1335 + return sysfs_emit(buf, "%u\n", iqs269->hall_enable); 1336 1336 } 1337 1337 1338 1338 static ssize_t hall_enable_store(struct device *dev, ··· 1362 1362 { 1363 1363 struct iqs269_private *iqs269 = dev_get_drvdata(dev); 1364 1364 1365 - return scnprintf(buf, PAGE_SIZE, "%u\n", iqs269->ch_num); 1365 + return sysfs_emit(buf, "%u\n", iqs269->ch_num); 1366 1366 } 1367 1367 1368 1368 static ssize_t ch_number_store(struct device *dev, ··· 1391 1391 struct iqs269_private *iqs269 = dev_get_drvdata(dev); 1392 1392 struct iqs269_ch_reg *ch_reg = iqs269->sys_reg.ch_reg; 1393 1393 1394 - return scnprintf(buf, PAGE_SIZE, "%u\n", 1395 - ch_reg[iqs269->ch_num].rx_enable); 1394 + return sysfs_emit(buf, "%u\n", ch_reg[iqs269->ch_num].rx_enable); 1396 1395 } 1397 1396 1398 1397 static ssize_t rx_enable_store(struct device *dev, ··· 1431 1432 if (error) 1432 1433 return error; 1433 1434 1434 - return scnprintf(buf, PAGE_SIZE, "%u\n", val); 1435 + return sysfs_emit(buf, "%u\n", val); 1435 1436 } 1436 1437 1437 1438 static ssize_t ati_mode_store(struct device *dev, ··· 1464 1465 if (error) 1465 1466 return error; 1466 1467 1467 - return scnprintf(buf, PAGE_SIZE, "%u\n", val); 1468 + return sysfs_emit(buf, "%u\n", val); 1468 1469 } 1469 1470 1470 1471 static ssize_t ati_base_store(struct device *dev, ··· 1497 1498 if (error) 1498 1499 return error; 1499 1500 1500 - return scnprintf(buf, PAGE_SIZE, "%u\n", val); 1501 + return sysfs_emit(buf, "%u\n", val); 1501 1502 } 1502 1503 1503 1504 static ssize_t ati_target_store(struct device *dev, ··· 1524 1525 { 1525 1526 struct iqs269_private *iqs269 = dev_get_drvdata(dev); 1526 1527 1527 - return scnprintf(buf, PAGE_SIZE, "%u\n", 1528 - iqs269->ati_current && 1529 - completion_done(&iqs269->ati_done)); 1528 + return sysfs_emit(buf, "%u\n", 1529 + iqs269->ati_current && 1530 + completion_done(&iqs269->ati_done)); 1530 1531 } 1531 1532 1532 1533 static ssize_t ati_trigger_store(struct device *dev,