static int devfreq_set_target()

in devfreq.c [350:394]


static int devfreq_set_target(struct devfreq *devfreq, unsigned long new_freq,
			      u32 flags)
{
	struct devfreq_freqs freqs;
	unsigned long cur_freq;
	int err = 0;

	if (devfreq->profile->get_cur_freq)
		devfreq->profile->get_cur_freq(devfreq->dev.parent, &cur_freq);
	else
		cur_freq = devfreq->previous_freq;

	freqs.old = cur_freq;
	freqs.new = new_freq;
	devfreq_notify_transition(devfreq, &freqs, DEVFREQ_PRECHANGE);

	err = devfreq->profile->target(devfreq->dev.parent, &new_freq, flags);
	if (err) {
		freqs.new = cur_freq;
		devfreq_notify_transition(devfreq, &freqs, DEVFREQ_POSTCHANGE);
		return err;
	}

	/*
	 * Print devfreq_frequency trace information between DEVFREQ_PRECHANGE
	 * and DEVFREQ_POSTCHANGE because for showing the correct frequency
	 * change order of between devfreq device and passive devfreq device.
	 */
	if (trace_devfreq_frequency_enabled() && new_freq != cur_freq)
		trace_devfreq_frequency(devfreq, new_freq, cur_freq);

	freqs.new = new_freq;
	devfreq_notify_transition(devfreq, &freqs, DEVFREQ_POSTCHANGE);

	if (devfreq_update_status(devfreq, new_freq))
		dev_warn(&devfreq->dev,
			 "Couldn't update frequency transition information.\n");

	devfreq->previous_freq = new_freq;

	if (devfreq->suspend_freq)
		devfreq->resume_freq = new_freq;

	return err;
}