From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CBAE6344D95 for ; Fri, 17 Jul 2026 15:38:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784302701; cv=none; b=I1ls6mO8sretwrj8hiOagQYGi9rP69TfH4Trqme+0shg+lkA8FCPCNV2uJd2LQEZODUIdplJB83jXDtVY8ABKIgiSttgb3uR5ltzAApC3WNX3Hy5yZsQL0piO/9LJQA6XXHOXSvae4UoGEyOUJSyCUze3mbOHb+QF8G/vE0DZVk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784302701; c=relaxed/simple; bh=o05B1sznnG0EFm5f12G7gh70bDdeJZm8AZ8ddNvmIWk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rBC1c20S3xpo6TGci3Ocwi3RCMNqhtnEmGQww1eobUoCO8pLUezZj5DOmntkTOyUyzMFbCXkvfIwIezNaQNkNUAStAmYYAHoOGtEM7PqUbRTSpyliDtm/R1Kxq+an6OQyu5hg/Z5vA4oTVEYmVliUik/ABuw5JZlR0VatuYcKnY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=Ym4T26FG; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Qe8ODGeP; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject 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.b="Ym4T26FG"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Qe8ODGeP" 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 66HE7h6Q2093874 for ; Fri, 17 Jul 2026 15:38:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=qcppdkim1; bh=mU5plK4wOuXslrH5tzmT1Lzf M6TA652cX7f9RNduBGg=; b=Ym4T26FGSboWTOc59JBr4POlPj3J+PuT82mbDSwY XRzYDLR7OkRMjCjKvvmpRPZUEZNEZMcUJ1TZdM4i/OaecTGpd6cyft7WENJinH3I tt+dg/pjeYGey+bAGfsUAHGHYuXb2P2XVE+y2CZlw+s3g6Hy/zxMT+dzsg7x9s5B aEFFYNAT2NBk2//h4axm8Mdozm7fS+2wo7KaY/Zvpq078psWnAojwMnMNp90TaNv f4rpRtOOsOiOi80JUSgnZflxbXIVULuHMQJnsoJ97l4BNPwX9SwsLB1iLasZBlsI jxlOgKg2QlM/2l2jEprhcugzH/8XqpQggUULE2Sxb8hRsA== Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ffbquju6n-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 17 Jul 2026 15:38:15 +0000 (GMT) Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-38869800848so11959446a91.0 for ; Fri, 17 Jul 2026 08:38:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784302695; x=1784907495; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=mU5plK4wOuXslrH5tzmT1LzfM6TA652cX7f9RNduBGg=; b=Qe8ODGePh7YfXTWW9qjKTlZtZ4ULDflIub9HeAZx8JKwfFTLv7aaBkUKa3bUesSM1T DEAJFviAVQqpMbjJpOboIBegBg9Ex5eghprdXRcEWoqeKDGDSbwRzjXqsBj0JB3kRIMN d/MtDUdo/HmJhkS90p+EpyAv3sfBIBhW9r9SVoS+ws8jvDWDCcIcOBN64WshEasD6/03 QvBPb7MDGZy2/s6TUx1aO9qddMs8of3W2GmYe3hZgHawBLoaCCfqUhvSa5u6Q/U+q06N 1uZga5cZZ6wuK6F9rx976FxWf1LkmQRYzHRsOxebASSNUiH7YWjCTWyMmvY1ICk/BTk3 2CPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784302695; x=1784907495; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=mU5plK4wOuXslrH5tzmT1LzfM6TA652cX7f9RNduBGg=; b=in2DPpz7iP0QUvFTuusYv6HT8yBK89fLFOUAPu+/KI2EINf4vMKJgErLbGQI6eGvr8 1wpcOSJflMFV9hD6RIT67rZ+RxEy0uXKVouhbqrU20562/mf3ug6aLOAojbfZym0+QtY InWBt+I8PKkZOvXtrVym3t/7LD4qZLqkE2RLIl2YwywqNWAO2Djjz3jvyu3wl25CHfBM 4uka33HNDnW2r4myceJminR2AXX4slN8D54Tpak4qnp3hTRmfXUqeWAijB22nathAhWp ys/IUbq+SdZ0q/b9hMOC7KNrddhnQI6XsP1P1LX5kD/xP+zIMsd9F5FeRnU1e9YMejIg CGGA== X-Forwarded-Encrypted: i=1; AHgh+RqsMfbMRCW7lJIJUOtBI8t8m+xVhpzDTMYYw8A/OnQ9Mjizay4aqTz2Nf//J+dPW6Cz2gsjiEL0FBXPHe8=@vger.kernel.org X-Gm-Message-State: AOJu0Ywkq5IuECGoeLSjdTbyRXT6LnFZ8BQckd+/+bYDqKDfcqVTMDPd xiSzPRvuu5jsIKeTIGPXAupabkxYLX/RTA2tli5JoYI7dKKTtLSwccpHGuK6rS4aZ4p2viKYHcn DvciGsOXUmrVEwxEpNYepWYmGWhI+FvDfsFxoC4GXFQE7oAnomqFCmlLAytnFwdx3N88= X-Gm-Gg: AfdE7clqCsJbusN7YtNbNZnsL5i4nTjAd3jiUFi6QM4UWMZ1oQIdk0mJb7bGhsi3RQ5 ulS311TD55IUiAHlf6PpXZz6CD7XiySAAc7WjRZD8JvkvQ9rsEUGEBgxLW98DVhqR8dljJsk6DL GSkJyHXqt1bfEpC7nDwPvPKymwsTrJZdHprMr4pHShlSL3sm+jBssaI2/8MyO65o9q89TEzUvj1 kEFCQgj3b0IgQh/0aIzMmf6UR6wxTpLaQYSa4awfiYvjhBbqBF6H8nWKzH6Y1OmifOpSGdAVfBl EoeuhDCq3kmxE8U04ZChjpOrJtyKdhAI7dp09r7B7NeQWd9fvbd95dbBYK3/C0BQnJAeipq6sSB 649Xx3zzL1ODHmONjxCJMKuIbI8c= X-Received: by 2002:a17:90b:2684:b0:38d:f5bb:e0f4 with SMTP id 98e67ed59e1d1-38e4b3e1473mr3203785a91.1.1784302694230; Fri, 17 Jul 2026 08:38:14 -0700 (PDT) X-Received: by 2002:a17:90b:2684:b0:38d:f5bb:e0f4 with SMTP id 98e67ed59e1d1-38e4b3e1473mr3203716a91.1.1784302693542; Fri, 17 Jul 2026 08:38:13 -0700 (PDT) Received: from hu-mojha-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3142a1ddeb6sm10087302eec.20.2026.07.17.08.37.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2026 08:38:13 -0700 (PDT) Date: Fri, 17 Jul 2026 21:07:45 +0530 From: Mukesh Ojha To: Rob Herring Cc: Bjorn Andersson , Konrad Dybcio , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Joel Stanley , Andrew Jeffery , Paul Cercueil , Anitha Chrisanthus , Paul Kocialkowski , Linus Walleij , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Alexey Brodkin , Laurent Pinchart , Tomi Valkeinen , Michal Simek , Daniel Scally , Jacopo Mondi , Mauro Carvalho Chehab , Eddie James , Tiffany Lin , Andrew-CT Chen , Yunfei Dong , Minghsiu Tsai , Houlong Wei , Matthias Brugger , AngeloGioacchino Del Regno , Joseph Liu , Marvin Lin , Dmitry Osipenko , Krzysztof Kozlowski , Thierry Reding , Jonathan Hunter , Srinivas Kandagatla , Arnd Bergmann , Greg Kroah-Hartman , Ge Gordon , Adrian Hunter , Ulf Hansson , Saravana Kannan , Mathieu Poirier , Jaroslav Kysela , Takashi Iwai , Shengjiu Wang , Xiubo Li , Liam Girdwood , Mark Brown , Frank Li , Sascha Hauer , Peter Ujfalusi , Bard Liao , Daniel Baluta , Orson Zhai , Baolin Wang , Peter Chen , Fugang Duan , Ekansh Gupta , BST Linux Kernel Upstream Group , Fabio Estevam , Nicolin Chen , Pengutronix Kernel Team , Kai Vehmanen , Pierre-Louis Bossart , Vijendar Mukunda , Chunyan Zhang , CIX Linux Kernel Upstream Group , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-aspeed@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-media@vger.kernel.org, openbmc@lists.ozlabs.org, linux-mediatek@lists.infradead.org, kernel@collabora.com, linux-tegra@vger.kernel.org, linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-staging@lists.linux.dev, linux-sound@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, imx@lists.linux.dev, sound-open-firmware@alsa-project.org, Konrad Dybcio Subject: Re: [PATCH 01/42] of: reserved_mem: Introduce devres-managed initialization functions Message-ID: <20260717153745.geqmmgm4o3j3vhom@hu-mojha-hyd.qualcomm.com> References: <20260703193855.110619-1-mukesh.ojha@oss.qualcomm.com> <20260703193855.110619-2-mukesh.ojha@oss.qualcomm.com> <20260716200048.GA1183026-robh@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260716200048.GA1183026-robh@kernel.org> X-Proofpoint-GUID: 3gL-n9T3YfDYfMYa9DXwQGni7GWr-DXS X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzE3MDE2MCBTYWx0ZWRfX0sDHMxPkWy4q sagRiaBwwlQg+V3hzMgo3AXfCmo6bqVpLYRUMQOgMPYlNalziGUk8cH0b9B+hlfdb8wCSUAOVnS mNUpnOXwcHyuu0Tj1mIlFPhiKkIeCoZX4y/j6P0jmACpCrpqIYknz+40wEITGXp+vC2kfXyOW48 JjFsvd9S1XLQGqNsAz+heVZJqUB48kLfrLecu8V0sj3uT/BsGmy0d1npjPdATHyS6DUYsUzZl7b rUvsNuzFzSK6jmGpu59b+NP99OeXCUMw7Y6Ka7bnxg3+k5kZT+5sOpIRZdTfdWhyYUJehVWwUb6 UMA3IXlEeXjjrIed/YGk+7Kz5NOS8sMmDYPLHNM/+LrDeEI25DSo3IWcMPtimi+CSu37MHlWtio dHnO3JqDYqPULM3sBnspTG/Hgwaxo0PZNEw06PGppzvf5UveDNYPxnAbshej6sTn34AmvxPaC12 r7nz/VkdYmbnXARH78g== X-Authority-Analysis: v=2.4 cv=NZ3WEWD4 c=1 sm=1 tr=0 ts=6a5a4c67 cx=c_pps a=0uOsjrqzRL749jD1oC5vDA==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=kj9zAlcOel0A:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=9JV1VVRos5_Q502CX78A:9 a=CjuIK1q_8ugA:10 a=mQ_c8vxmzFEMiUWkPHU9:22 X-Proofpoint-ORIG-GUID: 3gL-n9T3YfDYfMYa9DXwQGni7GWr-DXS X-Proofpoint-Spam-Info: AW1haW4tMjYwNzE3MDE2MCBTYWx0ZWRfX4WYFf7rV6aCq Kb/e/7K61Rz/XgDlgfVeZQf0j/qSQlHqLGZih3bMtgDoDWEOam8ZZM6asHkWwsOCyz3PK+ZqIIK VJzFNggAXyLgpEjNlj0I5HGVi22KVvQ= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-17_04,2026-07-17_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 adultscore=0 bulkscore=0 phishscore=0 suspectscore=0 priorityscore=1501 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607170160 On Thu, Jul 16, 2026 at 03:00:48PM -0500, Rob Herring wrote: > On Sat, Jul 04, 2026 at 01:08:14AM +0530, Mukesh Ojha wrote: > > From: Konrad Dybcio > > > > Introduce devres-based helpers for of_reserved_mem_device_init(_by_idx) > > to help fight dangling references and ever so slightly reduce the > > number of boilerplate deinitialization calls. > > > > Signed-off-by: Konrad Dybcio > > Signed-off-by: Mukesh Ojha > > --- > > drivers/of/of_reserved_mem.c | 41 +++++++++++++++++++++++++++++++++ > > include/linux/of_reserved_mem.h | 25 ++++++++++++++++++++ > > 2 files changed, 66 insertions(+) > > > > diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c > > index 82222bd45ac6..b35541e9fbe8 100644 > > --- a/drivers/of/of_reserved_mem.c > > +++ b/drivers/of/of_reserved_mem.c > > @@ -787,6 +787,47 @@ void of_reserved_mem_device_release(struct device *dev) > > } > > EXPORT_SYMBOL_GPL(of_reserved_mem_device_release); > > > > +static void devm_of_reserved_mem_device_release(struct device *dev, void *res) > > +{ > > + of_reserved_mem_device_release(*(struct device **)res); > > +} > > + > > +/** > > + * devm_of_reserved_mem_device_init_by_idx() - Resource managed of_reserved_mem_device_init_by_idx() > > + * @dev: Pointer to the device to configure > > + * @np: Pointer to the device node with 'memory-region' property > > + * @idx: Index of selected region > > + * > > + * This is a resource managed version of of_reserved_mem_device_init_by_idx(). > > + * The reserved memory region will be released automatically when the device > > + * is unbound. > > + * > > + * Returns: Negative errno on failure or zero on success. > > + */ > > +int devm_of_reserved_mem_device_init_by_idx(struct device *dev, > > + struct device_node *np, int idx) > > It looks to me like the only 2? users of this could be converted to > devm_of_reserved_mem_device_init() instead. The mmc one obviously can. > The imx one depends if np is dev->of_node. I'm not a fan of APIs with > only a few users. You are right, mmc can be but imx can't. I can make this static and drop the API usage from imx but fix the leak by release function. -- -Mukesh Ojha