From patchwork Mon Oct 17 16:30:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 77776 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp477107qge; Mon, 17 Oct 2016 09:33:04 -0700 (PDT) X-Received: by 10.98.83.134 with SMTP id h128mr38816764pfb.94.1476721983951; Mon, 17 Oct 2016 09:33:03 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l78si31499519pfi.288.2016.10.17.09.33.03; Mon, 17 Oct 2016 09:33:03 -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 dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936284AbcJQQdA (ORCPT + 27 others); Mon, 17 Oct 2016 12:33:00 -0400 Received: from mail-pf0-f169.google.com ([209.85.192.169]:34670 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936016AbcJQQbw (ORCPT ); Mon, 17 Oct 2016 12:31:52 -0400 Received: by mail-pf0-f169.google.com with SMTP id r16so57555230pfg.1 for ; Mon, 17 Oct 2016 09:31:51 -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=kX9fy6nztZSkwUDm3NFMtb7nSI5ui5OmCHQyRHXaKuk=; b=ixYDSuM0452eNc7mZg7LvALLqKa9p/od1b77jjaw2N91am1hlUUKC+ChW+y3zuKvQq kEy+X63e0Ov//MHn5cipfWtAPuS1BN/cqrBZE6dueEj1q1WSZwcOel57y5LdvRiyLZJb TrV5PYD0aFaA6J8VB6sYpTSB3bSnD5TwOKmNE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kX9fy6nztZSkwUDm3NFMtb7nSI5ui5OmCHQyRHXaKuk=; b=iXyRoz+/q9GskzVlXHXnJhhch4bkkRu7+gEBdgjk0fsBDT9Dn79Duyfgvk6X2FHfjJ GhkI6REDMELkO+p3Nje55Prk0EtMg0pkjh5Ecv9BjZBK0pPV0LMeOlNXDi99rzjtjpos QhscO5amW/9gUUVrKRaUlLKDHTlZyCebQ9Q6rlTy5B7ksGn267c5RRohwCM12cj3o7EM cV01Lb0nOib+xerP/w0dLo4uJ1L3QqspMx0VuHJzG7YkmS3iW9/RnoyP3/Bw43AKl91K NxRT+Xsdjpg9NaZsShK9ObEoGcWzFCudUBK6lhjN7QxQV7U0Egz8M7fcv9IPWxZz9G2o fF9g== X-Gm-Message-State: AA6/9RlumMj1DlVxQ7dI2HQIhOtjd6QNEGsk9Hx7yBONliLCQMIZatX8QLZ0SlCHwT2wQ3Im X-Received: by 10.98.65.85 with SMTP id o82mr5633821pfa.168.1476721911029; Mon, 17 Oct 2016 09:31:51 -0700 (PDT) Received: from blr-ubuntu-59.ap.qualcomm.com ([202.46.23.61]) by smtp.gmail.com with ESMTPSA id o9sm43009638pac.27.2016.10.17.09.31.48 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Oct 2016 09:31:50 -0700 (PDT) From: Binoy Jayan To: Doug Ledford , Sean Hefty , Hal Rosenstock Cc: Arnd Bergmann , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Binoy Jayan Subject: [PATCH 5/8] IB/isert: Replace semaphore sem with completion Date: Mon, 17 Oct 2016 22:00:59 +0530 Message-Id: <1476721862-7070-6-git-send-email-binoy.jayan@linaro.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1476721862-7070-1-git-send-email-binoy.jayan@linaro.org> References: <1476721862-7070-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 'sem' in isert_device is used as completion, so convert it to struct completion. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- drivers/infiniband/ulp/isert/ib_isert.c | 6 +++--- drivers/infiniband/ulp/isert/ib_isert.h | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 6dd43f6..de80f56 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c @@ -619,7 +619,7 @@ mutex_unlock(&isert_np->mutex); isert_info("np %p: Allow accept_np to continue\n", isert_np); - up(&isert_np->sem); + complete(&isert_np->comp); } static void @@ -2311,7 +2311,7 @@ struct rdma_cm_id * isert_err("Unable to allocate struct isert_np\n"); return -ENOMEM; } - sema_init(&isert_np->sem, 0); + init_completion(&isert_np->comp); mutex_init(&isert_np->mutex); INIT_LIST_HEAD(&isert_np->accepted); INIT_LIST_HEAD(&isert_np->pending); @@ -2427,7 +2427,7 @@ struct rdma_cm_id * int ret; accept_wait: - ret = down_interruptible(&isert_np->sem); + ret = wait_for_completion_interruptible(&isert_np->comp); if (ret) return -ENODEV; diff --git a/drivers/infiniband/ulp/isert/ib_isert.h b/drivers/infiniband/ulp/isert/ib_isert.h index c02ada5..a1277c0 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.h +++ b/drivers/infiniband/ulp/isert/ib_isert.h @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -190,7 +191,7 @@ struct isert_device { struct isert_np { struct iscsi_np *np; - struct semaphore sem; + struct completion comp; struct rdma_cm_id *cm_id; struct mutex mutex; struct list_head accepted;