cpu_sys_devices[cpu] = sys_dev; 
static int cpufreq_add_dev (struct sys_device * sys_dev){	unsigned int cpu = sys_dev->id;	int ret = 0;	struct cpufreq_policy new_policy;	struct cpufreq_policy *policy;	struct freq_attr **drv_attr;	unsigned long flags;	unsigned int j;	cpufreq_debug_disable_ratelimit();	dprintk("adding CPU %u\n", cpu);#ifdef CONFIG_SMP	/* check whether a different CPU already registered this	 * CPU because it is in the same boat. */	policy = cpufreq_cpu_get(cpu);	if (unlikely(policy)) {		cpu_sys_devices[cpu] = sys_dev;		dprintk("CPU already managed, adding link\n");		sysfs_create_link(&sys_dev->kobj, &policy->kobj, "cpufreq");		cpufreq_debug_enable_ratelimit();		return 0;	}#endif	if (!try_module_get(cpufreq_driver->owner)) {		ret = -EINVAL;		goto module_out;	}	policy = kmalloc(sizeof(struct cpufreq_policy), GFP_KERNEL);	if (!policy) {		ret = -ENOMEM;		goto nomem_out;	}	memset(policy, 0, sizeof(struct cpufreq_policy));	policy->cpu = cpu;	policy->cpus = cpumask_of_cpu(cpu);	init_MUTEX_LOCKED(&policy->lock);	init_completion(&policy->kobj_unregister);	INIT_WORK(&policy->update, handle_update, (void *)(long)cpu);	/* call driver. From then on the cpufreq must be able	 * to accept all calls to ->verify and ->setpolicy for this CPU	 */	ret = cpufreq_driver->init(policy);	if (ret) {		dprintk("initialization failed\n");		goto err_out;	}	memcpy(&new_policy, policy, sizeof(struct cpufreq_policy));	/* prepare interface data */	policy->kobj.parent = &sys_dev->kobj;	policy->kobj.ktype = &ktype_cpufreq;	strlcpy(policy->kobj.name, "cpufreq", KOBJ_NAME_LEN);	ret = kobject_register(&policy->kobj);	if (ret)		goto err_out_driver_exit;	/* set up files for this cpu device */	drv_attr = cpufreq_driver->attr;	while ((drv_attr) && (*drv_attr)) {		sysfs_create_file(&policy->kobj, &((*drv_attr)->attr));		drv_attr++;	}	if (cpufreq_driver->get)		sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr);	if (cpufreq_driver->target)		sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr);	spin_lock_irqsave(&cpufreq_driver_lock, flags);	for_each_cpu_mask(j, policy->cpus)		cpufreq_cpu_data[j] = policy;	spin_unlock_irqrestore(&cpufreq_driver_lock, flags);	policy->governor = NULL; /* to assure that the starting sequence is				  * run in cpufreq_set_policy */	up(&policy->lock);		/* set default policy */		ret = cpufreq_set_policy(&new_policy);	if (ret) {		dprintk("setting policy failed\n");		goto err_out_unregister;	}	module_put(cpufreq_driver->owner);	cpu_sys_devices[cpu] = sys_dev;	dprintk("initialization complete\n");	cpufreq_debug_enable_ratelimit();		return 0;err_out_unregister:	spin_lock_irqsave(&cpufreq_driver_lock, flags);	for_each_cpu_mask(j, policy->cpus)		cpufreq_cpu_data[j] = NULL;	spin_unlock_irqrestore(&cpufreq_driver_lock, flags);	kobject_unregister(&policy->kobj);	wait_for_completion(&policy->kobj_unregister);err_out_driver_exit:	if (cpufreq_driver->exit)		cpufreq_driver->exit(policy);err_out:	kfree(policy);nomem_out:	module_put(cpufreq_driver->owner); module_out:	cpufreq_debug_enable_ratelimit();	return ret;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/d434fca737bee0862625c2377b987a7713b6b487/cpufreq.c/clean/drivers/cpufreq/cpufreq.c