From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754833AbdCIMNj (ORCPT ); Thu, 9 Mar 2017 07:13:39 -0500 Received: from mail-lf0-f68.google.com ([209.85.215.68]:36756 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932195AbdCIMMs (ORCPT ); Thu, 9 Mar 2017 07:12:48 -0500 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= To: Harald Welte , Darren Hart , Andy Shevchenko Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 11/14] platform/x86: panasonic-laptop: remove sparse_keymap_free() calls Date: Thu, 9 Mar 2017 13:11:47 +0100 Message-Id: <20170309121150.10553-12-kernel@kempniu.pl> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170309121150.10553-1-kernel@kempniu.pl> References: <20170309121150.10553-1-kernel@kempniu.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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ń --- 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