Commit f5915600 authored by Ben Horgan's avatar Ben Horgan Committed by Catalin Marinas
Browse files

platform: Define platform_device_put cleanup handler



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.

Reviewed-by: default avatarGavin Shan <gshan@redhat.com>
Reviewed-by: default avatarJonathan Cameron <jonathan.cameron@huawei.com>
Reviewed-by: default avatarFenghua Yu <fenghuay@nvidia.com>
Reviewed-by: default avatarShaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Tested-by: default avatarFenghua Yu <fenghuay@nvidia.com>
Tested-by: default avatarCarl Worth <carl@os.amperecomputing.com>
Tested-by: default avatarGavin Shan <gshan@redhat.com>
Tested-by: default avatarZeng Heng <zengheng4@huawei.com>
Tested-by: default avatarShaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Tested-by: default avatarHanjun Guo <guohanjun@huawei.com>
Signed-off-by: default avatarBen Horgan <ben.horgan@arm.com>
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent d8bf01d8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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 *);