]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
IB/umad: Refactor code to use cdev_device_add()
authorParav Pandit <parav@mellanox.com>
Fri, 21 Dec 2018 14:19:25 +0000 (16:19 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Fri, 21 Dec 2018 18:39:38 +0000 (11:39 -0700)
commite9dd5daf884cf591f9c9a122351d2f9ccf7b97d3
tree0853ff10e38b660002834dffc798d1c888a6b167
parentcf7ad3030271c55a7119a8c2162563e3f6e93879
IB/umad: Refactor code to use cdev_device_add()

Refactor code to use cdev_device_add() and do other minor refactors while
modifying these functions as below.

1. Instead of returning generic -1, return an actual error for
   ib_umad_init_port().

2. Introduce and use ib_umad_init_port_dev() for sm and umad char devices.

3. Instead of kobj, use more light weight kref to refcount ib_umad_device.

4. Use modern cdev_device_add() single code cut down three steps of
   cdev_add(), device_create(). This further helps to move device sysfs
   files to class attributes in subsequent patch.

5. Remove few empty lines while refactoring these functions.

6. Use sizeof() instead of sizeof to avoid checkpatch warning.

7. Use struct_size() for calculation of ib_umad_port.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Jack Morgenstein <jackm@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/user_mad.c