public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Binoy Jayan <binoy.jayan@linaro.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Johnny Kim <johnny.kim@atmel.com>,
	Austin Shin <austin.shin@atmel.com>,
	Chris Park <chris.park@atmel.com>, Tony Cho <tony.cho@atmel.com>,
	Glen Lee <glen.lee@atmel.com>, Leo Kim <leo.kim@atmel.com>,
	linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] staging: wilc1000: Replace kthread with workqueue for host interface
Date: Tue, 21 Jun 2016 18:07:41 +0200	[thread overview]
Message-ID: <7461266.G5R58nnEKu@wuerfel> (raw)
In-Reply-To: <1466417419-13568-3-git-send-email-binoy.jayan@linaro.org>

On Monday, June 20, 2016 3:40:19 PM CEST Binoy Jayan wrote:
> Deconstruct the kthread / message_queue logic, replacing it with
> create_singlethread_workqueue() / queue_work() setup, by adding a
> 'struct work_struct' to 'struct host_if_msg'. The current kthread
> hostIFthread() is converted to a work queue helper with the name
> 'host_if_work'.
> 
> Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
> Reviewed-by: Arnd Bergmann <arnd@arndb.de>

Hi Binoy,

You made a mistake here in adding the 'Reviewed-by:' tag before I replied with
that tag. I did a review of an earlier version and you addressed the comments
that I had for that, but you can only add the tag after I send that reply.

That said, the patch looks very good to me, and I see no remaining
problems that would prevent it from getting merged (after Atmel have tested
it), just a couple of things that would make it easier to review:

> +static int wilc_enqueue_cmd(struct host_if_msg *msg);
> +static void host_if_work(struct work_struct *work);

A small comment on coding style: we try to avoid forward declaration for local
functions. Instead, you can reorder the code to have the callee first. This
is the order which most readers will expect, and having no forward declarations
in the code makes it more likely that there are no recursions that would
be problematic for stack overflow.

>  /*!
>   *  @author		syounan
> @@ -336,95 +276,19 @@ static int wilc_mq_destroy(struct message_queue *mq)
>   *  @note		copied from FLO glue implementatuion
>   *  @version		1.0
>   */
> -static int wilc_mq_send(struct message_queue *mq,
> -		 const void *send_buf, u32 send_buf_size)
> +static int wilc_enqueue_cmd(struct host_if_msg *msg)

I think this API change can be done as a separate patch: the mq and send_buf_size
arguments are both constant for all callers, so you can have one patch just
removes them and renames the function, to make the patch that does the
tricky rework smaller.


> -		}
> +	if (msg->id == HOST_IF_MSG_CONNECT &&
> +	    msg->vif->hif_drv->usr_scan_req.scan_result) {
> +		wilc_enqueue_cmd(msg);
> +		usleep_range(2 * 1000, 2 * 1000);
> +		goto end;
> +	}
>  
> -		switch (msg.id) {
> -		case HOST_IF_MSG_SCAN:

A similar trick could apply here: we can leave the switch()
indented at the original level by putting it in an 'else'
clause. This again makes the patch shorter and easier to
review, and the optional reformatting can be done as a follow-up.

	Arnd

  reply	other threads:[~2016-06-21 16:05 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-13 10:37 [PATCH 0/7] *** staging: wilc1000: Replace semaphores with mutexes or completions *** Binoy Jayan
2016-06-13 10:37 ` [PATCH 1/7] staging: wilc1000: Replace semaphore txq_event with completion Binoy Jayan
2016-06-13 10:37 ` [PATCH 2/7] staging: wilc1000: Replace semaphore txq_add_to_head_cs with mutex Binoy Jayan
2016-06-13 13:20   ` Arnd Bergmann
2016-06-13 10:37 ` [PATCH 3/7] staging: wilc1000: Replace semaphore cfg_event with completion Binoy Jayan
2016-06-13 13:25   ` Arnd Bergmann
2016-06-13 10:37 ` [PATCH 4/7] staging: wilc1000: Replace semaphore sync_event " Binoy Jayan
2016-06-13 10:37 ` [PATCH 5/7] staging: wilc1000: Replace semaphore close_exit_sync " Binoy Jayan
2016-06-13 13:42   ` Arnd Bergmann
2016-06-13 10:37 ` [PATCH 6/7] staging: wilc1000: message_queue: Replace semaphore sem " Binoy Jayan
2016-06-13 14:24   ` Arnd Bergmann
2016-06-13 10:37 ` [PATCH 7/7] staging: wilc1000: Remove unused inclusion of semaphore header Binoy Jayan
2016-06-13 14:29 ` [PATCH 0/7] *** staging: wilc1000: Replace semaphores with mutexes or completions *** Arnd Bergmann
2016-06-13 14:48   ` Binoy Jayan
2016-06-15  5:24 ` [PATCH v2 0/5] " Binoy Jayan
2016-06-15  5:24   ` [PATCH v2 1/5] staging: wilc1000: Replace semaphore txq_event with completion Binoy Jayan
2016-06-15  5:30 ` [PATCH v3 0/5] *** staging: wilc1000: Replace semaphores with mutexes or completions *** Binoy Jayan
2016-06-15  5:30   ` [PATCH v3 1/5] staging: wilc1000: Replace semaphore txq_event with completion Binoy Jayan
2016-06-15  5:30   ` [PATCH v3 2/5] staging: wilc1000: Replace semaphore txq_add_to_head_cs with mutex Binoy Jayan
2016-06-15  5:30   ` [PATCH v3 3/5] staging: wilc1000: Replace semaphore cfg_event with completion Binoy Jayan
2016-06-15  5:30   ` [PATCH v3 4/5] staging: wilc1000: Replace semaphore sync_event " Binoy Jayan
2016-06-15  5:30   ` [PATCH v3 5/5] staging: wilc1000: Remove semaphore close_exit_sync Binoy Jayan
2016-06-20 10:10 ` [PATCH v2 0/2] *** staging: wilc1000: Replace semaphores *** Binoy Jayan
2016-06-20 10:10   ` [PATCH v2 1/2] staging: wilc1000: message_queue: Move code to host interface Binoy Jayan
2016-06-20 10:10   ` [PATCH v2 2/2] staging: wilc1000: Replace kthread with workqueue for " Binoy Jayan
2016-06-21 16:07     ` Arnd Bergmann [this message]
2016-06-22 10:01   ` [PATCH v3 0/3] *** staging: wilc1000: Replace semaphores *** Binoy Jayan
2016-06-22 10:01     ` [PATCH v3 1/3] staging: wilc1000: message_queue: Move code to host interface Binoy Jayan
2016-06-22 10:01     ` [PATCH v3 2/3] staging: wilc1000: Replace kthread with workqueue for " Binoy Jayan
2016-06-22 10:01     ` [PATCH v3 3/3] staging: wilc1000: Change interface wilc_mq_send to wilc_enqueue_cmd Binoy Jayan
2016-06-22 11:06       ` kbuild test robot
2016-06-23  5:41   ` [PATCH v4 0/3] *** staging: wilc1000: Replace semaphores *** Binoy Jayan
2016-06-23  5:41     ` [PATCH v4 1/3] staging: wilc1000: message_queue: Move code to host interface Binoy Jayan
2016-06-23  5:41     ` [PATCH v4 2/3] staging: wilc1000: Replace kthread with workqueue for " Binoy Jayan
2016-06-23  5:41     ` [PATCH v4 3/3] staging: wilc1000: Change interface wilc_mq_send to wilc_enqueue_cmd Binoy Jayan
2016-06-23  9:32     ` [PATCH v4 0/3] *** staging: wilc1000: Replace semaphores *** Arnd Bergmann

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=7461266.G5R58nnEKu@wuerfel \
    --to=arnd@arndb.de \
    --cc=austin.shin@atmel.com \
    --cc=binoy.jayan@linaro.org \
    --cc=chris.park@atmel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=glen.lee@atmel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=johnny.kim@atmel.com \
    --cc=leo.kim@atmel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=tony.cho@atmel.com \
    /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