@@ -3033,7 +3033,7 @@ static int mlx4_init_port_info(struct mlx4_dev *dev, int port)
3033
3033
struct mlx4_port_info * info = & mlx4_priv (dev )-> port [port ];
3034
3034
int err ;
3035
3035
3036
- err = devlink_port_register (devlink , & info -> devlink_port , port );
3036
+ err = devl_port_register (devlink , & info -> devlink_port , port );
3037
3037
if (err )
3038
3038
return err ;
3039
3039
@@ -3071,7 +3071,7 @@ static int mlx4_init_port_info(struct mlx4_dev *dev, int port)
3071
3071
err = device_create_file (& dev -> persist -> pdev -> dev , & info -> port_attr );
3072
3072
if (err ) {
3073
3073
mlx4_err (dev , "Failed to create file for port %d\n" , port );
3074
- devlink_port_unregister (& info -> devlink_port );
3074
+ devl_port_unregister (& info -> devlink_port );
3075
3075
info -> port = -1 ;
3076
3076
return err ;
3077
3077
}
@@ -3093,7 +3093,7 @@ static int mlx4_init_port_info(struct mlx4_dev *dev, int port)
3093
3093
mlx4_err (dev , "Failed to create mtu file for port %d\n" , port );
3094
3094
device_remove_file (& info -> dev -> persist -> pdev -> dev ,
3095
3095
& info -> port_attr );
3096
- devlink_port_unregister (& info -> devlink_port );
3096
+ devl_port_unregister (& info -> devlink_port );
3097
3097
info -> port = -1 ;
3098
3098
return err ;
3099
3099
}
@@ -3109,7 +3109,7 @@ static void mlx4_cleanup_port_info(struct mlx4_port_info *info)
3109
3109
device_remove_file (& info -> dev -> persist -> pdev -> dev , & info -> port_attr );
3110
3110
device_remove_file (& info -> dev -> persist -> pdev -> dev ,
3111
3111
& info -> port_mtu_attr );
3112
- devlink_port_unregister (& info -> devlink_port );
3112
+ devl_port_unregister (& info -> devlink_port );
3113
3113
3114
3114
#ifdef CONFIG_RFS_ACCEL
3115
3115
free_irq_cpu_rmap (info -> rmap );
@@ -3333,6 +3333,7 @@ static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data,
3333
3333
int total_vfs , int * nvfs , struct mlx4_priv * priv ,
3334
3334
int reset_flow )
3335
3335
{
3336
+ struct devlink * devlink = priv_to_devlink (priv );
3336
3337
struct mlx4_dev * dev ;
3337
3338
unsigned sum = 0 ;
3338
3339
int err ;
@@ -3629,6 +3630,7 @@ static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data,
3629
3630
}
3630
3631
}
3631
3632
3633
+ devl_lock (devlink );
3632
3634
for (port = 1 ; port <= dev -> caps .num_ports ; port ++ ) {
3633
3635
err = mlx4_init_port_info (dev , port );
3634
3636
if (err )
@@ -3642,6 +3644,7 @@ static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data,
3642
3644
if (err )
3643
3645
goto err_port ;
3644
3646
3647
+ devl_unlock (devlink );
3645
3648
mlx4_request_modules (dev );
3646
3649
3647
3650
mlx4_sense_init (dev );
@@ -3658,6 +3661,7 @@ static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data,
3658
3661
err_port :
3659
3662
for (-- port ; port >= 1 ; -- port )
3660
3663
mlx4_cleanup_port_info (& priv -> port [port ]);
3664
+ devl_unlock (devlink );
3661
3665
3662
3666
mlx4_cleanup_default_counters (dev );
3663
3667
if (!mlx4_is_slave (dev ))
@@ -4061,8 +4065,10 @@ static void mlx4_unload_one(struct pci_dev *pdev)
4061
4065
struct mlx4_dev * dev = persist -> dev ;
4062
4066
struct mlx4_priv * priv = mlx4_priv (dev );
4063
4067
int pci_dev_data ;
4068
+ struct devlink * devlink ;
4064
4069
int p , i ;
4065
4070
4071
+ devlink = priv_to_devlink (priv );
4066
4072
if (priv -> removed )
4067
4073
return ;
4068
4074
@@ -4078,10 +4084,12 @@ static void mlx4_unload_one(struct pci_dev *pdev)
4078
4084
mlx4_stop_sense (dev );
4079
4085
mlx4_unregister_device (dev );
4080
4086
4087
+ devl_lock (devlink );
4081
4088
for (p = 1 ; p <= dev -> caps .num_ports ; p ++ ) {
4082
4089
mlx4_cleanup_port_info (& priv -> port [p ]);
4083
4090
mlx4_CLOSE_PORT (dev , p );
4084
4091
}
4092
+ devl_unlock (devlink );
4085
4093
4086
4094
if (mlx4_is_master (dev ))
4087
4095
mlx4_free_resource_tracker (dev ,
0 commit comments