@@ -1462,8 +1462,8 @@ static int qca8k_find_cpu_port(struct dsa_switch *ds)
14621462static int
14631463qca8k_setup_of_pws_reg (struct qca8k_priv * priv )
14641464{
1465+ const struct qca8k_match_data * data = priv -> info ;
14651466 struct device_node * node = priv -> dev -> of_node ;
1466- const struct qca8k_match_data * data ;
14671467 u32 val = 0 ;
14681468 int ret ;
14691469
@@ -1472,8 +1472,6 @@ qca8k_setup_of_pws_reg(struct qca8k_priv *priv)
14721472 * Should be applied by default but we set this just to make sure.
14731473 */
14741474 if (priv -> switch_id == QCA8K_ID_QCA8327 ) {
1475- data = of_device_get_match_data (priv -> dev );
1476-
14771475 /* Set the correct package of 148 pin for QCA8327 */
14781476 if (data -> reduced_package )
14791477 val |= QCA8327_PWS_PACKAGE148_EN ;
@@ -1996,23 +1994,19 @@ static void qca8k_setup_pcs(struct qca8k_priv *priv, struct qca8k_pcs *qpcs,
19961994static void
19971995qca8k_get_strings (struct dsa_switch * ds , int port , u32 stringset , uint8_t * data )
19981996{
1999- const struct qca8k_match_data * match_data ;
20001997 struct qca8k_priv * priv = ds -> priv ;
20011998 int i ;
20021999
20032000 if (stringset != ETH_SS_STATS )
20042001 return ;
20052002
2006- match_data = of_device_get_match_data (priv -> dev );
2007-
2008- for (i = 0 ; i < match_data -> mib_count ; i ++ )
2003+ for (i = 0 ; i < priv -> info -> mib_count ; i ++ )
20092004 strncpy (data + i * ETH_GSTRING_LEN , ar8327_mib [i ].name ,
20102005 ETH_GSTRING_LEN );
20112006}
20122007
20132008static void qca8k_mib_autocast_handler (struct dsa_switch * ds , struct sk_buff * skb )
20142009{
2015- const struct qca8k_match_data * match_data ;
20162010 struct qca8k_mib_eth_data * mib_eth_data ;
20172011 struct qca8k_priv * priv = ds -> priv ;
20182012 const struct qca8k_mib_desc * mib ;
@@ -2031,10 +2025,9 @@ static void qca8k_mib_autocast_handler(struct dsa_switch *ds, struct sk_buff *sk
20312025 if (port != mib_eth_data -> req_port )
20322026 goto exit ;
20332027
2034- match_data = device_get_match_data (priv -> dev );
20352028 data = mib_eth_data -> data ;
20362029
2037- for (i = 0 ; i < match_data -> mib_count ; i ++ ) {
2030+ for (i = 0 ; i < priv -> info -> mib_count ; i ++ ) {
20382031 mib = & ar8327_mib [i ];
20392032
20402033 /* First 3 mib are present in the skb head */
@@ -2106,7 +2099,6 @@ qca8k_get_ethtool_stats(struct dsa_switch *ds, int port,
21062099 uint64_t * data )
21072100{
21082101 struct qca8k_priv * priv = (struct qca8k_priv * )ds -> priv ;
2109- const struct qca8k_match_data * match_data ;
21102102 const struct qca8k_mib_desc * mib ;
21112103 u32 reg , i , val ;
21122104 u32 hi = 0 ;
@@ -2116,9 +2108,7 @@ qca8k_get_ethtool_stats(struct dsa_switch *ds, int port,
21162108 qca8k_get_ethtool_stats_eth (ds , port , data ) > 0 )
21172109 return ;
21182110
2119- match_data = of_device_get_match_data (priv -> dev );
2120-
2121- for (i = 0 ; i < match_data -> mib_count ; i ++ ) {
2111+ for (i = 0 ; i < priv -> info -> mib_count ; i ++ ) {
21222112 mib = & ar8327_mib [i ];
21232113 reg = QCA8K_PORT_MIB_COUNTER (port ) + mib -> offset ;
21242114
@@ -2141,15 +2131,12 @@ qca8k_get_ethtool_stats(struct dsa_switch *ds, int port,
21412131static int
21422132qca8k_get_sset_count (struct dsa_switch * ds , int port , int sset )
21432133{
2144- const struct qca8k_match_data * match_data ;
21452134 struct qca8k_priv * priv = ds -> priv ;
21462135
21472136 if (sset != ETH_SS_STATS )
21482137 return 0 ;
21492138
2150- match_data = of_device_get_match_data (priv -> dev );
2151-
2152- return match_data -> mib_count ;
2139+ return priv -> info -> mib_count ;
21532140}
21542141
21552142static int
@@ -3093,23 +3080,22 @@ static const struct dsa_switch_ops qca8k_switch_ops = {
30933080
30943081static int qca8k_read_switch_id (struct qca8k_priv * priv )
30953082{
3096- const struct qca8k_match_data * data ;
30973083 u32 val ;
30983084 u8 id ;
30993085 int ret ;
31003086
3101- /* get the switches ID from the compatible */
3102- data = of_device_get_match_data (priv -> dev );
3103- if (!data )
3087+ if (!priv -> info )
31043088 return - ENODEV ;
31053089
31063090 ret = qca8k_read (priv , QCA8K_REG_MASK_CTRL , & val );
31073091 if (ret < 0 )
31083092 return - ENODEV ;
31093093
31103094 id = QCA8K_MASK_CTRL_DEVICE_ID (val );
3111- if (id != data -> id ) {
3112- dev_err (priv -> dev , "Switch id detected %x but expected %x" , id , data -> id );
3095+ if (id != priv -> info -> id ) {
3096+ dev_err (priv -> dev ,
3097+ "Switch id detected %x but expected %x" ,
3098+ id , priv -> info -> id );
31133099 return - ENODEV ;
31143100 }
31153101
@@ -3134,6 +3120,7 @@ qca8k_sw_probe(struct mdio_device *mdiodev)
31343120 if (!priv )
31353121 return - ENOMEM ;
31363122
3123+ priv -> info = of_device_get_match_data (priv -> dev );
31373124 priv -> bus = mdiodev -> bus ;
31383125 priv -> dev = & mdiodev -> dev ;
31393126
0 commit comments