From: Hans de Goede <hdegoede@redhat.com>
To: Suma Hegde <suma.hegde@amd.com>, platform-driver-x86@vger.kernel.org
Cc: ilpo.jarvinen@linux.intel.com,
Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Subject: Re: [PATCH 3/7] platform/x86: Create static func to handle platdev
Date: Mon, 18 Dec 2023 14:29:28 +0100 [thread overview]
Message-ID: <9950a6ac-3cc8-41bb-b93c-bb2e8af1f1a0@redhat.com> (raw)
In-Reply-To: <20231212103644.768460-4-suma.hegde@amd.com>
Hi,
On 12/12/23 11:36, Suma Hegde wrote:
> 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>
> Co-developed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
> Signed-off-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
> ---
> drivers/platform/x86/amd/hsmp.c | 33 ++++++++++++++++++---------------
> 1 file changed, 18 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/platform/x86/amd/hsmp.c b/drivers/platform/x86/amd/hsmp.c
> index 62a274c84f25..f0db7a480ace 100644
> --- a/drivers/platform/x86/amd/hsmp.c
> +++ b/drivers/platform/x86/amd/hsmp.c
> @@ -552,6 +552,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, -1);
Please use PLATFORM_DEVID_NONE instead of -1, like the code
you are replacing did.
With that fixed this is:
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Regards,
Hans
> + 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;
> @@ -574,22 +589,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 = platform_device_add(amd_hsmp_platdev);
> - if (ret) {
> - platform_device_put(amd_hsmp_platdev);
> - goto drv_unregister;
> - }
> -
> - return 0;
> + ret = hsmp_plat_dev_register();
> + if (ret)
> + platform_driver_unregister(&amd_hsmp_driver);
>
> -drv_unregister:
> - platform_driver_unregister(&amd_hsmp_driver);
> return ret;
> }
>
next prev parent reply other threads:[~2023-12-18 13:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-12 10:36 [PATCH 0/7] platform/x86: Add ACPI probing support for HSMP Suma Hegde
2023-12-12 10:36 ` [PATCH 1/7] platform/x86: Move hsmp_test to probe Suma Hegde
2023-12-18 12:32 ` Hans de Goede
2023-12-12 10:36 ` [PATCH 2/7] platform/x86: Cache pci_dev in struct hsmp_socket Suma Hegde
2023-12-18 12:34 ` Hans de Goede
2023-12-12 10:36 ` [PATCH 3/7] platform/x86: Create static func to handle platdev Suma Hegde
2023-12-18 13:29 ` Hans de Goede [this message]
2023-12-12 10:36 ` [PATCH 4/7] platform/x86: Define a struct to hold mailbox regs Suma Hegde
2023-12-18 13:32 ` Hans de Goede
2023-12-12 10:36 ` [PATCH 5/7] platform/x86: Move dev from platdev to hsmp_socket Suma Hegde
2023-12-18 13:34 ` Hans de Goede
2023-12-12 10:36 ` [PATCH 6/7] platform/x86: Convert to ACPI based probing Suma Hegde
2023-12-18 13:54 ` Hans de Goede
2023-12-12 10:36 ` [PATCH] platform/x86: Non-ACPI support for AMD F1A~M0Fh Suma Hegde
2023-12-18 13:55 ` Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9950a6ac-3cc8-41bb-b93c-bb2e8af1f1a0@redhat.com \
--to=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=naveenkrishna.chatradhi@amd.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=suma.hegde@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).