Re: [PATCH 27/32] ocrdma: Convert ocrdma_dev_id to IDA

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

 



On Wed, Feb 20, 2019 at 04:21:02PM -0800, Matthew Wilcox wrote:
> This driver doesn't look up the pointer that it stores, so this can
> just be an IDA and save some memory.
> 
> Signed-off-by: Matthew Wilcox <willy@xxxxxxxxxxxxx>
> ---
>  drivers/infiniband/hw/ocrdma/ocrdma_main.c | 16 +++++++---------
>  1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
> index 1f393842453a..b014eeffbcce 100644
> --- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c
> +++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
> @@ -62,7 +62,7 @@ MODULE_DESCRIPTION(OCRDMA_ROCE_DRV_DESC " " OCRDMA_ROCE_DRV_VERSION);
>  MODULE_AUTHOR("Emulex Corporation");
>  MODULE_LICENSE("Dual BSD/GPL");
>  
> -static DEFINE_IDR(ocrdma_dev_id);
> +static DEFINE_IDA(ocrdma_dev_id);
>  
>  void ocrdma_get_guid(struct ocrdma_dev *dev, u8 *guid)
>  {
> @@ -302,12 +302,12 @@ static struct ocrdma_dev *ocrdma_add(struct be_dev_info *dev_info)
>  	}
>  	dev->mbx_cmd = kzalloc(sizeof(struct ocrdma_mqe_emb_cmd), GFP_KERNEL);
>  	if (!dev->mbx_cmd)
> -		goto idr_err;
> +		goto ida_err;
>  
>  	memcpy(&dev->nic_info, dev_info, sizeof(*dev_info));
> -	dev->id = idr_alloc(&ocrdma_dev_id, NULL, 0, 0, GFP_KERNEL);
> +	dev->id = ida_alloc(&ocrdma_dev_id, GFP_KERNEL);

WTF.. There are only three places where this id is used:
 - A whole bunch of pr_* calls which *really* should be dev_* calls
   with no ID (grrrr)
 - It is passed to userspace in the ucontext udata, and userpace
   ignores it (double grrrrr)
 - It is used to form a name for request_irq (use the pci BDF)

We should delete this thing :(

Jason



[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