Skip to content

Commit 7c73226

Browse files
ye xingchendtor
authored andcommitted
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>
1 parent 3e39104 commit 7c73226

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

drivers/input/misc/iqs269a.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,7 +1286,7 @@ static ssize_t counts_show(struct device *dev,
12861286
if (error)
12871287
return error;
12881288

1289-
return scnprintf(buf, PAGE_SIZE, "%u\n", le16_to_cpu(counts));
1289+
return sysfs_emit(buf, "%u\n", le16_to_cpu(counts));
12901290
}
12911291

12921292
static ssize_t hall_bin_show(struct device *dev,
@@ -1324,15 +1324,15 @@ static ssize_t hall_bin_show(struct device *dev,
13241324
return -EINVAL;
13251325
}
13261326

1327-
return scnprintf(buf, PAGE_SIZE, "%u\n", val);
1327+
return sysfs_emit(buf, "%u\n", val);
13281328
}
13291329

13301330
static ssize_t hall_enable_show(struct device *dev,
13311331
struct device_attribute *attr, char *buf)
13321332
{
13331333
struct iqs269_private *iqs269 = dev_get_drvdata(dev);
13341334

1335-
return scnprintf(buf, PAGE_SIZE, "%u\n", iqs269->hall_enable);
1335+
return sysfs_emit(buf, "%u\n", iqs269->hall_enable);
13361336
}
13371337

13381338
static ssize_t hall_enable_store(struct device *dev,
@@ -1362,7 +1362,7 @@ static ssize_t ch_number_show(struct device *dev,
13621362
{
13631363
struct iqs269_private *iqs269 = dev_get_drvdata(dev);
13641364

1365-
return scnprintf(buf, PAGE_SIZE, "%u\n", iqs269->ch_num);
1365+
return sysfs_emit(buf, "%u\n", iqs269->ch_num);
13661366
}
13671367

13681368
static ssize_t ch_number_store(struct device *dev,
@@ -1391,8 +1391,7 @@ static ssize_t rx_enable_show(struct device *dev,
13911391
struct iqs269_private *iqs269 = dev_get_drvdata(dev);
13921392
struct iqs269_ch_reg *ch_reg = iqs269->sys_reg.ch_reg;
13931393

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);
13961395
}
13971396

13981397
static ssize_t rx_enable_store(struct device *dev,
@@ -1432,7 +1431,7 @@ static ssize_t ati_mode_show(struct device *dev,
14321431
if (error)
14331432
return error;
14341433

1435-
return scnprintf(buf, PAGE_SIZE, "%u\n", val);
1434+
return sysfs_emit(buf, "%u\n", val);
14361435
}
14371436

14381437
static ssize_t ati_mode_store(struct device *dev,
@@ -1465,7 +1464,7 @@ static ssize_t ati_base_show(struct device *dev,
14651464
if (error)
14661465
return error;
14671466

1468-
return scnprintf(buf, PAGE_SIZE, "%u\n", val);
1467+
return sysfs_emit(buf, "%u\n", val);
14691468
}
14701469

14711470
static ssize_t ati_base_store(struct device *dev,
@@ -1498,7 +1497,7 @@ static ssize_t ati_target_show(struct device *dev,
14981497
if (error)
14991498
return error;
15001499

1501-
return scnprintf(buf, PAGE_SIZE, "%u\n", val);
1500+
return sysfs_emit(buf, "%u\n", val);
15021501
}
15031502

15041503
static ssize_t ati_target_store(struct device *dev,
@@ -1525,9 +1524,9 @@ static ssize_t ati_trigger_show(struct device *dev,
15251524
{
15261525
struct iqs269_private *iqs269 = dev_get_drvdata(dev);
15271526

1528-
return scnprintf(buf, PAGE_SIZE, "%u\n",
1529-
iqs269->ati_current &&
1530-
completion_done(&iqs269->ati_done));
1527+
return sysfs_emit(buf, "%u\n",
1528+
iqs269->ati_current &&
1529+
completion_done(&iqs269->ati_done));
15311530
}
15321531

15331532
static ssize_t ati_trigger_store(struct device *dev,

0 commit comments

Comments
 (0)