From patchwork Wed Jun 8 07:50:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 69585 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp2358504qgf; Wed, 8 Jun 2016 00:51:12 -0700 (PDT) X-Received: by 10.98.49.133 with SMTP id x127mr4393926pfx.140.1465372272368; Wed, 08 Jun 2016 00:51:12 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o3si538853pfg.243.2016.06.08.00.51.11; Wed, 08 Jun 2016 00:51:12 -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 S1422848AbcFHHvD (ORCPT + 31 others); Wed, 8 Jun 2016 03:51:03 -0400 Received: from mail-pf0-f178.google.com ([209.85.192.178]:36089 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161308AbcFHHu7 (ORCPT ); Wed, 8 Jun 2016 03:50:59 -0400 Received: by mail-pf0-f178.google.com with SMTP id t190so90909pfb.3 for ; Wed, 08 Jun 2016 00:50: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=BzKXqi0U9GvwZe8eaJRvzuUFC2h3iQjE2zG/Umf2AwM=; b=J75+erO10sjtnzmpeFOWSIglfCAtVjRPM4CxyiM28VBwXHEL2f+ZItlwYLDJAbBJwG k+HsOyZZpddfY1UgLPIlD/UsGcBXbiorRMgMdTAR7YcdrHYc2Sd8UXPOiAcY0eVojeRl HFFmuAoT86L7e02lN8Ia0YAWLYpW5eXDT/YSA= 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=BzKXqi0U9GvwZe8eaJRvzuUFC2h3iQjE2zG/Umf2AwM=; b=Fcc38ougoZAaMaCd1ceUadqvxUBuKg2ZqW5J6f8kD/myIJNGZUPNMw+8hPnsBakERs Cumqewfui2mSy7UZerdU7vFH7AUXfHLWkPelcNAejrCMrqegd60HZe8lu+dMYSr5HIHo dH6OxVVV0tO6ktdOmzUT39Pnuisjh3qkrQPONpBRcZL9JzsPPXwwPL18IcCthLv+pp/U /R0+uOGL+5eTRhVhucRuUdrtLp2VBKrRZW8aIp08ni1h5BFxfXaZhFD8zF9ZzsKpOPto BG6RRrWrwylYpFF2Nv9bOHw7dJ+Op/5xGo/+Gwmo3ZOYqNF6eJ/kMG6PG5R2SZlND7R9 pmpA== X-Gm-Message-State: ALyK8tJF2GtrU0Jb2Ft6JZ3pxCEPahd4o1ysdKZni7BlP3QXXMa70lwEFwm/Y2GK6ImKvg2n X-Received: by 10.98.216.199 with SMTP id e190mr2007708pfg.76.1465372256938; Wed, 08 Jun 2016 00:50:56 -0700 (PDT) Received: from blr-ubuntu-59.ap.qualcomm.com ([202.46.23.61]) by smtp.gmail.com with ESMTPSA id x71sm40438095pfj.43.2016.06.08.00.50.53 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jun 2016 00:50:56 -0700 (PDT) From: Binoy Jayan To: Greg Kroah-Hartman , Oleg Drokin , Andreas Dilger , lustre-devel@lists.lustre.org Cc: Arnd Bergmann , driverdev-devel@linuxdriverproject.org, linux-kernel@vger.kernel.org, Binoy Jayan Subject: [PATCH 1/2] staging: lustre: lloop_device: Replace semaphore lo_sem with completion Date: Wed, 8 Jun 2016 13:20:41 +0530 Message-Id: <1465372242-7116-2-git-send-email-binoy.jayan@linaro.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1465372242-7116-1-git-send-email-binoy.jayan@linaro.org> References: <1465372242-7116-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 'lo_sem' in lloop_device is used as completion, so it should be written as one. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- drivers/staging/lustre/lustre/llite/lloop.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c index 813a9a3..90b31ba 100644 --- a/drivers/staging/lustre/lustre/llite/lloop.c +++ b/drivers/staging/lustre/lustre/llite/lloop.c @@ -131,7 +131,7 @@ struct lloop_device { struct bio *lo_bio; struct bio *lo_biotail; int lo_state; - struct semaphore lo_sem; + struct completion lo_comp; struct mutex lo_ctl_mutex; atomic_t lo_pending; wait_queue_head_t lo_bh_wait; @@ -423,9 +423,9 @@ static int loop_thread(void *data) lo->lo_pvec.ldp_offsets = lo->lo_requests[0].lrd_offsets; /* - * up sem, we are running + * signal completion, we are running */ - up(&lo->lo_sem); + complete(&lo->lo_comp); for (;;) { wait_event(lo->lo_bh_wait, loop_active(lo)); @@ -466,7 +466,7 @@ static int loop_thread(void *data) cl_env_put(env, &refcheck); out: - up(&lo->lo_sem); + complete(&lo->lo_comp); return ret; } @@ -539,7 +539,7 @@ static int loop_set_fd(struct lloop_device *lo, struct file *unused, set_blocksize(bdev, lo->lo_blocksize); kthread_run(loop_thread, lo, "lloop%d", lo->lo_number); - down(&lo->lo_sem); + wait_for_completion(&lo->lo_comp); return 0; out: @@ -568,7 +568,7 @@ static int loop_clr_fd(struct lloop_device *lo, struct block_device *bdev, spin_unlock_irq(&lo->lo_lock); wake_up(&lo->lo_bh_wait); - down(&lo->lo_sem); + wait_for_completion(&lo->lo_comp); lo->lo_backing_file = NULL; lo->lo_device = NULL; lo->lo_offset = 0; @@ -821,7 +821,7 @@ static int __init lloop_init(void) goto out_mem4; mutex_init(&lo->lo_ctl_mutex); - sema_init(&lo->lo_sem, 0); + init_completion(&lo->lo_comp); init_waitqueue_head(&lo->lo_bh_wait); lo->lo_number = i; spin_lock_init(&lo->lo_lock);