All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] alienware-wmi: Simplify platform device creation
@ 2024-11-19  4:34 Kurt Borja
  2024-11-19  4:36 ` Mario Limonciello
  0 siblings, 1 reply; 2+ messages in thread
From: Kurt Borja @ 2024-11-19  4:34 UTC (permalink / raw)
  To: kuurtb
  Cc: Dell.Client.Kernel, hdegoede, ilpo.jarvinen, linux-kernel,
	mario.limonciello, platform-driver-x86, w_armin

Simplfy platform device creation by using
platform_device_register_simple().

Signed-off-by: Kurt Borja <kuurtb@gmail.com>
---
 drivers/platform/x86/dell/alienware-wmi.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c
index 77465ed9b449..742fe79f13dc 100644
--- a/drivers/platform/x86/dell/alienware-wmi.c
+++ b/drivers/platform/x86/dell/alienware-wmi.c
@@ -1196,14 +1196,13 @@ static int __init alienware_wmi_init(void)
 	ret = platform_driver_register(&platform_driver);
 	if (ret)
 		goto fail_platform_driver;
-	platform_device = platform_device_alloc("alienware-wmi", PLATFORM_DEVID_NONE);
-	if (!platform_device) {
-		ret = -ENOMEM;
+
+	platform_device = platform_device_register_simple("alienware-wmi",
+							  PLATFORM_DEVID_NONE, NULL, 0);
+	if (IS_ERR(platform_device)) {
+		ret = PTR_ERR(platform_device);
 		goto fail_platform_device1;
 	}
-	ret = platform_device_add(platform_device);
-	if (ret)
-		goto fail_platform_device2;
 
 	if (quirks->hdmi_mux > 0) {
 		ret = create_hdmi(platform_device);
@@ -1242,9 +1241,7 @@ static int __init alienware_wmi_init(void)
 fail_prep_deepsleep:
 fail_prep_amplifier:
 fail_prep_hdmi:
-	platform_device_del(platform_device);
-fail_platform_device2:
-	platform_device_put(platform_device);
+	platform_device_unregister(platform_device);
 fail_platform_device1:
 	platform_driver_unregister(&platform_driver);
 fail_platform_driver:
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/5] alienware-wmi: Simplify platform device creation
  2024-11-19  4:34 [PATCH 1/5] alienware-wmi: Simplify platform device creation Kurt Borja
@ 2024-11-19  4:36 ` Mario Limonciello
  0 siblings, 0 replies; 2+ messages in thread
From: Mario Limonciello @ 2024-11-19  4:36 UTC (permalink / raw)
  To: Kurt Borja
  Cc: Dell.Client.Kernel, hdegoede, ilpo.jarvinen, linux-kernel,
	platform-driver-x86, w_armin

On 11/18/2024 22:34, Kurt Borja wrote:
> Simplfy platform device creation by using

Typo

s/Simplfy/Simplify/

> platform_device_register_simple().
> 
> Signed-off-by: Kurt Borja <kuurtb@gmail.com>

Minor typo in commit message.  LGTM otherwise.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>

> ---
>   drivers/platform/x86/dell/alienware-wmi.c | 15 ++++++---------
>   1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c
> index 77465ed9b449..742fe79f13dc 100644
> --- a/drivers/platform/x86/dell/alienware-wmi.c
> +++ b/drivers/platform/x86/dell/alienware-wmi.c
> @@ -1196,14 +1196,13 @@ static int __init alienware_wmi_init(void)
>   	ret = platform_driver_register(&platform_driver);
>   	if (ret)
>   		goto fail_platform_driver;
> -	platform_device = platform_device_alloc("alienware-wmi", PLATFORM_DEVID_NONE);
> -	if (!platform_device) {
> -		ret = -ENOMEM;
> +
> +	platform_device = platform_device_register_simple("alienware-wmi",
> +							  PLATFORM_DEVID_NONE, NULL, 0);
> +	if (IS_ERR(platform_device)) {
> +		ret = PTR_ERR(platform_device);
>   		goto fail_platform_device1;
>   	}
> -	ret = platform_device_add(platform_device);
> -	if (ret)
> -		goto fail_platform_device2;
>   
>   	if (quirks->hdmi_mux > 0) {
>   		ret = create_hdmi(platform_device);
> @@ -1242,9 +1241,7 @@ static int __init alienware_wmi_init(void)
>   fail_prep_deepsleep:
>   fail_prep_amplifier:
>   fail_prep_hdmi:
> -	platform_device_del(platform_device);
> -fail_platform_device2:
> -	platform_device_put(platform_device);
> +	platform_device_unregister(platform_device);
>   fail_platform_device1:
>   	platform_driver_unregister(&platform_driver);
>   fail_platform_driver:


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-19  4:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-19  4:34 [PATCH 1/5] alienware-wmi: Simplify platform device creation Kurt Borja
2024-11-19  4:36 ` Mario Limonciello

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.