On Thu, Jan 31, 2013 at 8:11 PM, Thomas Gleixner <t...@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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to