Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4329231rwb; Tue, 8 Nov 2022 15:43:02 -0800 (PST) X-Google-Smtp-Source: AMsMyM5z4Wx0Qsa/4lzTP9VmoC0/CrCyaWa3LP3lheBvDNPGu/FFG9GtPZ1jFLBSG3IUmIHmQrYA X-Received: by 2002:a17:902:ceca:b0:187:12cc:d6a1 with SMTP id d10-20020a170902ceca00b0018712ccd6a1mr53496571plg.162.1667950982069; Tue, 08 Nov 2022 15:43:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667950982; cv=none; d=google.com; s=arc-20160816; b=t+sfVD61+lTlnrwO0+tTobzM4POK5Wn1uOKSZbLByR1lVLka6+rcy5q9Tcd/niVzin lQkzhCsZUqEbVusQNS0qBIMPJpWC7nuaNs2v2yJJgap5dN2Us1jxfoGrL1G6BGEjSl2z 0KYJNOeRq84U1b27fgd+Cfnlg/gwWoT1FkoSYMBlpLb/UUJlk5wd14XCV1YE0Mr//E5H fYYYq45c+EzZq9TSvuBqu1EJG2z09ZwimVX6L+yIihiCZ6cHIT5FA2trUPf9Pr9mE2pL hxbf8ZRzVuRctif/PEp26KrWxuZqcrTBABJuy5XrSXnW9NivXZjaEG8tZ8DhdXYRI+26 8feg== 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=JMh8J/oFNoRdEnWHwUoV5ShUmqG5pbux0mW3rqhQ82s=; b=GwgK/qanyJqhevYNnaGCB51BnpZuXjaVD0FZO7tJAFnW0ZSlXwwLPVvv13HoIYxrlF Jj8C3Iox1ETSNffSlt/xh0NTVQIiyA82zzfq6alKTZRyzs7ZzbX8+Fm5tc8SWu/y/J5x WtALdNpOTlnwlXdwalNLGqaE5c7Z8BJEP50z7HM4cdqNA8QcVbs2q8bQwZNY6wDb09jG 3pr5B5009VYWAQ3M1Gm/78eXF7JVIruhVWYPI+vgaSpAx4XGiyoQhvq34fCzoIDVP6yL ZuzftQ043JQ0KtV700/xnrDZspKYlrb15ZrHY9YoUxsQ63CZmyLKv/heYjaG1pmSbMD2 UxfA== 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 oa10-20020a17090b1bca00b00214021e87d1si21711879pjb.173.2022.11.08.15.42.49; Tue, 08 Nov 2022 15:43:02 -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 S229751AbiKHXGL (ORCPT + 92 others); Tue, 8 Nov 2022 18:06:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229552AbiKHXGK (ORCPT ); Tue, 8 Nov 2022 18:06:10 -0500 Received: from fudo.makrotopia.org (fudo.makrotopia.org [IPv6:2a07:2ec0:3002::71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 952E463159; Tue, 8 Nov 2022 15:06:09 -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 1osXfK-0005wb-6u; Wed, 09 Nov 2022 00:05:58 +0100 Date: Tue, 8 Nov 2022 23:04:35 +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 5/5] mtd: ubi: block: 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 option CONFIG_MTD_UBI_BLOCK_PARTITIONS and enable block partition parsers on ubiblock devices in case it is selected. Signed-off-by: Daniel Golle --- drivers/mtd/ubi/Kconfig | 10 ++++++++++ drivers/mtd/ubi/block.c | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/ubi/Kconfig b/drivers/mtd/ubi/Kconfig index 2ed77b7b3fcb..491330e42ab2 100644 --- a/drivers/mtd/ubi/Kconfig +++ b/drivers/mtd/ubi/Kconfig @@ -104,4 +104,14 @@ config MTD_UBI_BLOCK If in doubt, say "N". +config MTD_UBI_BLOCK_PARTITIONS + bool "Scan UBI block devices for partitions" + default y if FIT_PARTITION + depends on MTD_UBI_BLOCK + help + Scan UBI block devices for partitions (ie. MBR, GPT, uImage.FIT, ...). + + Unless your UBI volumes contain sub-partitions mapped using a partition + table, say no. + endif # MTD_UBI diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c index 75eaecc8639f..d9baa99ca093 100644 --- a/drivers/mtd/ubi/block.c +++ b/drivers/mtd/ubi/block.c @@ -430,7 +430,10 @@ int ubiblock_create(struct ubi_volume_info *vi) ret = -ENODEV; goto out_cleanup_disk; } - gd->flags |= GENHD_FL_NO_PART; + + if (!IS_ENABLED(CONFIG_MTD_UBI_BLOCK_PARTITIONS)) + gd->flags |= GENHD_FL_NO_PART; + gd->private_data = dev; sprintf(gd->disk_name, "ubiblock%d_%d", dev->ubi_num, dev->vol_id); set_capacity(gd, disk_capacity); -- 2.38.1