Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp91302imm; Thu, 21 Jun 2018 14:30:59 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIc5CCaShNwSrjECJ4PhqRFcZoQQa1iO0Z32+0AXQpDbpIoOAmhpM6N2d5eFjTekMTvdgqZ X-Received: by 2002:a65:418b:: with SMTP id a11-v6mr23917651pgq.118.1529616659163; Thu, 21 Jun 2018 14:30:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529616659; cv=none; d=google.com; s=arc-20160816; b=hjMgiw3XWnWlAb+oqqdKwTmtsQ3gGFVGDxZ5xzlzMt2gV/Aa/wnDU6GAno1pCpGjph SnErgahM4ZBZjTswgAecuWXqxDMZ3ahrHWZct3sKefHOK9UOjE7UOtT1cAYIgBxiVobN YQjWSRcHDCmPfOJu1q5U2MvgVA9KawqeLURj9my20iCU1u/ewgB8Jcx4c60lGp7Q1YhG rtSMmcOTn5nHUWqu8j3PzwyKnz9lDii8yUx2d1+Hp2JUV7LcsAJZqEBhL+uvk46ix8iB rWjkd44u9CuBCrXxSTAYVtEhwP32xaXd1SEVIYI/RI+XzkUUWRpbdoCVn/eIF7Mv7eER WBaQ== 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=u8BTn218/t3eDoWCzJWmHuqJemJyGCmVAnA9recO0+4=; b=rNPjBwjr1kDwk+0ySVQnxC/fxppxHdATrDmWmz2IAyxKoYNu4RSsdOV0hsIvXuI+ue NUJ+AM3azfxNXuvY6S5WygLbPRHaKOl4GMGeAEUjIgAEKSKrl+bxsJCWlD2Kl5Pax64U 9w7g/2SeI862aZ5GGsCLncrWM13EEuqVgZ+eixHfRY8mxsrqFEsOuijpZAE3voDYv5KE wZJjKsdwQr1YbKBy21SmKW2yyXdgzNtKw2NurcD2kbLPZf0IFABz3ywWeiL0KD9aCdb6 w0DAvmg8q64iR+1Bt/fvRkBNuV8W5LsKeeLC1pYvPmq3XXaAf71fHtHpmo3d1XUFupU2 sxQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=ikPar9SD; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t12-v6si4604575pgp.565.2018.06.21.14.30.44; Thu, 21 Jun 2018 14:30:59 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=ikPar9SD; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934034AbeFUV3Q (ORCPT + 99 others); Thu, 21 Jun 2018 17:29:16 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:41768 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933945AbeFUV3J (ORCPT ); Thu, 21 Jun 2018 17:29:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=u8BTn218/t3eDoWCzJWmHuqJemJyGCmVAnA9recO0+4=; b=ikPar9SD/Pc79to3I5GKp7dos BMLGzmyAUeG+eI9fXXrfQpYLcWEZ7U7kVGnXq9LYifa9O12tELxcuN+OFXufRwjQ0ob34MHYSZSbP O869KjLB/Pc/nsdOiJFHkYUl0CHzkplIafUqIwBgd2pCH9xoHmMbUl+W0pYEJ2LPNDyb15fr4qEo8 TqWIPKFsUD0gkL6yd+nF57f3IuuiiIRTs8dEP1PuuF6Kp4NwQUXuakyLfikQnAizwBMY8TJNj+5N/ Eg76+xr8Q8p7V0rhAaVX4fip8w1AeIaI5NIU7qsspBLd9metSORtfnbm9j2ePWJTdRPmsYulSrM+h 5vbKWI7ZQ==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fW78e-0001bW-NY; Thu, 21 Jun 2018 21:29:08 +0000 From: Matthew Wilcox To: linux-kernel@vger.kernel.org Cc: Matthew Wilcox , Joshua Morris , Philip Kelleher , Jens Axboe , linux-block@vger.kernel.org Subject: [PATCH 10/26] rsxx: Convert to new IDA API Date: Thu, 21 Jun 2018 14:28:19 -0700 Message-Id: <20180621212835.5636-11-willy@infradead.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180621212835.5636-1-willy@infradead.org> References: <20180621212835.5636-1-willy@infradead.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Eliminate the custom spinlock and the call to ida_pre_get. Also add a call to ida_free() in the card remove routine, which I believe fixes a bug in this driver. Signed-off-by: Matthew Wilcox --- drivers/block/rsxx/core.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c index b7d71914a32a..f2c631ce793c 100644 --- a/drivers/block/rsxx/core.c +++ b/drivers/block/rsxx/core.c @@ -58,7 +58,6 @@ MODULE_PARM_DESC(sync_start, "On by Default: Driver load will not complete " "until the card startup has completed."); static DEFINE_IDA(rsxx_disk_ida); -static DEFINE_SPINLOCK(rsxx_ida_lock); /* --------------------Debugfs Setup ------------------- */ @@ -771,19 +770,10 @@ static int rsxx_pci_probe(struct pci_dev *dev, card->dev = dev; pci_set_drvdata(dev, card); - do { - if (!ida_pre_get(&rsxx_disk_ida, GFP_KERNEL)) { - st = -ENOMEM; - goto failed_ida_get; - } - - spin_lock(&rsxx_ida_lock); - st = ida_get_new(&rsxx_disk_ida, &card->disk_id); - spin_unlock(&rsxx_ida_lock); - } while (st == -EAGAIN); - - if (st) + st = ida_alloc(&rsxx_disk_ida, GFP_KERNEL); + if (st < 0) goto failed_ida_get; + card->disk_id = st; st = pci_enable_device(dev); if (st) @@ -985,9 +975,7 @@ static int rsxx_pci_probe(struct pci_dev *dev, failed_dma_mask: pci_disable_device(dev); failed_enable: - spin_lock(&rsxx_ida_lock); - ida_remove(&rsxx_disk_ida, card->disk_id); - spin_unlock(&rsxx_ida_lock); + ida_free(&rsxx_disk_ida, card->disk_id); failed_ida_get: kfree(card); @@ -1050,6 +1038,7 @@ static void rsxx_pci_remove(struct pci_dev *dev) pci_disable_device(dev); pci_release_regions(dev); + ida_free(&rsxx_disk_ida, card->disk_id); kfree(card); } -- 2.17.1