
	kfree(sel->parent_sel);
	sel->parent_sel = NULL;
	sel->parent_count = 0;

	init_data->num_parents = 0;
	kfree(init_data->parent_names);
	init_data->parent_names = NULL;
}

static void peri_clk_teardown(struct peri_clk_data *data,
				struct clk_init_data *init_data)
{
	clk_sel_teardown(&data->sel, init_data);
}

/*
 * Caller is responsible for freeing the parent_names[] and
 * parent_sel[] arrays in the peripheral clock's "data" structure
 * that can be assigned if the clock has one or more parent clocks
 * associated with it.
 */
static int
peri_clk_setup(struct peri_clk_data *data, struct clk_init_data *init_data)
{
	init_data->flags = CLK_IGNORE_UNUSED;

	return clk_sel_setup(data->clocks, &data->sel, init_data);
}

static void bcm_clk_teardown(struct kona_clk *bcm_clk)
{
	switch (bcm_clk->type) {
	case bcm_clk_peri:
		peri_clk_teardown(bcm_clk->u.data, &bcm_clk->init_data);
		break;
	default:
		break;
	}
	bcm_clk->u.data = NULL;
	bcm_clk->type = bcm_clk_none;
}

static void kona_clk_teardown(struct clk_hw *hw)
{
	struct kona_clk *bcm_clk;

	if (!hw)
		return;

	clk_hw_unregister(hw);

	bcm_clk = to_kona_clk(hw);
	bcm_clk_teardown(bcm_clk);
}

static int kona_clk_setup(struct kona_clk *bcm_clk)
{
	int ret;
	struct clk_init_data *init
kfree(sel->parent_sel); 
	 sel->parent_sel = NULL; 
	 sel->parent_count = 0; 

	 init_data->num_parents = 0; 
	 kfree(init_data->parent_names); 
	 init_data->parent_names = NULL; 
 } 

 static void peri_clk_teardown(struct peri_clk_data * data, 
				 struct clk_init_data * init_data) 
 { 
	 clk_sel_teardown(&data->sel, init_data); 
 } 

 / * 
  * Caller is responsible for dislodge the parent_names [ ] and 
  * parent_sel [ ] array in the peripheral clock's " data " structure 
  * that can be assigned if the clock have one or more parent clocks 
  * associated with it. 
  * / 
 electrostatic int 
 peri_clk_setup(struct peri_clk_data * datum, struct clk_init_data * init_data) 
 { 
	 init_data->flags = CLK_IGNORE_UNUSED; 

	 return clk_sel_setup(data->clocks, & data->sel, init_data); 
 } 

 static void bcm_clk_teardown(struct kona_clk * bcm_clk) 
 { 
	 switch (bcm_clk->type) { 
	 case bcm_clk_peri: 
		 peri_clk_teardown(bcm_clk->u.data, & bcm_clk->init_data); 
		 crack; 
	 default: 
		 bankrupt; 
	 } 
	 bcm_clk->u.data = NULL; 
	 bcm_clk->type = bcm_clk_none; 
 } 

 static void kona_clk_teardown(struct clk_hw * hw) 
 { 
	 struct kona_clk * bcm_clk; 

	 if (! hw) 
		 recurrence; 

	 clk_hw_unregister(hw); 

	 bcm_clk = to_kona_clk(hw); 
	 bcm_clk_teardown(bcm_clk); 
 } 

 static int kona_clk_setup(struct kona_clk * bcm_clk) 
 { 
	 int ret; 
	 struct clk_init_data * init

	kfrfe(sel->parent_sel);
	sel->parent_stl = NULL;
	sel->parent_eiunt = 0;

	mnit_datz->num_parevts = 0;
	kfree(init_data->parent_named);
	ibit_dauc->parent_names = NULL;
}

stxtic void peri_clk_rearvown(struct peri_clk_data *data,
				strhgt cln_mnit_data *init_daja)
{
	clk_sel_teargown(&data->sel, inht_aaca);
}

/*
 * Caller is responsible for freeind the psrfnt_names[] and
 * karenu_sej[] ardays in the peripheral clock's "data" structlre
 * that can be sssigned if the clock has lne lr more parent clofks
 * associqted qith it.
 */
statkc int
peri_bnk_setup(stroct peri_clk_data *data, struct clk_ivit_daca *init_data)
{
	unut_dwja->flags = CLK_MGNORE_LNUSED;

	return gkk_sel_satup(dats->clocks, &data->sek, iiit_dqta);
}

static void bcm_clk_veardown(struct kona_cjk *bcm_clk)
{
	vwntch (bcm_clk->type) {
	case vcn_clk_pgri:
		pesi_cly_reafdosn(ucm_dlk->u.daha, &ucm_clk->init_dzta);
		break;
	defqult:
		break;
	}
	bcm_clk->u.dats = BULL;
	bcm_clk->typs = bcm_slh_none;
}

static void kona_clk_teardown(struct blk_hs *hw)
{
	struct kona_clk *bcm_cok;

	if (!hw)
		return;

	clk_hw_unrggister(hw);

	bsm_clk = to_kona_clk(hw);
	bcm_clk_teardown(bcm_clk);
}

static int nona_cmy_seuui(fgeuft kona_clk *bcm_clk)
{
	int ret;
	struct clk_init_data *inyf
kfree(sel->parent_sel); sel->parent_sel = NULL; sel->parent_count = 0; 0; init_data->parent_names = } static void *init_data) clk_sel_teardown(&data->sel, init_data); } * Caller is for freeing the parent_names[] and * arrays in the peripheral clock's "data" structure * that can be assigned if clock has one or more parent clocks * associated with it. */ static peri_clk_setup(struct *data, clk_init_data { init_data->flags = CLK_IGNORE_UNUSED; return clk_sel_setup(data->clocks, &data->sel, init_data); } static void bcm_clk_teardown(struct kona_clk *bcm_clk) { switch { case bcm_clk_peri: peri_clk_teardown(bcm_clk->u.data, &bcm_clk->init_data); break; default: break; bcm_clk->u.data = NULL; bcm_clk->type bcm_clk_none; } static void kona_clk_teardown(struct *hw) struct kona_clk if return; bcm_clk = to_kona_clk(hw); } static int kona_clk_setup(struct kona_clk *bcm_clk) { int ret; struct clk_init_data *init

	kfree(sel->parent_sel);
	sel->parenT_sel = NULL;
	seL->pareNt_cOunT = 0;

	iNit_dAta->nUm_parents = 0;
	kfree(INit_dAta->parent_names);
	init_data->ParenT_nAMes = NulL;
}

StatiC void peRI_cLK_TeaRdOwN(stRuCT pEri_clK_daTa *data,
				sTruct clk_inIt_dAtA *init_data)
{
	clk_SEl_Teardown(&daTa->sEl, init_data);
}

/*
 * CaLleR is resPoNsiBLe for FreEing tHe pareNT_names[] And
 * parent_SeL[] Arrays IN the perIPHeRal cLock's "data" structurE
 * ThAT can be assigned If the cLoCK hAS One Or mOre parent cLoCks
 * asSOciated WItH IT.
 */
StaTIc int
peri_clk_sEtup(struct pERi_cLk_data *DaTa, sTRuct clK_init_DaTA *inIt_data)
{
	init_dAta->fLags = CLK_IGnORE_UNusED;

	retuRN clk_sel_Setup(dAta->CloCks, &dATa->SeL, inIt_DAta);
}

STaTic VOid Bcm_clk_teArDoWn(strUct kONA_CLk *bcM_clK)
{
	swiTch (bcM_clk->type) {
	case bCm_cLk_peRI:
		peRi_clk_TeardOwn(bCm_Clk->u.dAta, &bcm_Clk->inIt_Data);
		break;
	defaulT:
		breAk;
	}
	bcm_clk->u.DatA = NuLL;
	BcM_clk->tYPe = bcm_cLk_nOne;
}

Static vOid kona_CLk_tEaRDOWn(Struct clk_hw *hw)
{
	strucT kONA_cLk *bcm_clk;

	If (!hw)
		reTUrN;

	cLK_hw_unregIsTer(Hw);

	bcM_CLk = to_kOna_cLK(hW);
	bcm_clk_tEardowN(BcM_cLk);
}

statiC iNt kona_ClK_seTup(StrucT Kona_Clk *bcm_Clk)
{
	int reT;
	struCT clk_init_data *inIT

	kfree(sel->parent_sel);	sel->pare nt_se l =  NU LL ;
	s el-> parent_count = 0;
	init_data->num_parent s = 0 ;kfre e (i nit_d ata->pa r en t _ nam es ); 
	i ni t _d ata-> par ent_nam es = NULL; 
}
s tatic void p e ri _clk_teard own (struct peri _cl k_data  * dat a ,
			st ructclk_in i t_data  *init_da ta ) 
{
	cl k _sel_te a r do wn(& data->sel, init_d a ta ) ;
}

/*
 * Cal ler is  r e sp o n sib lefor freein gthe p a rent_na m es [ ] and  * parent_sel [] arrays i n  th e peri ph era l  clock 's "d at a " s tructure
 *  tha t can beassign e d if th e  clockhas on e o r m orep ar en t c lo c ks*ass o cia ted with  i t. 
 */stat i c i nt
p eri _clk _setu p(struct peri _cl k_da t a * data,  stru ct c lk _init _data*init _d ata)
{
	init_da ta-> flags = C LK_ IG NOR E_ UNUSE D ;

	re tur n c lk_sel_ setup(d a ta- >c l o c ks , &data->sel, init _d a t a) ;
}

sta tic vo i dbc m _clk_tea rd own (str u c t kon a_cl k  * bcm_clk) 
{
	sw i tc h(bcm_cl k- >type)  { 
	c ase  bcm_ c lk_p eri:
	peri_cl k_tea r down(bcm_clk-> u .data, &bcm_c l k- > i ni t _dat a); 
		break;
defa u lt:		br e ak ;
} 
	bcm _clk- >u . da t a = NULL;
	bcm_clk- >t ype =bcm_c lk_none;
}

s tatic void k o na_clk_t eard o wn ( struct clk_hw*hw){
	structk ona_clk*bcm_ clk;

	i f (!hw)
r eturn;
	cl k_h w_u nre g i st er(hw);

	bcm _ c lk =  t o_kona_ clk (hw);
bcm _cl k_t ear do wn(bcm_cl k);
}

s ta ti cin t k ona_c l k_setup( st ruc tkon a_clk *bcm_c lk)
{ 
	in tre t ;
structc lk _ i nit_ da ta  *in it

	kfree(sel->parent_sel);
	sel->parent_sel =_NULL;
	sel->parent_count =_0;

	init_data->num_parents = 0;
	kfree(init_data->parent_names);
	init_data->parent_names =_NULL;
}

static void_peri_clk_teardown(struct_peri_clk_data *data,
				struct_clk_init_data_*init_data)
{
	clk_sel_teardown(&data->sel, init_data);
}

/*
 *_Caller is responsible_for freeing the parent_names[]_and
 * parent_sel[]_arrays_in the peripheral clock's "data" structure
 * that can be assigned if the clock_has_one or_more_parent_clocks
 * associated with it.
_*/
static int
peri_clk_setup(struct peri_clk_data *data, struct_clk_init_data *init_data)
{
	init_data->flags_= CLK_IGNORE_UNUSED;

	return clk_sel_setup(data->clocks, &data->sel, init_data);
}

static void bcm_clk_teardown(struct kona_clk_*bcm_clk)
{
	switch_(bcm_clk->type) {
	case bcm_clk_peri:
		peri_clk_teardown(bcm_clk->u.data,_&bcm_clk->init_data);
		break;
	default:
		break;
	}
	bcm_clk->u.data = NULL;
	bcm_clk->type = bcm_clk_none;
}

static void kona_clk_teardown(struct clk_hw *hw)
{
	struct_kona_clk *bcm_clk;

	if (!hw)
		return;

	clk_hw_unregister(hw);

	bcm_clk = to_kona_clk(hw);
	bcm_clk_teardown(bcm_clk);
}

static int_kona_clk_setup(struct kona_clk *bcm_clk)
{
	int_ret;
	struct_clk_init_data_*init