From patchwork Tue Sep 15 16:46:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Duncan X-Patchwork-Id: 7188261 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 71F5A9F32B for ; Tue, 15 Sep 2015 16:52:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AACE420741 for ; Tue, 15 Sep 2015 16:52:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D480B2073A for ; Tue, 15 Sep 2015 16:52:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753401AbbIOQv1 (ORCPT ); Tue, 15 Sep 2015 12:51:27 -0400 Received: from mx2.suse.de ([195.135.220.15]:52886 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753094AbbIOQrv (ORCPT ); Tue, 15 Sep 2015 12:47:51 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E1B0BAD73; Tue, 15 Sep 2015 16:47:48 +0000 (UTC) Received: by worklaptop.gonzoleeman.net (Postfix, from userid 1000) id 28BE540C80; Tue, 15 Sep 2015 09:47:37 -0700 (PDT) From: Lee Duncan To: , Cc: Hannes Reinecke , Johannes Thumshirn , Christoph Hellwig , Lee Duncan , Samuel Ortiz Subject: [PATCH 11/17] Update the rtsx multifunction driver to use idr helper functions. Date: Tue, 15 Sep 2015 09:46:11 -0700 Message-Id: <07029fe6d1206aa0e6aa0e539173bf3289920ca8.1442263512.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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 Signed-off-by: Lee Duncan --- drivers/mfd/rtsx_pcr.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c index a66540a49079..8ddefb8c5e64 100644 --- a/drivers/mfd/rtsx_pcr.c +++ b/drivers/mfd/rtsx_pcr.c @@ -1191,15 +1191,10 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, } handle->pcr = pcr; - idr_preload(GFP_KERNEL); - spin_lock(&rtsx_pci_lock); - ret = idr_alloc(&rtsx_pci_idr, pcr, 0, 0, GFP_NOWAIT); - if (ret >= 0) - pcr->id = ret; - spin_unlock(&rtsx_pci_lock); - idr_preload_end(); + ret = idr_get_index(&rtsx_pci_idr, &rtsc_pci_lock, pcr); if (ret < 0) goto free_handle; + pcr->id = ret; pcr->pci = pcidev; dev_set_drvdata(&pcidev->dev, handle); @@ -1311,9 +1306,7 @@ static void rtsx_pci_remove(struct pci_dev *pcidev) pci_release_regions(pcidev); pci_disable_device(pcidev); - spin_lock(&rtsx_pci_lock); - idr_remove(&rtsx_pci_idr, pcr->id); - spin_unlock(&rtsx_pci_lock); + idr_put_index(&rtsx_pci_idr, &rtsx_pci_lock, pcr->id); kfree(pcr->slots); kfree(pcr);