From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64680D1812D for ; Mon, 14 Oct 2024 16:12:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EB2F86B0089; Mon, 14 Oct 2024 12:12:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E62F66B008A; Mon, 14 Oct 2024 12:12:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CB4B56B008C; Mon, 14 Oct 2024 12:12:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id AAA766B0089 for ; Mon, 14 Oct 2024 12:12:39 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 657811C69C6 for ; Mon, 14 Oct 2024 16:12:30 +0000 (UTC) X-FDA: 82672700586.03.EB36566 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf03.hostedemail.com (Postfix) with ESMTP id 4B81920019 for ; Mon, 14 Oct 2024 16:12:34 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=0v0YUG9t; spf=pass (imf03.hostedemail.com: domain of gregkh@linuxfoundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org; dmarc=pass (policy=none) header.from=linuxfoundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728922311; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Phak4mdiAndwJS0DKpis4DuXwBgkFyOdavTfvVZmEX8=; b=sVEmGEesBhBnfx+bfWLzRJon4BlUV1xbyxVHtvhIeNhdjKgiE/ruQ9S3mNvzwhu3hDsn7r 0zMEtymkjxE/H495zJBvtEchnZZcaBCKso2p2zNXUA/o68d0t4Mc0J2RC7/CiBpQTEd0L6 Pr5NQJOfiK64EZAiiGkv544a7CibgJ0= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=0v0YUG9t; spf=pass (imf03.hostedemail.com: domain of gregkh@linuxfoundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org; dmarc=pass (policy=none) header.from=linuxfoundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728922311; a=rsa-sha256; cv=none; b=c0kI4WoxXY+sTTOJssDFUS1bToB4K8Zumv773wo+UPn+6q2g2UAhPWkPpx1Il024CtHodj JIu5qaRnE6c6XG+kYG2ffoZ9CZCH8d33BNngmrySnv+h4uQ/DcpqQnSg/NC97PDHBoCagf OlvrZwNkHpdxuYGbuUav7ZG39DFO++w= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 4594E5C5B0A; Mon, 14 Oct 2024 16:12:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8A1DC4CEC3; Mon, 14 Oct 2024 16:12:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728922356; bh=ihTjQMfT+HpJ1Yf30NWcPkihLJvrI6C5hJHvt+WDVNw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=0v0YUG9tKk8CPFe1ByE0w3apGT0w+Cj1c0RH5p3Da8JSiHBhHn33V28LNnNLqiIeq zjnCVz9/ZW8S6NUNgtP9iI9MVPanVxwZ9TNiGT+m0DUOj9VC+zqZptwrlNXJzd1tdA nbb9b1h1qeqSAXkkUgigFfRHc0cUPp1LVabDvu94= Date: Mon, 14 Oct 2024 18:04:37 +0200 From: Greg KH To: Jonathan Cameron Cc: shiju.jose@huawei.com, linux-edac@vger.kernel.org, linux-cxl@vger.kernel.org, linux-acpi@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, bp@alien8.de, tony.luck@intel.com, rafael@kernel.org, lenb@kernel.org, mchehab@kernel.org, dan.j.williams@intel.com, dave@stgolabs.net, dave.jiang@intel.com, alison.schofield@intel.com, vishal.l.verma@intel.com, ira.weiny@intel.com, david@redhat.com, Vilas.Sridharan@amd.com, leo.duran@amd.com, Yazen.Ghannam@amd.com, rientjes@google.com, jiaqiyan@google.com, Jon.Grimm@amd.com, dave.hansen@linux.intel.com, naoya.horiguchi@nec.com, james.morse@arm.com, jthoughton@google.com, somasundaram.a@hpe.com, erdemaktas@google.com, pgonda@google.com, duenwen@google.com, gthelen@google.com, wschwartz@amperecomputing.com, dferguson@amperecomputing.com, wbs@os.amperecomputing.com, nifan.cxl@gmail.com, tanxiaofei@huawei.com, prime.zeng@hisilicon.com, roberto.sassu@huawei.com, kangkang.shen@futurewei.com, wanghuiqiang@huawei.com, linuxarm@huawei.com Subject: Re: [PATCH v13 12/18] platform: Add __free() based cleanup function for platform_device_put Message-ID: <2024101451-reword-animation-2179@gregkh> References: <20241009124120.1124-1-shiju.jose@huawei.com> <20241009124120.1124-13-shiju.jose@huawei.com> <20241014164339.00003e73@Huawei.com> <2024101410-turf-junior-7739@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2024101410-turf-junior-7739@gregkh> X-Rspam-User: X-Stat-Signature: 3huzp6qmg9hyd69ra166w7d61wgrk35o X-Rspamd-Queue-Id: 4B81920019 X-Rspamd-Server: rspam11 X-HE-Tag: 1728922354-868088 X-HE-Meta: U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qmDwsq+UJbvAYO+x4orimaiAA1D44HACOor9JLtesE5j6l1qaxqNBuI40hW2erFyjhddNyVk+7TNGD4Ho3PYlFNj7wa9UKDvnLHjvkUdtjH0QTAhpeXg7BGBvUuLyRtueAbZHW/czTR+pecH4Kmd6Qjf7PN61/aVRLTsxp2U+z6qu/n5kUdxOD9UgYRyKiOWdDws+CQ5JG9veB6EvcXOG7ZD/NIzsjaO8U1zW6p3KL6qSFpcep8Qgco9fyxio56/tGhSFbMy+c0aaM5UPlO3Aw1YK3abZF8RK2TKoev+Km/5BMuukYeDLKNIkxJPI4KEo31xeyJ5HjfeSl+/ohRPx0dZ2QyaocL7sOlp03LQVcib2SGdnYXT+NPBYcxIHxV8k7KTHaGSs50hwr4kRc= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Mon, Oct 14, 2024 at 06:00:51PM +0200, Greg KH wrote: > On Mon, Oct 14, 2024 at 04:43:39PM +0100, Jonathan Cameron wrote: > > On Wed, 9 Oct 2024 13:41:13 +0100 > > wrote: > > > > > From: Jonathan Cameron > > > > > > Add __free() based cleanup function for platform_device_put(). > > > > > > Signed-off-by: Jonathan Cameron > > > Signed-off-by: Shiju Jose > > > --- > > > include/linux/platform_device.h | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h > > > index d422db6eec63..606533b88f44 100644 > > > --- a/include/linux/platform_device.h > > > +++ b/include/linux/platform_device.h > > > @@ -232,6 +232,7 @@ extern int platform_device_add_data(struct platform_device *pdev, > > > extern int platform_device_add(struct platform_device *pdev); > > > extern void platform_device_del(struct platform_device *pdev); > > > extern void platform_device_put(struct platform_device *pdev); > > > +DEFINE_FREE(platform_device_put, struct platform_device *, if (_T) platform_device_put(_T)) > > > > > > struct platform_driver { > > > int (*probe)(struct platform_device *); > > > > +CC Greg KH and Rafael. > > > > Makes sure to include them on v14 as this needs review from a driver core point > > of view I think. > > Why is this needed for a platform device? This feels like you will have > to do more work to "keep" the reference on the normal path than you to > today to release the reference on the error path, right? Have a pointer > to a patch that uses this? Ah, is it this one: https://lore.kernel.org/all/20241014164955.00003439@Huawei.com/ ? If so, no, that's an abuse of a platform device, don't do that, make a REAL device on the bus that this device lives on. If it doesn't live on a real bus, then put it on the virtual bus but do NOT abuse the platform device layer for something like this. thanks, greg k-h