From patchwork Thu Jul 28 07:55:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 9250815 X-Patchwork-Delegate: kvalo@adurom.com 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 7218E6077C for ; Thu, 28 Jul 2016 08:05:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65B26212DA for ; Thu, 28 Jul 2016 08:05:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A6D226253; Thu, 28 Jul 2016 08:05:47 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 07DC8212DA for ; Thu, 28 Jul 2016 08:05:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758386AbcG1IFm (ORCPT ); Thu, 28 Jul 2016 04:05:42 -0400 Received: from hotel311.server4you.de ([85.25.146.15]:52497 "EHLO hotel311.server4you.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754757AbcG1IFa (ORCPT ); Thu, 28 Jul 2016 04:05:30 -0400 Received: from hotel311.server4you.de (localhost [127.0.0.1]) by filter.mynetwork.local (Postfix) with ESMTP id 1A3291941A74; Thu, 28 Jul 2016 09:55:29 +0200 (CEST) Received: from localhost (unknown [212.118.206.70]) by hotel311.server4you.de (Postfix) with ESMTPSA id E8E641941A6D; Thu, 28 Jul 2016 09:55:28 +0200 (CEST) From: Daniel Wagner To: Bastien Nocera , Bjorn Andersson , Dmitry Torokhov , Greg Kroah-Hartman , Johannes Berg , Kalle Valo , Ohad Ben-Cohen Cc: linux-input@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Daniel Wagner Subject: [RFC v0 4/8] Input: goodix: use firmware_stat instead of completion Date: Thu, 28 Jul 2016 09:55:08 +0200 Message-Id: <1469692512-16863-5-git-send-email-wagi@monom.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1469692512-16863-1-git-send-email-wagi@monom.org> References: <1469692512-16863-1-git-send-email-wagi@monom.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Daniel Wagner Loading firmware is an operation many drivers implement in various ways around the completion API. And most of them do it almost in the same way. Let's reuse the firmware_stat API which is used also by the firmware_class loader. Apart of streamlining the firmware loading states we also document it slightly better. Signed-off-by: Daniel Wagner --- drivers/input/touchscreen/goodix.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index 240b16f..67158d3 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -47,7 +47,7 @@ struct goodix_ts_data { u16 id; u16 version; const char *cfg_name; - struct completion firmware_loading_complete; + struct firmware_stat fwst; unsigned long irq_flags; }; @@ -683,7 +683,7 @@ static void goodix_config_cb(const struct firmware *cfg, void *ctx) err_release_cfg: release_firmware(cfg); - complete_all(&ts->firmware_loading_complete); + fw_loading_done(ts->fwst); } static int goodix_ts_probe(struct i2c_client *client, @@ -705,7 +705,7 @@ static int goodix_ts_probe(struct i2c_client *client, ts->client = client; i2c_set_clientdata(client, ts); - init_completion(&ts->firmware_loading_complete); + firmware_stat_init(&ts->fwst); error = goodix_get_gpio_config(ts); if (error) @@ -766,7 +766,7 @@ static int goodix_ts_remove(struct i2c_client *client) struct goodix_ts_data *ts = i2c_get_clientdata(client); if (ts->gpiod_int && ts->gpiod_rst) - wait_for_completion(&ts->firmware_loading_complete); + fw_loading_wait(ts->fwst); return 0; } @@ -781,7 +781,7 @@ static int __maybe_unused goodix_suspend(struct device *dev) if (!ts->gpiod_int || !ts->gpiod_rst) return 0; - wait_for_completion(&ts->firmware_loading_complete); + fw_loading_wait(ts->fwst); /* Free IRQ as IRQ pin is used as output in the suspend sequence */ goodix_free_irq(ts);