| Date | Fri, 1 Feb 2013 21:44:41 +0800 | Subject | Re: [patch 09/40] cpu: hotplug: Implement setup/removal interface | From | Hillf Danton <> |
| |
On Thu, Jan 31, 2013 at 8:11 PM, Thomas Gleixner <tglx@linutronix.de> wrote: > +/** > + * __cpuhp_setup_state - Setup the callbacks for an hotplug machine state > + * @state: The state to setup > + * @invoke: If true, the startup function is invoked for cpus where > + * cpu state >= @state > + * @startup: startup callback function > + * @teardown: teardown callback function > + * > + * Returns 0 if successful, otherwise a proper error code > + */ > +int __cpuhp_setup_state(enum cpuhp_states state, bool invoke, > + int (*startup)(unsigned int cpu), > + int (*teardown)(unsigned int cpu)) > +{ > + int cpu, ret = 0; > + > + if (cpuhp_cb_check(state)) > + return -EINVAL; > + > + get_online_cpus(); > + > + if (!invoke || !startup) > + goto install; > + > + /* > + * Try to call the startup callback for each present cpu > + * depending on the hotplug state of the cpu. > + */ > + for_each_present_cpu(cpu) { > + int ret, cpustate = per_cpu(cpuhp_state, cpu);
s/ret,//
> + > + if (cpustate < state) > + continue; > + > + ret = cpuhp_issue_call(cpu, state, startup, true); > + if (ret) { > + cpuhp_rollback_install(cpu, state, teardown); > + goto out; > + } > + } > +install: > + cpuhp_store_callbacks(state, startup, teardown); > +out: > + put_online_cpus(); > + return ret; > +} > +EXPORT_SYMBOL(__cpuhp_setup_state);
|