From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796133934; b=XB8Tt4vAodiRMB8TTvJU899UA0V0wjxTEdj4m3vwvV8sid8kjt1AAKWZEntdzzi1lWIR KLpcliOmm5RceDAdBtI5Q+kYvXwzqx1DGJGaQII7W3mpzUpcMxB7cMNn4jSscQaIk+fFq s8F9K+d8c3VJQUCE6AB4jzuSq/iQg4tNAhl8DbaG3oRvnkLvrS1nVoB7XbjCmxbWFtRJk SBY9WTogOCD15ld9JK99JD7DSCQh5/yTu6Kmujcx3MqXXWcCPvFhHO4LlIVTZ94wnRib7 tL+gVONT0YNghF+vTEqiF8KaaO6DuUbpdWVCvZhs+YN/gMd5If7WuC5oPdCl7f+FWPA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796133934; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:X-Received:Received:From:Date: Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer:X-Authority-Analysis: X-Proofpoint-Spam-Info:X-Proofpoint-GUID:X-Proofpoint-ORIG-GUID: X-Proofpoint-Spam-Details-Enc:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=q2LLXgfqwD+xrLJorPVwTBLDULLlABEy70l/ShybkrI=; b=o1k88Zu3s807ijXb6YzSP1DtmQ+RrKCflSTWwnOlvNFLdj+l2Ca48lZhUpuDzs1Ix1Vk RrFcdJonfqaEI2bEexqlFYlmPIRM9HUJ1mBlOaV5gMeFfDP2N5P6yv88yYVAt75XmNCj+ ck5HFxxBlgyQEhiMBMHmE1ViSA8BvvC/MnnVwvEGHV20871RwW3AfAwtjSa9FxhVGii55 NmdCbOFJ+GmcpoiGRw0FEdpzal+xcCXg5TCi/BKinwPEmgUTiCwJ5w8yzi7uam1/dTXr6 IrXCVSwPI5cACvwBakFZrqTIMSyTVDqHr9J1yBOVsXo+EULnR4M3c8WPVFYXdyMTiYw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=ecXSdaIT; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=Z17FLkwk; arc=none smtp.remote-ip=205.220.168.131 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A9646606A69C for ; Tue, 1 Dec 2026 14:05:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A9646606A69C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=ecXSdaIT; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=Z17FLkwk Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B1D1qlC1723028 for ; Tue, 1 Dec 2026 14:05:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= q2LLXgfqwD+xrLJorPVwTBLDULLlABEy70l/ShybkrI=; b=ecXSdaITtII9IvKm pD9JJtr13+Oy0FpaOG9CodFHCguIWYhi9rskDdOFTjzVahOm/YKqX64xL6RHythD WgRC+hsFns7JMH4XGJAS9GkihnIU38YFCD/7cirI+20kXSYBBa0ZJKpyxjNAmVXc KiAeOvM2r/SsUIRensh8I+54hdlmDaXz1YSSDUAjHUQLtgNdafo6ylqoR8uvtq+m yahO6qb0tvL+Sac9K/+OqtNn0hcR7wqSpkSNwKmoefHv43N6XGiVnaWwYaaBOI8p xpdPdmVqHzNaCMcy1aFQ83VfNDvSXub1GiwyU58HP9pE63sDTlAKjNpViUA0eT7T Mv7IEw== Received: from mail-yx1-f69.google.com (mail-yx1-f69.google.com [74.125.224.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j9gnbkmnp-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 01 Dec 2026 14:05:32 +0000 (GMT) Received: by mail-yx1-f69.google.com with SMTP id 956f58d0204a3-67dc4e966b5so11056236d50.0 for ; Tue, 01 Dec 2026 06:05:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796133932; x=1796738732; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=q2LLXgfqwD+xrLJorPVwTBLDULLlABEy70l/ShybkrI=; b=Z17FLkwkPFVNxGy7hNJgRStEtKjABn1s9Gqcp2BFI9rLpH9rN0Ndidc9+4uvkXpRCz D34kAz8tLxQVGjDfhbiGqF6gNPGW9MunPRgQ3MvpknUj/uZ5Mz7JKRDha51LlUyKdRI/ u8blA+Vhaqn+iBCNbgWIPqNSUtIIf1Smc8QxzIt74mvXPVcHheIRdWg9k6kGq33oFiv0 yvVVeFcdBcafjqbH/Y1DeJbVl0Ox4+5al8E1FEtWlt/CaHehvyPkBsGae/2CzoNRL6RP Qd1t9hg4Na5PFdqDQIxRINTJzuxyvbWd6Gb1P3Ud0mIVgCSrBqefqDY3SPJvYT1A8Rgm 67WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796133932; x=1796738732; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=q2LLXgfqwD+xrLJorPVwTBLDULLlABEy70l/ShybkrI=; b=wiEOndM/3RHbg5bs6DYxK6SHJN+V71lrrxz9ECtWbEuaD8pNZyoJ3kqSLgWmEjT3cP mavjxZDMatFDft9cRKjBbCKg6unECHBZniC72ND7R/YfeusXf1jdCNlk1s18LkwN62DZ fHV+UZgn4ADxrZYLdOG/7PMIzTuu0y5tdCV3JLWkm5CzF9sHPKrFBQ4fUqDSySUMxEId AsnVtebfwxvwwdv1NzP/3H4DScJ103wmd3GB/moLkngI8C1OxQDYXywvZRKy0jih0quc pIQiCKRZJPPwfrXG0s2Y0byrAdyPTOI9tlL6NdX8GjVl2D2zLTOkoGLFXzEyVN17kxDH FX7A== X-Forwarded-Encrypted: i=1; AL+hErEuIRYaXR2W2D9v9yJy+pi6J4D6QnwEfN5lT2c3buQ/Vu3efwTKIN5nHwBuFAss4Rf5OEUbNDU8VWyqNJU=@vger.kernel.org X-Gm-Message-State: APuU4Z8F3w0P5O73xdaN5sdglWhUruibOF1kVvAJ+dgLb3qDfMWmvzQh A/it9U/SUTnElWWdizF3ZXqac/usFKZ0FP0jeiEMuvWhqKC0ZX9MvMXvBe7kE1WYLyt2ZAnsApE PaCsXPArKgtbbeV52+BENdgG5XLQ541XQke8k1yp0aPfZ9bF0nbtrvTJZ0lTtPVPG++c= X-Gm-Gg: AZFdTZfO5jydVyzGqYQ8I2nWYXFWSdc1og1/GO2netoNHaDVjI8U/Knbga+Lg1JpVJG Sv8l+kf/WU472DqM7Pz121WTM6nP1u9ElJ/BbbiaeZIz5DjhY/ofhaXJ7+3S/bs8MgvsH916awK h5hJOcs0XBxfHIAshV2E4N38brgakbvUyQoQh93zoiNA8LzxwhgOTyM0tm2OYVejiY3UZj9aod4 qncYMG/oPTCi0NZ9qvnJme+nu1am0NoFyWHoYgdH7Ne6OSkqbgLCCALsLWfYpRJBAnKFhyvpAXP JFAYBBE/FP2/ZlmHQ7nfjgjGEKHcnhMrtvL2E1wYfyYFVaMEa0i/kyf63SOIkpPUMQzLONd62ng jERLfdIZhm5bsrwlhrVwds8dSEs598Kgvqcep+HVBAMfVg0yMNeRxEAdsHZtIyePWhvHJIEsIP5 YclQfRsUX5pHyDeivQV8vVu+0fQknBaQQkUuSyLPQgYz5t8eH0ePn12j/hUxkKTAIpnKf6GmeXL G+CSzB0KW1eF6hKnPkK+dvi+avB X-Received: by 2002:a05:690e:140e:b0:67d:a253:ec51 with SMTP id 956f58d0204a3-67df43ce1f4mr15820616d50.31.1796133931285; Tue, 01 Dec 2026 06:05:31 -0800 (PST) X-Received: by 2002:a05:690e:140e:b0:67d:a253:ec51 with SMTP id 956f58d0204a3-67df43ce1f4mr15820439d50.31.1796133929997; Tue, 01 Dec 2026 06:05:29 -0800 (PST) Received: from QCOM-eG0v1AUPpu.na.qualcomm.com ([2a01:e0a:830:450:2022:3328:5af7:2b49]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bba6a0d65fsm538404065e9.3.2026.12.01.06.05.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 06:05:29 -0800 (PST) From: Loic Poulain Date: Tue, 01 Dec 2026 15:05:24 +0100 Subject: [PATCH v14 1/2] block: partitions: of: Attach partition fwnode to the block device X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261201-block-as-nvmem-v14-1-3a07f4ff246c@oss.qualcomm.com> References: <20261201-block-as-nvmem-v14-0-3a07f4ff246c@oss.qualcomm.com> In-Reply-To: <20261201-block-as-nvmem-v14-0-3a07f4ff246c@oss.qualcomm.com> To: Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio , Jens Axboe , Johannes Berg , Jeff Johnson , Bartosz Golaszewski , Marcel Holtmann , Luiz Augusto von Dentz , Balakrishna Godavarthi , Rocky Liao , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Simon Horman , Srinivas Kandagatla , Andrew Lunn , Heiner Kallweit , Russell King , Saravana Kannan , Christian Marangi , Eric Dumazet , Abel Vesa , Eric Dumazet Cc: linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-block@vger.kernel.org, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org, linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org, daniel@makrotopia.org, Loic Poulain , Bartosz Golaszewski , Christoph Hellwig X-Mailer: b4 0.14.2 X-Authority-Analysis: v=2.4 cv=Y9BtIReN c=1 sm=1 tr=0 ts=6b0ed42d cx=c_pps a=J+5FMm3BkXb42VdG8aMU9w==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=VwQbUJbxAAAA:8 a=_IYX2gaGVZBpxN60pRUA:9 a=QEXdDO2ut3YA:10 a=Epx66wHExT0cjJnnR-oj:22 X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAxMDA1NSBTYWx0ZWRfXxxlg0BDTJv4T ZbfuvvDAo1v9VnN6Fn9SwLIJBKkqUdnPPuidQotawM79+27hINHyQS8bSs0KV5cVQqXeu9iQq10 DyN9Z0Sh31jQ8rAnpaiSr4s6FmH6PLY= X-Proofpoint-GUID: lK8k55OMEPfFWtfBj0d7GchIN9HAPXz2 X-Proofpoint-ORIG-GUID: lK8k55OMEPfFWtfBj0d7GchIN9HAPXz2 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAxMDA1NSBTYWx0ZWRfX0e73HC0Xx/Ei up5goZL9rwXtB2anQW5wDtUpbbwPD65MxFxn7hTcnmHPjPpOJ+AiGTzb588OfchrCVW4L1osi5r mut6O89/5aXkPtK3Uf4Rk+oZvQyKsHH4p3xwGSw4k703WWvVJMqwvQlL7cHyw/cJ3Nx7m6/wWeG 4UWrGk7jHR+6RSuRA/7hW2RYIePSVmk5WotjKH3ly3iVe45sXuwmUQ3GSu8FhzuSUymdbycFRaI BQPTt++CRR2fQHxZf3Cx4mEn65wSu7gfJZKzuY8RvwG0xRBVEtptmsTQ+ICaJR04gc8NJdEaPrv lTG362SRzPqV20p3XUyMY2svYH0Tjn0inrXb9WNH26dhk1mQridE0Ul80DhrMn71vaKOvfU+m4V 3Re/Hf0+0+jF0S3V2UqL/gx190jyg26f7pwXqvWdOtz9LIVaWAjNUmvYynWDzbLyEbVY1Yk0Kgp KSaDX+tGU08GRhhnKyQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-01_02,2026-12-01_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 phishscore=0 adultscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612010055 The OF partition parser reads offset, size and label from each "fixed-partitions" child node but does not associate that node with the resulting partition block device. As a result a partition has no of_node, unlike the whole-disk device which gets its firmware node via add_disk_fwnode(). Carry the partition's device tree node through the parser and attach it to the partition's block device with device_set_node(), mirroring the whole-disk case. This lets consumers describe per-partition properties in the device tree (for example an NVMEM layout on a partition node) and look them up through the partition device. No functional change for existing users, partitions without a matching device tree node simply get a NULL fwnode. Reviewed-by: Bartosz Golaszewski Reviewed-by: Christoph Hellwig Reviewed-by: Ulf Hansson Signed-off-by: Loic Poulain --- block/partitions/check.h | 1 + block/partitions/core.c | 20 +++++++++++++++++--- block/partitions/of.c | 3 +++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/block/partitions/check.h b/block/partitions/check.h index b0997467b61a54a8a621b9c155c8329289649460..326081499d9a6be730dbd659c110449cfa06921f 100644 --- a/block/partitions/check.h +++ b/block/partitions/check.h @@ -17,6 +17,7 @@ struct parsed_partitions { int flags; bool has_info; struct partition_meta_info info; + struct fwnode_handle *fwnode; } *parts; int next; int limit; diff --git a/block/partitions/core.c b/block/partitions/core.c index b5c59b79ca7cbb28d4d93478ee1c80908f76ee9f..eee954df1ac6ef7dd4f02ad5c9d49aed778bf015 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include "check.h" @@ -110,8 +111,17 @@ static struct parsed_partitions *allocate_partitions(struct gendisk *hd) return state; } +static void drop_partitions_fwnodes(struct parsed_partitions *state) +{ + for (int i = 0; i < state->limit; i++) { + fwnode_handle_put(state->parts[i].fwnode); + state->parts[i].fwnode = NULL; + } +} + static void free_partitions(struct parsed_partitions *state) { + drop_partitions_fwnodes(state); vfree(state->parts); kfree(state); } @@ -139,6 +149,7 @@ static struct parsed_partitions *check_partition(struct gendisk *hd) i = res = err = 0; while (!res && check_part[i]) { + drop_partitions_fwnodes(state); memset(state->parts, 0, state->limit * sizeof(state->parts[0])); res = check_part[i++](state); if (res < 0) { @@ -247,6 +258,7 @@ static const struct attribute_group *part_attr_groups[] = { static void part_release(struct device *dev) { + fwnode_handle_put(dev_fwnode(dev)); put_disk(dev_to_bdev(dev)->bd_disk); bdev_drop(dev_to_bdev(dev)); } @@ -294,7 +306,8 @@ static const DEVICE_ATTR(whole_disk, 0444, whole_disk_show, NULL); */ static struct block_device *add_partition(struct gendisk *disk, int partno, sector_t start, sector_t len, int flags, - struct partition_meta_info *info) + struct partition_meta_info *info, + struct fwnode_handle *fwnode) { dev_t devt = MKDEV(0, 0); struct device *ddev = disk_to_dev(disk); @@ -343,6 +356,7 @@ static struct block_device *add_partition(struct gendisk *disk, int partno, pdev->class = &block_class; pdev->type = &part_type; pdev->parent = ddev; + device_set_node(pdev, fwnode_handle_get(fwnode)); /* in consecutive minor range? */ if (bdev_partno(bdev) < disk->minors) { @@ -449,7 +463,7 @@ int bdev_add_partition(struct gendisk *disk, int partno, sector_t start, } part = add_partition(disk, partno, start, length, - ADDPART_FLAG_NONE, NULL); + ADDPART_FLAG_NONE, NULL, NULL); ret = PTR_ERR_OR_ZERO(part); out: mutex_unlock(&disk->open_mutex); @@ -564,7 +578,7 @@ static bool blk_add_partition(struct gendisk *disk, } part = add_partition(disk, p, from, size, state->parts[p].flags, - &state->parts[p].info); + &state->parts[p].info, state->parts[p].fwnode); if (IS_ERR(part)) { if (PTR_ERR(part) != -ENXIO) { printk(KERN_ERR " %s: p%d could not be added: %pe\n", diff --git a/block/partitions/of.c b/block/partitions/of.c index 53664ea06b6540e3d1155141adaafac7286f2d21..4fc7c80c407de42b2b31be2c82e0e6bc2a30c9e3 100644 --- a/block/partitions/of.c +++ b/block/partitions/of.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include "check.h" @@ -62,6 +63,8 @@ static void add_of_partition(struct parsed_partitions *state, int slot, partname = of_get_property(np, "name", &len); strscpy(info->volname, partname, sizeof(info->volname)); + state->parts[slot].fwnode = fwnode_handle_get(of_fwnode_handle(np)); + seq_buf_printf(&state->pp_buf, "(%s)", info->volname); } -- 2.34.1