mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 17:41:50 +00:00
IB/ocrdma: convert to idr_alloc()
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Roland Dreier <roland@purestorage.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
6a9200603d
commit
cffcd59f15
1 changed files with 1 additions and 13 deletions
|
@ -51,18 +51,6 @@ static DEFINE_IDR(ocrdma_dev_id);
|
||||||
|
|
||||||
static union ib_gid ocrdma_zero_sgid;
|
static union ib_gid ocrdma_zero_sgid;
|
||||||
|
|
||||||
static int ocrdma_get_instance(void)
|
|
||||||
{
|
|
||||||
int instance = 0;
|
|
||||||
|
|
||||||
/* Assign an unused number */
|
|
||||||
if (!idr_pre_get(&ocrdma_dev_id, GFP_KERNEL))
|
|
||||||
return -1;
|
|
||||||
if (idr_get_new(&ocrdma_dev_id, NULL, &instance))
|
|
||||||
return -1;
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ocrdma_get_guid(struct ocrdma_dev *dev, u8 *guid)
|
void ocrdma_get_guid(struct ocrdma_dev *dev, u8 *guid)
|
||||||
{
|
{
|
||||||
u8 mac_addr[6];
|
u8 mac_addr[6];
|
||||||
|
@ -416,7 +404,7 @@ static struct ocrdma_dev *ocrdma_add(struct be_dev_info *dev_info)
|
||||||
goto idr_err;
|
goto idr_err;
|
||||||
|
|
||||||
memcpy(&dev->nic_info, dev_info, sizeof(*dev_info));
|
memcpy(&dev->nic_info, dev_info, sizeof(*dev_info));
|
||||||
dev->id = ocrdma_get_instance();
|
dev->id = idr_alloc(&ocrdma_dev_id, NULL, 0, 0, GFP_KERNEL);
|
||||||
if (dev->id < 0)
|
if (dev->id < 0)
|
||||||
goto idr_err;
|
goto idr_err;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue