Skip to contentSkip to conversation

acer-wmi: remove threeg and interface sysfs files

PATCH In review Lee, Chun-Yi 3 participants 5 messages May 25, 2011 – May 28, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover acer-wmi: remove threeg and interface sysfs files

Remove threeg sysfs because we can autodetect internal 3G device and already have the threeg rfkill now. And, We also remove interface sysfs and replaced by information log.

The above 2 files are the last two sysfs interfaces that were provided by acer-wmi.

Lee, Chun-Yi (2):
acer-wmi: remove threeg sysfs support
acer-wmi: remove interface sysfs file

 drivers/platform/x86/acer-wmi.c |   96 +++------------------------------------
 1 files changed, 7 insertions(+), 89 deletions(-)
#1 lore raw

PATCH 1/2 acer-wmi: remove threeg sysfs support

We can now autodetect internal 3G device and already have the threeg rfkill device. So, we remove threeg sysfs support for it's no longer necessary.

Tested on Acer Travelmate 8572

Cc Carlos Corbacho <[email protected]>
Cc Matthew Garrett <[email protected]>
Cc Dmitry Torokhov <[email protected]>
Cc Corentin Chary <[email protected]>
Cc Thomas Renninger <[email protected]>
---
 drivers/platform/x86/acer-wmi.c |   37 -------------------------------------
 1 files changed, 0 insertions(+), 37 deletions(-)
drivers/platform/x86/acer-wmi.c +0 -37
index 1495539..ba10dba 100644
@@ -1391,33 +1391,6 @@ static void acer_rfkill_exit(void)
 /*
  * sysfs interface
  */
-static ssize_t show_bool_threeg(struct device *dev,
-	struct device_attribute *attr, char *buf)
-{
-	u32 result; \
-	acpi_status status;
-	if (wmi_has_guid(WMID_GUID3))
-		status = wmid3_get_device_status(&result,
-				ACER_WMID3_GDS_THREEG);
-	else
-		status = get_u32(&result, ACER_CAP_THREEG);
-	if (ACPI_SUCCESS(status))
-		return sprintf(buf, "%u\n", result);
-	return sprintf(buf, "Read error\n");
-}
-
-static ssize_t set_bool_threeg(struct device *dev,
-	struct device_attribute *attr, const char *buf, size_t count)
-{
-	u32 tmp = simple_strtoul(buf, NULL, 10);
-	acpi_status status = set_u32(tmp, ACER_CAP_THREEG);
-		if (ACPI_FAILURE(status))
-			return -EINVAL;
-	return count;
-}
-static DEVICE_ATTR(threeg, S_IRUGO | S_IWUSR, show_bool_threeg,
-	set_bool_threeg);
-
 static ssize_t show_interface(struct device *dev, struct device_attribute *attr,
 	char *buf)
 {
@@ -1754,9 +1727,6 @@ static struct platform_device *acer_platform_device;
 
 static int remove_sysfs(struct platform_device *device)
 {
-	if (has_cap(ACER_CAP_THREEG))
-		device_remove_file(&device->dev, &dev_attr_threeg);
-
 	device_remove_file(&device->dev, &dev_attr_interface);
 
 	return 0;
@@ -1766,13 +1736,6 @@ static int create_sysfs(void)
 {
 	int retval = -ENOMEM;
 
-	if (has_cap(ACER_CAP_THREEG)) {
-		retval = device_create_file(&acer_platform_device->dev,
-			&dev_attr_threeg);
-		if (retval)
-			goto error_sysfs;
-	}
-
 	retval = device_create_file(&acer_platform_device->dev,
 		&dev_attr_interface);
 	if (retval)
Signature · 1 line
1.6.0.2
#2 lore raw

PATCH 2/2 acer-wmi: remove interface sysfs file

Remove interface sysfs file that exposed which ACPI-WMI interface that was used by acer-wmi driver. It was replaced by information log when acer-wmi initial.

Tested on Acer Travelmate 8572

Cc Carlos Corbacho <[email protected]>
Cc Matthew Garrett <[email protected]>
Cc Dmitry Torokhov <[email protected]>
Cc Corentin Chary <[email protected]>
Cc Thomas Renninger <[email protected]>
---
 drivers/platform/x86/acer-wmi.c |   59 ++++----------------------------------
 1 files changed, 7 insertions(+), 52 deletions(-)
drivers/platform/x86/acer-wmi.c +7 -52
index ba10dba..64b7e20 100644
@@ -1388,26 +1388,6 @@ static void acer_rfkill_exit(void)
 	return;
 }
 
-/*
- * sysfs interface
- */
-static ssize_t show_interface(struct device *dev, struct device_attribute *attr,
-	char *buf)
-{
-	switch (interface->type) {
-	case ACER_AMW0:
-		return sprintf(buf, "AMW0\n");
-	case ACER_AMW0_V2:
-		return sprintf(buf, "AMW0 v2\n");
-	case ACER_WMID:
-		return sprintf(buf, "WMID\n");
-	default:
-		return sprintf(buf, "Error!\n");
-	}
-}
-
-static DEVICE_ATTR(interface, S_IRUGO, show_interface, NULL);
-
 static void acer_wmi_notify(u32 value, void *context)
 {
 	struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
@@ -1725,29 +1705,6 @@ static struct platform_driver acer_platform_driver = {
 
 static struct platform_device *acer_platform_device;
 
-static int remove_sysfs(struct platform_device *device)
-{
-	device_remove_file(&device->dev, &dev_attr_interface);
-
-	return 0;
-}
-
-static int create_sysfs(void)
-{
-	int retval = -ENOMEM;
-
-	retval = device_create_file(&acer_platform_device->dev,
-		&dev_attr_interface);
-	if (retval)
-		goto error_sysfs;
-
-	return 0;
-
-error_sysfs:
-		remove_sysfs(acer_platform_device);
-	return retval;
-}
-
 static void remove_debugfs(void)
 {
 	debugfs_remove(interface->debug.devices);
@@ -1791,11 +1748,15 @@ static int __init acer_wmi_init(void)
 	/*
 	 * Detect which ACPI-WMI interface we're using.
 	 */
-	if (wmi_has_guid(AMW0_GUID1) && wmi_has_guid(WMID_GUID1))
+	if (wmi_has_guid(AMW0_GUID1) && wmi_has_guid(WMID_GUID1)) {
+		pr_info("Using AMW0 v2 interface\n");
 		interface = &AMW0_V2_interface;
+	}
 
-	if (!wmi_has_guid(AMW0_GUID1) && wmi_has_guid(WMID_GUID1))
+	if (!wmi_has_guid(AMW0_GUID1) && wmi_has_guid(WMID_GUID1)) {
+		pr_info("Using WMID interface\n");
 		interface = &wmid_interface;
+	}
 
 	if (wmi_has_guid(WMID_GUID2) && interface) {
 		if (ACPI_FAILURE(WMID_set_capabilities())) {
@@ -1808,6 +1769,7 @@ static int __init acer_wmi_init(void)
 	}
 
 	if (wmi_has_guid(AMW0_GUID1) && !wmi_has_guid(WMID_GUID1)) {
+		pr_info("Using AMW0 interface\n");
 		interface = &AMW0_interface;
 
 		if (ACPI_FAILURE(AMW0_set_capabilities())) {
@@ -1868,10 +1830,6 @@ static int __init acer_wmi_init(void)
 	if (err)
 		goto error_device_add;
 
-	err = create_sysfs();
-	if (err)
-		goto error_create_sys;
-
 	if (wmi_has_guid(WMID_GUID2)) {
 		interface->debug.wmid_devices = get_wmid_devices();
 		err = create_debugfs();
@@ -1885,8 +1843,6 @@ static int __init acer_wmi_init(void)
 	return 0;
 
 error_create_debugfs:
-	remove_sysfs(acer_platform_device);
-error_create_sys:
 	platform_device_del(acer_platform_device);
 error_device_add:
 	platform_device_put(acer_platform_device);
@@ -1904,7 +1860,6 @@ static void __exit acer_wmi_exit(void)
 	if (wmi_has_guid(ACERWMID_EVENT_GUID))
 		acer_wmi_input_destroy();
 
-	remove_sysfs(acer_platform_device);
 	remove_debugfs();
 	platform_device_unregister(acer_platform_device);
 	platform_driver_unregister(&acer_platform_driver);
Signature · 1 line
1.6.0.2
#3 lore raw
In reply to Lee, Chun-Yi

I think that we should probably put these through a proper deprecation cycle. Can you document them in the deprecation listing and add some printks to tell people that they're going away, and then we'll drop them in a couple of releases?

Signature · 1 line
Matthew Garrett | [email protected]
#4 lore raw

Hi Matthew,

於 五,2011-05-27 於 17:30 +0100,Matthew Garrett 提到:

Quoted 5 lines

I think that we should probably put these through a proper deprecation cycle. Can you document them in the deprecation listing and add some printks to tell people that they're going away, and then we'll drop them in a couple of releases?

Got it!

Like the following patch?

Thank's
Joey Lee

From c9308632bd0b17005d3f6cd2eaf27e1d053f40fb Mon Sep 17 00:00:00 2001
From: Lee, Chun-Yi <[email protected]>
Date: Sat, 28 May 2011 09:02:41 +0800
Subject: [PATCH] acer-wmi: schedule threeg and interface sysfs for feature removal

we can now autodetect internal 3G device and already have the threeg rfkill device. So, we plan to remove threeg sysfs support for it's no longer necessary.

We also plan to remove interface sysfs file that exposed which ACPI-WMI interface that was used by acer-wmi driver. It will replaced by information log when acer-wmi initial.

We keep it around for userspace compatibility reasons, schedule removal in 2012.

---
 Documentation/feature-removal-schedule.txt |   13 +++++++++++++
 drivers/platform/x86/acer-wmi.c            |    3 +++
 2 files changed, 16 insertions(+), 0 deletions(-)
Documentation/feature-removal-schedule.txt +13 -0
index 492e81d..8427ad0 100644
@@ -580,3 +580,16 @@ Why:	These legacy callbacks should no longer be used as i2c-core offers
 Who:	Jean Delvare <[email protected]>
 
 ----------------------------
+
+What:   threeg and interface sysfs files in /sys/devices/platform/acer-wmi
+When:   2012
+Why:    In 2.6.40, we can now autodetect internal 3G device and already have
+	the threeg rfkill device. So, we plan to remove threeg sysfs support
+	for it's no longer necessary.
+
+	We also plan to remove interface sysfs file that exposed which ACPI-WMI
+	interface that was used by acer-wmi driver. It will replaced by
+	information log when acer-wmi initial.
+Who:    Lee, Chun-Yi <[email protected]>
+
+----------------------------
drivers/platform/x86/acer-wmi.c +3 -0
index 1495539..7e7e668 100644
@@ -1396,6 +1396,8 @@ static ssize_t show_bool_threeg(struct device *dev,
 {
 	u32 result; \
 	acpi_status status;
+
+	pr_info("This threeg sysfs will be removed in 2012.");
 	if (wmi_has_guid(WMID_GUID3))
 		status = wmid3_get_device_status(&result,
 				ACER_WMID3_GDS_THREEG);
@@ -1421,6 +1423,7 @@ static DEVICE_ATTR(threeg, S_IRUGO | S_IWUSR, show_bool_threeg,
 static ssize_t show_interface(struct device *dev, struct device_attribute *attr,
 	char *buf)
 {
+	pr_info("This interface sysfs will be removed in 2012.");
 	switch (interface->type) {
 	case ACER_AMW0:
 		return sprintf(buf, "AMW0\n");
Signature · 1 line
1.6.0.2