From patchwork Sun Sep 6 17:59:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Duncan X-Patchwork-Id: 7132391 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 278D19F380 for ; Sun, 6 Sep 2015 17:59:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 62C44206D2 for ; Sun, 6 Sep 2015 17:59:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 66CC5206D0 for ; Sun, 6 Sep 2015 17:59:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753263AbbIFR7x (ORCPT ); Sun, 6 Sep 2015 13:59:53 -0400 Received: from mx2.suse.de ([195.135.220.15]:46822 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753218AbbIFR7t (ORCPT ); Sun, 6 Sep 2015 13:59:49 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 0C6BBAD8D; Sun, 6 Sep 2015 17:59:48 +0000 (UTC) Received: by worklaptop.gonzoleeman.net (Postfix, from userid 1000) id 0F76140C78; Sun, 6 Sep 2015 10:59:36 -0700 (PDT) From: Lee Duncan To: linux-scsi Cc: Christoph Hellwig , hare@suse.com, jthumshirn@suse.de, JBottomley@Parallels.com, Lee Duncan Subject: [PATCH 5/6] Update nvme-core driver to use new ida helper functions Date: Sun, 6 Sep 2015 10:59:33 -0700 Message-Id: <90505dd4055db214efa70ad36b78d0c4b4d500ba.1441416572.git.lduncan@suse.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This simplifies the calling sequence to acquire and to release an ida-managed index. Signed-off-by: Lee Duncan --- drivers/block/nvme-core.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index d1d6141920d3..ab13833d4fde 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c @@ -2715,15 +2715,7 @@ static int nvme_set_instance(struct nvme_dev *dev) { int instance, error; - do { - if (!ida_pre_get(&nvme_instance_ida, GFP_KERNEL)) - return -ENODEV; - - spin_lock(&dev_list_lock); - error = ida_get_new(&nvme_instance_ida, &instance); - spin_unlock(&dev_list_lock); - } while (error == -EAGAIN); - + error = ida_get_index(&nvme_instance_ida, &dev_list_lock, &instance); if (error) return -ENODEV; @@ -2733,9 +2725,7 @@ static int nvme_set_instance(struct nvme_dev *dev) static void nvme_release_instance(struct nvme_dev *dev) { - spin_lock(&dev_list_lock); - ida_remove(&nvme_instance_ida, dev->instance); - spin_unlock(&dev_list_lock); + ida_put_index(&nvme_instance_ida, &dev_list_lock, dev->instance); } static void nvme_free_namespaces(struct nvme_dev *dev)