lkml.org 
[lkml]   [2013]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [patch 09/40] cpu: hotplug: Implement setup/removal interface
From
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);


\
 
 \ /
  Last update: 2013-02-01 15:21    [W:0.309 / U:0.496 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site