From patchwork Sat Jan 21 18:46:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 9530609 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0BD7D6046E for ; Sat, 21 Jan 2017 18:48:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F12DE283BC for ; Sat, 21 Jan 2017 18:48:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E637B283EF; Sat, 21 Jan 2017 18:48:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66056283F9 for ; Sat, 21 Jan 2017 18:48:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751399AbdAUSs3 (ORCPT ); Sat, 21 Jan 2017 13:48:29 -0500 Received: from bh-25.webhostbox.net ([208.91.199.152]:50850 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751586AbdAUSs0 (ORCPT ); Sat, 21 Jan 2017 13:48:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=References:In-Reply-To:Message-Id:Date:Subject: Cc:To:From; bh=I+s27ygJlXD8a16eoDIdkiirBnopPju7BNVR1fVoW/k=; b=eggLWW09TrINIh AL/8KsiE4JXy2fWkp8jXWikEKTS9oeQOZdg45iWr5GggaxE/dk20wabEz0frOJ1Z4pa7Z2jCOsyGN f8uR/Z/UuTRUuNFLInRr8I+nEetVuqkQ0O5aE2in6T38ENd8iEYFNWnlGupGKYRBV6Wr5XMLXHStV BarkXZkivHjoKZUrjetMkPJ9r0b4c8VZ984w1lacRFnPk3yJXKRSzKFlpvO/KFGbg+PbM1FV9Xu+4 W5qP8uuxcg9irluuBXaz69VsEkAC4lYRVSgcE57h02tZqO4DdZdHcDngeOHOsMSWmW4Y/t2qU7iWJ zMWyTyKUdwKs0pwA6azA==; Received: from 108-223-40-66.lightspeed.sntcca.sbcglobal.net ([108.223.40.66]:48096 helo=localhost) by bh-25.webhostbox.net with esmtpa (Exim 4.86_1) (envelope-from ) id 1cV0i3-001vKV-5Y; Sat, 21 Jan 2017 18:48:19 +0000 From: Guenter Roeck To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck , Arnd Bergmann , Geert Uytterhoeven , Linus Walleij , Sudeep Holla Subject: [PATCH 09/13] Input: keyboard - drop unnecessary calls to device_init_wakeup Date: Sat, 21 Jan 2017 10:46:01 -0800 Message-Id: <1485024365-3368-10-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1485024365-3368-1-git-send-email-linux@roeck-us.net> References: <1485024365-3368-1-git-send-email-linux@roeck-us.net> X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Calling device_init_wakeup in the remove function is unnecessary since the device is going away, and thus won't be able to cause any wakeups under any circumstances. Besides, the driver cleanup code already handles the necessary cleanup. Similar, disabling wakeup in the probe error path is unnecessary, as is disabling wakeup in the probe function in the first place. Changes were done automatically using the following coccinelle script. @probe@ identifier p, probefn; declarer name module_platform_driver_probe; position pos; @@ ( module_platform_driver_probe(p, probefn@pos); | struct platform_driver p = { .probe = probefn@pos, }; | struct i2c_driver p = { .probe = probefn@pos, }; | struct spi_driver p = { .probe = probefn@pos, }; ) @remove@ identifier p, removefn; @@ struct ( platform_driver | i2c_driver | spi_driver | hv_driver ) p = { .remove = \(__exit_p(removefn)\|removefn\), }; @depends on remove@ identifier remove.removefn; @@ removefn(...) { <+... - device_init_wakeup(...); ...+> } @depends on probe@ identifier probe.probefn; expression dev; @@ probefn(...) { <+... - device_init_wakeup(..., \(false\|0\)); ...+> } Signed-off-by: Guenter Roeck --- drivers/input/keyboard/gpio_keys.c | 2 -- drivers/input/keyboard/matrix_keypad.c | 2 -- drivers/input/keyboard/omap4-keypad.c | 3 --- drivers/input/keyboard/samsung-keypad.c | 2 -- drivers/input/keyboard/spear-keyboard.c | 2 -- 5 files changed, 11 deletions(-) diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 0da10ab34368..e5bc04e90601 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -829,8 +829,6 @@ static int gpio_keys_remove(struct platform_device *pdev) { sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group); - device_init_wakeup(&pdev->dev, 0); - return 0; } diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c index 7f12b6579f82..18839cd5f76e 100644 --- a/drivers/input/keyboard/matrix_keypad.c +++ b/drivers/input/keyboard/matrix_keypad.c @@ -545,8 +545,6 @@ static int matrix_keypad_remove(struct platform_device *pdev) { struct matrix_keypad *keypad = platform_get_drvdata(pdev); - device_init_wakeup(&pdev->dev, 0); - matrix_keypad_free_gpio(keypad); input_unregister_device(keypad->input_dev); kfree(keypad); diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c index 6639b2b8528a..9ecb16701b13 100644 --- a/drivers/input/keyboard/omap4-keypad.c +++ b/drivers/input/keyboard/omap4-keypad.c @@ -375,7 +375,6 @@ static int omap4_keypad_probe(struct platform_device *pdev) err_pm_disable: pm_runtime_disable(&pdev->dev); - device_init_wakeup(&pdev->dev, false); free_irq(keypad_data->irq, keypad_data); err_free_keymap: kfree(keypad_data->keymap); @@ -401,8 +400,6 @@ static int omap4_keypad_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); - device_init_wakeup(&pdev->dev, false); - input_unregister_device(keypad_data->input); iounmap(keypad_data->base); diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c index 4e319eb9e19d..316414465c77 100644 --- a/drivers/input/keyboard/samsung-keypad.c +++ b/drivers/input/keyboard/samsung-keypad.c @@ -445,7 +445,6 @@ static int samsung_keypad_probe(struct platform_device *pdev) err_disable_runtime_pm: pm_runtime_disable(&pdev->dev); - device_init_wakeup(&pdev->dev, 0); err_unprepare_clk: clk_unprepare(keypad->clk); return error; @@ -456,7 +455,6 @@ static int samsung_keypad_remove(struct platform_device *pdev) struct samsung_keypad *keypad = platform_get_drvdata(pdev); pm_runtime_disable(&pdev->dev); - device_init_wakeup(&pdev->dev, 0); input_unregister_device(keypad->input_dev); diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c index 8083eaa0524a..7d25fa338ab4 100644 --- a/drivers/input/keyboard/spear-keyboard.c +++ b/drivers/input/keyboard/spear-keyboard.c @@ -283,8 +283,6 @@ static int spear_kbd_remove(struct platform_device *pdev) input_unregister_device(kbd->input); clk_unprepare(kbd->clk); - device_init_wakeup(&pdev->dev, 0); - return 0; }