From patchwork Thu Jun 8 10:07:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 103374 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2361347qgd; Thu, 8 Jun 2017 03:08:10 -0700 (PDT) X-Received: by 10.84.213.129 with SMTP id g1mr30830608pli.202.1496916490707; Thu, 08 Jun 2017 03:08:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496916490; cv=none; d=google.com; s=arc-20160816; b=WmquHMy72QblW7hPiMCtL/DhWBM34YTt0SvwGEgM5PGuMcl5ne3GE2Ujhbpms02Dx2 ScldSo376QIXJMW9XRVg3KhjdXbxqdR7WxEs7ZjGTC9DsRtN0oVekHkfPiughf55Ga1I 3/zF90L5Kdy1d5AVd8SKR69/9w+kcNkgd5Xu0uKz3lLsE/9xVAm4bCsicRbwnzzfONB7 4hjDNdB2HZRBlV3uurxdincxXyW3Cx/73YUs62x99whd1M5NK2dAuITQNLDYWVszQfoz /F6bwoWHSAJecQdN9WU3P049kfsE/uJ7AblgUapVazmqyudRDIlfGyiW2baWeMl/oNIl k/Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=bd4XqtAxA98RGmTthA5rT7ze3tutWVR/qyA5npuKdyk=; b=gT4NemXCyIOg2FfvrZGcH4V47hyy7jEYXmQKbK0oXTU8N1spycEde+0Lc3L8KaKFbz Y95/nQpTrgS0SBqZYnBFQi/9hJOPCefaJk9UBxQQKlT6JS+52ePvWkwIDSFrFi+Vrhya j3qm/mRItYVK1yskpf2gbD29x+WhraNq/XIuua7oCpghBAxa9Im8zddFu83UYmXst6wu 4MA8aM65t3YhKuhx7l2wml39oJmauMNJZMTxS94GPTkUKfvkuxrZ99MU2RFyzJ2f/hxq +4ygAQP9eSUnV+UDyJ57qDV2T8aTvH6ScZsSK/Q/cO7Dv5YyxrZvd0t6Q38ctey4nLUj AfgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q12si4038013pgr.237.2017.06.08.03.08.10; Thu, 08 Jun 2017 03:08:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751667AbdFHKIB (ORCPT + 1 other); Thu, 8 Jun 2017 06:08:01 -0400 Received: from mail-pf0-f182.google.com ([209.85.192.182]:35208 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751557AbdFHKH5 (ORCPT ); Thu, 8 Jun 2017 06:07:57 -0400 Received: by mail-pf0-f182.google.com with SMTP id l89so15608656pfi.2 for ; Thu, 08 Jun 2017 03:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bd4XqtAxA98RGmTthA5rT7ze3tutWVR/qyA5npuKdyk=; b=cCm357+wPv/CGUcYP1YKVsBPD68IF2xUaI5RxP2cx2V9Qk4y0lWHq9bDcuHv4nXqNg QbgMc0F0Wse1/EHKngwSjEeD61kqLbu1RR5JYmAIcahQfhRqTaFbjKgGVv0NdhjAtMAl FlWPQ7R3nEQK/dIKa3GGtZPsb2gQ04S8clg5U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bd4XqtAxA98RGmTthA5rT7ze3tutWVR/qyA5npuKdyk=; b=hCV4C85SFkd1kHaqwhLOodKP4uyKrxFqz5YwcmL8k4nEf1/rbqxI3pEsdgAQdLk0Y0 q4Uz1nfBy3AbxymgDWMS69yo2acD0I9Fp+1oBhJsAxppIgiSN2yuTGOudKnJJfYrxtqY 5pAK3zkY/TEoqn0ef8ibl0x4ryp+XryMbhsBNVvedIfulgzhpwP23KD5RjgT3ouh6Mum 21rrhEp1oBD80pVVmA60I2NQ6p5AAVJ2syVrt6fcHvu6GPn1amHt0u5Kvt8AU92K1FoI Vns7RXPk+UkrJA30B3gsLQ9tCrtEodf/iYYzpiHS82JMTN0RpXKWMw164EHbsfLP8Obp EHRQ== X-Gm-Message-State: AODbwcDGZuEY8ZsuyVf7n0VVfnQ18nLtm8NbPB/XSGfCusplCnN4TmaK Od0vkbXNrX7DHTck X-Received: by 10.98.34.8 with SMTP id i8mr23469875pfi.194.1496916476985; Thu, 08 Jun 2017 03:07:56 -0700 (PDT) Received: from blr-ubuntu-59.ap.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id y9sm8689981pgc.27.2017.06.08.03.07.54 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Jun 2017 03:07:56 -0700 (PDT) From: Binoy Jayan To: Binoy Jayan Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Rajendra , Mark Brown , Bradley Grove , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org Subject: [PATCH 2/2] scsi: esas2r: Replace semaphore fs_api_semaphore with mutex Date: Thu, 8 Jun 2017 15:37:31 +0530 Message-Id: <1496916451-6606-3-git-send-email-binoy.jayan@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1496916451-6606-1-git-send-email-binoy.jayan@linaro.org> References: <1496916451-6606-1-git-send-email-binoy.jayan@linaro.org> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The semaphore 'fs_api_semaphore' is used as a simple mutex, so it should be written as one. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- drivers/scsi/esas2r/esas2r.h | 2 +- drivers/scsi/esas2r/esas2r_init.c | 2 +- drivers/scsi/esas2r/esas2r_ioctl.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) -- Binoy Jayan diff --git a/drivers/scsi/esas2r/esas2r.h b/drivers/scsi/esas2r/esas2r.h index c5013de..1da6407 100644 --- a/drivers/scsi/esas2r/esas2r.h +++ b/drivers/scsi/esas2r/esas2r.h @@ -946,7 +946,7 @@ struct esas2r_adapter { struct esas2r_mem_desc *vrq_mds; int num_vrqs; struct mutex fm_api_mutex; - struct semaphore fs_api_semaphore; + struct mutex fs_api_mutex; struct semaphore nvram_semaphore; struct atto_ioctl *local_atto_ioctl; u8 fw_coredump_buff[ESAS2R_FWCOREDUMP_SZ]; diff --git a/drivers/scsi/esas2r/esas2r_init.c b/drivers/scsi/esas2r/esas2r_init.c index ad85b33..5b14dd2 100644 --- a/drivers/scsi/esas2r/esas2r_init.c +++ b/drivers/scsi/esas2r/esas2r_init.c @@ -328,7 +328,7 @@ int esas2r_init_adapter(struct Scsi_Host *host, struct pci_dev *pcid, spin_lock_init(&a->request_lock); spin_lock_init(&a->fw_event_lock); mutex_init(&a->fm_api_mutex); - sema_init(&a->fs_api_semaphore, 1); + mutex_init(&a->fs_api_mutex); sema_init(&a->nvram_semaphore, 1); esas2r_fw_event_off(a); diff --git a/drivers/scsi/esas2r/esas2r_ioctl.c b/drivers/scsi/esas2r/esas2r_ioctl.c index c6b041a..9762300 100644 --- a/drivers/scsi/esas2r/esas2r_ioctl.c +++ b/drivers/scsi/esas2r/esas2r_ioctl.c @@ -1962,7 +1962,7 @@ int esas2r_read_fs(struct esas2r_adapter *a, char *buf, long off, int count) (struct esas2r_ioctl_fs *)a->fs_api_buffer; /* If another flash request is already in progress, return. */ - if (down_interruptible(&a->fs_api_semaphore)) { + if (mutex_lock_interruptible(&a->fs_api_mutex)) { busy: fs->status = ATTO_STS_OUT_OF_RSRC; return -EBUSY; @@ -1978,7 +1978,7 @@ int esas2r_read_fs(struct esas2r_adapter *a, char *buf, long off, int count) rq = esas2r_alloc_request(a); if (rq == NULL) { esas2r_debug("esas2r_read_fs: out of requests"); - up(&a->fs_api_semaphore); + mutex_unlock(&a->fs_api_mutex); goto busy; } @@ -2006,7 +2006,7 @@ int esas2r_read_fs(struct esas2r_adapter *a, char *buf, long off, int count) ; dont_wait: /* Free the request and keep going */ - up(&a->fs_api_semaphore); + mutex_unlock(&a->fs_api_mutex); esas2r_free_request(a, (struct esas2r_request *)rq); /* Pick up possible error code from above */