Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7138725rwr; Tue, 2 May 2023 10:00:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Lc6ny2Nyf/F+K83Dah0X//C72dPfMHk3B/PJXmUQdTR8z4ZfdrSTVNbD3ZVSfno8k3SxT X-Received: by 2002:a05:6a00:23cc:b0:640:f519:e1cc with SMTP id g12-20020a056a0023cc00b00640f519e1ccmr26390009pfc.34.1683046807077; Tue, 02 May 2023 10:00:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683046807; cv=none; d=google.com; s=arc-20160816; b=xCL3gJqakGWK4sDVz74kG6fIPllIGWLwQXgt4l/odl4sdkyT06rGcOgtKafqloXOE7 RdKJJZe/2GJDBQ6Oi0dnaXzAq8fxzbe59BpiHdp0giVTcqF4GiqF2Wnk55RmmO8ZGyOj x4K15ObClWU+wFeQ62JOqIaj4FlqhFJxvd5DoyGtX5eDGqxccwcvMI117TWXIMJWv9AT C7r265IsZAO8OecgIls0THBqDj5lGbVgdWwDKpzyW7x8JhTucUAbsKJaHrsKn/KzlmMj ue5ZYYHLEsf8DqY99FItSamF3QQfu2Yf+MD5JcaWkbBk3GeUD9dMqj5o+Dj7KNd4DxZX LCQQ== 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=cJfaZQG8hBrJtDhajAlvORrz26NEG9fDeDDmZDb2uKw=; b=QrPdqwcI+xdrSCOVQ4dBxQ3ypNQfXTWbpPG441ZSaZNIIIG83yPfl7wc9gTmaGm6O1 WzRfmaIBur1RlT44BAd19ASc8Zp1hmKThoO7/ize5mYOozOe2FJeTj9xjjs8BjRuaI3K Jv0XbuSD9fjou0i6ZdsSOVpnpLB/6TtYtJREoGtNyppuqqRanOX4qd6MknkZ8wR5pT3K BCyeaIDPZtQmSiCGpCgLwMPxVPIgQJAleEis2rBz5VSuH4d2NWu+caNO+ZiOuswIbooM if5KFXyqsTjyPZdeOz3KV7gZ6CHBgEQwqm+I52YxWZG4p9Wya5jYEQh2YOUNK1HFLBDb pN2w== 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 79-20020a630252000000b005287c9c425csi11349536pgc.407.2023.05.02.09.59.54; Tue, 02 May 2023 10:00:07 -0700 (PDT) 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 S234289AbjEBQsN (ORCPT + 99 others); Tue, 2 May 2023 12:48:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233724AbjEBQsL (ORCPT ); Tue, 2 May 2023 12:48:11 -0400 Received: from fudo.makrotopia.org (fudo.makrotopia.org [IPv6:2a07:2ec0:3002::71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F8CD1992; Tue, 2 May 2023 09:48:09 -0700 (PDT) Received: from local by fudo.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1pttAS-0000UL-0r; Tue, 02 May 2023 18:47:56 +0200 Date: Tue, 2 May 2023 17:47:48 +0100 From: Daniel Golle To: linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Zhihao Cheng , =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH 0/4] mtd: ubi: behave like a good MTD citizen 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,T_SCC_BODY_TEXT_LINE 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 As of now one can easily trigger the existence of "ghost" UBI devices or even worse by removing e.g. the SPI bus driver which previously provided access to an SPI-NAND chip. Make UBI behave more like other MTD users and create/remove UBI devices based on MTD notifications. As removing could previously fail in case of an ubiblock device still being in use, make sure there are no excuses preventing release of an already gone MTD partition. This makes it possible to attach UBI devices immediately after the MTD partition becomes available, which will allow using UBI volumes as nvmem-cells provider in the future [1]. Introduce new device tree compatible "linux,ubi" to be used on MTD partitions which should be attached. In order to make sure ubiblock devices are still created according to the module or kernel parameters, let ubiblock creation from parameters be triggered by UBI_VOLUME_ADDED notifications instead of trying only once during boot. [1]: https://forum.openwrt.org/t/asus-tuf-ax4200-support/155738/44?u=daniel Daniel Golle (4): mtd: ubi: block: don't return on error when removing mtd: ubi: block: use notifier to create ubiblock from parameter dt-bindings: mtd: partitions: add linux,ubi mtd: ubi: attach MTD partition from device-tree .../bindings/mtd/partitions/ubi.yaml | 49 +++++ drivers/mtd/ubi/block.c | 158 ++++++++------- drivers/mtd/ubi/build.c | 189 ++++++++++++------ drivers/mtd/ubi/cdev.c | 4 +- drivers/mtd/ubi/ubi.h | 6 +- 5 files changed, 271 insertions(+), 135 deletions(-) create mode 100644 Documentation/devicetree/bindings/mtd/partitions/ubi.yaml base-commit: b5fda08ef213352ac2df7447611eb4d383cce929 -- 2.40.1