Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4155382imu; Mon, 10 Dec 2018 14:09:55 -0800 (PST) X-Google-Smtp-Source: AFSGD/WG1NOLsMYQdSm8aaG0Dxx+arjbbKioJIZO99+NwCWhkj9NgSvHZEKD4x66OJXA/Sy9ph7c X-Received: by 2002:a63:e445:: with SMTP id i5mr12356332pgk.307.1544479795037; Mon, 10 Dec 2018 14:09:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544479795; cv=none; d=google.com; s=arc-20160816; b=ntbUk6rzH3Gk+BJTQ5oB2iYBonXiZ5csryp2W3Dt1ErBF3d1xKvfrqk1LQ9/SyKHe1 WGZlGRag1CAFU3MdfvYYwpiM1cJI6HdRibXSdR0rzEN20FFrIDXfS49D8yMdm1KCMGGc RX7Tyhb0d/QI2H8rHjx5E2AdnGW1BTJjaF5UQJlDJXv7CFrAhz3egrEmbbuDj28PKr39 5yhVoe4h2qT7khsPKujNlTShQopmxRLCkjPDwMapXCuOjKX/v77rDy3oQ1FHXRlDmrxj tfTWYRl/nTy4898hYdYUtm0f+SFCJhcH5zfLlyouYixevyUejjKbVtG4Fl41ml7gjJQv FUiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Fdvj4rxNsbLvX+nCRKFQ2CqxhR0WSiCWn0hmUl2h07U=; b=hlYLxqo+S9uW4bW/LLy9TZDxo6UOWH+0dKvZPvGP5TnXXVD9jOxuZI+TaO/8BEYjoO NrEya8IrGorgUFId2e+0wB10G16zUf4lQIrGFWltGvUx9Ryle4o9ZjpgSMKHZXM5wgxT wYKPk0QN7mzd6gkjE0ZmMHjEqw8NVxH+fWSNtHeCU5M9qSxA0d4p60fUGsfO5y6LGxgb 9HBOfUaaZXFWb5GIl3Qri8IMBcVzXl2o6GA/+r//ngljaTXlPS6j1+SC9H+tJtPjsZS7 06YJjcnb/yrc1ENGSrCiZwfdiXsH3U+ypVgL7G2LXLb2VRenkYZaPsfAtG35ODvSJkUn +29g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bc7si10773664plb.120.2018.12.10.14.09.39; Mon, 10 Dec 2018 14:09:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729959AbeLJVdu (ORCPT + 99 others); Mon, 10 Dec 2018 16:33:50 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:56351 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728088AbeLJVdu (ORCPT ); Mon, 10 Dec 2018 16:33:50 -0500 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue002 [212.227.15.129]) with ESMTPA (Nemesis) id 0M9j3f-1gbilr2rtP-00D1Ct; Mon, 10 Dec 2018 22:33:36 +0100 From: Arnd Bergmann To: Adaptec OEM Raid Solutions , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Arnd Bergmann , Raghava Aditya Renukunta , Prasad B Munirathnam , Dave Carroll , Dan Carpenter , Johannes Thumshirn , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] scsi: aacraid: change event_wait to a completion Date: Mon, 10 Dec 2018 22:32:41 +0100 Message-Id: <20181210213301.1065510-2-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181210213301.1065510-1-arnd@arndb.de> References: <20181210213301.1065510-1-arnd@arndb.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:kxdNZyNNJz19uuP6Iwhkdm+DBfCJ9YU8YmmGGgZSnvEPkbRYe4M l2boWkj9TelrH9D4+PQNkmvck4aJ9PWcNERJQr1LkxWliwGm8F3SvTMvoBQ2wcM0p8wVgQD +qzqzW8lFPppo+GaXKfFDibwBCia+nKSgg20lWO0k0xHIRnYZ3zG/+rkz/2pp2wVZOFZzrn WdnbnC+ASEqZmB/w2DwMQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:hwMhN/bSMqw=:w1J/3KC1u7cdXiIRChjDfN T5RXxQFbu4Ub42STk185IYJ+/2y9CB/D2E1IQjezvIcMlKv1ayusss/zdP+eZDJLUB8Gt8sxY g63vM7mO7uQiYhNLoU281kvE90Mnx2wmZF1QT2/SBSEBPMeBFYeXhUTMuu3jnE8dr+KM1hYWi crGEWDnPjKClh44Yo96C83k4I1YqP5pSreO7lEXwrtpqng/9yjXkNqsodvWOOiT1iOLTSf2p3 AfOBaZI1hF9GxN4jwg53rW9r0unQEQ7xRxYQKO0l8vPK8TmM895fAzfNcSOyr2rQpiKT8hePY k6EKSUyg9HOr1mXgC2mdc+TQxPQlXxWuNfNI9JFGFg87vAzP20TtOrGiuqZxjawdII3XV0zmw wwwm7qtM/LZLyR8ud7irMvIxrZ2xWlBo3PX4I1eyWVqwAG/Q+N7trOKar6pSEF3acHTwi9S6c oSReo1Vtm3nJvlaozRjivxNeZ/v+O7y5iYfm3dTspMgBWRx3Fusda4IsmpYBffi/pLPEdRpGW HXjdcyE8bPw4dcPku0BaLirzilB9N75WQGg9sWfOgp4tycR2VAhsL5vFCJD/k/2A0ZfQetxP9 Ny6uB5ZsLLwL3sIr2oh0qy4kxwHntsAGuKES9rSccVe49tB+LhiWW5UCtfap+21nzlRn3JZtU Wv3BumiYCuPSfdC50Geyg4x9xIcUrc1Xu1h/NCgWLkOZjrC+djyKIMgT6/tBoV/IdkQQXhR/O bORjjH/Y7e6Rk535A9tFY+gjY8/1kTH/uZ8afg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The event_wait semaphore has completion semantics, so we can change it over to the completion interface for clarity without changing the behavior. Signed-off-by: Arnd Bergmann --- drivers/scsi/aacraid/aacraid.h | 3 ++- drivers/scsi/aacraid/commctrl.c | 1 - drivers/scsi/aacraid/commsup.c | 15 +++++++-------- drivers/scsi/aacraid/dpcsup.c | 19 +++++++++---------- drivers/scsi/aacraid/linit.c | 2 +- drivers/scsi/aacraid/src.c | 2 +- 6 files changed, 20 insertions(+), 22 deletions(-) diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 531a0b9a58f8..3291d1c16864 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -40,6 +40,7 @@ #define nblank(x) _nblank(x)[0] #include +#include #include #include @@ -1313,7 +1314,7 @@ struct fib { * This is the event the sendfib routine will wait on if the * caller did not pass one and this is synch io. */ - struct semaphore event_wait; + struct completion event_wait; spinlock_t event_lock; u32 done; /* gets set to 1 when fib is complete */ diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c index 6a6ad9477786..e2899ff7913e 100644 --- a/drivers/scsi/aacraid/commctrl.c +++ b/drivers/scsi/aacraid/commctrl.c @@ -41,7 +41,6 @@ #include #include /* ssleep prototype */ #include -#include #include #include diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index 7ed51a77e39d..d5a6aa9676c8 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include @@ -189,7 +188,7 @@ int aac_fib_setup(struct aac_dev * dev) fibptr->hw_fib_va = hw_fib; fibptr->data = (void *) fibptr->hw_fib_va->data; fibptr->next = fibptr+1; /* Forward chain the fibs */ - sema_init(&fibptr->event_wait, 0); + init_completion(&fibptr->event_wait); spin_lock_init(&fibptr->event_lock); hw_fib->header.XferState = cpu_to_le32(0xffffffff); hw_fib->header.SenderSize = @@ -623,7 +622,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, } if (wait) { fibptr->flags |= FIB_CONTEXT_FLAG_WAIT; - if (down_interruptible(&fibptr->event_wait)) { + if (wait_for_completion_interruptible(&fibptr->event_wait)) { fibptr->flags &= ~FIB_CONTEXT_FLAG_WAIT; return -EFAULT; } @@ -659,7 +658,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, * hardware failure has occurred. */ unsigned long timeout = jiffies + (180 * HZ); /* 3 minutes */ - while (down_trylock(&fibptr->event_wait)) { + while (!try_wait_for_completion(&fibptr->event_wait)) { int blink; if (time_is_before_eq_jiffies(timeout)) { struct aac_queue * q = &dev->queues->queue[AdapNormCmdQueue]; @@ -689,9 +688,9 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, */ schedule(); } - } else if (down_interruptible(&fibptr->event_wait)) { + } else if (wait_for_completion_interruptible(&fibptr->event_wait)) { /* Do nothing ... satisfy - * down_interruptible must_check */ + * wait_for_completion_interruptible must_check */ } spin_lock_irqsave(&fibptr->event_lock, flags); @@ -777,7 +776,7 @@ int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback, return -EFAULT; fibptr->flags |= FIB_CONTEXT_FLAG_WAIT; - if (down_interruptible(&fibptr->event_wait)) + if (wait_for_completion_interruptible(&fibptr->event_wait)) fibptr->done = 2; fibptr->flags &= ~(FIB_CONTEXT_FLAG_WAIT); @@ -1538,7 +1537,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type) || fib->flags & FIB_CONTEXT_FLAG_WAIT) { unsigned long flagv; spin_lock_irqsave(&fib->event_lock, flagv); - up(&fib->event_wait); + complete(&fib->event_wait); spin_unlock_irqrestore(&fib->event_lock, flagv); schedule(); retval = 0; diff --git a/drivers/scsi/aacraid/dpcsup.c b/drivers/scsi/aacraid/dpcsup.c index ddc69738375f..40a771dd1c0e 100644 --- a/drivers/scsi/aacraid/dpcsup.c +++ b/drivers/scsi/aacraid/dpcsup.c @@ -38,7 +38,6 @@ #include #include #include -#include #include "aacraid.h" @@ -129,7 +128,7 @@ unsigned int aac_response_normal(struct aac_queue * q) spin_lock_irqsave(&fib->event_lock, flagv); if (!fib->done) { fib->done = 1; - up(&fib->event_wait); + complete(&fib->event_wait); } spin_unlock_irqrestore(&fib->event_lock, flagv); @@ -376,16 +375,16 @@ unsigned int aac_intr_normal(struct aac_dev *dev, u32 index, int isAif, start_callback = 1; } else { unsigned long flagv; - int complete = 0; + int completed = 0; dprintk((KERN_INFO "event_wait up\n")); spin_lock_irqsave(&fib->event_lock, flagv); if (fib->done == 2) { fib->done = 1; - complete = 1; + completed = 1; } else { fib->done = 1; - up(&fib->event_wait); + complete(&fib->event_wait); } spin_unlock_irqrestore(&fib->event_lock, flagv); @@ -395,7 +394,7 @@ unsigned int aac_intr_normal(struct aac_dev *dev, u32 index, int isAif, mflags); FIB_COUNTER_INCREMENT(aac_config.NativeRecved); - if (complete) + if (completed) aac_fib_complete(fib); } } else { @@ -428,16 +427,16 @@ unsigned int aac_intr_normal(struct aac_dev *dev, u32 index, int isAif, start_callback = 1; } else { unsigned long flagv; - int complete = 0; + int completed = 0; dprintk((KERN_INFO "event_wait up\n")); spin_lock_irqsave(&fib->event_lock, flagv); if (fib->done == 2) { fib->done = 1; - complete = 1; + completed = 1; } else { fib->done = 1; - up(&fib->event_wait); + complete(&fib->event_wait); } spin_unlock_irqrestore(&fib->event_lock, flagv); @@ -447,7 +446,7 @@ unsigned int aac_intr_normal(struct aac_dev *dev, u32 index, int isAif, mflags); FIB_COUNTER_INCREMENT(aac_config.NormalRecved); - if (complete) + if (completed) aac_fib_complete(fib); } } diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 42defee90eb2..1c5d54c2f031 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c @@ -1560,7 +1560,7 @@ static void __aac_shutdown(struct aac_dev * aac) struct fib *fib = &aac->fibs[i]; if (!(fib->hw_fib_va->header.XferState & cpu_to_le32(NoResponseExpected | Async)) && (fib->hw_fib_va->header.XferState & cpu_to_le32(ResponseExpected))) - up(&fib->event_wait); + complete(&fib->event_wait); } kthread_stop(aac->thread); aac->thread = NULL; diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c index 7a51ccfa8662..8377aec0649d 100644 --- a/drivers/scsi/aacraid/src.c +++ b/drivers/scsi/aacraid/src.c @@ -106,7 +106,7 @@ static irqreturn_t aac_src_intr_message(int irq, void *dev_id) spin_lock_irqsave(&dev->sync_fib->event_lock, sflags); if (dev->sync_fib->flags & FIB_CONTEXT_FLAG_WAIT) { dev->management_fib_count--; - up(&dev->sync_fib->event_wait); + complete(&dev->sync_fib->event_wait); } spin_unlock_irqrestore(&dev->sync_fib->event_lock, sflags); -- 2.20.0