From patchwork Mon Jul 8 12:33:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuqian Huang X-Patchwork-Id: 11034957 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8862013B1 for ; Mon, 8 Jul 2019 12:33:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79ABF285EC for ; Mon, 8 Jul 2019 12:33:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C541285E5; Mon, 8 Jul 2019 12:33:33 +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.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB autolearn=ham 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 07249285B3 for ; Mon, 8 Jul 2019 12:33:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730716AbfGHMdc (ORCPT ); Mon, 8 Jul 2019 08:33:32 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:33868 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727373AbfGHMdc (ORCPT ); Mon, 8 Jul 2019 08:33:32 -0400 Received: by mail-pl1-f196.google.com with SMTP id i2so8218054plt.1; Mon, 08 Jul 2019 05:33:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=KBezzKXC+quBmYtuOLs/KQOhhcAej9/sFp0EhMpVed4=; b=lbiuTy4NTNKv7+lo/RiO5xjrasMyJSle7JXu4HwcBCnmxVuYZm1ZKinniHnW7atbW/ F4go8xH1I+droR2rm3k4ju1BcKA10vQxv23tCsaBNROc6sjh0Qa6grNQe5sBhO+p87pX 4Fgtxg4RXC5sTlTyPpSd09lGUcY9ebXKXpO8PzCNUiQWpkh9jVB71kfNSQoEUi7UxZ4f e7UG0BJpIQdE/Ix2ghhZ+EoIIqWmxVVtNbNhqaeLpkqP3kMq4QicPL5K0Kuh8TvyQlbH FGSuXotNb2lUABwbMEPSWhp474/U5pzXb4ehG7oyrSvvYFDvvkRHQLGtjgPwU6N++5aH y37w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=KBezzKXC+quBmYtuOLs/KQOhhcAej9/sFp0EhMpVed4=; b=mmFRkMvll1dWzjbQ3+wKjQRcloNiLisxD92ulyJIz2CUzSj6hxEOrI/4iD5BvJ8Nbh A9Udqx8VAsD7Hl6qC+u/oGHdUHaV8tcW/RPE0rv+/ZC/h9UYBZG1lrszTsfo4JYLXLxw lJhewPMkEUm0fQPBBX8MRDsV8h21ieOuLlnjE/IoYpcj3LLUhmXtl/d7tUPt8VLY7CVV nZ0Kr0r3xx+EQR9gCwMEF9nXC+/bO0jdjqLAhRoAzlOrPHRUxWMB340y7ROIYYDaV8/k t8ADNztnM8RhXRAEWhmKJNS1zutpi2dO/ETnELCO54FaKASe/rNfqzKMrVOrB/46Hfp7 /Sbg== X-Gm-Message-State: APjAAAVXSgB8PB4ydidN5jmOn41XCJREMcCESIz5u98CpiEZwAGDnlqq 9bhtHx3wsEix+4ykeoo7b7U= X-Google-Smtp-Source: APXvYqwAEbLV7qkevKSnyycTL/ijhsv7uxN4JSwyzV/xBJqGacY6oo2Q77Q4VJoUtYtJbIWmT/pp9A== X-Received: by 2002:a17:902:e2:: with SMTP id a89mr24664291pla.210.1562589211477; Mon, 08 Jul 2019 05:33:31 -0700 (PDT) Received: from hfq-skylake.ipads-lab.se.sjtu.edu.cn ([202.120.40.82]) by smtp.googlemail.com with ESMTPSA id t10sm17102282pjr.13.2019.07.08.05.33.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jul 2019 05:33:31 -0700 (PDT) From: Fuqian Huang Cc: Dmitry Torokhov , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Fuqian Huang Subject: [PATCH 07/14] Input: cyapa - Replace devm_add_action() followed by failure action with devm_add_action_or_reset() Date: Mon, 8 Jul 2019 20:33:23 +0800 Message-Id: <20190708123323.11943-1-huangfq.daxian@gmail.com> X-Mailer: git-send-email 2.11.0 To: unlisted-recipients:; (no To-header on input) 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 devm_add_action_or_reset() is introduced as a helper function which internally calls devm_add_action(). If devm_add_action() fails then it will execute the action mentioned and return the error code. This reduce source code size (avoid writing the action twice) and reduce the likelyhood of bugs. Signed-off-by: Fuqian Huang --- drivers/input/mouse/cyapa.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c index dfd3873513e4..e1d9ab558ecf 100644 --- a/drivers/input/mouse/cyapa.c +++ b/drivers/input/mouse/cyapa.c @@ -840,10 +840,9 @@ static int cyapa_prepare_wakeup_controls(struct cyapa *cyapa) return error; } - error = devm_add_action(dev, + error = devm_add_action_or_reset(dev, cyapa_remove_power_wakeup_group, cyapa); if (error) { - cyapa_remove_power_wakeup_group(cyapa); dev_err(dev, "failed to add power cleanup action: %d\n", error); return error; @@ -957,9 +956,8 @@ static int cyapa_start_runtime(struct cyapa *cyapa) return error; } - error = devm_add_action(dev, cyapa_remove_power_runtime_group, cyapa); + error = devm_add_action_or_reset(dev, cyapa_remove_power_runtime_group, cyapa); if (error) { - cyapa_remove_power_runtime_group(cyapa); dev_err(dev, "failed to add power runtime cleanup action: %d\n", error); @@ -1298,9 +1296,8 @@ static int cyapa_probe(struct i2c_client *client, return error; } - error = devm_add_action(dev, cyapa_disable_regulator, cyapa); + error = devm_add_action_or_reset(dev, cyapa_disable_regulator, cyapa); if (error) { - cyapa_disable_regulator(cyapa); dev_err(dev, "failed to add disable regulator action: %d\n", error); return error; @@ -1318,9 +1315,8 @@ static int cyapa_probe(struct i2c_client *client, return error; } - error = devm_add_action(dev, cyapa_remove_sysfs_group, cyapa); + error = devm_add_action_or_reset(dev, cyapa_remove_sysfs_group, cyapa); if (error) { - cyapa_remove_sysfs_group(cyapa); dev_err(dev, "failed to add sysfs cleanup action: %d\n", error); return error; } From patchwork Mon Jul 8 12:33:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuqian Huang X-Patchwork-Id: 11034959 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 935A7912 for ; Mon, 8 Jul 2019 12:33:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84633285B0 for ; Mon, 8 Jul 2019 12:33:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7905428600; Mon, 8 Jul 2019 12:33:41 +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.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB autolearn=ham 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 2BCDF285D5 for ; Mon, 8 Jul 2019 12:33:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727545AbfGHMdk (ORCPT ); Mon, 8 Jul 2019 08:33:40 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:40619 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727373AbfGHMdk (ORCPT ); Mon, 8 Jul 2019 08:33:40 -0400 Received: by mail-pl1-f193.google.com with SMTP id a93so8217477pla.7; Mon, 08 Jul 2019 05:33:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=lkjVj98Felp05trt7jRzFQsD+gNA9UjSMyIU2HU/EqU=; b=KEp5Uj9Wkb0QGty172p5U0KeVxe2SDg/PDpZfFwtY/HVROxcxnMMhHNwRrpxijdc7+ HeyCR76HA1WFhMsTtnxHQD0SVVjy2JekKzXuhemh/CIkRD3UIgQSw3P5x1T9WPAur4PN WnmcsVTJcP7GtTzBuiHgrx8Cn7LPk8swF3ereGdcpHW239E2+au+t67nLbXWwx+pZxSI x3FDjh3ta7gynKpk1YY71VgxnBbZuXagWHDQfxNOvZPTSFN+/1Yt+n8dy3Vmdo3M89cn 59jpTO5ChLfID61+DwQrlPYNsNYwviN8O0dVGoaO5d+NXKekw2441YufVQiozmfjGC7b cGsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=lkjVj98Felp05trt7jRzFQsD+gNA9UjSMyIU2HU/EqU=; b=oqezzvAvBq9RWkcNFuW6Sy38uVEYcz3QSPMfsqr6kTW4LPq1R07RknIvDGjVHdH4XS Fu+0LhgiPM9l90zL4weo3tpCcQv/kR8fPcMWPFsqjlQv0LqXSgJKSrwv1r381BHhPh+f Ap0CWGt4gaB8KBVAHehq3dwT9kL4Qi1RR7QwvI6Y3gV/auUcJsUvEHres3vnWEl1bngk 1TdflqdIQkEaOp6a5YzaWx2VM+eQzebAVTiu45Tsia5NQ7DEZVPiZ7FLlqyR/WMWQ+w5 VRDVxnoiNQeav3XARAu72A6jqz102gkmeANvf2dG50Q3xkLEfb3ASq1UIln19SqU3hF2 PKqg== X-Gm-Message-State: APjAAAVLVezBpuEyPlw3CkNommz9+S6aUOPFtkEOL833aD6kpHbcqeyY KBrbV0DDDw7yPfjX//96WUw= X-Google-Smtp-Source: APXvYqxnKi+ASBL+wRU6+87VJNasFODvRDJ8hl2UkMHkb8EgXBxEiU1qHDgD6AKW8ymV59lm/+QcIA== X-Received: by 2002:a17:902:7687:: with SMTP id m7mr24837299pll.310.1562589219671; Mon, 08 Jul 2019 05:33:39 -0700 (PDT) Received: from hfq-skylake.ipads-lab.se.sjtu.edu.cn ([202.120.40.82]) by smtp.googlemail.com with ESMTPSA id c8sm26537982pjq.2.2019.07.08.05.33.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jul 2019 05:33:39 -0700 (PDT) From: Fuqian Huang Cc: Dmitry Torokhov , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Fuqian Huang Subject: [PATCH 08/14] Input: elan_i2c - Replace devm_add_action() followed by failure action with devm_add_action_or_reset() Date: Mon, 8 Jul 2019 20:33:32 +0800 Message-Id: <20190708123332.11989-1-huangfq.daxian@gmail.com> X-Mailer: git-send-email 2.11.0 To: unlisted-recipients:; (no To-header on input) 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 devm_add_action_or_reset() is introduced as a helper function which internally calls devm_add_action(). If devm_add_action() fails then it will execute the action mentioned and return the error code. This reduce source code size (avoid writing the action twice) and reduce the likelyhood of bugs. Signed-off-by: Fuqian Huang --- drivers/input/mouse/elan_i2c_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index 420efaab3860..a8d4f3bd09bf 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -1234,9 +1234,8 @@ static int elan_probe(struct i2c_client *client, return error; } - error = devm_add_action(dev, elan_remove_sysfs_groups, data); + error = devm_add_action_or_reset(dev, elan_remove_sysfs_groups, data); if (error) { - elan_remove_sysfs_groups(data); dev_err(dev, "Failed to add sysfs cleanup action: %d\n", error); return error; From patchwork Mon Jul 8 12:33:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuqian Huang X-Patchwork-Id: 11034963 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 59189912 for ; Mon, 8 Jul 2019 12:33:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B0FE28560 for ; Mon, 8 Jul 2019 12:33:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F42228607; Mon, 8 Jul 2019 12:33:55 +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.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB autolearn=ham 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 CFFEE285C6 for ; Mon, 8 Jul 2019 12:33:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730753AbfGHMdy (ORCPT ); Mon, 8 Jul 2019 08:33:54 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:32830 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727373AbfGHMdx (ORCPT ); Mon, 8 Jul 2019 08:33:53 -0400 Received: by mail-pf1-f193.google.com with SMTP id g2so2762290pfq.0; Mon, 08 Jul 2019 05:33:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=wkiM+H4s5Fx2zqrRyd6RVHqMLlLu515oxV/wDuVW7xE=; b=EY1NmA6hWRJyv4POxlpAl4OgtUVmqKk+8xn744a/j0JiLrZ4JtJ9Hb+18Q4NA5nKly k/vOaAIUFJzq9//Syqexf97oOrgBMkO2nL7p+4eLo3cexQlkx333I1KTek01ts9m0+UL x0PaMazC4U4gadCehkaFamo3teuNBTuMeI1U1hnNCFlNZSumtPSCHYj1Wa2/A3oqKn7C wWElxde/U26KEd/rTRV/rhOW3wLic1LMy2XOrn/q+SB/+NNy5UeraJsmfjwkatFNRz// x8gbROb7WGNgLeaW+Y8UGdzF2vMe/UZpMiTo0k8jltXe6Q3QqvoUaNXenvqLhXYMzrY3 M5MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=wkiM+H4s5Fx2zqrRyd6RVHqMLlLu515oxV/wDuVW7xE=; b=FhUmvpS5skrlRI+PkrjjNcrj6QFg72L83nBPoyE8J2uEDSPzaGK+CVbovXYVT40kf3 go9y2RBMZqwdoTgBbvO150leMZ4CSpfU0JPRmyUFnmXH8ENk4fIRUVvV4QDuo0sl4gge 6Cwzg7wB4rBtLaEzPsU+wSCCd00wK3rdwkPwkl/IDnwFzmIgsZRxJm6wh8q9xxzgrkkS eZuDvZFgE8mlhPc4YtHSeXIUt49Fo/3HAma1q+fnSQavGlpUeEFF2XevkeEJmB6LU4OZ 8xlsOrXDeq9qjMdQ6fQnGg8YdXrVzxJLPjNxAJeTEFtBjQkYnUNPkvf5R3iE0r6uSUx5 9SlA== X-Gm-Message-State: APjAAAV0++cgnvl1+XXAa4DtOUMaPzO6aWctEg0ppIMKAhMux3ZXkFp+ AxPHJoJLxv0LconnbY2S6GGgDMPFLKE= X-Google-Smtp-Source: APXvYqyQji5KOWUy67+mrc5RjfQiyEnaGWn8m8OlZBjCTYvagSPwD/DTwI+AcjH7o+mltIP2bKojhA== X-Received: by 2002:a17:90a:a410:: with SMTP id y16mr25449728pjp.62.1562589233228; Mon, 08 Jul 2019 05:33:53 -0700 (PDT) Received: from hfq-skylake.ipads-lab.se.sjtu.edu.cn ([202.120.40.82]) by smtp.googlemail.com with ESMTPSA id b24sm16551286pfd.98.2019.07.08.05.33.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jul 2019 05:33:52 -0700 (PDT) From: Fuqian Huang Cc: Dmitry Torokhov , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Fuqian Huang Subject: [PATCH 10/14] Input: auo-pixcir-ts - Replace devm_add_action() followed by failure action with devm_add_action_or_reset() Date: Mon, 8 Jul 2019 20:33:47 +0800 Message-Id: <20190708123347.12081-1-huangfq.daxian@gmail.com> X-Mailer: git-send-email 2.11.0 To: unlisted-recipients:; (no To-header on input) 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 devm_add_action_or_reset() is introduced as a helper function which internally calls devm_add_action(). If devm_add_action() fails then it will execute the action mentioned and return the error code. This reduce source code size (avoid writing the action twice) and reduce the likelyhood of bugs. Signed-off-by: Fuqian Huang --- drivers/input/touchscreen/auo-pixcir-ts.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/auo-pixcir-ts.c b/drivers/input/touchscreen/auo-pixcir-ts.c index 8e48fbda487a..8e9f3b7b8180 100644 --- a/drivers/input/touchscreen/auo-pixcir-ts.c +++ b/drivers/input/touchscreen/auo-pixcir-ts.c @@ -602,9 +602,8 @@ static int auo_pixcir_probe(struct i2c_client *client, return error; } - error = devm_add_action(&client->dev, auo_pixcir_reset, ts); + error = devm_add_action_or_reset(&client->dev, auo_pixcir_reset, ts); if (error) { - auo_pixcir_reset(ts); dev_err(&client->dev, "failed to register reset action, %d\n", error); return error;