From patchwork Wed Sep 16 17:50:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Duncan X-Patchwork-Id: 7198071 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 D94DF9F380 for ; Wed, 16 Sep 2015 17:53:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2AC8E207B5 for ; Wed, 16 Sep 2015 17:53:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 45900203DC for ; Wed, 16 Sep 2015 17:53:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753841AbbIPRxl (ORCPT ); Wed, 16 Sep 2015 13:53:41 -0400 Received: from mx2.suse.de ([195.135.220.15]:51438 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754281AbbIPRvT (ORCPT ); Wed, 16 Sep 2015 13:51:19 -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 B1A9DADDA; Wed, 16 Sep 2015 17:51:17 +0000 (UTC) Received: by worklaptop.gonzoleeman.net (Postfix, from userid 1000) id C19DB40C7E; Wed, 16 Sep 2015 10:51:12 -0700 (PDT) From: Lee Duncan To: linux-scsi@vger.kernel.org, James.Bottomley@HansenPartnership.com Cc: linux-kernel@vger.kernel.org, hare@suse.com, jthumshirn@suse.de, hch@infradead.org, Lee Duncan , Samuel Ortiz Subject: [PATCH 11/17] Update the rtsx multifunction driver to use idr helper functions. Date: Wed, 16 Sep 2015 10:50:29 -0700 Message-Id: <07029fe6d1206aa0e6aa0e539173bf3289920ca8.1442263513.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);