Re: [PATCH rdma-next 1/6] IB/umad: Define and use macro for infiniband_mad class name

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

 



On Tue, Dec 18, 2018 at 02:15:43PM +0200, Leon Romanovsky wrote:
> From: Parav Pandit <parav@xxxxxxxxxxxx>
> 
> Define a class name macro for infiniband_mad class and use it in
> procedure calls (replacing the explicit string argument).
> 
> Signed-off-by: Parav Pandit <parav@xxxxxxxxxxxx>
> Reviewed-by: Jack Morgenstein <jackm@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
>  drivers/infiniband/core/user_mad.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
> index f55f48f6b272..6ca5b517a944 100644
> +++ b/drivers/infiniband/core/user_mad.c
> @@ -61,6 +61,8 @@ MODULE_AUTHOR("Roland Dreier");
>  MODULE_DESCRIPTION("InfiniBand userspace MAD packet access");
>  MODULE_LICENSE("Dual BSD/GPL");
>  
> +#define IB_UMAD_CLASS_NAME "infiniband_mad"
> +
>  enum {
>  	IB_UMAD_MAX_PORTS  = RDMA_MAX_PORTS,
>  	IB_UMAD_MAX_AGENTS = 32,
> @@ -1338,7 +1340,7 @@ static int __init ib_umad_init(void)
>  
>  	ret = register_chrdev_region(base_umad_dev,
>  				     IB_UMAD_NUM_FIXED_MINOR * 2,
> -				     "infiniband_mad");
> +				     IB_UMAD_CLASS_NAME);
>  	if (ret) {
>  		pr_err("couldn't register device number\n");
>  		goto out;
> @@ -1346,14 +1348,14 @@ static int __init ib_umad_init(void)
>  
>  	ret = alloc_chrdev_region(&dynamic_umad_dev, 0,
>  				  IB_UMAD_NUM_DYNAMIC_MINOR * 2,
> -				  "infiniband_mad");
> +				  IB_UMAD_CLASS_NAME);
>  	if (ret) {
>  		pr_err("couldn't register dynamic device number\n");
>  		goto out_alloc;
>  	}
>  	dynamic_issm_dev = dynamic_umad_dev + IB_UMAD_NUM_DYNAMIC_MINOR;
>  
> -	umad_class = class_create(THIS_MODULE, "infiniband_mad");
> +	umad_class = class_create(THIS_MODULE, IB_UMAD_CLASS_NAME);

Why not create the class first and just use umad_class->name for all
the other stuff?

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