kobject: Add helper kobj_ns_type_is_valid()
authorZhen Lei <thunder.leizhen@huawei.com>
Wed, 26 Jul 2023 06:25:08 +0000 (14:25 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Aug 2023 06:31:41 +0000 (08:31 +0200)
commite2dfa1d5223cdfa7b832a582de0b7504eaf7ae22
tree38da1624732c3ea890f7910cc0d8fe3e49e8ddb7
parentf429378a9bf84d79a7e2cae05d2e3384cf7d68ba
kobject: Add helper kobj_ns_type_is_valid()

There are too many "(type > KOBJ_NS_TYPE_NONE) && (type < KOBJ_NS_TYPES)"
and "(type <= KOBJ_NS_TYPE_NONE) || (type >= KOBJ_NS_TYPES)", add helper
kobj_ns_type_is_valid() to eliminate duplicate code and improve
readability.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Link: https://lore.kernel.org/r/20230726062508.950-1-thunder.leizhen@huaweicloud.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
lib/kobject.c