All of lore.kernel.org
 help / color / mirror / Atom feed
From: Binoy Jayan <binoy.jayan@linaro.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Doug Ledford <dledford@redhat.com>,
	Sean Hefty <sean.hefty@intel.com>,
	Hal Rosenstock <hal.rosenstock@gmail.com>,
	linux-rdma@vger.kernel.org,
	Linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 6/8] IB/hns: Replace counting semaphore event_sem with wait_event
Date: Tue, 25 Oct 2016 19:05:59 +0530	[thread overview]
Message-ID: <CAHv-k_92-bs=0kKSdGhZ15n9roUsn1B+t9dxA+oSw=2wn8t9kw@mail.gmail.com> (raw)
In-Reply-To: <3400101.E3rphEBHnx@wuerfel>

On 25 October 2016 at 18:51, Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday, October 25, 2016 6:29:45 PM CEST Binoy Jayan wrote:
>
> Something like
>
> static struct hns_roce_cmd_context *hns_roce_try_get_context(struct hns_roce_cmdq *cmd)
> {
>         struct hns_roce_cmd_context *context = NULL;
>
>         spin_lock(&cmd->context_lock);
>
>         if (cmd->free_head < 0)
>                 goto out;
>
>         context = &cmd->context[cmd->free_head];
>
>         ... /* update free_head */
>
> out:
>         spin_unlock(&cmd->context_lock);
>
>         return context;
> }
> ...
>
> static struct hns_roce_cmd_context *hns_roce_get_context(struct hns_roce_cmdq *cmd)
> {
>         struct hns_roce_cmd_context *context;
>
>         wait_event(cmd->wq, (context = hns_roce_try_get_context(cmd)));
>
>         return context;
> }

That looks more elegant. Didn't think of that, Thank you Arnd.:)

      reply	other threads:[~2016-10-25 13:35 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-25 12:01 [PATCH v2 0/8] infiniband: Remove semaphores Binoy Jayan
2016-10-25 12:01 ` Binoy Jayan
     [not found] ` <1477396919-27669-1-git-send-email-binoy.jayan-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-10-25 12:01   ` [PATCH v2 1/8] IB/core: iwpm_nlmsg_request: Replace semaphore with completion Binoy Jayan
2016-10-25 12:01     ` Binoy Jayan
2016-10-25 12:01   ` [PATCH v2 2/8] IB/core: Replace semaphore sm_sem " Binoy Jayan
2016-10-25 12:01     ` Binoy Jayan
2016-10-25 12:43     ` Jack Wang
2016-10-25 15:08       ` Binoy Jayan
     [not found]         ` <CAHv-k_86z3MTYePPQcs5fWSqFeoGxt7UYG_b-SyZGQ7zVW-hSw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-25 15:48           ` Jack Wang
2016-10-25 15:48             ` Jack Wang
2016-10-25 15:48         ` Jason Gunthorpe
     [not found]           ` <20161025154822.GA27240-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-10-25 20:15             ` Arnd Bergmann
2016-10-25 20:15               ` Arnd Bergmann
2016-10-25 12:01   ` [PATCH v2 7/8] IB/mthca: Replace counting semaphore event_sem with wait_event Binoy Jayan
2016-10-25 12:01     ` Binoy Jayan
2016-10-25 12:01   ` [PATCH v2 8/8] IB/mlx5: Add helper mlx5_ib_post_send_wait Binoy Jayan
2016-10-25 12:01     ` Binoy Jayan
2016-10-25 12:23     ` Arnd Bergmann
2016-10-25 12:46       ` Binoy Jayan
2016-10-25 12:46         ` Binoy Jayan
2016-10-25 12:26     ` Leon Romanovsky
2016-10-25 13:16       ` Binoy Jayan
2016-10-27  6:05         ` Leon Romanovsky
2016-10-27  6:23           ` Binoy Jayan
2016-10-25 12:01 ` [PATCH v2 3/8] IB/hns: Replace semaphore poll_sem with mutex Binoy Jayan
2016-10-25 12:01 ` [PATCH v2 4/8] IB/mthca: " Binoy Jayan
2016-10-25 12:01 ` [PATCH v2 5/8] IB/isert: Replace semaphore sem with completion Binoy Jayan
2016-10-25 12:01 ` [PATCH v2 6/8] IB/hns: Replace counting semaphore event_sem with wait_event Binoy Jayan
     [not found]   ` <1477396919-27669-7-git-send-email-binoy.jayan-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-10-25 12:28     ` Arnd Bergmann
2016-10-25 12:28       ` Arnd Bergmann
2016-10-25 12:59       ` Binoy Jayan
2016-10-25 13:21         ` Arnd Bergmann
2016-10-25 13:35           ` Binoy Jayan [this message]

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='CAHv-k_92-bs=0kKSdGhZ15n9roUsn1B+t9dxA+oSw=2wn8t9kw@mail.gmail.com' \
    --to=binoy.jayan@linaro.org \
    --cc=arnd@arndb.de \
    --cc=dledford@redhat.com \
    --cc=hal.rosenstock@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sean.hefty@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.