From nobody Wed Sep 17 06:42:28 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F29F6C001B2 for ; Thu, 22 Dec 2022 19:34:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235794AbiLVTe2 (ORCPT ); Thu, 22 Dec 2022 14:34:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235852AbiLVTeE (ORCPT ); Thu, 22 Dec 2022 14:34:04 -0500 Received: from fudo.makrotopia.org (fudo.makrotopia.org [IPv6:2a07:2ec0:3002::71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEC4227CD4 for ; Thu, 22 Dec 2022 11:33:38 -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-0004VD-2o; Thu, 22 Dec 2022 20:33:37 +0100 Date: Thu, 22 Dec 2022 19:33:31 +0000 From: Daniel Golle To: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Vignesh Raghavendra , Miquel Raynal , Richard Weinberger Subject: [PATCH 2/2] mtd: ubi: block: wire-up device parent Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ubiblock devices were previously only identifyable by their name, but not connected to their parent UBI volume device e.g. in sysfs. Properly parent ubiblock device as descendant of a UBI volume device to reflect device model hierachy. Signed-off-by: Daniel Golle --- drivers/mtd/ubi/block.c | 2 +- drivers/mtd/ubi/kapi.c | 1 + include/linux/mtd/ubi.h | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c index d725215ae66e5..e99b29ba48dc4 100644 --- a/drivers/mtd/ubi/block.c +++ b/drivers/mtd/ubi/block.c @@ -455,7 +455,7 @@ int ubiblock_create(struct ubi_volume_info *vi) list_add_tail(&dev->list, &ubiblock_devices); =20 /* Must be the last step: anyone can call file ops from now on */ - ret =3D add_disk(dev->gd); + ret =3D device_add_disk(vi->dev, dev->gd, NULL); if (ret) goto out_destroy_wq; =20 diff --git a/drivers/mtd/ubi/kapi.c b/drivers/mtd/ubi/kapi.c index 0fce99ff29b58..5db653eacbd45 100644 --- a/drivers/mtd/ubi/kapi.c +++ b/drivers/mtd/ubi/kapi.c @@ -79,6 +79,7 @@ void ubi_do_get_volume_info(struct ubi_device *ubi, struc= t ubi_volume *vol, vi->name_len =3D vol->name_len; vi->name =3D vol->name; vi->cdev =3D vol->cdev.dev; + vi->dev =3D &vol->dev; } =20 /** diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h index 7d48ea368c5e5..a529347fd75b2 100644 --- a/include/linux/mtd/ubi.h +++ b/include/linux/mtd/ubi.h @@ -110,6 +110,7 @@ struct ubi_volume_info { int name_len; const char *name; dev_t cdev; + struct device *dev; }; =20 /** --=20 2.39.0