Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp92572imm; Thu, 21 Jun 2018 14:32:19 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLzFyVaM7BQADn9HqsRoH00IIReRFHv8Y9C4j0g4Xh2j0LEFw9smOIv7T97I4BHzDLov8QU X-Received: by 2002:a63:920c:: with SMTP id o12-v6mr24004941pgd.233.1529616738931; Thu, 21 Jun 2018 14:32:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529616738; cv=none; d=google.com; s=arc-20160816; b=aEAzwVQMx8jm0bb+aouOt/RNKr9929gQYHgFpQjWWwBt6eZLgZe+oDc2qtHL2f/USt 0RZHa2zeDS4tLxrLYysdgE4gBvIt6HV99tjO9G5sNK/gA1oVwq50vWBrOT1Ee9lTRprK dJlWoBmHw2rYFYGJNxqhgo/c8Jo/wT4yBs6CvPVJE167cNuW1JFc35GRZKLj6o3THBoJ ANPZamUqEVGE+rXSLRS4zL+8O9lprcPuo1GRF70ajQfi9Tr5yGo07uRv+uVFE0Wwjtir muujQdljMLTWSuG78Kj7JcSitxNfWG17TEExfe6gvB7OYGSIzdnfxzYRNawbzvu/Vk/r LOtA== 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=omgzzMx1J+Hfd5X9RmHLAvs+yg1SHAbIpfDV56GPEcg=; b=jeATuLbrvf5pJJjS+IaI7IJ8dBM3lVOPqyXVJHFtmMr70UJ7wXUN+QdNWST/29BsZU 7LawqxflFCas7AvJsJL2tk8EegBPUD1Pe7tvlvSOn0Qn4pOqFJBU95SUL8KQmweu0Fhj u27q4d20vPR2tYNnJfuTcRcOvXClfb5ZqfNVUMXW4Qni26sGbm0Z/Z7vsDjOXc2dGQZK 9EpcAz1lPgUQZeRSGyGVRhPyJ9sDNqKr5D0g+pUApYsOggl1TF5XAlbhdNledSxyOivL 5trHIqN5Vc9I8MG26mchmnF0ZRGTKluyzKnxWS/xOCGH8hCO7GUmUeUkY3gJvdyllmtA /+iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=ntTpH7BD; 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 s9-v6si4823085pgr.474.2018.06.21.14.32.04; Thu, 21 Jun 2018 14:32:18 -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=ntTpH7BD; 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 S934069AbeFUVaf (ORCPT + 99 others); Thu, 21 Jun 2018 17:30:35 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:41854 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933991AbeFUV3M (ORCPT ); Thu, 21 Jun 2018 17:29:12 -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=omgzzMx1J+Hfd5X9RmHLAvs+yg1SHAbIpfDV56GPEcg=; b=ntTpH7BDuL2OvKVRfR94gA+US R0JctUW2u1KaaAaSyarybunGB6kHfpWoKKdrBoVtOfFFduLp0gFsPT2BoeGLy9LhozfQ+moatqs+m mmuFfasrHO1D/wt0+EUyY3kT3HA/IJ665vkj1HjD3LUgUPEilc56+tyU5h3qHJP9meP2WOrueqS7V 4BVx22DachMOv5VgpeAfOybTgnyqfRsLATQjT13023bpyoRPjQALCy713geBT8uElKuvlwNwVBhvf gKUSYlzrGB/wDDBgVbAQlkQIksx+GHfd8rQ/RjgFw8RqOo+Dmhw2jtU/oKH+VI2dTE+yAriBTKkNW vv+gjUy6A==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fW78e-0001bd-SZ; Thu, 21 Jun 2018 21:29:08 +0000 From: Matthew Wilcox To: linux-kernel@vger.kernel.org Cc: Matthew Wilcox , =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= , Arnd Bergmann , Greg Kroah-Hartman Subject: [PATCH 11/26] cb710: Convert to new IDA API Date: Thu, 21 Jun 2018 14:28:20 -0700 Message-Id: <20180621212835.5636-12-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 Eliminates the custom spinlock and the call to ida_pre_get. Signed-off-by: Matthew Wilcox --- drivers/misc/cb710/core.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/drivers/misc/cb710/core.c b/drivers/misc/cb710/core.c index 4d4acf763b65..2c43fd09d602 100644 --- a/drivers/misc/cb710/core.c +++ b/drivers/misc/cb710/core.c @@ -16,7 +16,6 @@ #include static DEFINE_IDA(cb710_ida); -static DEFINE_SPINLOCK(cb710_ida_lock); void cb710_pci_update_config_reg(struct pci_dev *pdev, int reg, uint32_t mask, uint32_t xor) @@ -205,7 +204,6 @@ static int cb710_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { struct cb710_chip *chip; - unsigned long flags; u32 val; int err; int n = 0; @@ -256,18 +254,10 @@ static int cb710_probe(struct pci_dev *pdev, if (err) return err; - do { - if (!ida_pre_get(&cb710_ida, GFP_KERNEL)) - return -ENOMEM; - - spin_lock_irqsave(&cb710_ida_lock, flags); - err = ida_get_new(&cb710_ida, &chip->platform_id); - spin_unlock_irqrestore(&cb710_ida_lock, flags); - - if (err && err != -EAGAIN) - return err; - } while (err); - + err = ida_alloc(&cb710_ida, GFP_KERNEL); + if (err < 0) + return err; + chip->platform_id = err; dev_info(&pdev->dev, "id %d, IO 0x%p, IRQ %d\n", chip->platform_id, chip->iobase, pdev->irq); @@ -308,7 +298,6 @@ static int cb710_probe(struct pci_dev *pdev, static void cb710_remove_one(struct pci_dev *pdev) { struct cb710_chip *chip = pci_get_drvdata(pdev); - unsigned long flags; cb710_unregister_slot(chip, CB710_SLOT_SM); cb710_unregister_slot(chip, CB710_SLOT_MS); @@ -317,9 +306,7 @@ static void cb710_remove_one(struct pci_dev *pdev) BUG_ON(atomic_read(&chip->slot_refs_count) != 0); #endif - spin_lock_irqsave(&cb710_ida_lock, flags); - ida_remove(&cb710_ida, chip->platform_id); - spin_unlock_irqrestore(&cb710_ida_lock, flags); + ida_free(&cb710_ida, chip->platform_id); } static const struct pci_device_id cb710_pci_tbl[] = { -- 2.17.1