From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Daniel Wagner <wagi@monom.org>
Cc: Bastien Nocera <hadess@hadess.net>,
Bjorn Andersson <bjorn.andersson@linaro.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Johannes Berg <johannes.berg@intel.com>,
Kalle Valo <kvalo@codeaurora.org>,
Ohad Ben-Cohen <ohad@wizery.com>,
linux-input@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
Daniel Wagner <daniel.wagner@bmw-carit.de>
Subject: Re: [RFC v0 7/8] Input: ims-pcu: use firmware_stat instead of completion
Date: Thu, 28 Jul 2016 11:33:43 -0700 [thread overview]
Message-ID: <20160728183343.GD16852@dtor-ws> (raw)
In-Reply-To: <1469692512-16863-8-git-send-email-wagi@monom.org>
On Thu, Jul 28, 2016 at 09:55:11AM +0200, Daniel Wagner wrote:
> From: Daniel Wagner <daniel.wagner@bmw-carit.de>
>
> 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 <daniel.wagner@bmw-carit.de>
> ---
> drivers/input/misc/ims-pcu.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
> index 9c0ea36..cda1fbf 100644
> --- a/drivers/input/misc/ims-pcu.c
> +++ b/drivers/input/misc/ims-pcu.c
> @@ -109,7 +109,7 @@ struct ims_pcu {
>
> u32 fw_start_addr;
> u32 fw_end_addr;
> - struct completion async_firmware_done;
> + struct firmware_stat fw_st;
>
> struct ims_pcu_buttons buttons;
> struct ims_pcu_gamepad *gamepad;
> @@ -940,7 +940,7 @@ static void ims_pcu_process_async_firmware(const struct firmware *fw,
> release_firmware(fw);
>
> out:
> - complete(&pcu->async_firmware_done);
> + fw_loading_done(pcu->fw_st);
Why does the driver have to do it? If firmware loader manages this, then
it should let waiters know when callback finishes.
> }
>
> /*********************************************************************
> @@ -1967,7 +1967,7 @@ static int ims_pcu_init_bootloader_mode(struct ims_pcu *pcu)
> ims_pcu_process_async_firmware);
> if (error) {
> /* This error is not fatal, let userspace have another chance */
> - complete(&pcu->async_firmware_done);
> + fw_loading_abort(pcu->fw_st);
Why should the driver signal abort if it does not manage completion in
this case?
> }
>
> return 0;
> @@ -1976,7 +1976,7 @@ static int ims_pcu_init_bootloader_mode(struct ims_pcu *pcu)
> static void ims_pcu_destroy_bootloader_mode(struct ims_pcu *pcu)
> {
> /* Make sure our initial firmware request has completed */
> - wait_for_completion(&pcu->async_firmware_done);
> + fw_loading_wait(pcu->fw_st);
> }
>
> #define IMS_PCU_APPLICATION_MODE 0
> @@ -2000,7 +2000,7 @@ static int ims_pcu_probe(struct usb_interface *intf,
> pcu->bootloader_mode = id->driver_info == IMS_PCU_BOOTLOADER_MODE;
> mutex_init(&pcu->cmd_mutex);
> init_completion(&pcu->cmd_done);
> - init_completion(&pcu->async_firmware_done);
> + firmware_stat_init(&pcu->fw_st);
Do not quite like it... I'd rather asynchronous request give out a
firmware status pointer that could be used later on.
pcu->fw_st = request_firmware_async(IMS_PCU_FIRMWARE_NAME,
pcu,
ims_pcu_process_async_firmware);
if (IS_ERR(pcu->fw_st))
return PTR_ERR(pcu->fw_st);
....
fw_loading_wait(pcu->fw_st);
Thanks.
--
Dmitry
next prev parent reply other threads:[~2016-07-28 18:33 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-28 7:55 [RFC v0 0/8] Reuse firmware loader helpers Daniel Wagner
2016-07-28 7:55 ` [RFC v0 1/8] selftests: firmware: do not abort test too early Daniel Wagner
2016-07-28 7:55 ` [RFC v0 2/8] selftests: firmware: do not clutter output Daniel Wagner
2016-07-28 7:55 ` [RFC v0 3/8] firmware: Factor out firmware load helpers Daniel Wagner
2016-07-28 15:01 ` Dan Williams
2016-07-29 6:07 ` Daniel Wagner
2016-07-28 17:57 ` Dmitry Torokhov
2016-07-29 6:08 ` Daniel Wagner
2016-07-28 7:55 ` [RFC v0 4/8] Input: goodix: use firmware_stat instead of completion Daniel Wagner
2016-07-28 11:22 ` Bastien Nocera
2016-07-28 11:59 ` Daniel Wagner
2016-07-28 12:20 ` Bastien Nocera
2016-07-28 13:10 ` Daniel Wagner
2016-07-28 7:55 ` [RFC v0 5/8] ath9k_htc: " Daniel Wagner
2016-07-28 7:55 ` [RFC v0 6/8] remoteproc: " Daniel Wagner
2016-07-28 7:55 ` [RFC v0 7/8] Input: ims-pcu: " Daniel Wagner
2016-07-28 18:33 ` Dmitry Torokhov [this message]
2016-07-28 19:01 ` Bjorn Andersson
2016-07-29 6:13 ` Daniel Wagner
2016-07-30 12:42 ` Arend van Spriel
2016-07-30 16:58 ` Luis R. Rodriguez
2016-07-31 7:23 ` Dmitry Torokhov
2016-08-01 12:26 ` Daniel Wagner
2016-08-01 19:44 ` Luis R. Rodriguez
2016-08-02 5:49 ` Daniel Wagner
2016-08-02 6:34 ` Luis R. Rodriguez
2016-08-02 6:53 ` Daniel Wagner
2016-08-02 7:41 ` Luis R. Rodriguez
2016-08-03 6:57 ` Daniel Wagner
2016-08-03 15:55 ` Luis R. Rodriguez
2016-08-03 16:18 ` Dmitry Torokhov
2016-08-03 17:37 ` Luis R. Rodriguez
2016-08-03 18:40 ` Luis R. Rodriguez
2016-08-03 22:26 ` Bjorn Andersson
2016-08-03 7:42 ` Dmitry Torokhov
2016-08-03 11:43 ` Arend van Spriel
2016-08-03 15:18 ` Luis R. Rodriguez
2016-08-03 15:35 ` Dmitry Torokhov
2016-08-03 20:42 ` Arend van Spriel
2016-08-03 16:03 ` Luis R. Rodriguez
2016-08-03 17:39 ` Bjorn Andersson
2016-08-03 18:08 ` Luis R. Rodriguez
2016-08-01 19:36 ` Luis R. Rodriguez
2016-08-01 17:19 ` Bjorn Andersson
2016-08-01 19:56 ` Luis R. Rodriguez
2016-08-01 21:34 ` Dmitry Torokhov
2016-07-31 7:17 ` Dmitry Torokhov
2016-07-28 7:55 ` [RFC v0 8/8] iwl4965: " Daniel Wagner
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=20160728183343.GD16852@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=bjorn.andersson@linaro.org \
--cc=daniel.wagner@bmw-carit.de \
--cc=gregkh@linuxfoundation.org \
--cc=hadess@hadess.net \
--cc=johannes.berg@intel.com \
--cc=kvalo@codeaurora.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=ohad@wizery.com \
--cc=wagi@monom.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;
as well as URLs for NNTP newsgroup(s).