@@ -198,13 +198,6 @@ static int ethtool_get_drvinfo(struct net_device *dev, void __user *useraddr)
198
198
rc = ops -> get_sset_count (dev , ETH_SS_PRIV_FLAGS );
199
199
if (rc >= 0 )
200
200
info .n_priv_flags = rc ;
201
- } else {
202
- /* code path for obsolete hooks */
203
-
204
- if (ops -> self_test_count )
205
- info .testinfo_len = ops -> self_test_count (dev );
206
- if (ops -> get_stats_count )
207
- info .n_stats = ops -> get_stats_count (dev );
208
201
}
209
202
if (ops -> get_regs_len )
210
203
info .regdump_len = ops -> get_regs_len (dev );
@@ -684,16 +677,10 @@ static int ethtool_self_test(struct net_device *dev, char __user *useraddr)
684
677
u64 * data ;
685
678
int ret , test_len ;
686
679
687
- if (!ops -> self_test )
688
- return - EOPNOTSUPP ;
689
- if (!ops -> get_sset_count && !ops -> self_test_count )
680
+ if (!ops -> self_test || !ops -> get_sset_count )
690
681
return - EOPNOTSUPP ;
691
682
692
- if (ops -> get_sset_count )
693
- test_len = ops -> get_sset_count (dev , ETH_SS_TEST );
694
- else
695
- /* code path for obsolete hook */
696
- test_len = ops -> self_test_count (dev );
683
+ test_len = ops -> get_sset_count (dev , ETH_SS_TEST );
697
684
if (test_len < 0 )
698
685
return test_len ;
699
686
WARN_ON (test_len == 0 );
@@ -728,36 +715,17 @@ static int ethtool_get_strings(struct net_device *dev, void __user *useraddr)
728
715
u8 * data ;
729
716
int ret ;
730
717
731
- if (!ops -> get_strings )
718
+ if (!ops -> get_strings || ! ops -> get_sset_count )
732
719
return - EOPNOTSUPP ;
733
720
734
721
if (copy_from_user (& gstrings , useraddr , sizeof (gstrings )))
735
722
return - EFAULT ;
736
723
737
- if (ops -> get_sset_count ) {
738
- ret = ops -> get_sset_count (dev , gstrings .string_set );
739
- if (ret < 0 )
740
- return ret ;
741
-
742
- gstrings .len = ret ;
743
- } else {
744
- /* code path for obsolete hooks */
745
-
746
- switch (gstrings .string_set ) {
747
- case ETH_SS_TEST :
748
- if (!ops -> self_test_count )
749
- return - EOPNOTSUPP ;
750
- gstrings .len = ops -> self_test_count (dev );
751
- break ;
752
- case ETH_SS_STATS :
753
- if (!ops -> get_stats_count )
754
- return - EOPNOTSUPP ;
755
- gstrings .len = ops -> get_stats_count (dev );
756
- break ;
757
- default :
758
- return - EINVAL ;
759
- }
760
- }
724
+ ret = ops -> get_sset_count (dev , gstrings .string_set );
725
+ if (ret < 0 )
726
+ return ret ;
727
+
728
+ gstrings .len = ret ;
761
729
762
730
data = kmalloc (gstrings .len * ETH_GSTRING_LEN , GFP_USER );
763
731
if (!data )
@@ -798,16 +766,10 @@ static int ethtool_get_stats(struct net_device *dev, void __user *useraddr)
798
766
u64 * data ;
799
767
int ret , n_stats ;
800
768
801
- if (!ops -> get_ethtool_stats )
802
- return - EOPNOTSUPP ;
803
- if (!ops -> get_sset_count && !ops -> get_stats_count )
769
+ if (!ops -> get_ethtool_stats || !ops -> get_sset_count )
804
770
return - EOPNOTSUPP ;
805
771
806
- if (ops -> get_sset_count )
807
- n_stats = ops -> get_sset_count (dev , ETH_SS_STATS );
808
- else
809
- /* code path for obsolete hook */
810
- n_stats = ops -> get_stats_count (dev );
772
+ n_stats = ops -> get_sset_count (dev , ETH_SS_STATS );
811
773
if (n_stats < 0 )
812
774
return n_stats ;
813
775
WARN_ON (n_stats == 0 );
0 commit comments