mirror of
https://git.proxmox.com/git/mirror_ubuntu-kernels.git
synced 2026-01-26 23:30:15 +00:00
platform/x86/amd/hsmp: Create static func to handle platdev
Create a static function and call platform device alloc and add device, which will simplify handling acpi and plat device probing. Signed-off-by: Suma Hegde <suma.hegde@amd.com> Signed-off-by: Naveen Krishna Chatradhi <nchatrad@amd.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240106022532.1746932-3-suma.hegde@amd.com Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
This commit is contained in:
parent
287a821c76
commit
e76064e34a
@ -551,6 +551,21 @@ static struct platform_driver amd_hsmp_driver = {
|
||||
|
||||
static struct platform_device *amd_hsmp_platdev;
|
||||
|
||||
static int hsmp_plat_dev_register(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
amd_hsmp_platdev = platform_device_alloc(DRIVER_NAME, PLATFORM_DEVID_NONE);
|
||||
if (!amd_hsmp_platdev)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = platform_device_add(amd_hsmp_platdev);
|
||||
if (ret)
|
||||
platform_device_put(amd_hsmp_platdev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __init hsmp_plt_init(void)
|
||||
{
|
||||
int ret = -ENODEV;
|
||||
@ -573,22 +588,10 @@ static int __init hsmp_plt_init(void)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
amd_hsmp_platdev = platform_device_alloc(DRIVER_NAME, PLATFORM_DEVID_NONE);
|
||||
if (!amd_hsmp_platdev) {
|
||||
ret = -ENOMEM;
|
||||
goto drv_unregister;
|
||||
}
|
||||
ret = hsmp_plat_dev_register();
|
||||
if (ret)
|
||||
platform_driver_unregister(&amd_hsmp_driver);
|
||||
|
||||
ret = platform_device_add(amd_hsmp_platdev);
|
||||
if (ret) {
|
||||
platform_device_put(amd_hsmp_platdev);
|
||||
goto drv_unregister;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
drv_unregister:
|
||||
platform_driver_unregister(&amd_hsmp_driver);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user