* [PATCH 01/14] platform/x86: acer-wmi: remove sparse_keymap_free() calls
2017-03-09 12:11 [PATCH 00/14] platform/x86: remove sparse_keymap_free() calls Michał Kępień
@ 2017-03-09 12:11 ` Michał Kępień
2017-03-09 12:11 ` [PATCH 02/14] platform/x86: asus-laptop: " Michał Kępień
` (13 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michał Kępień @ 2017-03-09 12:11 UTC (permalink / raw)
To: Lee, Chun-Yi, Darren Hart, Andy Shevchenko
Cc: platform-driver-x86, linux-kernel
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically. Remove all
calls to sparse_keymap_free().
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
---
drivers/platform/x86/acer-wmi.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index dac0fbe87460..8a27f0be1aec 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -1987,7 +1987,7 @@ static int __init acer_wmi_input_setup(void)
acer_wmi_notify, NULL);
if (ACPI_FAILURE(status)) {
err = -EIO;
- goto err_free_keymap;
+ goto err_free_dev;
}
err = input_register_device(acer_wmi_input_dev);
@@ -1998,8 +1998,6 @@ static int __init acer_wmi_input_setup(void)
err_uninstall_notifier:
wmi_remove_notify_handler(ACERWMID_EVENT_GUID);
-err_free_keymap:
- sparse_keymap_free(acer_wmi_input_dev);
err_free_dev:
input_free_device(acer_wmi_input_dev);
return err;
@@ -2008,7 +2006,6 @@ static int __init acer_wmi_input_setup(void)
static void acer_wmi_input_destroy(void)
{
wmi_remove_notify_handler(ACERWMID_EVENT_GUID);
- sparse_keymap_free(acer_wmi_input_dev);
input_unregister_device(acer_wmi_input_dev);
}
--
2.12.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 02/14] platform/x86: asus-laptop: remove sparse_keymap_free() calls
2017-03-09 12:11 [PATCH 00/14] platform/x86: remove sparse_keymap_free() calls Michał Kępień
2017-03-09 12:11 ` [PATCH 01/14] platform/x86: acer-wmi: " Michał Kępień
@ 2017-03-09 12:11 ` Michał Kępień
2017-03-09 12:11 ` [PATCH 03/14] platform/x86: asus-wmi: " Michał Kępień
` (12 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michał Kępień @ 2017-03-09 12:11 UTC (permalink / raw)
To: Corentin Chary, Darren Hart, Andy Shevchenko
Cc: acpi4asus-user, platform-driver-x86, linux-kernel
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically. Remove all
calls to sparse_keymap_free().
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
---
drivers/platform/x86/asus-laptop.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
index 28551f5a2e07..c4768be24ba9 100644
--- a/drivers/platform/x86/asus-laptop.c
+++ b/drivers/platform/x86/asus-laptop.c
@@ -1516,14 +1516,12 @@ static int asus_input_init(struct asus_laptop *asus)
error = input_register_device(input);
if (error) {
pr_warn("Unable to register input device\n");
- goto err_free_keymap;
+ goto err_free_dev;
}
asus->inputdev = input;
return 0;
-err_free_keymap:
- sparse_keymap_free(input);
err_free_dev:
input_free_device(input);
return error;
@@ -1531,10 +1529,8 @@ static int asus_input_init(struct asus_laptop *asus)
static void asus_input_exit(struct asus_laptop *asus)
{
- if (asus->inputdev) {
- sparse_keymap_free(asus->inputdev);
+ if (asus->inputdev)
input_unregister_device(asus->inputdev);
- }
asus->inputdev = NULL;
}
--
2.12.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 03/14] platform/x86: asus-wmi: remove sparse_keymap_free() calls
2017-03-09 12:11 [PATCH 00/14] platform/x86: remove sparse_keymap_free() calls Michał Kępień
2017-03-09 12:11 ` [PATCH 01/14] platform/x86: acer-wmi: " Michał Kępień
2017-03-09 12:11 ` [PATCH 02/14] platform/x86: asus-laptop: " Michał Kępień
@ 2017-03-09 12:11 ` Michał Kępień
2017-03-09 12:11 ` [PATCH 04/14] platform/x86: dell-wmi-aio: " Michał Kępień
` (11 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michał Kępień @ 2017-03-09 12:11 UTC (permalink / raw)
To: Corentin Chary, Darren Hart, Andy Shevchenko
Cc: acpi4asus-user, platform-driver-x86, linux-kernel
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically. Remove all
calls to sparse_keymap_free().
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
---
drivers/platform/x86/asus-wmi.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 8fe5890bf539..d817e6327fec 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -269,12 +269,10 @@ static int asus_wmi_input_init(struct asus_wmi *asus)
err = input_register_device(asus->inputdev);
if (err)
- goto err_free_keymap;
+ goto err_free_dev;
return 0;
-err_free_keymap:
- sparse_keymap_free(asus->inputdev);
err_free_dev:
input_free_device(asus->inputdev);
return err;
@@ -282,10 +280,8 @@ static int asus_wmi_input_init(struct asus_wmi *asus)
static void asus_wmi_input_exit(struct asus_wmi *asus)
{
- if (asus->inputdev) {
- sparse_keymap_free(asus->inputdev);
+ if (asus->inputdev)
input_unregister_device(asus->inputdev);
- }
asus->inputdev = NULL;
}
--
2.12.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 04/14] platform/x86: dell-wmi-aio: remove sparse_keymap_free() calls
2017-03-09 12:11 [PATCH 00/14] platform/x86: remove sparse_keymap_free() calls Michał Kępień
` (2 preceding siblings ...)
2017-03-09 12:11 ` [PATCH 03/14] platform/x86: asus-wmi: " Michał Kępień
@ 2017-03-09 12:11 ` Michał Kępień
2017-03-09 12:11 ` [PATCH 05/14] platform/x86: dell-wmi: " Michał Kępień
` (10 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michał Kępień @ 2017-03-09 12:11 UTC (permalink / raw)
To: Darren Hart, Andy Shevchenko; +Cc: platform-driver-x86, linux-kernel
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically. Remove all
calls to sparse_keymap_free().
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
---
drivers/platform/x86/dell-wmi-aio.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/platform/x86/dell-wmi-aio.c b/drivers/platform/x86/dell-wmi-aio.c
index dbc97a33bbc8..50c2078715d6 100644
--- a/drivers/platform/x86/dell-wmi-aio.c
+++ b/drivers/platform/x86/dell-wmi-aio.c
@@ -152,12 +152,10 @@ static int __init dell_wmi_aio_input_setup(void)
err = input_register_device(dell_wmi_aio_input_dev);
if (err) {
pr_info("Unable to register input device\n");
- goto err_free_keymap;
+ goto err_free_dev;
}
return 0;
-err_free_keymap:
- sparse_keymap_free(dell_wmi_aio_input_dev);
err_free_dev:
input_free_device(dell_wmi_aio_input_dev);
return err;
@@ -192,7 +190,6 @@ static int __init dell_wmi_aio_init(void)
err = wmi_install_notify_handler(guid, dell_wmi_aio_notify, NULL);
if (err) {
pr_err("Unable to register notify handler - %d\n", err);
- sparse_keymap_free(dell_wmi_aio_input_dev);
input_unregister_device(dell_wmi_aio_input_dev);
return err;
}
@@ -206,7 +203,6 @@ static void __exit dell_wmi_aio_exit(void)
guid = dell_wmi_aio_find();
wmi_remove_notify_handler(guid);
- sparse_keymap_free(dell_wmi_aio_input_dev);
input_unregister_device(dell_wmi_aio_input_dev);
}
--
2.12.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 05/14] platform/x86: dell-wmi: remove sparse_keymap_free() calls
2017-03-09 12:11 [PATCH 00/14] platform/x86: remove sparse_keymap_free() calls Michał Kępień
` (3 preceding siblings ...)
2017-03-09 12:11 ` [PATCH 04/14] platform/x86: dell-wmi-aio: " Michał Kępień
@ 2017-03-09 12:11 ` Michał Kępień
2017-03-09 12:11 ` [PATCH 06/14] platform/x86: eeepc-laptop: " Michał Kępień
` (9 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michał Kępień @ 2017-03-09 12:11 UTC (permalink / raw)
To: Matthew Garrett, Pali Rohár, Darren Hart, Andy Shevchenko
Cc: platform-driver-x86, linux-kernel
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically. Remove all
calls to sparse_keymap_free().
As this reduces dell_wmi_input_destroy() to one line, replace all calls
to that function with direct calls to input_unregister_device().
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
---
drivers/platform/x86/dell-wmi.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
index 75e637047d36..d921b26267e9 100644
--- a/drivers/platform/x86/dell-wmi.c
+++ b/drivers/platform/x86/dell-wmi.c
@@ -603,23 +603,15 @@ static int __init dell_wmi_input_setup(void)
err = input_register_device(dell_wmi_input_dev);
if (err)
- goto err_free_keymap;
+ goto err_free_dev;
return 0;
- err_free_keymap:
- sparse_keymap_free(dell_wmi_input_dev);
err_free_dev:
input_free_device(dell_wmi_input_dev);
return err;
}
-static void dell_wmi_input_destroy(void)
-{
- sparse_keymap_free(dell_wmi_input_dev);
- input_unregister_device(dell_wmi_input_dev);
-}
-
/*
* Descriptor buffer is 128 byte long and contains:
*
@@ -740,7 +732,7 @@ static int __init dell_wmi_init(void)
status = wmi_install_notify_handler(DELL_EVENT_GUID,
dell_wmi_notify, NULL);
if (ACPI_FAILURE(status)) {
- dell_wmi_input_destroy();
+ input_unregister_device(dell_wmi_input_dev);
pr_err("Unable to register notify handler - %d\n", status);
return -ENODEV;
}
@@ -752,7 +744,7 @@ static int __init dell_wmi_init(void)
if (err) {
pr_err("Failed to enable WMI events\n");
wmi_remove_notify_handler(DELL_EVENT_GUID);
- dell_wmi_input_destroy();
+ input_unregister_device(dell_wmi_input_dev);
return err;
}
}
@@ -766,6 +758,6 @@ static void __exit dell_wmi_exit(void)
if (wmi_requires_smbios_request)
dell_wmi_events_set_enabled(false);
wmi_remove_notify_handler(DELL_EVENT_GUID);
- dell_wmi_input_destroy();
+ input_unregister_device(dell_wmi_input_dev);
}
module_exit(dell_wmi_exit);
--
2.12.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 06/14] platform/x86: eeepc-laptop: remove sparse_keymap_free() calls
2017-03-09 12:11 [PATCH 00/14] platform/x86: remove sparse_keymap_free() calls Michał Kępień
` (4 preceding siblings ...)
2017-03-09 12:11 ` [PATCH 05/14] platform/x86: dell-wmi: " Michał Kępień
@ 2017-03-09 12:11 ` Michał Kępień
2017-03-09 12:11 ` [PATCH 07/14] platform/x86: hp-wmi: " Michał Kępień
` (8 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michał Kępień @ 2017-03-09 12:11 UTC (permalink / raw)
To: Corentin Chary, Darren Hart, Andy Shevchenko
Cc: acpi4asus-user, platform-driver-x86, linux-kernel
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically. Remove all
calls to sparse_keymap_free().
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
---
drivers/platform/x86/eeepc-laptop.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index 8cdf315f9730..6f11c51b7e60 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -1205,14 +1205,12 @@ static int eeepc_input_init(struct eeepc_laptop *eeepc)
error = input_register_device(input);
if (error) {
pr_err("Unable to register input device\n");
- goto err_free_keymap;
+ goto err_free_dev;
}
eeepc->inputdev = input;
return 0;
-err_free_keymap:
- sparse_keymap_free(input);
err_free_dev:
input_free_device(input);
return error;
@@ -1220,10 +1218,8 @@ static int eeepc_input_init(struct eeepc_laptop *eeepc)
static void eeepc_input_exit(struct eeepc_laptop *eeepc)
{
- if (eeepc->inputdev) {
- sparse_keymap_free(eeepc->inputdev);
+ if (eeepc->inputdev)
input_unregister_device(eeepc->inputdev);
- }
eeepc->inputdev = NULL;
}
--
2.12.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 07/14] platform/x86: hp-wmi: remove sparse_keymap_free() calls
2017-03-09 12:11 [PATCH 00/14] platform/x86: remove sparse_keymap_free() calls Michał Kępień
` (5 preceding siblings ...)
2017-03-09 12:11 ` [PATCH 06/14] platform/x86: eeepc-laptop: " Michał Kępień
@ 2017-03-09 12:11 ` Michał Kępień
2017-03-09 12:11 ` [PATCH 08/14] platform/x86: ideapad-laptop: " Michał Kępień
` (7 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michał Kępień @ 2017-03-09 12:11 UTC (permalink / raw)
To: Darren Hart, Andy Shevchenko; +Cc: platform-driver-x86, linux-kernel
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically. Remove all
calls to sparse_keymap_free().
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
---
drivers/platform/x86/hp-wmi.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 96ffda493266..7abf92d0ba81 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -673,7 +673,7 @@ static int __init hp_wmi_input_setup(void)
status = wmi_install_notify_handler(HPWMI_EVENT_GUID, hp_wmi_notify, NULL);
if (ACPI_FAILURE(status)) {
err = -EIO;
- goto err_free_keymap;
+ goto err_free_dev;
}
err = input_register_device(hp_wmi_input_dev);
@@ -684,8 +684,6 @@ static int __init hp_wmi_input_setup(void)
err_uninstall_notifier:
wmi_remove_notify_handler(HPWMI_EVENT_GUID);
- err_free_keymap:
- sparse_keymap_free(hp_wmi_input_dev);
err_free_dev:
input_free_device(hp_wmi_input_dev);
return err;
@@ -694,7 +692,6 @@ static int __init hp_wmi_input_setup(void)
static void hp_wmi_input_destroy(void)
{
wmi_remove_notify_handler(HPWMI_EVENT_GUID);
- sparse_keymap_free(hp_wmi_input_dev);
input_unregister_device(hp_wmi_input_dev);
}
--
2.12.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 08/14] platform/x86: ideapad-laptop: remove sparse_keymap_free() calls
2017-03-09 12:11 [PATCH 00/14] platform/x86: remove sparse_keymap_free() calls Michał Kępień
` (6 preceding siblings ...)
2017-03-09 12:11 ` [PATCH 07/14] platform/x86: hp-wmi: " Michał Kępień
@ 2017-03-09 12:11 ` Michał Kępień
2017-03-09 12:11 ` [PATCH 09/14] platform/x86: msi-laptop: " Michał Kępień
` (6 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michał Kępień @ 2017-03-09 12:11 UTC (permalink / raw)
To: Ike Panhc, Darren Hart, Andy Shevchenko; +Cc: platform-driver-x86, linux-kernel
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically. Remove all
calls to sparse_keymap_free().
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
---
drivers/platform/x86/ideapad-laptop.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index f46ece2ce3c4..f64faa00c83a 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -604,14 +604,12 @@ static int ideapad_input_init(struct ideapad_private *priv)
error = input_register_device(inputdev);
if (error) {
pr_err("Unable to register input device\n");
- goto err_free_keymap;
+ goto err_free_dev;
}
priv->inputdev = inputdev;
return 0;
-err_free_keymap:
- sparse_keymap_free(inputdev);
err_free_dev:
input_free_device(inputdev);
return error;
@@ -619,7 +617,6 @@ static int ideapad_input_init(struct ideapad_private *priv)
static void ideapad_input_exit(struct ideapad_private *priv)
{
- sparse_keymap_free(priv->inputdev);
input_unregister_device(priv->inputdev);
priv->inputdev = NULL;
}
--
2.12.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 09/14] platform/x86: msi-laptop: remove sparse_keymap_free() calls
2017-03-09 12:11 [PATCH 00/14] platform/x86: remove sparse_keymap_free() calls Michał Kępień
` (7 preceding siblings ...)
2017-03-09 12:11 ` [PATCH 08/14] platform/x86: ideapad-laptop: " Michał Kępień
@ 2017-03-09 12:11 ` Michał Kępień
2017-03-09 12:11 ` [PATCH 10/14] platform/x86: msi-wmi: " Michał Kępień
` (5 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michał Kępień @ 2017-03-09 12:11 UTC (permalink / raw)
To: Lee, Chun-Yi, Darren Hart, Andy Shevchenko
Cc: platform-driver-x86, linux-kernel
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically. Remove all
calls to sparse_keymap_free().
As this reduces msi_laptop_input_destroy() to one line, replace all
calls to that function with direct calls to input_unregister_device().
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
---
drivers/platform/x86/msi-laptop.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c
index 42317704629d..9e90827c176a 100644
--- a/drivers/platform/x86/msi-laptop.c
+++ b/drivers/platform/x86/msi-laptop.c
@@ -976,23 +976,15 @@ static int __init msi_laptop_input_setup(void)
err = input_register_device(msi_laptop_input_dev);
if (err)
- goto err_free_keymap;
+ goto err_free_dev;
return 0;
-err_free_keymap:
- sparse_keymap_free(msi_laptop_input_dev);
err_free_dev:
input_free_device(msi_laptop_input_dev);
return err;
}
-static void msi_laptop_input_destroy(void)
-{
- sparse_keymap_free(msi_laptop_input_dev);
- input_unregister_device(msi_laptop_input_dev);
-}
-
static int __init load_scm_model_init(struct platform_device *sdev)
{
u8 data;
@@ -1037,7 +1029,7 @@ static int __init load_scm_model_init(struct platform_device *sdev)
return 0;
fail_filter:
- msi_laptop_input_destroy();
+ input_unregister_device(msi_laptop_input_dev);
fail_input:
rfkill_cleanup();
@@ -1158,7 +1150,7 @@ static void __exit msi_cleanup(void)
{
if (quirks->load_scm_model) {
i8042_remove_filter(msi_laptop_i8042_filter);
- msi_laptop_input_destroy();
+ input_unregister_device(msi_laptop_input_dev);
cancel_delayed_work_sync(&msi_rfkill_dwork);
cancel_work_sync(&msi_rfkill_work);
rfkill_cleanup();
--
2.12.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 10/14] platform/x86: msi-wmi: remove sparse_keymap_free() calls
2017-03-09 12:11 [PATCH 00/14] platform/x86: remove sparse_keymap_free() calls Michał Kępień
` (8 preceding siblings ...)
2017-03-09 12:11 ` [PATCH 09/14] platform/x86: msi-laptop: " Michał Kępień
@ 2017-03-09 12:11 ` Michał Kępień
2017-03-09 12:11 ` [PATCH 11/14] platform/x86: panasonic-laptop: " Michał Kępień
` (4 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michał Kępień @ 2017-03-09 12:11 UTC (permalink / raw)
To: Darren Hart, Andy Shevchenko; +Cc: platform-driver-x86, linux-kernel
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically. Remove all
calls to sparse_keymap_free().
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
---
drivers/platform/x86/msi-wmi.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/platform/x86/msi-wmi.c b/drivers/platform/x86/msi-wmi.c
index 9a32f8627ecc..f6209b739ec0 100644
--- a/drivers/platform/x86/msi-wmi.c
+++ b/drivers/platform/x86/msi-wmi.c
@@ -281,14 +281,12 @@ static int __init msi_wmi_input_setup(void)
err = input_register_device(msi_wmi_input_dev);
if (err)
- goto err_free_keymap;
+ goto err_free_dev;
last_pressed = 0;
return 0;
-err_free_keymap:
- sparse_keymap_free(msi_wmi_input_dev);
err_free_dev:
input_free_device(msi_wmi_input_dev);
return err;
@@ -342,10 +340,8 @@ static int __init msi_wmi_init(void)
if (event_wmi)
wmi_remove_notify_handler(event_wmi->guid);
err_free_input:
- if (event_wmi) {
- sparse_keymap_free(msi_wmi_input_dev);
+ if (event_wmi)
input_unregister_device(msi_wmi_input_dev);
- }
return err;
}
@@ -353,7 +349,6 @@ static void __exit msi_wmi_exit(void)
{
if (event_wmi) {
wmi_remove_notify_handler(event_wmi->guid);
- sparse_keymap_free(msi_wmi_input_dev);
input_unregister_device(msi_wmi_input_dev);
}
backlight_device_unregister(backlight);
--
2.12.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 11/14] platform/x86: panasonic-laptop: remove sparse_keymap_free() calls
2017-03-09 12:11 [PATCH 00/14] platform/x86: remove sparse_keymap_free() calls Michał Kępień
` (9 preceding siblings ...)
2017-03-09 12:11 ` [PATCH 10/14] platform/x86: msi-wmi: " Michał Kępień
@ 2017-03-09 12:11 ` Michał Kępień
2017-03-09 12:11 ` [PATCH 12/14] platform/x86: topstar-laptop: " Michał Kępień
` (3 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michał Kępień @ 2017-03-09 12:11 UTC (permalink / raw)
To: Harald Welte, Darren Hart, Andy Shevchenko
Cc: platform-driver-x86, linux-kernel
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically. Remove all
calls to sparse_keymap_free().
As this reduces acpi_pcc_destroy_input() to one line, replace all calls
to that function with direct calls to input_unregister_device().
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
---
drivers/platform/x86/panasonic-laptop.c | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index 59b8eb626dcc..975f4e100dbd 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -520,29 +520,17 @@ static int acpi_pcc_init_input(struct pcc_acpi *pcc)
if (error) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unable to register input device\n"));
- goto err_free_keymap;
+ goto err_free_dev;
}
pcc->input_dev = input_dev;
return 0;
- err_free_keymap:
- sparse_keymap_free(input_dev);
err_free_dev:
input_free_device(input_dev);
return error;
}
-static void acpi_pcc_destroy_input(struct pcc_acpi *pcc)
-{
- sparse_keymap_free(pcc->input_dev);
- input_unregister_device(pcc->input_dev);
- /*
- * No need to input_free_device() since core input API refcounts
- * and free()s the device.
- */
-}
-
/* kernel module interface */
#ifdef CONFIG_PM_SLEEP
@@ -640,7 +628,7 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
out_backlight:
backlight_device_unregister(pcc->backlight);
out_input:
- acpi_pcc_destroy_input(pcc);
+ input_unregister_device(pcc->input_dev);
out_sinf:
kfree(pcc->sinf);
out_hotkey:
@@ -660,7 +648,7 @@ static int acpi_pcc_hotkey_remove(struct acpi_device *device)
backlight_device_unregister(pcc->backlight);
- acpi_pcc_destroy_input(pcc);
+ input_unregister_device(pcc->input_dev);
kfree(pcc->sinf);
kfree(pcc);
--
2.12.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 12/14] platform/x86: topstar-laptop: remove sparse_keymap_free() calls
2017-03-09 12:11 [PATCH 00/14] platform/x86: remove sparse_keymap_free() calls Michał Kępień
` (10 preceding siblings ...)
2017-03-09 12:11 ` [PATCH 11/14] platform/x86: panasonic-laptop: " Michał Kępień
@ 2017-03-09 12:11 ` Michał Kępień
2017-03-09 12:11 ` [PATCH 13/14] platform/x86: toshiba-wmi: " Michał Kępień
` (2 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michał Kępień @ 2017-03-09 12:11 UTC (permalink / raw)
To: Herton Ronaldo Krzesinski, Darren Hart, Andy Shevchenko
Cc: platform-driver-x86, linux-kernel
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically. Remove all
calls to sparse_keymap_free().
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
---
drivers/platform/x86/topstar-laptop.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/platform/x86/topstar-laptop.c b/drivers/platform/x86/topstar-laptop.c
index e597de05e6c2..70205d222da9 100644
--- a/drivers/platform/x86/topstar-laptop.c
+++ b/drivers/platform/x86/topstar-laptop.c
@@ -113,14 +113,12 @@ static int acpi_topstar_init_hkey(struct topstar_hkey *hkey)
error = input_register_device(input);
if (error) {
pr_err("Unable to register input device\n");
- goto err_free_keymap;
+ goto err_free_dev;
}
hkey->inputdev = input;
return 0;
- err_free_keymap:
- sparse_keymap_free(input);
err_free_dev:
input_free_device(input);
return error;
@@ -157,7 +155,6 @@ static int acpi_topstar_remove(struct acpi_device *device)
acpi_topstar_fncx_switch(device, false);
- sparse_keymap_free(tps_hkey->inputdev);
input_unregister_device(tps_hkey->inputdev);
kfree(tps_hkey);
--
2.12.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 13/14] platform/x86: toshiba-wmi: remove sparse_keymap_free() calls
2017-03-09 12:11 [PATCH 00/14] platform/x86: remove sparse_keymap_free() calls Michał Kępień
` (11 preceding siblings ...)
2017-03-09 12:11 ` [PATCH 12/14] platform/x86: topstar-laptop: " Michał Kępień
@ 2017-03-09 12:11 ` Michał Kępień
2017-03-09 12:11 ` [PATCH 14/14] platform/x86: toshiba_acpi: " Michał Kępień
2017-03-13 16:11 ` [PATCH 00/14] platform/x86: " Andy Shevchenko
14 siblings, 0 replies; 16+ messages in thread
From: Michał Kępień @ 2017-03-09 12:11 UTC (permalink / raw)
To: Azael Avalos, Darren Hart, Andy Shevchenko
Cc: platform-driver-x86, linux-kernel
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically. Remove all
calls to sparse_keymap_free().
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
---
drivers/platform/x86/toshiba-wmi.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/platform/x86/toshiba-wmi.c b/drivers/platform/x86/toshiba-wmi.c
index 2df07ee8f3c3..440528676170 100644
--- a/drivers/platform/x86/toshiba-wmi.c
+++ b/drivers/platform/x86/toshiba-wmi.c
@@ -96,7 +96,7 @@ static int __init toshiba_wmi_input_setup(void)
toshiba_wmi_notify, NULL);
if (ACPI_FAILURE(status)) {
err = -EIO;
- goto err_free_keymap;
+ goto err_free_dev;
}
err = input_register_device(toshiba_wmi_input_dev);
@@ -107,8 +107,6 @@ static int __init toshiba_wmi_input_setup(void)
err_remove_notifier:
wmi_remove_notify_handler(WMI_EVENT_GUID);
- err_free_keymap:
- sparse_keymap_free(toshiba_wmi_input_dev);
err_free_dev:
input_free_device(toshiba_wmi_input_dev);
return err;
@@ -117,7 +115,6 @@ static int __init toshiba_wmi_input_setup(void)
static void toshiba_wmi_input_destroy(void)
{
wmi_remove_notify_handler(WMI_EVENT_GUID);
- sparse_keymap_free(toshiba_wmi_input_dev);
input_unregister_device(toshiba_wmi_input_dev);
}
--
2.12.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 14/14] platform/x86: toshiba_acpi: remove sparse_keymap_free() calls
2017-03-09 12:11 [PATCH 00/14] platform/x86: remove sparse_keymap_free() calls Michał Kępień
` (12 preceding siblings ...)
2017-03-09 12:11 ` [PATCH 13/14] platform/x86: toshiba-wmi: " Michał Kępień
@ 2017-03-09 12:11 ` Michał Kępień
2017-03-13 16:11 ` [PATCH 00/14] platform/x86: " Andy Shevchenko
14 siblings, 0 replies; 16+ messages in thread
From: Michał Kępień @ 2017-03-09 12:11 UTC (permalink / raw)
To: Azael Avalos, Darren Hart, Andy Shevchenko
Cc: platform-driver-x86, linux-kernel
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically. Remove all
calls to sparse_keymap_free().
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
---
drivers/platform/x86/toshiba_acpi.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 074bf2fa1c55..d0daf75cbed1 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -2849,7 +2849,7 @@ static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev)
error = i8042_install_filter(toshiba_acpi_i8042_filter);
if (error) {
pr_err("Error installing key filter\n");
- goto err_free_keymap;
+ goto err_free_dev;
}
dev->ntfy_supported = 1;
@@ -2880,8 +2880,6 @@ static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev)
err_remove_filter:
if (dev->ntfy_supported)
i8042_remove_filter(toshiba_acpi_i8042_filter);
- err_free_keymap:
- sparse_keymap_free(dev->hotkey_dev);
err_free_dev:
input_free_device(dev->hotkey_dev);
dev->hotkey_dev = NULL;
@@ -3018,10 +3016,8 @@ static int toshiba_acpi_remove(struct acpi_device *acpi_dev)
cancel_work_sync(&dev->hotkey_work);
}
- if (dev->hotkey_dev) {
+ if (dev->hotkey_dev)
input_unregister_device(dev->hotkey_dev);
- sparse_keymap_free(dev->hotkey_dev);
- }
backlight_device_unregister(dev->backlight_dev);
--
2.12.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 00/14] platform/x86: remove sparse_keymap_free() calls
2017-03-09 12:11 [PATCH 00/14] platform/x86: remove sparse_keymap_free() calls Michał Kępień
` (13 preceding siblings ...)
2017-03-09 12:11 ` [PATCH 14/14] platform/x86: toshiba_acpi: " Michał Kępień
@ 2017-03-13 16:11 ` Andy Shevchenko
14 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2017-03-13 16:11 UTC (permalink / raw)
To: Michał Kępień
Cc: Andy Shevchenko, Azael Avalos, Corentin Chary, Darren Hart,
Harald Welte, Herton Ronaldo Krzesinski, Ike Panhc, Lee, Chun-Yi,
Matthew Garrett, Pali Rohár, acpi4asus-user,
Platform Driver, linux-kernel
On Thu, Mar 9, 2017 at 2:11 PM, Michał Kępień <kernel@kempniu.pl> wrote:
> Hi everyone,
>
> This patch series removes all uses of sparse_keymap_free() in the x86
> platform driver subsystem due to an upcoming change in
> sparse_keymap_setup() behavior wrt memory management. Specifically,
> sparse_keymap_setup() will use managed memory for the keymap copy it
> creates, which enables it to be automatically freed upon input device
> removal, without the need to explicitly call sparse_keymap_free().
>
> I thought it makes sense to post all these patches as a single series.
> To minimize spamming, only this cover letter is addressed to all the
> maintainers whose drivers are affected by this series, while each of the
> subsequent patches will only be sent to the relevant recipients, plus
> the platform-driver-x86 mailing list and subsystem maintainers.
>
> Darren, Andy, all these patches should only be applied after merging an
> immutable branch called ib/4.10-sparse-keymap-managed from Dmitry
> Torokhov's git tree.
Pushed to testing.
If anyone has objections, please tell me as soon as possible (though
we have still time to remove / revert changes which I hope not the
case here).
> drivers/platform/x86/acer-wmi.c | 5 +----
> drivers/platform/x86/asus-laptop.c | 8 ++------
> drivers/platform/x86/asus-wmi.c | 8 ++------
> drivers/platform/x86/dell-wmi-aio.c | 6 +-----
> drivers/platform/x86/dell-wmi.c | 16 ++++------------
> drivers/platform/x86/eeepc-laptop.c | 8 ++------
> drivers/platform/x86/hp-wmi.c | 5 +----
> drivers/platform/x86/ideapad-laptop.c | 5 +----
> drivers/platform/x86/msi-laptop.c | 14 +++-----------
> drivers/platform/x86/msi-wmi.c | 9 ++-------
> drivers/platform/x86/panasonic-laptop.c | 18 +++---------------
> drivers/platform/x86/topstar-laptop.c | 5 +----
> drivers/platform/x86/toshiba-wmi.c | 5 +----
> drivers/platform/x86/toshiba_acpi.c | 8 ++------
> 14 files changed, 26 insertions(+), 94 deletions(-)
>
> --
> 2.12.0
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 16+ messages in thread