Shrink the mutex region. And save a clocksource_select action if set clocksource is same as current clocksource.
Signed-off-by: Alex Shi <alex....@intel.com> --- kernel/time/clocksource.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index 021c159..9d6c333 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -885,13 +885,15 @@ static ssize_t sysfs_override_clocksource(struct device *dev, { size_t ret; - mutex_lock(&clocksource_mutex); - ret = sysfs_get_uname(buf, override_name, count); - if (ret >= 0) - clocksource_select(); + if (ret >= 0) { + if (!strcmp(curr_clocksource->name, override_name)) + return ret; - mutex_unlock(&clocksource_mutex); + mutex_lock(&clocksource_mutex); + clocksource_select(); + mutex_unlock(&clocksource_mutex); + } return ret; } -- 1.7.12 -- 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/