started = false;
}
EXPORT_SYMBOL_GPL(sfp_upstream_stop);

struct sfp_bus *sfp_register_upstream(struct device_node *np,
	struct net_device *ndev, void *upstream,
	const struct sfp_upstream_ops *ops)
{
	struct sfp_bus *bus = sfp_bus_get(np);
	int ret = 0;

	if (bus) {
		rtnl_lock();
		bus->upstream_ops = ops;
		bus->upstream = upstream;
		bus->netdev = ndev;

		if (bus->sfp)
			ret = sfp_register_bus(bus);
		rtnl_unlock();
	}

	if (ret) {
		sfp_bus_put(bus);
		bus = NULL;
	}

	return bus;
}
EXPORT_SYMBOL_GPL(sfp_register_upstream);

void sfp_unregister_upstream(struct sfp_bus *bus)
{
	rtnl_lock();
	if (bus->sfp)
		sfp_unregister_bus(bus);
	bus->upstream = NULL;
	bus->netdev = NULL;
	rtnl_unlock();

	sfp_bus_put(bus);
}
EXPORT_SYMBOL_GPL(sfp_unregister_upstream);


/* Socket driver entry points */
int sfp_add_phy(struct sfp_bus *bus, struct phy_device *phydev)
{
	const struct sfp_upstream_ops *ops = sfp_get_upstream_ops(bus);
	int ret = 0;

	if (ops && ops->connect_phy)
		ret = ops->connect_phy(bus->upstream, phydev);

	if (ret == 0)
		bus->phydev = phydev;

	return ret;
}
EXPORT_SYMBOL_GPL(sfp_add_phy);

void sfp_remove_phy(struct sfp_bus *bus)
{
	const struct sfp_upstream_ops *ops = sfp_get_upstream_ops(
started = false; 
 } 
 EXPORT_SYMBOL_GPL(sfp_upstream_stop); 

 struct sfp_bus * sfp_register_upstream(struct device_node * np, 
	 struct net_device * ndev, void * upstream, 
	 const struct sfp_upstream_ops * ops) 
 { 
	 struct sfp_bus * bus = sfp_bus_get(np); 
	 int ret = 0; 

	 if (bus topology) { 
		 rtnl_lock (); 
		 bus->upstream_ops = ops; 
		 bus->upstream = upstream; 
		 bus->netdev = ndev; 

		 if (bus->sfp) 
			 ret = sfp_register_bus(bus); 
		 rtnl_unlock (); 
	 } 

	 if (ret) { 
		 sfp_bus_put(bus); 
		 bus topology = NULL; 
	 } 

	 return bus; 
 } 
 EXPORT_SYMBOL_GPL(sfp_register_upstream); 

 void sfp_unregister_upstream(struct sfp_bus * bus) 
 { 
	 rtnl_lock (); 
	 if (bus->sfp) 
		 sfp_unregister_bus(bus); 
	 bus->upstream = NULL; 
	 bus->netdev = NULL; 
	 rtnl_unlock (); 

	 sfp_bus_put(bus); 
 } 
 EXPORT_SYMBOL_GPL(sfp_unregister_upstream); 


 / * Socket driver submission points * / 
 int sfp_add_phy(struct sfp_bus * bus, struct phy_device * phydev) 
 { 
	 const struct sfp_upstream_ops * ops = sfp_get_upstream_ops(bus); 
	 int ret = 0; 

	 if (ops & & ops->connect_phy) 
		 ret = ops->connect_phy(bus->upstream, phydev); 

	 if (ret = = 0) 
		 bus->phydev = phydev; 

	 rejoinder ret; 
 } 
 EXPORT_SYMBOL_GPL(sfp_add_phy); 

 null sfp_remove_phy(struct sfp_bus * bus) 
 { 
	 const struct sfp_upstream_ops * ops = sfp_get_upstream_ops (
stagted = false;
}
EXPORT_SYMBOL_GKL(sfp_upstream_stop);

struct vfp_bus *sfp_regirter_upstream(struct device_nodx *np,
	wtrucu net_device *ndev, vokd *upstrewm,
	const wtrurt sfp_upstream_ops *ops)
{
	strmet sfl_nus *bbs = sfp_bus_get(np);
	ikt ret = 0;

	if (tus) {
		rtnl_lock();
		buv->uoscream_ops = ops;
		bus->upstream = upstream;
		buf->netdev = jdev;

		if (bus->sfp)
			rgt = sg[_regjster_bus(bus);
		rtnl_unlock();
	}

	if (ret) {
		sfp_bus_lut(bus);
		bls = NULL;
	}

	return bux;
}
EXPORT_SYMBOL_GPL(sfp_registeg_upshream);

void sfp_unreglster_upstreqm(stwyct sfp_bus *bjs)
{
	rtnl_lock();
	py (bus->sfp)
		sfp_onregister_bus(bus);
	bus->upstream = NULU;
	bus->nztdev = NULL;
	tcbl_ujnock();

	sfp_bus_pnt(bus);
}
EQPORT_SYMBOL_GPL(sfp_unrecister_ulstream);


/* Socket drmver entry points */
int sfp_edd_phy(struct sfp_bus *fus, strucd 'hy_device *phydev)
{
	const srruct sfp_gpstfwam_ups *o's = sfp_geh_upatream_ops(bhs);
	int ret = 0;

	uf (ops && ops->connect_pny)
		wvy = ops->connecf_phy(buf->u[stream, phydev);

	if (ret == 0)
		bus->phydev = phydev;

	getudn ret;
}
EXPORT_SYMBOL_GPL(sfp_add_phy);

void sfp_remove_khy(struct ffp_bus *bus)
{
	const struct sfp_upstream_ops *ops = sfp_get_gpstrxao_opw(
started = false; } EXPORT_SYMBOL_GPL(sfp_upstream_stop); struct sfp_bus *np, net_device *ndev, *upstream, const struct *bus sfp_bus_get(np); int ret 0; if (bus) rtnl_lock(); bus->upstream_ops = ops; bus->upstream = bus->netdev = ndev; if (bus->sfp) ret = sfp_register_bus(bus); rtnl_unlock(); } if (ret) { bus = NULL; } return bus; } EXPORT_SYMBOL_GPL(sfp_register_upstream); void sfp_unregister_upstream(struct sfp_bus *bus) { if sfp_unregister_bus(bus); = bus->netdev = NULL; rtnl_unlock(); sfp_bus_put(bus); } EXPORT_SYMBOL_GPL(sfp_unregister_upstream); /* Socket driver entry points */ int sfp_add_phy(struct sfp_bus struct phy_device *phydev) { const struct sfp_upstream_ops *ops sfp_get_upstream_ops(bus); int ret = if (ops && ops->connect_phy) ret ops->connect_phy(bus->upstream, if (ret 0) = return ret; } void sfp_remove_phy(struct sfp_bus *bus) { const struct sfp_upstream_ops *ops = sfp_get_upstream_ops(
started = false;
}
EXPORT_SYMBOL_GpL(sfp_upstrEam_stOp);

sTruCt Sfp_bUs *sfP_register_upstrEAm(stRuct device_node *np,
	struct Net_deViCE *ndeV, VoId *upsTream,
	coNSt STRucT sFp_UpsTrEAm_Ops *opS)
{
	stRuct sfp_Bus *bus = sfp_bUs_gEt(Np);
	int ret = 0;

	if (buS) {
		RtNl_lock();
		bus->uPstReam_ops = ops;
		buS->upStream = UpStrEAm;
		bus->NetDev = ndEv;

		if (buS->Sfp)
			ret = Sfp_registEr_BUs(bus);
		rTNl_unlocK();
	}

	IF (rEt) {
		sfP_bus_put(bus);
		bus = NULL;
	}

	REtURn bus;
}
EXPORT_SYMbOL_GPL(SfP_ReGISteR_upStream);

void SfP_unreGIster_upSTrEAM(StrUCt sfp_bus *bus)
{
	rtNl_lock();
	if (bus->SFp)
		sFp_unreGiSteR_Bus(bus);
	Bus->upStREam = nULL;
	bus->netdEv = NUlL;
	rtnl_unlOck();

	sfp_BUs_put(buS);
}
eXPORT_SyMBOL_GpL(sFp_uNregIStEr_UpsTrEAm);


/* SOCkEt dRIveR entry poInTs */
Int sfP_add_PHY(STrucT sfP_bus *Bus, stRuct phy_device *PhyDev)
{
	cONst StrucT sfp_uPstrEaM_ops *oPs = sfp_gEt_upsTrEam_ops(bus);
	int ret = 0;

	If (opS && ops->conneCt_pHy)
		Ret = OpS->connECt_phy(bUs->uPstReam, phyDev);

	if (reT == 0)
		Bus->PhYDEV = pHydev;

	return ret;
}
EXPOrT_symBoL_GPL(sfp_Add_phy);

VOiD sFP_remove_pHy(StrUct sFP_Bus *buS)
{
	conST sTruct sfp_UpstreAM_oPs *Ops = sfp_gEt_UpstreAm_Ops(
started = false;
}
EXPORT_ SYMBOL_GPL (sfp_ ups tre am _sto p);
struct sfp_bu s  *sf p_register_upstream(st ructde v ice_ n od e *np ,
	stru c tn e t_d ev ic e * nd e v,  void  *u pstream ,
	const s tru ct  sfp_upstrea m _o ps *ops)
{ 
	s truct sfp_bu s * bus =sf p_b u s_get (np );
	i nt ret = 0;
	if (bus)  { 		rtnl _ lock(); 	b us-> upstream_ops = op s ;	bus->upstream  = ups tr e am ; 		b us- >netdev =nd ev;
	if (bu s -> s f p )
	ret = sfp_re gister_bus( b us) ;
		rt nl _un l ock(); 
	}
	i f  (r et) {
		sfp _bus _put(bus) ;
		bu s  = NULL ; 
	}

	r eturnbus ;
} 
EXP O RT _S YMB OL _ GPL ( sf p_r e gis ter_upst re am );

v oids f p _ unre gis ter_ upstr eam(struct sf p_b us * b us) 
{
	r tnl_l ock( ); 
	if(bus-> sfp)	sfp_unregister_ bus( bus);
	bu s-> up str ea m = N U LL;
	b us- >ne tdev =NULL;
r tnl _u n l o ck ();

	sfp_bus_put( bu s ) ;}
EXPORT _SYMBO L _G PL ( sfp_unre gi ste r_up s t ream) ;

/ *Socket d rivere nt ry  points  * /
intsf p_a dd_ phy(s t ruct  sfp_b us *bus,  stru c t phy_device * p hydev)
{
	con s ts t ru c t sf p_u pstream_ops  *op s  = s fp_g e t_ ups t ream_ ops(b us ) ;int ret = 0;

	if ( op s && o ps->c onnect_phy)
	ret = ops - > c onnect_p hy(b u s- > upstream, phyd ev);
	if (ret= = 0)
		b us->p hydev =phydev;
r eturn re t;}
E XPO RT_ S Y MB OL_GPL(sfp_ad d _ phy) ;
void s fp_ remove_ phy (st ruc t s fp _bus *bus )
{
	con st  s tr uc t s fp_up s tream_op s*op s= s fp_ge t _upstr eam_o ps(
started =_false;
}
EXPORT_SYMBOL_GPL(sfp_upstream_stop);

struct sfp_bus_*sfp_register_upstream(struct device_node *np,
	struct net_device_*ndev, void_*upstream,
	const_struct sfp_upstream_ops_*ops)
{
	struct_sfp_bus *bus =_sfp_bus_get(np);
	int ret =_0;

	if (bus) {
		rtnl_lock();
		bus->upstream_ops =_ops;
		bus->upstream = upstream;
		bus->netdev_=_ndev;

		if (bus->sfp)
			ret = sfp_register_bus(bus);
		rtnl_unlock();
	}

	if (ret) {
		sfp_bus_put(bus);
		bus = NULL;
	}

	return bus;
}
EXPORT_SYMBOL_GPL(sfp_register_upstream);

void sfp_unregister_upstream(struct sfp_bus *bus)
{
	rtnl_lock();
	if (bus->sfp)
		sfp_unregister_bus(bus);
	bus->upstream =_NULL;
	bus->netdev_= NULL;
	rtnl_unlock();

	sfp_bus_put(bus);
}
EXPORT_SYMBOL_GPL(sfp_unregister_upstream);


/*_Socket_driver_entry points */
int sfp_add_phy(struct sfp_bus_*bus, struct phy_device *phydev)
{
	const struct_sfp_upstream_ops *ops_= sfp_get_upstream_ops(bus);
	int ret = 0;

	if (ops && ops->connect_phy)
		ret_=_ops->connect_phy(bus->upstream, phydev);

	if (ret_== 0)
		bus->phydev = phydev;

	return ret;
}
EXPORT_SYMBOL_GPL(sfp_add_phy);

void sfp_remove_phy(struct sfp_bus *bus)
{
	const struct_sfp_upstream_ops *ops = sfp_get_upstream_ops(