mm/damon/sysfs: use enum for 'state' input handling
authorSeongJae Park <sj@kernel.org>
Tue, 10 May 2022 01:20:55 +0000 (18:20 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 13 May 2022 14:20:08 +0000 (07:20 -0700)
commit3cbab4ca1ea8752912d8719d72059869b4c18045
tree810bed6b77a475f67f665b7549adab80ba8dee25
parent97d482f4592fde2322c319f07bc54f3a0d37861c
mm/damon/sysfs: use enum for 'state' input handling

DAMON sysfs 'state' file handling code is using string literals in both
'state_show()' and 'state_store()'.  This makes the code error prone and
inflexible for future extensions.

To improve the situation, this commit defines possible input strings and
'enum' for identifying each input keyword only once, and refactors the
code to reuse those.

Link: https://lkml.kernel.org/r/20220429160606.127307-10-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/damon/sysfs.c