Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1226339 > unrolled thread

[PATCH 11/17] Update the rtsx multifunction driver to use idr helper functions.

Started byLee Duncan <lduncan@suse.com>
First post2015-09-16 20:00 +0200
Last post2015-09-16 20:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 11/17] Update the rtsx multifunction driver to use idr helper functions. Lee Duncan <lduncan@suse.com> - 2015-09-16 20:00 +0200

#1226339 — [PATCH 11/17] Update the rtsx multifunction driver to use idr helper functions.

FromLee Duncan <lduncan@suse.com>
Date2015-09-16 20:00 +0200
Subject[PATCH 11/17] Update the rtsx multifunction driver to use idr helper functions.
Message-ID<q9p9W-3ca-71@gated-at.bofh.it>
Signed-off-by: Lee Duncan <lduncan@suse.com>
---
 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);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web