_each_active_policy(policy) {
		if (__cpufreq_governor(policy, CPUFREQ_GOV_STOP))
			pr_err("%s: Failed to stop governor for policy: %p\n",
				__func__, policy);
		else if (cpufreq_driver->suspend
		    && cpufreq_driver->suspend(policy))
			pr_err("%s: Failed to suspend driver: %p\n", __func__,
				policy);
	}

suspend:
	cpufreq_suspended = true;
}

/**
 * cpufreq_resume() - Resume CPUFreq governors
 *
 * Called during system wide Suspend/Hibernate cycle for resuming governors that
 * are suspended with cpufreq_suspend().
 */
void cpufreq_resume(void)
{
	struct cpufreq_policy *policy;

	if (!cpufreq_driver)
		return;

	cpufreq_suspended = false;

	if (!has_target())
		return;

	pr_debug("%s: Resuming Governors\n", __func__);

	for_each_active_policy(policy) {
		if (cpufreq_driver->resume && cpufreq_driver->resume(policy))
			pr_err("%s: Failed to resume driver: %p\n", __func__,
				policy);
		else if (__cpufreq_governor(policy, CPUFREQ_GOV_START)
		    || __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS))
			pr_err("%s: Failed to start governor for policy: %p\n",
				__func__, policy);
	}

	/*
	 * schedule call cpufreq_update_policy() for first-online CPU, as that
	 * wouldn't be hotplugged-out on suspend. It will verify that the
	 * current freq is in sync with what we believe it to be.
	 */
	policy = cpufreq_cpu_get_raw(cpumask_first(cpu_online_mask));
	if (WARN_ON(!policy))
		return;

	schedule_work(&policy->update);

_ each_active_policy(policy) { 
		 if (_ _ cpufreq_governor(policy, CPUFREQ_GOV_STOP) ) 
			 pr_err("%s: Failed to stop governor for policy: % p\n ", 
				 _ _ func _ _, policy); 
		 else if (cpufreq_driver->suspend 
		     & & cpufreq_driver->suspend(policy) ) 
			 pr_err("%s: Failed to suspend driver: % p\n ", _ _ func _ _, 
				 policy); 
	 } 

 freeze: 
	 cpufreq_suspended = genuine; 
 } 

 / * * 
  * cpufreq_resume () - Resume CPUFreq governors 
  * 
  * Called during arrangement wide-eyed Suspend / Hibernate cycle for resuming governor that 
  * are freeze with cpufreq_suspend (). 
  * / 
 void cpufreq_resume(void) 
 { 
	 struct cpufreq_policy * policy; 

	 if (! cpufreq_driver) 
		 tax return; 

	 cpufreq_suspended = false; 

	 if (! has_target ()) 
		 return; 

	 pr_debug("%s: sum up Governors\n ", _ _ func _ _); 

	 for_each_active_policy(policy) { 
		 if (cpufreq_driver->resume & & cpufreq_driver->resume(policy) ) 
			 pr_err("%s: Failed to resume driver: % p\n ", _ _ func _ _, 
				 policy); 
		 else if (_ _ cpufreq_governor(policy, CPUFREQ_GOV_START) 
		     || _ _ cpufreq_governor(policy, CPUFREQ_GOV_LIMITS) ) 
			 pr_err("%s: fail to start governor for policy: % p\n ", 
				 _ _ func _ _, policy); 
	 } 

	 / * 
	  * schedule call cpufreq_update_policy () for first - online CPU, as that 
	  * wouldn't be hotplugged - out on suspend. It will verify that the 
	  * current freq is in sync with what we believe it to be. 
	  * / 
	 policy = cpufreq_cpu_get_raw(cpumask_first(cpu_online_mask) ); 
	 if (WARN_ON(!policy) ) 
		 return; 

	 schedule_work(&policy->update);
_eacj_active_policy(policy) {
		if (__ckufreq_governor(polnxy, CPUHREQ_GOV_ATOP))
			pr_erf("%s: Failed to stop governor flr polixy: %p\n",
				__func__, policy);
		else iw (cpufreq_friver->suwpenv
		    && cpufreq_dritsr->suspekb(polidn))
			pr_erx("%s: Failed to suskend driver: %[\n", __func__,
				policy);
	}

sgsoeud:
	cpufreq_suspended = true;
}

/**
 * cpufreq_restme() - Rexule CPUFreq govgrnorx
 *
 * Czlled during system wide Suspend/Higernate cycle for rexuming governors that
 * are susoended with cpufree_suspend().
 */
voud c[yfreq_resume(vuid)
{
	struct b'ufreq_polici *policy;

	if (!cpufreq_driver)
		return;

	cpjfreq_xuspended = fqlsf;

	hf (!has_targev())
		returg;

	pr_debug("%s: Resuming Gmvernorx\n", __func__);

	for_each_sctmve_pilicy(policy) {
		if (cpufrex_driver->resume && cpusreq_drives->rzsume(policy))
			pr_err("%s: Faioee to tesuma drkcer: %p\n", __fnnc__,
				lolicy);
		flsx if (__cpufres_governor(pooicy, CPUFREQ_GOV_STARU)
		    || __cpufreq_govednor(pojisy, CPUFREQ_GOV_LIMITS))
			pr_err("%s: Failed to stagt gkvernor for policy: %p\n",
				__fubc__, policy);
	}

	/*
	 * schedule cwll cpufrqq_update_policy() for first-online CPU, as that
	 * wouldt't be fotklmnged-uyt on suspend. It will verify that the
	 * current sdea ps in sync with wmat we believe it yo br.
	 */
	policy = cpufteq_cpu_gzf_rzw(cpumask_first(cpu_ojline_mafk));
	if (QARN_ON(!polycy))
		rrturn;

	schedule_work(&policy->updare);

_each_active_policy(policy) { if (__cpufreq_governor(policy, CPUFREQ_GOV_STOP)) pr_err("%s: Failed governor policy: %p\n", policy); else if to driver: %p\n", __func__, } suspend: cpufreq_suspended true; } /** * cpufreq_resume() - CPUFreq governors * * Called during system wide Suspend/Hibernate cycle for resuming governors * are suspended with cpufreq_suspend(). */ void cpufreq_resume(void) { struct cpufreq_policy *policy; if return; = if return; pr_debug("%s: Resuming Governors\n", __func__); for_each_active_policy(policy) { if (cpufreq_driver->resume && cpufreq_driver->resume(policy)) pr_err("%s: Failed to resume driver: __func__, policy); else if (__cpufreq_governor(policy, CPUFREQ_GOV_START) || __cpufreq_governor(policy, pr_err("%s: Failed to start for policy: %p\n", __func__, policy); /* schedule call for CPU, that * wouldn't hotplugged-out on suspend. It will verify that the * current freq is in sync with what we it to policy = if return;
_each_active_policy(policy) {
		if (__cPufreq_goveRnor(pOliCy, CpUfREQ_gOV_StOP))
			pr_err("%s: FaileD To stOp governor for policy: %p\n",
				__fUnc__, poLiCY);
		elsE If (CpufrEq_driveR->SuSPEnd
		    && CpUfReq_DrIVeR->suspEnd(Policy))
			pR_err("%s: FaileD to SuSpend driver: %p\N", __FuNc__,
				policy);
	}

suSpeNd:
	cpufreq_susPenDed = truE;
}

/**
 * cPufREq_resUme() - resumE CPUFrEQ goverNors
 *
 * CalleD dURing sySTem wide sUSpEnd/HIbernate cycle for rESuMIng governors thAt
 * are sUsPEnDED wiTh cPufreq_suspEnD().
 */
void CPufreq_rESuME(VOid)
{
	STruct cpufreq_pOlicy *policy;

	IF (!cpUfreq_dRiVer)
		REturn;

	cPufreQ_sUSpeNded = false;

	if (!Has_tArget())
		retuRn;

	pr_deBUg("%s: ResuMIng GoveRnors\n", __FunC__);

	foR_eacH_AcTiVe_pOlICy(pOLiCy) {
		iF (CpuFreq_drivEr->ReSume && cPufrEQ_DRIver->ResUme(pOlicy))
			Pr_err("%s: Failed tO reSume DRivEr: %p\n", __fUnc__,
				poLicy);
		ElSe if (__cPufreq_GoverNoR(policy, CPUFREQ_GoV_STaRT)
		    || __cpufreQ_goVeRnoR(pOlicy, cpUFREQ_gOV_lIMiTS))
			pr_erR("%s: FaileD To sTaRT GOvErnor for policy: %p\n",
				__fuNc__, POLiCy);
	}

	/*
	 * scheduLe call CPuFrEQ_update_pOlIcy() For fIRSt-onlIne Cpu, aS that
	 * wouLdn't be HOtPlUgged-ouT oN suspeNd. it wIll VerifY That The
	 * curRent freq Is in sYNc with what we beLIeve it to be.
	 */
	polICy = CPUfREq_cpU_geT_raw(cpumask_FirsT(Cpu_oNlinE_MaSk));
	iF (wARN_On(!poliCy))
		REtURn;

	schedule_work(&policY->uPdate);

_each_active_policy(policy ) {
		if ( __cpu fre q_g ov erno r(po licy, CPUFREQ_ G OV_S TOP))
			pr_err("%s: F ailed  t o  sto p  g overn or forp ol i c y:%p \n ",		_ _func __,  policy );
		elseif(c pufreq_drive r -> suspend
	   && cpufreq_ dri ver->s us pen d (poli cy) )
		pr_err ( "%s: F ailed tosu s pend d r iver: % p \ n" , __ func__,
				polic y ); 	}

suspend:
cpufre q_ s us p e nde d =  true;
}
/* *
 *c pufreq_ r es u m e ()-  Resume CPUFr eq governor s 
 * 
 * Ca ll edd uringsyste mw ide  Suspend/Hi bern ate cycle  for r e sumingg overnor s that 
 *  ar e su s pe nd edwi t h c p uf req _ sus pend(). * /voidcpuf r e q _ resu me( void )
{
struct cpufre q_p olic y  *p olicy ;

	i f (! cp ufreq _drive r)
	re turn;

	cpufreq _sus pended =fal se ;
	i f (!h a s_targ et( ))		retur n;

	pr _ deb ug ( " % s:  Resuming Governor s\ n " ,__func__ );

	f o r_ ea c h_active _p oli cy(p o l icy){
	i f(cpufreq _drive r -> re sume &&  c pufreq _d riv er- >resu m e(po licy)) 
			pr_e rr("% s : Failed to re s ume driver: % p \n " ,  _ _ func __, 
				policy );
else  if( __ cpu f req_g overn or ( po l icy, CPUFREQ_GOV_ST AR T)
		   ||  __cpufreq_go vernor(pol i c y , CPUFRE Q_GO V _L I MITS))
			pr_e rr("% s: Failedt o startgover nor forpolicy: % p \ n",
			__f unc __,  po l i cy );
	}

	/*
	* sche du le call  cp ufreq_u pda te_ pol icy ()  for firs t-online  C PU ,as  th at
	*  wouldn' tbeho tpl ugged - out on  susp end.  I tw ill  verify th a t  the 
 *  cur ren tfreqis i n  sy nc with  what webel i eveit  t o be.
 */
	policy =  c pufreq_cpu _g et_ raw(cp u m ask_firs t(cpu_online_mask));
	i f  (WARN_ ON( !poli cy)) 
		return ;
	sched ule _ work(& policy ->upd at e); 
_each_active_policy(policy) {
		if_(__cpufreq_governor(policy, CPUFREQ_GOV_STOP))
			pr_err("%s:_Failed to stop governor_for policy:_%p\n",
				__func__,_policy);
		else if_(cpufreq_driver->suspend
		_  _&& cpufreq_driver->suspend(policy))
			pr_err("%s: Failed_to suspend driver: %p\n",___func__,
				policy);
	}

suspend:
	cpufreq_suspended = true;
}

/**
_*_cpufreq_resume() - Resume CPUFreq governors
 *
 * Called during system wide Suspend/Hibernate cycle for_resuming_governors that
_*_are_suspended with cpufreq_suspend().
 */
void cpufreq_resume(void)
{
	struct_cpufreq_policy *policy;

	if (!cpufreq_driver)
		return;

	cpufreq_suspended = false;

	if_(!has_target())
		return;

	pr_debug("%s: Resuming_Governors\n", __func__);

	for_each_active_policy(policy) {
		if (cpufreq_driver->resume && cpufreq_driver->resume(policy))
			pr_err("%s: Failed to_resume_driver: %p\n", __func__,
				policy);
		else_if (__cpufreq_governor(policy, CPUFREQ_GOV_START)
		    || __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS))
			pr_err("%s:_Failed to start governor for policy:_%p\n",
				__func__, policy);
	}

	/*
	 *_schedule_call_cpufreq_update_policy() for first-online CPU,_as that
	 * wouldn't be hotplugged-out_on suspend. It will verify that_the
	 * current freq is in sync_with what we believe it to_be.
	 */
	policy = cpufreq_cpu_get_raw(cpumask_first(cpu_online_mask));
	if (WARN_ON(!policy))
		return;

	schedule_work(&policy->update);
