[PATCH 0/6] ARM: tegra114: add CPU hotplug support

Russell King - ARM Linux linux at arm.linux.org.uk
Fri May 17 06:27:00 EDT 2013


On Thu, May 16, 2013 at 12:19:48PM -0600, Stephen Warren wrote:
> Is there a specific reason for that; is there some problem in the core
> ARM code that implies CPU0 should never be disabled?

No.  This is the code I removed:

-int tegra_cpu_disable(unsigned int cpu)
-{
-       /*
-        * we don't allow CPU 0 to be shutdown (it is still too special
-        * e.g. clock tick interrupts)
-        */
-       return cpu == 0 ? -EPERM : 0;
-}

This gets called from here:

static int platform_cpu_disable(unsigned int cpu)
{
        if (smp_ops.cpu_disable)
                return smp_ops.cpu_disable(cpu);

        /*
         * By default, allow disabling all CPUs except the first one,
         * since this is special on a lot of platforms, e.g. because
         * of clock tick interrupts.
         */
        return cpu == 0 ? -EPERM : 0;
}

Notice the useless utterly nature of tegra_cpu_disable() given that it's
doing _precisely_ the same thing as the common code.  It might as well
not even exist - and it doesn't for that very reason.  Never provide
implementations for methods which are copies of the default action if
no method is provided.



More information about the linux-arm-kernel mailing list