• Parav Pandit's avatar
    IB/umad: Refactor code to use cdev_device_add() · e9dd5daf
    Parav Pandit authored
    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: default avatarParav Pandit <parav@mellanox.com>
    Reviewed-by: default avatarJack Morgenstein <jackm@mellanox.com>
    Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
    Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
    e9dd5daf
user_mad.c 34.3 KB