From patchwork Tue Nov 8 23:04:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 17268 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp26211wru; Tue, 8 Nov 2022 15:09:57 -0800 (PST) X-Google-Smtp-Source: AMsMyM5k2P6++dGSLxAOd8NvK+sy/PX13tsCWBBJh4pNnVGkJQH5CuaOeYleBoKJW6beTUqfmTKs X-Received: by 2002:a17:90a:c56:b0:213:d200:e958 with SMTP id u22-20020a17090a0c5600b00213d200e958mr53431308pje.6.1667948996833; Tue, 08 Nov 2022 15:09:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667948996; cv=none; d=google.com; s=arc-20160816; b=cOLoOfx/ato7y2MB/X36gQm1rDKWLgtTbwq1wbFh4Bq0wss1VfRWcaHEeIUe9bPBK3 3nu+0oQ8xYSLlgpe1Kijq/roBR4apM89fit/e3vMQLxwl/i5T/HnUm6AHH3btWo4mIu0 vE7WTn0TIZFK66L0cXph9Bw6DAP4Ug4pPfmfh9005rI5o3Kq5fPhuaS6wrGty/SEp3HJ SfeujD/ZHIENwawvEkrRsk1KPeCSKEbueLcVpO7/FTDfRiDS0uj5D8aG+4aPKWVOkAQn 5vTixhzIjJwK/w2nXh/i6lTgFquanNxLXHMspBfJ9lfP5Qf9vQm0ImjS1lX/Vqa0B5EC MjCQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j8-20020a170902da8800b0017680ae3a9csi18449858plx.534.2022.11.08.15.09.42; Tue, 08 Nov 2022 15:09:56 -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 + 99 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-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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748971287470924814?= X-GMAIL-MSGID: =?utf-8?q?1748971287470924814?= 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);