mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Michał Kępień" <kernel@kempniu.pl>
To: "Matthew Garrett" <mjg59@srcf.ucam.org>,
	"Pali Rohár" <pali.rohar@gmail.com>,
	"Darren Hart" <dvhart@infradead.org>,
	"Andy Shevchenko" <andy@infradead.org>
Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 05/14] platform/x86: dell-wmi: remove sparse_keymap_free() calls
Date: Thu,  9 Mar 2017 13:11:41 +0100	[thread overview]
Message-ID: <20170309121150.10553-6-kernel@kempniu.pl> (raw)
In-Reply-To: <20170309121150.10553-1-kernel@kempniu.pl>

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

  parent reply	other threads:[~2017-03-09 12:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-09 12:11 [PATCH 00/14] platform/x86: " 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 ` [PATCH 03/14] platform/x86: asus-wmi: " Michał Kępień
2017-03-09 12:11 ` [PATCH 04/14] platform/x86: dell-wmi-aio: " Michał Kępień
2017-03-09 12:11 ` Michał Kępień [this message]
2017-03-09 12:11 ` [PATCH 06/14] platform/x86: eeepc-laptop: " Michał Kępień
2017-03-09 12:11 ` [PATCH 07/14] platform/x86: hp-wmi: " Michał Kępień
2017-03-09 12:11 ` [PATCH 08/14] platform/x86: ideapad-laptop: " Michał Kępień
2017-03-09 12:11 ` [PATCH 09/14] platform/x86: msi-laptop: " Michał Kępień
2017-03-09 12:11 ` [PATCH 10/14] platform/x86: msi-wmi: " Michał Kępień
2017-03-09 12:11 ` [PATCH 11/14] platform/x86: panasonic-laptop: " Michał Kępień
2017-03-09 12:11 ` [PATCH 12/14] platform/x86: topstar-laptop: " Michał Kępień
2017-03-09 12:11 ` [PATCH 13/14] platform/x86: toshiba-wmi: " 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

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=20170309121150.10553-6-kernel@kempniu.pl \
    --to=kernel@kempniu.pl \
    --cc=andy@infradead.org \
    --cc=dvhart@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=pali.rohar@gmail.com \
    --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

all inboxes | Powered by JetHome®