Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752883AbcCYCmU (ORCPT ); Thu, 24 Mar 2016 22:42:20 -0400 Received: from cmccmta2.chinamobile.com ([221.176.66.80]:2878 "EHLO cmccmta2.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751862AbcCYCmT (ORCPT ); Thu, 24 Mar 2016 22:42:19 -0400 X-RM-TRANSID: 2ee756f4a5861ed-d051d X-RM-SPAM-FLAG: 00000000 X-RM-TRANSID: 2eea56f4a585ebc-fd1f7 From: Yaowei Bai To: dwmw2@infradead.org, computersforpeace@gmail.com, richard@nod.at, boris.brezillon@free-electrons.com Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, baiyaowei@cmss.chinamobile.com Subject: [PATCH 1/5] drivers/mtd: mtd_is_partition can be boolean Date: Fri, 25 Mar 2016 10:41:51 +0800 Message-Id: <1458873715-3670-2-git-send-email-baiyaowei@cmss.chinamobile.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1458873715-3670-1-git-send-email-baiyaowei@cmss.chinamobile.com> References: <1458873715-3670-1-git-send-email-baiyaowei@cmss.chinamobile.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1631 Lines: 52 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 --- 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