[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJd=RBCn0bM2rkXD3C6+7UZxFGO=fT7JNAcG-3SjR_zuGOZiCw@mail.gmail.com>
Date: Fri, 1 Feb 2013 21:44:41 +0800
From: Hillf Danton <dhillf@...il.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Rusty Russell <rusty@...tcorp.com.au>,
Paul McKenney <paulmck@...ux.vnet.ibm.com>,
"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>,
Arjan van de Veen <arjan@...radead.org>, Paul@...per.es
Subject: Re: [patch 09/40] cpu: hotplug: Implement setup/removal interface
On Thu, Jan 31, 2013 at 8:11 PM, Thomas Gleixner <tglx@...utronix.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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists