mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Salyzyn, Mark" <Mark_Salyzyn@adaptec.com>
To: Matthias Kaehlcke <matthias@kaehlcke.net>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Subject: RE: [PATCH] Adaptec AACRAID: convert fibctx->wait_sem to completion
Date: Wed, 13 Feb 2008 11:05:12 -0800	[thread overview]
Message-ID: <532ABFBDAAC3A34EB12EBA6CEC2838F4399643B1@ADPE2K703.adaptec.com> (raw)
In-Reply-To: <20080213183444.GA27068@traven>

linux/completion is already included in commctrl.c, in the patch fragment it is noted two lines below the addition. Please explain in the description the need/advantages for the change from semaphore to completion.

Sincerely -- Mark Salyzyn

> -----Original Message-----
> From: Matthias Kaehlcke [mailto:matthias@kaehlcke.net]
> Sent: Wednesday, February 13, 2008 1:35 PM
> To: AACRAID; linux-scsi@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org; akpm@linux-foundation.org
> Subject: [PATCH] Adaptec AACRAID: convert fibctx->wait_sem to
> completion
>
> Adaptec AACRAID driver: The semaphore fibctx->wait_sem is used for
> signalling an event. Convert it to a completion.
>
> Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
>
> --
> diff --git a/drivers/scsi/aacraid/aacraid.h
> b/drivers/scsi/aacraid/aacraid.h
> index 3195d29..eef4939 100644
> --- a/drivers/scsi/aacraid/aacraid.h
> +++ b/drivers/scsi/aacraid/aacraid.h
> @@ -717,7 +717,7 @@ struct aac_fib_context {
>         u32                     unique;         // unique
> value representing this context
>         ulong                   jiffies;        // used for
> cleanup - dmb changed to ulong
>         struct list_head        next;           // used to
> link context's into a linked list
> -       struct semaphore        wait_sem;       // this is
> used to wait for the next fib to arrive.
> +       struct completion       compl;          // this is
> used to wait for the next fib to arrive.
>         int                     wait;           // Set to
> true when thread is in WaitForSingleObject
>         unsigned long           count;          // total
> number of FIBs on FibList
>         struct list_head        fib_list;       // this holds
> fibs and their attachd hw_fibs
> diff --git a/drivers/scsi/aacraid/commctrl.c
> b/drivers/scsi/aacraid/commctrl.c
> index abef051..98efda6 100644
> --- a/drivers/scsi/aacraid/commctrl.c
> +++ b/drivers/scsi/aacraid/commctrl.c
> @@ -33,6 +33,7 @@
>  #include <linux/types.h>
>  #include <linux/pci.h>
>  #include <linux/spinlock.h>
> +#include <linux/completion.h>
>  #include <linux/slab.h>
>  #include <linux/completion.h>
>  #include <linux/dma-mapping.h>
> @@ -177,9 +178,9 @@ static int open_getadapter_fib(struct
> aac_dev * dev, void __user *arg)
>                  */
>                 fibctx->unique = (u32)((ulong)fibctx & 0xFFFFFFFF);
>                 /*
> -                *      Initialize the mutex used to wait for
> the next AIF.
> +                *      Initialize the completion used to
> wait for the next AIF.
>                  */
> -               init_MUTEX_LOCKED(&fibctx->wait_sem);
> +               init_completion(&fibctx->compl);
>                 fibctx->wait = 0;
>                 /*
>                  *      Initialize the fibs and set the count
> of fibs on
> @@ -310,7 +311,7 @@ return_fib:
>                         ssleep(1);
>                 }
>                 if (f.wait) {
> -
> if(down_interruptible(&fibctx->wait_sem) < 0) {
> +
> if(wait_for_completion_interruptible(&fibctx->compl) < 0) {
>                                 status = -EINTR;
>                         } else {
>                                 /* Lock again and retry */
> diff --git a/drivers/scsi/aacraid/commsup.c
> b/drivers/scsi/aacraid/commsup.c
> index 81b3692..486bdb3 100644
> --- a/drivers/scsi/aacraid/commsup.c
> +++ b/drivers/scsi/aacraid/commsup.c
> @@ -1440,7 +1440,7 @@ int aac_check_health(struct aac_dev * aac)
>                          * Set the event to wake up the
>                          * thread that will waiting.
>                          */
> -                       up(&fibctx->wait_sem);
> +                       complete(&fibctx->compl);
>                 } else {
>                         printk(KERN_WARNING "aifd: didn't
> allocate NewFib.\n");
>                         kfree(fib);
> @@ -1671,7 +1671,7 @@ int aac_command_thread(void *data)
>                                                  * Set the
> event to wake up the
>                                                  * thread
> that is waiting.
>                                                  */
> -                                               up(&fibctx->wait_sem);
> +
> complete(&fibctx->compl);
>                                         } else {
>
> printk(KERN_WARNING "aifd: didn't allocate NewFib.\n");
>                                         }
> --
> Matthias Kaehlcke
> Linux System Developer
> Barcelona
>
>   Si deseas mantener tu libertad, debes estar preparado para
> defenderla
>                           (Richard Stallman)
>                                                                  .''`.
>     using free software / Debian GNU/Linux |
> http://debian.org  : :'  :
>                                                                 `. `'`
> gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-
>

  reply	other threads:[~2008-02-13 19:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-13 18:34 Matthias Kaehlcke
2008-02-13 19:05 ` Salyzyn, Mark [this message]
2008-02-13 19:09 ` James Bottomley
2008-02-13 20:15   ` Matthias Kaehlcke

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=532ABFBDAAC3A34EB12EBA6CEC2838F4399643B1@ADPE2K703.adaptec.com \
    --to=mark_salyzyn@adaptec.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=matthias@kaehlcke.net \
    /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

all inboxes | Powered by JetHome®