Re: [PATCH 21/32] hfi1: Convert hfi1_unit_table to XArray

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/20/2019 7:20 PM, Matthew Wilcox wrote:
Also remove hfi1_devs_list.

Signed-off-by: Matthew Wilcox <willy@xxxxxxxxxxxxx>
---
  drivers/infiniband/hw/hfi1/chip.c    | 16 ++++-----
  drivers/infiniband/hw/hfi1/debugfs.c |  8 ++---
  drivers/infiniband/hw/hfi1/driver.c  | 10 +++---
  drivers/infiniband/hw/hfi1/hfi.h     |  5 ++-
  drivers/infiniband/hw/hfi1/init.c    | 51 +++++-----------------------
  drivers/infiniband/hw/hfi1/verbs.c   |  8 ++---
  6 files changed, 30 insertions(+), 68 deletions(-)

Not able to apply on top of rdma/for-next so I didn't test it but it looks mostly OK to me except one issue noted below.

@@ -1293,21 +1275,10 @@ static struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev,
  	dd->pport = (struct hfi1_pportdata *)(dd + 1);
  	dd->pcidev = pdev;
  	pci_set_drvdata(pdev, dd);
-
-	INIT_LIST_HEAD(&dd->list);
-	idr_preload(GFP_KERNEL);
-	spin_lock_irqsave(&hfi1_devs_lock, flags);
-
-	ret = idr_alloc(&hfi1_unit_table, dd, 0, 0, GFP_NOWAIT);
-	if (ret >= 0) {
-		dd->unit = ret;
-		list_add(&dd->list, &hfi1_dev_list);
-	}
  	dd->node = -1;
- spin_unlock_irqrestore(&hfi1_devs_lock, flags);
-	idr_preload_end();
-
+	ret = xa_alloc_irq(&hfi1_dev_table, &dd->unit, dd, xa_limit_32b,
+			GFP_KERNEL);
  	if (ret < 0) {
  		dev_err(&pdev->dev,
  			"Could not allocate unit ID: error %d\n", -ret);

Why change this from a no sleep to being able to sleep?


-Denny



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux