From patchwork Thu Dec 22 19:33:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 35926 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp128233wrn; Thu, 22 Dec 2022 11:34:10 -0800 (PST) X-Google-Smtp-Source: AMrXdXt7MKhxoOFX19ZQ8Rv92e5dG2qYhYFH1wS//Fdw3kbbFkEt107kG0vrAXgzWnpz1HhETZ1a X-Received: by 2002:a05:6a20:2a89:b0:9d:efbe:a0f3 with SMTP id v9-20020a056a202a8900b0009defbea0f3mr11016161pzh.3.1671737650585; Thu, 22 Dec 2022 11:34:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671737650; cv=none; d=google.com; s=arc-20160816; b=KfDz0oJL0Fx5lPkVO58NG9LCpG/F2nWaR25yE21j1zzXYHnEE2+SY7Gcq8G3d8brn+ DRAYNbyV2TJ/X2Rrb23fBaiLxEammchDCEtty3oM6eFTao4PlLbvOTv8nFl0igVgIx6M tIbpxQ6Zb1UeFsQ8efMoQ5nroQAdv9Y6NJqrH6n6L0tvH5vXwioeub/ne1ZZxkFYFdOZ /MggOokdkKUyBz7fY2rveNdYAj0ZaLKftmg7iMS4aBc19it5QWedP74o95jG2qcEXVDM mnXYYgp2SoO4P6fUjlCoG0xmNTuKoW5oyzFmtDN1cf6DppvG0Yckemk1mfzh5COS1f9R 3iNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:to:from:date; bh=0Sh+0g42NY1/kWiXwL9IJJ1FKCg7/iqRCYY/oCwKlT4=; b=ELilCuvu3NJi8oroxcSOsRCo2PjNNwjlaLNWK3KacdyfT4RiJQf2A3hzwprte6SF9X HNsij1WmX+DrgAr3ueYP4ASh1lElLZ6aqX/HeXWoBAfFrtIk/058NeimjUbjUy40nIkf +le936PVwd71AUnNHH0o8yQmT4myUpHbUnvfJfGICVxc56F+HyrAYKOhs4E3jEFln4cO dZgSeVohtRXv44PchTjt0O9xvjdTPzpdBYsRl86ZU1CfOpb8JzxkvK+bSDmy6Rp6FUXo qW8j5dB+75JtkPvhKARMN7JnYywLazWZqxHb1/Th2L8Gcc/mSMoJIfwP5DXbfRH0n5i8 AbJA== 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 t191-20020a6381c8000000b00484b1102325si1581091pgd.291.2022.12.22.11.33.58; Thu, 22 Dec 2022 11:34:10 -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 S235201AbiLVTdZ (ORCPT + 99 others); Thu, 22 Dec 2022 14:33:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235658AbiLVTdM (ORCPT ); Thu, 22 Dec 2022 14:33:12 -0500 Received: from fudo.makrotopia.org (fudo.makrotopia.org [IPv6:2a07:2ec0:3002::71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A87E17E1D for ; Thu, 22 Dec 2022 11:33:11 -0800 (PST) Received: from local by fudo.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1p8RJW-0004V0-0C; Thu, 22 Dec 2022 20:33:10 +0100 Date: Thu, 22 Dec 2022 19:33:04 +0000 From: Daniel Golle To: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Vignesh Raghavendra , Miquel Raynal , Richard Weinberger Subject: [PATCH 1/2] mtd: ubi: wire-up parent MTD device Message-ID: <39de7617513dfae3a0183b74aac119fbdc5141e9.1671737443.git.daniel@makrotopia.org> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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?1752943978502966402?= X-GMAIL-MSGID: =?utf-8?q?1752943978502966402?= Wire up the device parent pointer of UBI devices to their lower MTD device, typically an MTD partition or whole-chip device. The most noticeable change is that in sysfs, previously ubi devices would be could in /sys/devices/virtual/ubi while after this change they would be correctly attached to their parent MTD device, e.g. /sys/devices/platform/1100d000.spi/spi_master/spi1/spi1.0/mtd/mtd2/ubi0. Locating UBI devices using /sys/class/ubi/ of course still works as well. Signed-off-by: Daniel Golle --- drivers/mtd/ubi/build.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 5e90a4423b699..0904eb40c95fa 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -915,6 +915,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, ubi->dev.release = dev_release; ubi->dev.class = &ubi_class; ubi->dev.groups = ubi_dev_groups; + ubi->dev.parent = &mtd->dev; ubi->mtd = mtd; ubi->ubi_num = ubi_num;