for (i=0; i<100; i++) { ret = acpi_processor_read_port(port, bit_width, &value); if (ret) { dprintk("Invalid port width 0x%04x\n", bit_width); retval = ret; goto migrate_end; 
for (i=0; i<100; i++) { ret = acpi_processor_read_port(port, bit_width, &value); if (ret) { dprintk("Invalid port width 0x%04x\n", bit_width); retval = ret; goto migrate_end; } if (value == (u32) data->acpi_data.states[state].status) break; udelay(10); 
acpi_processor_set_performance (	struct cpufreq_acpi_io	*data,	unsigned int		cpu,	int			state){	u16			port = 0;	u8			bit_width = 0;	int			ret = 0;	u32			value = 0;	int			i = 0;	struct cpufreq_freqs    cpufreq_freqs;	cpumask_t		saved_mask;	int			retval;	dprintk("acpi_processor_set_performance\n");	/*	 * TBD: Use something other than set_cpus_allowed.	 * As set_cpus_allowed is a bit racy, 	 * with any other set_cpus_allowed for this process.	 */	saved_mask = current->cpus_allowed;	set_cpus_allowed(current, cpumask_of_cpu(cpu));	if (smp_processor_id() != cpu) {		return (-EAGAIN);	}		if (state == data->acpi_data.state) {		if (unlikely(data->resume)) {			dprintk("Called after resume, resetting to P%d\n", state);			data->resume = 0;		} else {			dprintk("Already at target state (P%d)\n", state);			retval = 0;			goto migrate_end;		}	}	dprintk("Transitioning from P%d to P%d\n",		data->acpi_data.state, state);	/* cpufreq frequency struct */	cpufreq_freqs.cpu = cpu;	cpufreq_freqs.old = data->freq_table[data->acpi_data.state].frequency;	cpufreq_freqs.new = data->freq_table[state].frequency;	/* notify cpufreq */	cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_PRECHANGE);	/*	 * First we write the target state's 'control' value to the	 * control_register.	 */	port = data->acpi_data.control_register.address;	bit_width = data->acpi_data.control_register.bit_width;	value = (u32) data->acpi_data.states[state].control;	dprintk("Writing 0x%08x to port 0x%04x\n", value, port);	ret = acpi_processor_write_port(port, bit_width, value);	if (ret) {		dprintk("Invalid port width 0x%04x\n", bit_width);		retval = ret;		goto migrate_end;	}	/*	 * Then we read the 'status_register' and compare the value with the	 * target state's 'status' to make sure the transition was successful.	 * Note that we'll poll for up to 1ms (100 cycles of 10us) before	 * giving up.	 */	port = data->acpi_data.status_register.address;	bit_width = data->acpi_data.status_register.bit_width;	dprintk("Looking for 0x%08x from port 0x%04x\n",		(u32) data->acpi_data.states[state].status, port);	for (i=0; i<100; i++) {		ret = acpi_processor_read_port(port, bit_width, &value);		if (ret) {				dprintk("Invalid port width 0x%04x\n", bit_width);			retval = ret;			goto migrate_end;		}		if (value == (u32) data->acpi_data.states[state].status)			break;		udelay(10);	}	/* notify cpufreq */	cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE);	if (value != (u32) data->acpi_data.states[state].status) {		unsigned int tmp = cpufreq_freqs.new;		cpufreq_freqs.new = cpufreq_freqs.old;		cpufreq_freqs.old = tmp;		cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_PRECHANGE);		cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE);		printk(KERN_WARNING "acpi-cpufreq: Transition failed\n");		retval = -ENODEV;		goto migrate_end;	}	dprintk("Transition successful after %d microseconds\n", i * 10);	data->acpi_data.state = state;	retval = 0;migrate_end:	set_cpus_allowed(current, saved_mask);	return (retval);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/d395bf12d1ba61437e546eb642f0d7ea666123ff/acpi-cpufreq.c/buggy/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c