@@ -542,8 +542,7 @@ static const u16 phy2speed[] = {
542
542
};
543
543
544
544
static struct platform_device * dpaa_eth_add_device (int fman_id ,
545
- struct mac_device * mac_dev ,
546
- struct device_node * node )
545
+ struct mac_device * mac_dev )
547
546
{
548
547
struct platform_device * pdev ;
549
548
struct dpaa_eth_data data ;
@@ -556,10 +555,8 @@ static struct platform_device *dpaa_eth_add_device(int fman_id,
556
555
data .mac_dev = mac_dev ;
557
556
data .mac_hw_id = priv -> cell_index ;
558
557
data .fman_hw_id = fman_id ;
559
- data .mac_node = node ;
560
558
561
559
mutex_lock (& eth_lock );
562
-
563
560
pdev = platform_device_alloc ("dpaa-ethernet" , dpaa_eth_dev_cnt );
564
561
if (!pdev ) {
565
562
ret = - ENOMEM ;
@@ -648,9 +645,6 @@ static int mac_probe(struct platform_device *_of_dev)
648
645
goto _return ;
649
646
}
650
647
651
- /* Register mac_dev */
652
- dev_set_drvdata (dev , mac_dev );
653
-
654
648
INIT_LIST_HEAD (& priv -> mc_addr_list );
655
649
656
650
/* Get the FM node */
@@ -659,7 +653,7 @@ static int mac_probe(struct platform_device *_of_dev)
659
653
dev_err (dev , "of_get_parent(%pOF) failed\n" ,
660
654
mac_node );
661
655
err = - EINVAL ;
662
- goto _return_dev_set_drvdata ;
656
+ goto _return_of_get_parent ;
663
657
}
664
658
665
659
of_dev = of_find_device_by_node (dev_node );
@@ -693,7 +687,7 @@ static int mac_probe(struct platform_device *_of_dev)
693
687
if (err < 0 ) {
694
688
dev_err (dev , "of_address_to_resource(%pOF) = %d\n" ,
695
689
mac_node , err );
696
- goto _return_dev_set_drvdata ;
690
+ goto _return_of_get_parent ;
697
691
}
698
692
699
693
mac_dev -> res = __devm_request_region (dev ,
@@ -703,15 +697,15 @@ static int mac_probe(struct platform_device *_of_dev)
703
697
if (!mac_dev -> res ) {
704
698
dev_err (dev , "__devm_request_mem_region(mac) failed\n" );
705
699
err = - EBUSY ;
706
- goto _return_dev_set_drvdata ;
700
+ goto _return_of_get_parent ;
707
701
}
708
702
709
703
priv -> vaddr = devm_ioremap (dev , mac_dev -> res -> start ,
710
704
mac_dev -> res -> end + 1 - mac_dev -> res -> start );
711
705
if (!priv -> vaddr ) {
712
706
dev_err (dev , "devm_ioremap() failed\n" );
713
707
err = - EIO ;
714
- goto _return_dev_set_drvdata ;
708
+ goto _return_of_get_parent ;
715
709
}
716
710
717
711
if (!of_device_is_available (mac_node )) {
@@ -728,7 +722,7 @@ static int mac_probe(struct platform_device *_of_dev)
728
722
if (err ) {
729
723
dev_err (dev , "failed to read cell-index for %pOF\n" , mac_node );
730
724
err = - EINVAL ;
731
- goto _return_dev_set_drvdata ;
725
+ goto _return_of_get_parent ;
732
726
}
733
727
priv -> cell_index = (u8 )val ;
734
728
@@ -737,7 +731,7 @@ static int mac_probe(struct platform_device *_of_dev)
737
731
if (!mac_addr ) {
738
732
dev_err (dev , "of_get_mac_address(%pOF) failed\n" , mac_node );
739
733
err = - EINVAL ;
740
- goto _return_dev_set_drvdata ;
734
+ goto _return_of_get_parent ;
741
735
}
742
736
memcpy (mac_dev -> addr , mac_addr , sizeof (mac_dev -> addr ));
743
737
@@ -747,14 +741,14 @@ static int mac_probe(struct platform_device *_of_dev)
747
741
dev_err (dev , "of_count_phandle_with_args(%pOF, fsl,fman-ports) failed\n" ,
748
742
mac_node );
749
743
err = nph ;
750
- goto _return_dev_set_drvdata ;
744
+ goto _return_of_get_parent ;
751
745
}
752
746
753
747
if (nph != ARRAY_SIZE (mac_dev -> port )) {
754
748
dev_err (dev , "Not supported number of fman-ports handles of mac node %pOF from device tree\n" ,
755
749
mac_node );
756
750
err = - EINVAL ;
757
- goto _return_dev_set_drvdata ;
751
+ goto _return_of_get_parent ;
758
752
}
759
753
760
754
for (i = 0 ; i < ARRAY_SIZE (mac_dev -> port ); i ++ ) {
@@ -818,20 +812,20 @@ static int mac_probe(struct platform_device *_of_dev)
818
812
819
813
err = of_phy_register_fixed_link (mac_node );
820
814
if (err )
821
- goto _return_dev_set_drvdata ;
815
+ goto _return_of_get_parent ;
822
816
823
817
priv -> fixed_link = kzalloc (sizeof (* priv -> fixed_link ),
824
818
GFP_KERNEL );
825
819
if (!priv -> fixed_link ) {
826
820
err = - ENOMEM ;
827
- goto _return_dev_set_drvdata ;
821
+ goto _return_of_get_parent ;
828
822
}
829
823
830
824
mac_dev -> phy_node = of_node_get (mac_node );
831
825
phy = of_phy_find_device (mac_dev -> phy_node );
832
826
if (!phy ) {
833
827
err = - EINVAL ;
834
- goto _return_dev_set_drvdata ;
828
+ goto _return_of_get_parent ;
835
829
}
836
830
837
831
priv -> fixed_link -> link = phy -> link ;
@@ -847,7 +841,7 @@ static int mac_probe(struct platform_device *_of_dev)
847
841
if (err < 0 ) {
848
842
dev_err (dev , "mac_dev->init() = %d\n" , err );
849
843
of_node_put (mac_dev -> phy_node );
850
- goto _return_dev_set_drvdata ;
844
+ goto _return_of_get_parent ;
851
845
}
852
846
853
847
/* pause frame autonegotiation enabled */
@@ -868,7 +862,7 @@ static int mac_probe(struct platform_device *_of_dev)
868
862
mac_dev -> addr [0 ], mac_dev -> addr [1 ], mac_dev -> addr [2 ],
869
863
mac_dev -> addr [3 ], mac_dev -> addr [4 ], mac_dev -> addr [5 ]);
870
864
871
- priv -> eth_dev = dpaa_eth_add_device (fman_id , mac_dev , mac_node );
865
+ priv -> eth_dev = dpaa_eth_add_device (fman_id , mac_dev );
872
866
if (IS_ERR (priv -> eth_dev )) {
873
867
dev_err (dev , "failed to add Ethernet platform device for MAC %d\n" ,
874
868
priv -> cell_index );
@@ -879,9 +873,8 @@ static int mac_probe(struct platform_device *_of_dev)
879
873
880
874
_return_of_node_put :
881
875
of_node_put (dev_node );
882
- _return_dev_set_drvdata :
876
+ _return_of_get_parent :
883
877
kfree (priv -> fixed_link );
884
- dev_set_drvdata (dev , NULL );
885
878
_return :
886
879
return err ;
887
880
}
0 commit comments