Re: [PATCH v13 12/18] platform: Add __free() based cleanup function for platform_device_put

Jonathan Cameron
2024-10-14T15:43:44Z

On Wed, 9 Oct 2024 13:41:13 +0100
<shiju.jose@huawei.com> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> Add __free() based cleanup function for platform_device_put().
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Shiju Jose <shiju.jose@huawei.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 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.