From: "Rafael J. Wysocki" <rafael@kernel.org>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Linux ACPI <linux-acpi@vger.kernel.org>,
Hans de Goede <hansg@kernel.org>,
platform-driver-x86@vger.kernel.org,
Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Subject: [PATCH v2 02/10] platform/x86: classmate-laptop: Unify probe rollback and remove code
Date: Mon, 11 May 2026 22:04:39 +0200 [thread overview]
Message-ID: <2036641.PYKUYFuaPT@rafael.j.wysocki> (raw)
In-Reply-To: <3415394.44csPzL39Z@rafael.j.wysocki>
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
To facilitate subsequent modifications, change code ordering in
cmpc_accel_add_v4(), cmpc_accel_add(), and cmpc_accel_remove_v4()
so that the ordering of the probe rollback code is the same as the
ordering of the corresponding removal code.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
v1 -> v2: Rebase
---
drivers/platform/x86/classmate-laptop.c | 40 +++++++++++++------------
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/drivers/platform/x86/classmate-laptop.c b/drivers/platform/x86/classmate-laptop.c
index a5fe34211afb..d1407a28c1de 100644
--- a/drivers/platform/x86/classmate-laptop.c
+++ b/drivers/platform/x86/classmate-laptop.c
@@ -406,12 +406,19 @@ static int cmpc_accel_add_v4(struct acpi_device *acpi)
accel->inputdev_state = CMPC_ACCEL_DEV_STATE_CLOSED;
+ error = cmpc_add_acpi_notify_device(acpi, "cmpc_accel_v4",
+ cmpc_accel_idev_init_v4);
+ if (error)
+ return error;
+
+ inputdev = dev_get_drvdata(&acpi->dev);
+
accel->sensitivity = CMPC_ACCEL_SENSITIVITY_DEFAULT;
cmpc_accel_set_sensitivity_v4(acpi->handle, accel->sensitivity);
error = device_create_file(&acpi->dev, &cmpc_accel_sensitivity_attr_v4);
if (error)
- return error;
+ goto failed_sensitivity;
accel->g_select = CMPC_ACCEL_G_SELECT_DEFAULT;
cmpc_accel_set_g_select_v4(acpi->handle, accel->g_select);
@@ -420,27 +427,21 @@ static int cmpc_accel_add_v4(struct acpi_device *acpi)
if (error)
goto failed_g_select;
- error = cmpc_add_acpi_notify_device(acpi, "cmpc_accel_v4",
- cmpc_accel_idev_init_v4);
- if (error)
- goto failed_input;
-
- inputdev = dev_get_drvdata(&acpi->dev);
dev_set_drvdata(&inputdev->dev, accel);
return 0;
-failed_input:
- device_remove_file(&acpi->dev, &cmpc_accel_g_select_attr_v4);
failed_g_select:
device_remove_file(&acpi->dev, &cmpc_accel_sensitivity_attr_v4);
+failed_sensitivity:
+ cmpc_remove_acpi_notify_device(acpi);
return error;
}
static void cmpc_accel_remove_v4(struct acpi_device *acpi)
{
- device_remove_file(&acpi->dev, &cmpc_accel_sensitivity_attr_v4);
device_remove_file(&acpi->dev, &cmpc_accel_g_select_attr_v4);
+ device_remove_file(&acpi->dev, &cmpc_accel_sensitivity_attr_v4);
cmpc_remove_acpi_notify_device(acpi);
}
@@ -652,25 +653,26 @@ static int cmpc_accel_add(struct acpi_device *acpi)
if (!accel)
return -ENOMEM;
+ error = cmpc_add_acpi_notify_device(acpi, "cmpc_accel",
+ cmpc_accel_idev_init);
+ if (error)
+ return error;
+
+ inputdev = dev_get_drvdata(&acpi->dev);
+
accel->sensitivity = CMPC_ACCEL_SENSITIVITY_DEFAULT;
cmpc_accel_set_sensitivity(acpi->handle, accel->sensitivity);
error = device_create_file(&acpi->dev, &cmpc_accel_sensitivity_attr);
if (error)
- return error;
-
- error = cmpc_add_acpi_notify_device(acpi, "cmpc_accel",
- cmpc_accel_idev_init);
- if (error)
- goto failed_input;
+ goto failed_file;
- inputdev = dev_get_drvdata(&acpi->dev);
dev_set_drvdata(&inputdev->dev, accel);
return 0;
-failed_input:
- device_remove_file(&acpi->dev, &cmpc_accel_sensitivity_attr);
+failed_file:
+ cmpc_remove_acpi_notify_device(acpi);
return error;
}
--
2.51.0
next prev parent reply other threads:[~2026-05-11 20:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-11 20:01 [PATCH v2 00/10] platform/x86: classmate-laptop: Bind to platform devices instead of ACPI ones Rafael J. Wysocki
2026-05-11 20:03 ` [PATCH v2 01/10] platform/x86: classmate-laptop: Address memory leaks on driver removal Rafael J. Wysocki
2026-05-11 20:04 ` Rafael J. Wysocki [this message]
2026-05-11 20:06 ` [PATCH v2 03/10] platform/x86: classmate-laptop: Pass struct device pointer to helpers Rafael J. Wysocki
2026-05-11 20:07 ` [PATCH v2 04/10] platform/x86: classmate-laptop: Rename two helper functions Rafael J. Wysocki
2026-05-11 20:08 ` [PATCH v2 05/10] platform/x86: classmate-laptop: Register ACPI notify handlers directly Rafael J. Wysocki
2026-05-11 20:10 ` [PATCH v2 06/10] platform/x86: classmate-laptop: Convert v4 accel driver to a platform one Rafael J. Wysocki
2026-05-11 20:11 ` [PATCH v2 07/10] platform/x86: classmate-laptop: Convert " Rafael J. Wysocki
2026-05-11 20:12 ` [PATCH v2 08/10] platform/x86: classmate-laptop: Convert tablet " Rafael J. Wysocki
2026-05-11 20:14 ` [PATCH v2 09/10] platform/x86: classmate-laptop: Convert ipml " Rafael J. Wysocki
2026-05-11 20:15 ` [PATCH v2 10/10] platform/x86: classmate-laptop: Convert keys " Rafael J. Wysocki
2026-05-12 15:09 ` [PATCH v2 00/10] platform/x86: classmate-laptop: Bind to platform devices instead of ACPI ones Thadeu Lima de Souza Cascardo
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=2036641.PYKUYFuaPT@rafael.j.wysocki \
--to=rafael@kernel.org \
--cc=cascardo@holoscopio.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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