@@ -312,23 +312,14 @@ static ssize_t sta_aql_write(struct file *file, const char __user *userbuf,
312312STA_OPS_RW (aql );
313313
314314
315- static ssize_t sta_agg_status_read (struct file * file , char __user * userbuf ,
316- size_t count , loff_t * ppos )
315+ static ssize_t sta_agg_status_do_read (struct wiphy * wiphy , struct file * file ,
316+ char * buf , size_t bufsz , void * data )
317317{
318- char * buf , * p ;
319- ssize_t bufsz = 71 + IEEE80211_NUM_TIDS * 40 ;
318+ struct sta_info * sta = data ;
319+ char * p = buf ;
320320 int i ;
321- struct sta_info * sta = file -> private_data ;
322321 struct tid_ampdu_rx * tid_rx ;
323322 struct tid_ampdu_tx * tid_tx ;
324- ssize_t ret ;
325-
326- buf = kzalloc (bufsz , GFP_KERNEL );
327- if (!buf )
328- return - ENOMEM ;
329- p = buf ;
330-
331- rcu_read_lock ();
332323
333324 p += scnprintf (p , bufsz + buf - p , "next dialog_token: %#02x\n" ,
334325 sta -> ampdu_mlme .dialog_token_allocator + 1 );
@@ -338,8 +329,8 @@ static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf,
338329 for (i = 0 ; i < IEEE80211_NUM_TIDS ; i ++ ) {
339330 bool tid_rx_valid ;
340331
341- tid_rx = rcu_dereference ( sta -> ampdu_mlme .tid_rx [i ]);
342- tid_tx = rcu_dereference ( sta -> ampdu_mlme .tid_tx [i ]);
332+ tid_rx = wiphy_dereference ( wiphy , sta -> ampdu_mlme .tid_rx [i ]);
333+ tid_tx = wiphy_dereference ( wiphy , sta -> ampdu_mlme .tid_tx [i ]);
343334 tid_rx_valid = test_bit (i , sta -> ampdu_mlme .agg_session_valid );
344335
345336 p += scnprintf (p , bufsz + buf - p , "%02d" , i );
@@ -358,31 +349,39 @@ static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf,
358349 tid_tx ? skb_queue_len (& tid_tx -> pending ) : 0 );
359350 p += scnprintf (p , bufsz + buf - p , "\n" );
360351 }
361- rcu_read_unlock ();
362352
363- ret = simple_read_from_buffer (userbuf , count , ppos , buf , p - buf );
353+ return p - buf ;
354+ }
355+
356+ static ssize_t sta_agg_status_read (struct file * file , char __user * userbuf ,
357+ size_t count , loff_t * ppos )
358+ {
359+ struct sta_info * sta = file -> private_data ;
360+ struct wiphy * wiphy = sta -> local -> hw .wiphy ;
361+ size_t bufsz = 71 + IEEE80211_NUM_TIDS * 40 ;
362+ char * buf = kmalloc (bufsz , GFP_KERNEL );
363+ ssize_t ret ;
364+
365+ if (!buf )
366+ return - ENOMEM ;
367+
368+ ret = wiphy_locked_debugfs_read (wiphy , file , buf , bufsz ,
369+ userbuf , count , ppos ,
370+ sta_agg_status_do_read , sta );
364371 kfree (buf );
372+
365373 return ret ;
366374}
367375
368- static ssize_t sta_agg_status_write (struct file * file , const char __user * userbuf ,
369- size_t count , loff_t * ppos )
376+ static ssize_t sta_agg_status_do_write (struct wiphy * wiphy , struct file * file ,
377+ char * buf , size_t count , void * data )
370378{
371- char _buf [25 ] = {}, * buf = _buf ;
372- struct sta_info * sta = file -> private_data ;
379+ struct sta_info * sta = data ;
373380 bool start , tx ;
374381 unsigned long tid ;
375- char * pos ;
382+ char * pos = buf ;
376383 int ret , timeout = 5000 ;
377384
378- if (count > sizeof (_buf ))
379- return - EINVAL ;
380-
381- if (copy_from_user (buf , userbuf , count ))
382- return - EFAULT ;
383-
384- buf [sizeof (_buf ) - 1 ] = '\0' ;
385- pos = buf ;
386385 buf = strsep (& pos , " " );
387386 if (!buf )
388387 return - EINVAL ;
@@ -420,7 +419,6 @@ static ssize_t sta_agg_status_write(struct file *file, const char __user *userbu
420419 if (ret || tid >= IEEE80211_NUM_TIDS )
421420 return - EINVAL ;
422421
423- wiphy_lock (sta -> local -> hw .wiphy );
424422 if (tx ) {
425423 if (start )
426424 ret = ieee80211_start_tx_ba_session (& sta -> sta , tid ,
@@ -432,10 +430,22 @@ static ssize_t sta_agg_status_write(struct file *file, const char __user *userbu
432430 3 , true);
433431 ret = 0 ;
434432 }
435- wiphy_unlock (sta -> local -> hw .wiphy );
436433
437434 return ret ?: count ;
438435}
436+
437+ static ssize_t sta_agg_status_write (struct file * file ,
438+ const char __user * userbuf ,
439+ size_t count , loff_t * ppos )
440+ {
441+ struct sta_info * sta = file -> private_data ;
442+ struct wiphy * wiphy = sta -> local -> hw .wiphy ;
443+ char _buf [26 ];
444+
445+ return wiphy_locked_debugfs_write (wiphy , file , _buf , sizeof (_buf ),
446+ userbuf , count ,
447+ sta_agg_status_do_write , sta );
448+ }
439449STA_OPS_RW (agg_status );
440450
441451/* link sta attributes */
0 commit comments