platform/x86: asus-laptop: get rid of parse_arg()
authorGiedrius Statkevičius <giedrius.statkevicius@gmail.com>
Fri, 5 Aug 2016 20:57:10 +0000 (23:57 +0300)
committerDarren Hart <dvhart@linux.intel.com>
Fri, 23 Sep 2016 23:20:44 +0000 (16:20 -0700)
commit6f7e357bf181b5a9da9daffcd40a64ee516a29e4
tree93d340676406f8ec1ae46d0b205d2be5d22b8166
parent999d4376c62828b260fbb59d5ab6bc28918ca448
platform/x86: asus-laptop: get rid of parse_arg()

parse_arg() duplicates the funcionality of kstrtoint() so use the latter
function instead. There is no funcionality change except that in the
case of input being too big -ERANGE will be returned instead of -EINVAL
which is not bad because -ERANGE makes more sense here. The check for
!count is already done by the sysfs core so no need to duplicate it
again. Also, add some minor corrections to error handling to accommodate
the change in return values (parse_arg returned count if everything
succeeded whereas kstrtoint returns 0 in the same situation)

As a result of this patch asus-laptop.ko size is reduced by almost 1%:
add/remove: 0/1 grow/shrink: 1/6 up/down: 1/-149 (-148)
function                                     old     new   delta
__UNIQUE_ID_vermagic0                         69      70      +1
ls_switch_store                              133     117     -16
ledd_store                                   175     159     -16
display_store                                157     141     -16
ls_level_store                               193     176     -17
gps_store                                    200     178     -22
sysfs_acpi_set.isra                          148     125     -23
parse_arg.part                                39       -     -39
Total: Before=19160, After=19012, chg -0.77%

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
drivers/platform/x86/asus-laptop.c