X86 platform drivers
 help / color / mirror / Atom feed
From: Nikita Kravets <teackot@gmail.com>
To: platform-driver-x86@vger.kernel.org
Cc: Hans de Goede <hdegoede@redhat.com>,
	Nikita Kravets <teackot@gmail.com>,
	Aakash Singh <mail@singhaakash.dev>,
	Jose Angel Pastrana <japp0005@red.ujaen.es>
Subject: [PATCH 1/5] platform/x86: msi-ec: Register a platform driver
Date: Tue, 10 Oct 2023 20:20:36 +0300	[thread overview]
Message-ID: <20231010172037.611063-5-teackot@gmail.com> (raw)
In-Reply-To: <20231010172037.611063-3-teackot@gmail.com>

Register a platform driver for the future features.

Cc: Aakash Singh <mail@singhaakash.dev>
Cc: Jose Angel Pastrana <japp0005@red.ujaen.es>
Signed-off-by: Nikita Kravets <teackot@gmail.com>
---
 drivers/platform/x86/msi-ec.c | 44 +++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/drivers/platform/x86/msi-ec.c b/drivers/platform/x86/msi-ec.c
index f26a3121092f..12c559c9eac4 100644
--- a/drivers/platform/x86/msi-ec.c
+++ b/drivers/platform/x86/msi-ec.c
@@ -818,6 +818,30 @@ static struct acpi_battery_hook battery_hook = {
 	.name = MSI_EC_DRIVER_NAME,
 };
 
+/*
+ * Sysfs platform driver
+ */
+
+static int msi_platform_probe(struct platform_device *pdev)
+{
+	return 0;
+}
+
+static int msi_platform_remove(struct platform_device *pdev)
+{
+	return 0;
+}
+
+static struct platform_device *msi_platform_device;
+
+static struct platform_driver msi_platform_driver = {
+	.driver = {
+		.name = MSI_EC_DRIVER_NAME,
+	},
+	.probe = msi_platform_probe,
+	.remove = msi_platform_remove,
+};
+
 /*
  * Module load/unload
  */
@@ -878,6 +902,23 @@ static int __init msi_ec_init(void)
 	if (result < 0)
 		return result;
 
+	result = platform_driver_register(&msi_platform_driver);
+	if (result < 0)
+		return result;
+
+	msi_platform_device = platform_device_alloc(MSI_EC_DRIVER_NAME, -1);
+	if (msi_platform_device == NULL) {
+		platform_driver_unregister(&msi_platform_driver);
+		return -ENOMEM;
+	}
+
+	result = platform_device_add(msi_platform_device);
+	if (result < 0) {
+		platform_device_del(msi_platform_device);
+		platform_driver_unregister(&msi_platform_driver);
+		return result;
+	}
+
 	battery_hook_register(&battery_hook);
 	return 0;
 }
@@ -885,6 +926,9 @@ static int __init msi_ec_init(void)
 static void __exit msi_ec_exit(void)
 {
 	battery_hook_unregister(&battery_hook);
+
+	platform_driver_unregister(&msi_platform_driver);
+	platform_device_del(msi_platform_device);
 }
 
 MODULE_LICENSE("GPL");
-- 
2.42.0


  reply	other threads:[~2023-10-10 17:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-10 17:20 [PATCH 0/5] platform/x86: msi-ec: Add the first platform device attributes Nikita Kravets
2023-10-10 17:20 ` Nikita Kravets [this message]
2023-10-11 13:00   ` [PATCH 1/5] platform/x86: msi-ec: Register a platform driver Ilpo Järvinen
2023-10-12 12:30     ` Hans de Goede
2023-10-10 17:20 ` [PATCH 2/5] platform/x86: msi-ec: Add fw version and release date attributes Nikita Kravets
2023-10-11 12:41   ` Ilpo Järvinen
2023-10-12 12:34     ` Hans de Goede
2023-10-12 12:56       ` Ilpo Järvinen
2023-10-18 14:34         ` Hans de Goede
2025-02-20 12:25           ` N K
2023-10-10 17:20 ` [PATCH 3/5] platform/x86: msi-ec: Filter out unsupported attributes Nikita Kravets
2023-10-11 12:46   ` Ilpo Järvinen
2023-10-10 17:20 ` [PATCH 4/5] platform/x86: msi-ec: Add EC bit operation functions Nikita Kravets
2023-10-11 12:59   ` Ilpo Järvinen
2023-10-12 12:41     ` Hans de Goede
2023-10-10 17:20 ` [PATCH 5/5] platform/x86: msi-ec: Add a cooler boost attribute Nikita Kravets
2023-10-11 12:49   ` Ilpo Järvinen

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=20231010172037.611063-5-teackot@gmail.com \
    --to=teackot@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=japp0005@red.ujaen.es \
    --cc=mail@singhaakash.dev \
    --cc=platform-driver-x86@vger.kernel.org \
    /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