Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4310563rwb; Tue, 8 Nov 2022 15:24:18 -0800 (PST) X-Google-Smtp-Source: AMsMyM6V+XXr4yvhhsMbNlSih+fOze1e5dgJcDK+o8B8BUxf7LcYTJN9fkdhzmF2KQi7pSnYrhEh X-Received: by 2002:a05:6402:50d4:b0:461:e349:56b2 with SMTP id h20-20020a05640250d400b00461e34956b2mr59112290edb.17.1667949858112; Tue, 08 Nov 2022 15:24:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667949858; cv=none; d=google.com; s=arc-20160816; b=B6zl602i7AEi0zEYjEIGDwa/TVUXizgC/Eat22xy5TddRyM3Hwk1gZGvQHOOs5zoT8 fdioO6aJyjr120OCP6NQ+0pzDUpiCQPaimCIIqDD/PXk/hbor/h5KQ7xFYcBf+WTzgQR s+E2jlhsOWHaM5Apa3oa38wVBpYwHjPnDwg+XNWxsI7xTRfILIP2b1c1ubK/FF7/+qv8 nKUefhnt12bo5wqQfExfO+sdNY3I6bjKppPQw6jNgxKeA6MohCLoVu3K1SEprO0oJPIE gaylCXk13iAAVOdOKbywYhqIubYhlt0WqKvgM4JVmTdlMvnkgtIMg/RXbUs6sU9xuxZe LbRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:to:from:date; bh=ulczSCiKyYKYeEYWVUdvnRHWt1pChHSadOU6tR5w8FA=; b=kpvD3lreSZjI5O1EbJL5i5Vjyq/IIEWzF8bb5f6ayK/TC6oV4nLiT4yXpfU345encQ a7K5KoGcxtA3V/60en4AK8ch5cIOOyap7DvVlc/BAFCCiPqHW0o5N0D/wA6IfNmq+7AS nMkE0y2G6Ar4dbFEi079QCC8ptxV3RriKWyqtMJgXYs7sJ+6yUbu3/w0GrA3iQB28Skx J5iiF10U7l0WHN8swEgO0HvToIewk9QPugz/kstLECP2AbzKhKaAtuCTPnTDj6YVBmNU f6BcbrhzfjwdGuCLY3UaRmnF1khXeHVs4333uZW03Wp3gIMjSQRDftrHYgwzMKVquxsD TqGA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o3-20020aa7c503000000b004617551556csi11744607edq.128.2022.11.08.15.23.55; Tue, 08 Nov 2022 15:24:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229626AbiKHXF6 (ORCPT + 92 others); Tue, 8 Nov 2022 18:05:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230036AbiKHXFs (ORCPT ); Tue, 8 Nov 2022 18:05:48 -0500 Received: from fudo.makrotopia.org (fudo.makrotopia.org [IPv6:2a07:2ec0:3002::71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 558CF657D9; Tue, 8 Nov 2022 15:05:47 -0800 (PST) Received: from local by fudo.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.94.2) (envelope-from ) id 1osXex-0005vp-Nv; Wed, 09 Nov 2022 00:05:35 +0100 Date: Tue, 8 Nov 2022 23:04:13 +0000 From: Daniel Golle To: Jens Axboe , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Davidlohr Bueso , Matthew Wilcox , "Martin K. Petersen" , Chaitanya Kulkarni , Daniel Golle , Ming Lei , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-efi@vger.kernel.org Subject: [PATCH v4 4/5] mtd_blkdevs: add option to enable scanning for partitions Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add Kconfig boolean CONFIG_MTD_BLOCK_PARTITIONS and enable block partition parsers on non-NAND mtdblock devices in case it is selected. Signed-off-by: Daniel Golle Acked-by: Miquel Raynal --- drivers/mtd/Kconfig | 11 +++++++++++ drivers/mtd/mtd_blkdevs.c | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig index 796a2eccbef0..12874dec1569 100644 --- a/drivers/mtd/Kconfig +++ b/drivers/mtd/Kconfig @@ -69,6 +69,17 @@ config MTD_BLOCK_RO You do not need this option for use with the DiskOnChip devices. For those, enable NFTL support (CONFIG_NFTL) instead. +config MTD_BLOCK_PARTITIONS + bool "Scan for partitions on MTD block devices" + depends on MTD_BLOCK || MTD_BLOCK_RO + default y if FIT_PARTITION + help + Scan MTD block devices for partitions (ie. MBR, GPT, uImage.FIT, ...). + (NAND devices are omitted, ubiblock should be used instead when) + + Unless your MTD partitions contain sub-partitions mapped using a + partition table, say no. + comment "Note that in some cases UBI block is preferred. See MTD_UBI_BLOCK." depends on MTD_BLOCK || MTD_BLOCK_RO diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index 60b222799871..e6f2e0888246 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c @@ -359,7 +359,9 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) } else { snprintf(gd->disk_name, sizeof(gd->disk_name), "%s%d", tr->name, new->devnum); - gd->flags |= GENHD_FL_NO_PART; + + if (!IS_ENABLED(CONFIG_MTD_BLOCK_PARTITIONS) || mtd_type_is_nand(new->mtd)) + gd->flags |= GENHD_FL_NO_PART; } set_capacity(gd, ((u64)new->size * tr->blksize) >> 9); -- 2.38.1