[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251110160705.00007387@huawei.com>
Date: Mon, 10 Nov 2025 16:07:05 +0000
From: Jonathan Cameron <jonathan.cameron@...wei.com>
To: Ben Horgan <ben.horgan@....com>
CC: <james.morse@....com>, <amitsinght@...vell.com>,
<baisheng.gao@...soc.com>, <baolin.wang@...ux.alibaba.com>,
<bobo.shaobowang@...wei.com>, <carl@...amperecomputing.com>,
<catalin.marinas@....com>, <dakr@...nel.org>, <dave.martin@....com>,
<david@...hat.com>, <dfustini@...libre.com>, <fenghuay@...dia.com>,
<gregkh@...uxfoundation.org>, <gshan@...hat.com>, <guohanjun@...wei.com>,
<jeremy.linton@....com>, <kobak@...dia.com>, <lcherian@...vell.com>,
<lenb@...nel.org>, <linux-acpi@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
<lpieralisi@...nel.org>, <peternewman@...gle.com>, <quic_jiles@...cinc.com>,
<rafael@...nel.org>, <robh@...nel.org>, <rohit.mathew@....com>,
<scott@...amperecomputing.com>, <sdonthineni@...dia.com>,
<sudeep.holla@....com>, <tan.shaopeng@...itsu.com>, <will@...nel.org>,
<xhao@...ux.alibaba.com>
Subject: Re: [PATCH 07/33] platform: Define platform_device_put cleanup
handler
On Fri, 7 Nov 2025 12:34:24 +0000
Ben Horgan <ben.horgan@....com> wrote:
> Define a cleanup helper for use with __free to destroy platform devices
> automatically when the pointer goes out of scope. This is only intended to
> be used in error cases and so should be used with return_ptr() or
> no_free_ptr() directly to avoid the automatic destruction on success.
>
> A first use of this is introduced in a subsequent commit.
>
> Signed-off-by: Ben Horgan <ben.horgan@....com>
I'm fine with this but probably needs a tag from Greg KH.
Reviewed-by: Jonathan Cameron <jonathan.cameron@...wei.com>
> ---
> 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 074754c23d33..23a30ada2d4c 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 *);
Powered by blists - more mailing lists