From patchwork Thu Jun 8 10:07:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 103373 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2361345qgd; Thu, 8 Jun 2017 03:08:10 -0700 (PDT) X-Received: by 10.99.104.199 with SMTP id d190mr37665419pgc.185.1496916490434; 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=efRnEY63psGL4Z+KzSDbUDfm0P/TTedt0fXXLLvN21wevxBXaNDr51pdSsECZTGNpR /rLhA/PQ2LcW5Lm8LHtr/Bj9WflKhUGoixnZDKvK+Uogcq5mUjXUo3o6+Ih1+wJN+xQs cVcEVfvuwYIaZT9f/UraOhDZQF2WckoSvxpIdus494zH/9mzAiymFL1JU1rHpcH88ZGZ hScOB8YGwDFzvsK2Mal9gb+ndTNrH4nnFws+w+83YOmXo1Msh9e8Gq7rv8Lo9gJOStRX njfZ/XuQ1vd4xoMjVkb7ZDKdYLiXlIcd15S3sz0V8VdGjE46yZwL3qVVgPC8OS66n0jf OXGQ== 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=bt7N+fNm0yXo4lK/gGRRzmLkwWDDajrWvu6oJ7zcmEM=; b=PnXFtJ+SuKryfcNVtLyZ63lrJBPfSojWpkax7hrM3PJ0JqAhF03jncIoJwSplfwTpC 1yeu2inaAyyf2aAQEfvNVEL5ojJRptcz9Fka2VzkIkPVrHw4HXIsr9KzDgD3cp9v1d2q a6NcbOdL4YJzJdGoZssvXEdmkFwH7EFn5aP2rQLiH3Vg1CYt2RD8PSPfABVebxE6owl8 d8H6zQ8OeKqvf5L7CAc2zQzVOrOO7ay7/s3PhIun0LL1oZv8y7feBwqh306LRHI0PLeK UKtGdYH1bKAvvgy1LR+WbPAS9515bx9m2uUVMtCjX9UpQXRE2+APfwzFdRei+K2Rvx7r hWUw== 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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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.09; Thu, 08 Jun 2017 03:08:10 -0700 (PDT) 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; dkim=pass header.i=@linaro.org; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751619AbdFHKH5 (ORCPT + 25 others); Thu, 8 Jun 2017 06:07:57 -0400 Received: from mail-pg0-f49.google.com ([74.125.83.49]:36435 "EHLO mail-pg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751539AbdFHKHy (ORCPT ); Thu, 8 Jun 2017 06:07:54 -0400 Received: by mail-pg0-f49.google.com with SMTP id a70so14580178pge.3 for ; Thu, 08 Jun 2017 03:07:54 -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=bt7N+fNm0yXo4lK/gGRRzmLkwWDDajrWvu6oJ7zcmEM=; b=WK+z4/8UHwOHDoLLt0kH0xtWdMTLgWOGsKhyvcGG21KKZmT/oKKf+iIyYrVZccfbJG GdYA9EMBukWS4prDg4UflkqqrxelPjjxHzNxFukCbdz+FEUvEdDu4ljDn3W6mmVLNKmb SpRA0BhBbvSOuLh7sHkE3GS/JtGglWD5ygS/Q= 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=bt7N+fNm0yXo4lK/gGRRzmLkwWDDajrWvu6oJ7zcmEM=; b=sBiuoefVjTRmfwyerws3fSPhQdB8iiyJkjIxafY1OPT5jk0eqzDY8uUQRm/ggGHc10 iu8kDaGjaeBVuMp/2qElhNqHjYt5O+cZuYBbwxqtmuXg1edvOIBRLfXov5UXr7GGijKZ 8XJkqqGqwhphTkqNzAiiBoQS6Uw4qs6qj66ebjI2liZHl0e9nxri4m/LDkQcFC0KgVIo N5+DD/1qT+f8L2FG+fSBeOVRwLvPAKGHAxKQF4HKO3woC4PDqIZsN9BsUAjHGvJQWWQn TXjej4yG+vmAedO2z9tWAXJBVIqObvBea2AYb9NKNt4c0m7sSAUHTGPfUtp/bDD7HhfK Gvsg== X-Gm-Message-State: AODbwcBDKzO27l6mDUf+TGp2pgYZsVmpPxDhYLfV7lpbLnIHCgsC+YfL j1rNZ7ipnapJzOjB X-Received: by 10.99.160.82 with SMTP id u18mr17314452pgn.176.1496916473860; Thu, 08 Jun 2017 03:07:53 -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.50 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Jun 2017 03:07:53 -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 1/2] scsi: esas2r: Replace semaphore fm_api_semaphore with mutex Date: Thu, 8 Jun 2017 15:37:30 +0530 Message-Id: <1496916451-6606-2-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The semaphore 'fm_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 | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) -- Binoy Jayan diff --git a/drivers/scsi/esas2r/esas2r.h b/drivers/scsi/esas2r/esas2r.h index b6030e3..c5013de 100644 --- a/drivers/scsi/esas2r/esas2r.h +++ b/drivers/scsi/esas2r/esas2r.h @@ -945,7 +945,7 @@ struct esas2r_adapter { struct list_head vrq_mds_head; struct esas2r_mem_desc *vrq_mds; int num_vrqs; - struct semaphore fm_api_semaphore; + struct mutex fm_api_mutex; struct semaphore fs_api_semaphore; struct semaphore nvram_semaphore; struct atto_ioctl *local_atto_ioctl; diff --git a/drivers/scsi/esas2r/esas2r_init.c b/drivers/scsi/esas2r/esas2r_init.c index 6432a50..ad85b33 100644 --- a/drivers/scsi/esas2r/esas2r_init.c +++ b/drivers/scsi/esas2r/esas2r_init.c @@ -327,7 +327,7 @@ int esas2r_init_adapter(struct Scsi_Host *host, struct pci_dev *pcid, esas2r_debug("new adapter %p, name %s", a, a->name); spin_lock_init(&a->request_lock); spin_lock_init(&a->fw_event_lock); - sema_init(&a->fm_api_semaphore, 1); + mutex_init(&a->fm_api_mutex); sema_init(&a->fs_api_semaphore, 1); sema_init(&a->nvram_semaphore, 1); diff --git a/drivers/scsi/esas2r/esas2r_ioctl.c b/drivers/scsi/esas2r/esas2r_ioctl.c index 2d4b7f0..c6b041a 100644 --- a/drivers/scsi/esas2r/esas2r_ioctl.c +++ b/drivers/scsi/esas2r/esas2r_ioctl.c @@ -110,7 +110,7 @@ static void do_fm_api(struct esas2r_adapter *a, struct esas2r_flash_img *fi) { struct esas2r_request *rq; - if (down_interruptible(&a->fm_api_semaphore)) { + if (mutex_lock_interruptible(&a->fm_api_mutex)) { fi->status = FI_STAT_BUSY; return; } @@ -173,7 +173,7 @@ static void do_fm_api(struct esas2r_adapter *a, struct esas2r_flash_img *fi) free_req: esas2r_free_request(a, (struct esas2r_request *)rq); free_sem: - up(&a->fm_api_semaphore); + mutex_unlock(&a->fm_api_mutex); return; }