@@ -3001,188 +3001,6 @@ static void ice_ptp_cleanup_pf(struct ice_pf *pf)
3001
3001
mutex_unlock (& pf -> adapter -> ports .lock );
3002
3002
}
3003
3003
}
3004
- /**
3005
- * ice_ptp_aux_dev_to_aux_pf - Get auxiliary PF handle for the auxiliary device
3006
- * @aux_dev: auxiliary device to get the auxiliary PF for
3007
- */
3008
- static struct ice_pf *
3009
- ice_ptp_aux_dev_to_aux_pf (struct auxiliary_device * aux_dev )
3010
- {
3011
- struct ice_ptp_port * aux_port ;
3012
- struct ice_ptp * aux_ptp ;
3013
-
3014
- aux_port = container_of (aux_dev , struct ice_ptp_port , aux_dev );
3015
- aux_ptp = container_of (aux_port , struct ice_ptp , port );
3016
-
3017
- return container_of (aux_ptp , struct ice_pf , ptp );
3018
- }
3019
-
3020
- /**
3021
- * ice_ptp_aux_dev_to_owner_pf - Get PF handle for the auxiliary device
3022
- * @aux_dev: auxiliary device to get the PF for
3023
- */
3024
- static struct ice_pf *
3025
- ice_ptp_aux_dev_to_owner_pf (struct auxiliary_device * aux_dev )
3026
- {
3027
- struct ice_ptp_port_owner * ports_owner ;
3028
- const struct auxiliary_driver * aux_drv ;
3029
- struct ice_ptp * owner_ptp ;
3030
-
3031
- if (!aux_dev -> dev .driver )
3032
- return NULL ;
3033
-
3034
- aux_drv = to_auxiliary_drv (aux_dev -> dev .driver );
3035
- ports_owner = container_of (aux_drv , struct ice_ptp_port_owner ,
3036
- aux_driver );
3037
- owner_ptp = container_of (ports_owner , struct ice_ptp , ports_owner );
3038
- return container_of (owner_ptp , struct ice_pf , ptp );
3039
- }
3040
-
3041
- /**
3042
- * ice_ptp_auxbus_probe - Probe auxiliary devices
3043
- * @aux_dev: PF's auxiliary device
3044
- * @id: Auxiliary device ID
3045
- */
3046
- static int ice_ptp_auxbus_probe (struct auxiliary_device * aux_dev ,
3047
- const struct auxiliary_device_id * id )
3048
- {
3049
- struct ice_pf * owner_pf = ice_ptp_aux_dev_to_owner_pf (aux_dev );
3050
- struct ice_pf * aux_pf = ice_ptp_aux_dev_to_aux_pf (aux_dev );
3051
-
3052
- if (WARN_ON (!owner_pf ))
3053
- return - ENODEV ;
3054
-
3055
- INIT_LIST_HEAD (& aux_pf -> ptp .port .list_node );
3056
- mutex_lock (& owner_pf -> ptp .ports_owner .lock );
3057
- list_add (& aux_pf -> ptp .port .list_node ,
3058
- & owner_pf -> ptp .ports_owner .ports );
3059
- mutex_unlock (& owner_pf -> ptp .ports_owner .lock );
3060
-
3061
- return 0 ;
3062
- }
3063
-
3064
- /**
3065
- * ice_ptp_auxbus_remove - Remove auxiliary devices from the bus
3066
- * @aux_dev: PF's auxiliary device
3067
- */
3068
- static void ice_ptp_auxbus_remove (struct auxiliary_device * aux_dev )
3069
- {
3070
- struct ice_pf * owner_pf = ice_ptp_aux_dev_to_owner_pf (aux_dev );
3071
- struct ice_pf * aux_pf = ice_ptp_aux_dev_to_aux_pf (aux_dev );
3072
-
3073
- mutex_lock (& owner_pf -> ptp .ports_owner .lock );
3074
- list_del (& aux_pf -> ptp .port .list_node );
3075
- mutex_unlock (& owner_pf -> ptp .ports_owner .lock );
3076
- }
3077
-
3078
- /**
3079
- * ice_ptp_auxbus_shutdown
3080
- * @aux_dev: PF's auxiliary device
3081
- */
3082
- static void ice_ptp_auxbus_shutdown (struct auxiliary_device * aux_dev )
3083
- {
3084
- /* Doing nothing here, but handle to auxbus driver must be satisfied */
3085
- }
3086
-
3087
- /**
3088
- * ice_ptp_auxbus_suspend
3089
- * @aux_dev: PF's auxiliary device
3090
- * @state: power management state indicator
3091
- */
3092
- static int
3093
- ice_ptp_auxbus_suspend (struct auxiliary_device * aux_dev , pm_message_t state )
3094
- {
3095
- /* Doing nothing here, but handle to auxbus driver must be satisfied */
3096
- return 0 ;
3097
- }
3098
-
3099
- /**
3100
- * ice_ptp_auxbus_resume
3101
- * @aux_dev: PF's auxiliary device
3102
- */
3103
- static int ice_ptp_auxbus_resume (struct auxiliary_device * aux_dev )
3104
- {
3105
- /* Doing nothing here, but handle to auxbus driver must be satisfied */
3106
- return 0 ;
3107
- }
3108
-
3109
- /**
3110
- * ice_ptp_auxbus_create_id_table - Create auxiliary device ID table
3111
- * @pf: Board private structure
3112
- * @name: auxiliary bus driver name
3113
- */
3114
- static struct auxiliary_device_id *
3115
- ice_ptp_auxbus_create_id_table (struct ice_pf * pf , const char * name )
3116
- {
3117
- struct auxiliary_device_id * ids ;
3118
-
3119
- /* Second id left empty to terminate the array */
3120
- ids = devm_kcalloc (ice_pf_to_dev (pf ), 2 ,
3121
- sizeof (struct auxiliary_device_id ), GFP_KERNEL );
3122
- if (!ids )
3123
- return NULL ;
3124
-
3125
- snprintf (ids [0 ].name , sizeof (ids [0 ].name ), "ice.%s" , name );
3126
-
3127
- return ids ;
3128
- }
3129
-
3130
- /**
3131
- * ice_ptp_register_auxbus_driver - Register PTP auxiliary bus driver
3132
- * @pf: Board private structure
3133
- */
3134
- static int __always_unused ice_ptp_register_auxbus_driver (struct ice_pf * pf )
3135
- {
3136
- struct auxiliary_driver * aux_driver ;
3137
- struct ice_ptp * ptp ;
3138
- struct device * dev ;
3139
- char * name ;
3140
- int err ;
3141
-
3142
- ptp = & pf -> ptp ;
3143
- dev = ice_pf_to_dev (pf );
3144
- aux_driver = & ptp -> ports_owner .aux_driver ;
3145
- INIT_LIST_HEAD (& ptp -> ports_owner .ports );
3146
- mutex_init (& ptp -> ports_owner .lock );
3147
- name = devm_kasprintf (dev , GFP_KERNEL , "ptp_aux_dev_%u_%u_clk%u" ,
3148
- pf -> pdev -> bus -> number , PCI_SLOT (pf -> pdev -> devfn ),
3149
- ice_get_ptp_src_clock_index (& pf -> hw ));
3150
- if (!name )
3151
- return - ENOMEM ;
3152
-
3153
- aux_driver -> name = name ;
3154
- aux_driver -> shutdown = ice_ptp_auxbus_shutdown ;
3155
- aux_driver -> suspend = ice_ptp_auxbus_suspend ;
3156
- aux_driver -> remove = ice_ptp_auxbus_remove ;
3157
- aux_driver -> resume = ice_ptp_auxbus_resume ;
3158
- aux_driver -> probe = ice_ptp_auxbus_probe ;
3159
- aux_driver -> id_table = ice_ptp_auxbus_create_id_table (pf , name );
3160
- if (!aux_driver -> id_table )
3161
- return - ENOMEM ;
3162
-
3163
- err = auxiliary_driver_register (aux_driver );
3164
- if (err ) {
3165
- devm_kfree (dev , aux_driver -> id_table );
3166
- dev_err (dev , "Failed registering aux_driver, name <%s>\n" ,
3167
- name );
3168
- }
3169
-
3170
- return err ;
3171
- }
3172
-
3173
- /**
3174
- * ice_ptp_unregister_auxbus_driver - Unregister PTP auxiliary bus driver
3175
- * @pf: Board private structure
3176
- */
3177
- static void __always_unused ice_ptp_unregister_auxbus_driver (struct ice_pf * pf )
3178
- {
3179
- struct auxiliary_driver * aux_driver = & pf -> ptp .ports_owner .aux_driver ;
3180
-
3181
- auxiliary_driver_unregister (aux_driver );
3182
- devm_kfree (ice_pf_to_dev (pf ), aux_driver -> id_table );
3183
-
3184
- mutex_destroy (& pf -> ptp .ports_owner .lock );
3185
- }
3186
3004
3187
3005
/**
3188
3006
* ice_ptp_clock_index - Get the PTP clock index for this device
@@ -3321,76 +3139,6 @@ static int ice_ptp_init_port(struct ice_pf *pf, struct ice_ptp_port *ptp_port)
3321
3139
}
3322
3140
}
3323
3141
3324
- /**
3325
- * ice_ptp_release_auxbus_device
3326
- * @dev: device that utilizes the auxbus
3327
- */
3328
- static void ice_ptp_release_auxbus_device (struct device * dev )
3329
- {
3330
- /* Doing nothing here, but handle to auxbux device must be satisfied */
3331
- }
3332
-
3333
- /**
3334
- * ice_ptp_create_auxbus_device - Create PTP auxiliary bus device
3335
- * @pf: Board private structure
3336
- */
3337
- static __always_unused int ice_ptp_create_auxbus_device (struct ice_pf * pf )
3338
- {
3339
- struct auxiliary_device * aux_dev ;
3340
- struct ice_ptp * ptp ;
3341
- struct device * dev ;
3342
- char * name ;
3343
- int err ;
3344
- u32 id ;
3345
-
3346
- ptp = & pf -> ptp ;
3347
- id = ptp -> port .port_num ;
3348
- dev = ice_pf_to_dev (pf );
3349
-
3350
- aux_dev = & ptp -> port .aux_dev ;
3351
-
3352
- name = devm_kasprintf (dev , GFP_KERNEL , "ptp_aux_dev_%u_%u_clk%u" ,
3353
- pf -> pdev -> bus -> number , PCI_SLOT (pf -> pdev -> devfn ),
3354
- ice_get_ptp_src_clock_index (& pf -> hw ));
3355
- if (!name )
3356
- return - ENOMEM ;
3357
-
3358
- aux_dev -> name = name ;
3359
- aux_dev -> id = id ;
3360
- aux_dev -> dev .release = ice_ptp_release_auxbus_device ;
3361
- aux_dev -> dev .parent = dev ;
3362
-
3363
- err = auxiliary_device_init (aux_dev );
3364
- if (err )
3365
- goto aux_err ;
3366
-
3367
- err = auxiliary_device_add (aux_dev );
3368
- if (err ) {
3369
- auxiliary_device_uninit (aux_dev );
3370
- goto aux_err ;
3371
- }
3372
-
3373
- return 0 ;
3374
- aux_err :
3375
- dev_err (dev , "Failed to create PTP auxiliary bus device <%s>\n" , name );
3376
- devm_kfree (dev , name );
3377
- return err ;
3378
- }
3379
-
3380
- /**
3381
- * ice_ptp_remove_auxbus_device - Remove PTP auxiliary bus device
3382
- * @pf: Board private structure
3383
- */
3384
- static __always_unused void ice_ptp_remove_auxbus_device (struct ice_pf * pf )
3385
- {
3386
- struct auxiliary_device * aux_dev = & pf -> ptp .port .aux_dev ;
3387
-
3388
- auxiliary_device_delete (aux_dev );
3389
- auxiliary_device_uninit (aux_dev );
3390
-
3391
- memset (aux_dev , 0 , sizeof (* aux_dev ));
3392
- }
3393
-
3394
3142
/**
3395
3143
* ice_ptp_init_tx_interrupt_mode - Initialize device Tx interrupt mode
3396
3144
* @pf: Board private structure
0 commit comments