[PATCH 1/5] drivers/mtd: mtd_is_partition can be boolean
From: Yaowei Bai
Date: Thu Mar 24 2016 - 22:42:24 EST
This patch makes mtd_is_partition return bool to improve
readability due to this particular function only using either
one or zero as its return value.
No functional change.
Signed-off-by: Yaowei Bai <baiyaowei@xxxxxxxxxxxxxxxxxxxx>
---
drivers/mtd/mtdpart.c | 6 +++---
include/linux/mtd/partitions.h | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 10bf304..1aae1f4 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -829,15 +829,15 @@ void mtd_part_parser_cleanup(struct mtd_partitions *parts)
}
}
-int mtd_is_partition(const struct mtd_info *mtd)
+bool mtd_is_partition(const struct mtd_info *mtd)
{
struct mtd_part *part;
- int ispart = 0;
+ bool ispart = false;
mutex_lock(&mtd_partitions_mutex);
list_for_each_entry(part, &mtd_partitions, list)
if (&part->mtd == mtd) {
- ispart = 1;
+ ispart = true;
break;
}
mutex_unlock(&mtd_partitions_mutex);
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index 70736e1..042f3be 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -96,7 +96,7 @@ extern void deregister_mtd_parser(struct mtd_part_parser *parser);
module_driver(__mtd_part_parser, register_mtd_parser, \
deregister_mtd_parser)
-int mtd_is_partition(const struct mtd_info *mtd);
+bool mtd_is_partition(const struct mtd_info *mtd);
int mtd_add_partition(struct mtd_info *master, const char *name,
long long offset, long long length);
int mtd_del_partition(struct mtd_info *master, int partno);
--
1.9.1