Changeset 34372


Ignore:
Timestamp:
2012-11-25T17:23:03+01:00 (5 years ago)
Author:
juhosg
Message:

AA: generic: ar8216: introduce ar8216_mib_op helper

Backport of r34297.

The ar8216_mib_{capture,flush} functions are similar.
Move the common code into a helper and use that from
the original functions.

This change also fixes a lockdep warning in
ar8216_mib_flush.

Signed-off-by: Gabor Juhos <juhosg@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/attitude_adjustment/target/linux/generic/files/drivers/net/phy/ar8216.c

    r34371 r34372  
    362362 
    363363static int 
    364 ar8216_mib_capture(struct ar8216_priv *priv) 
     364ar8216_mib_op(struct ar8216_priv *priv, u32 op) 
    365365{ 
    366366        unsigned mib_func; 
     
    376376        mutex_lock(&priv->reg_mutex); 
    377377        /* Capture the hardware statistics for all ports */ 
    378         ar8216_rmw(priv, mib_func, AR8216_MIB_FUNC, 
    379                    (AR8216_MIB_FUNC_CAPTURE << AR8216_MIB_FUNC_S)); 
     378        ar8216_rmw(priv, mib_func, AR8216_MIB_FUNC, (op << AR8216_MIB_FUNC_S)); 
    380379        mutex_unlock(&priv->reg_mutex); 
    381380 
     
    392391 
    393392static int 
     393ar8216_mib_capture(struct ar8216_priv *priv) 
     394{ 
     395        return ar8216_mib_op(priv, AR8216_MIB_FUNC_CAPTURE); 
     396} 
     397 
     398static int 
    394399ar8216_mib_flush(struct ar8216_priv *priv) 
    395400{ 
    396         unsigned mib_func; 
    397         int ret; 
    398  
    399         lockdep_assert_held(&priv->mib_lock); 
    400  
    401         if (chip_is_ar8327(priv)) 
    402                 mib_func = AR8327_REG_MIB_FUNC; 
    403         else 
    404                 mib_func = AR8216_REG_MIB_FUNC; 
    405  
    406         /* Flush hardware statistics for all ports */ 
    407         ar8216_rmw(priv, mib_func, AR8216_MIB_FUNC, 
    408                    (AR8216_MIB_FUNC_FLUSH << AR8216_MIB_FUNC_S)); 
    409  
    410         /* Wait for the capturing to complete. */ 
    411         ret = ar8216_reg_wait(priv, mib_func, AR8216_MIB_BUSY, 0, 10); 
    412         if (ret) 
    413                 goto out; 
    414  
    415         ret = 0; 
    416  
    417 out: 
    418         return ret; 
     401        return ar8216_mib_op(priv, AR8216_MIB_FUNC_FLUSH); 
    419402} 
    420403 
Note: See TracChangeset for help on using the changeset viewer.