From patchwork Wed Oct 28 13:11:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 55688 Delivered-To: patch@linaro.org Received: by 10.112.61.134 with SMTP id p6csp115937lbr; Wed, 28 Oct 2015 06:19:35 -0700 (PDT) X-Received: by 10.50.119.9 with SMTP id kq9mr3086268igb.32.1446038373718; Wed, 28 Oct 2015 06:19:33 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f17si33686222iod.80.2015.10.28.06.19.33; Wed, 28 Oct 2015 06:19:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965945AbbJ1NTc (ORCPT + 28 others); Wed, 28 Oct 2015 09:19:32 -0400 Received: from mail-wm0-f43.google.com ([74.125.82.43]:37993 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965314AbbJ1NT3 (ORCPT ); Wed, 28 Oct 2015 09:19:29 -0400 Received: by wmeg8 with SMTP id g8so7626695wme.1 for ; Wed, 28 Oct 2015 06:19:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qn6HcvEv8vTMnitLsBjzlzitxBGob4bmVzEotiCBp+k=; b=amFVAU63imgvvC72YyCU6HU0F0PpYWGon8lkt75hlWpal2MfImqstQt2vDnYAr9VDL wVEain1YyzbnDYzb0UFuXjfEc+kryrwH0ylfoFjSrFrwTNJzhqnWb6etUWr6qPJhUO0p JSUK6ywqhYZenWtqQA2wSmJ64ryqnNrK0jh5rDTiq/dssLr4pVpl/IvvkoV2p1HRXo0L 0u57/FvDPsebORtxvTZTwrGfQ+B/04FMDB/GyK6NylnVMCUhT2uBBoRS4REoukLVm7D1 TXbpYzYXpUe67L0oNndvDLXk8wXDlgWdqsHfYCroBp4j7CdDMfnLh/AGYxaj1L2nRAPZ M0qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qn6HcvEv8vTMnitLsBjzlzitxBGob4bmVzEotiCBp+k=; b=NUmJCJ8Fll37h1/qEWaRti446LIKo0XuAN1DYREQdbQPUpxaLcuoeRU1KhiYQqTHLo F7PkAqLZ9ANxLf2GC9tR3gE6JjP4KYVD49yxVgQ+NQVHalpWPy8DxB8qZGso7V4YCcuT 7Sv2RPsbNp/qMfCi+JLpg11wFPC7KPkiCrItZIQfgdT0aXllg6+u7DbpBpv22UA2JUOm VNX4kJYii0YhQKTvHRw1c9SZDgDl0UTlCTuCHVWyytiHV88sA0mmhypjfGU6FnH2gL/D 5qJv1pxjk4VYx/yB2EktvxCUomXqBBRP7hmmWOOhG8/ojNrl3QQCxBS2B9B1SRMhElsr 2mvQ== X-Gm-Message-State: ALoCoQmiUSPzJHzS/FtXane2dTyVsGkkM9fRWipv9ih9fi8X6iQXt8PgUYf6vkXn0fADwv62TuM5 X-Received: by 10.28.146.133 with SMTP id u127mr1561577wmd.94.1446037927145; Wed, 28 Oct 2015 06:12:07 -0700 (PDT) Received: from localhost.localdomain (sju31-1-78-210-255-2.fbx.proxad.net. [78.210.255.2]) by smtp.gmail.com with ESMTPSA id lv4sm49967344wjb.43.2015.10.28.06.12.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Oct 2015 06:12:06 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de Cc: Magnus Damm , Viresh Kumar , Laurent Pinchart , Chris Brandt , linux-kernel@vger.kernel.org (open list:CLOCKSOURCE, CLOC...) Subject: [PATCH 8/8] clocksource/drivers/sh_mtu2: Fix multiple shutdown call issue Date: Wed, 28 Oct 2015 14:11:33 +0100 Message-Id: <1446037894-22601-8-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446037894-22601-1-git-send-email-daniel.lezcano@linaro.org> References: <5630C947.4020706@linaro.org> <1446037894-22601-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Magnus Damm On the r7s72100 Genmai board the MTU2 driver currently triggers a common clock framework WARN_ON(enable_count) when disabling the clock due to the MTU2 driver after recent callback rework may call ->set_state_shutdown() multiple times. A similar issue was spotted for the TMU driver and fixed in: 452b132 clocksource/drivers/sh_tmu: Fix traceback spotted in -next On r7s72100 Genmai v4.3-rc7 built with shmobile_defconfig spits out the following during boot: sh_mtu2 fcff0000.timer: ch0: used for clock events ------------[ cut here ]------------ WARNING: CPU: 0 PID: 1 at drivers/clk/clk.c:675 clk_core_disable+0x2c/0x6c() CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.3.0-rc7 #1 Hardware name: Generic R7S72100 (Flattened Device Tree) Backtrace: [] (dump_backtrace) from [] (show_stack+0x18/0x1c) [] (show_stack) from [] (dump_stack+0x74/0x90) [] (dump_stack) from [] (warn_slowpath_common+0x88/0xb4) [] (warn_slowpath_common) from [] (warn_slowpath_null+0x24/0x2c) [] (warn_slowpath_null) from [] (clk_core_disable+0x2c/0x6c) [] (clk_core_disable) from [] (clk_disable+0x40/0x4c) [] (clk_disable) from [] (sh_mtu2_disable+0x24/0x50) [] (sh_mtu2_disable) from [] (sh_mtu2_clock_event_shutdown+0x14/0x1c) [] (sh_mtu2_clock_event_shutdown) from [] (clockevents_switch_state+0xc8/0x114) [] (clockevents_switch_state) from [] (clockevents_shutdown+0x18/0x28) [] (clockevents_shutdown) from [] (clockevents_exchange_device+0x70/0x78) [] (clockevents_exchange_device) from [] (tick_check_new_device+0x88/0xe0) [] (tick_check_new_device) from [] (clockevents_register_device+0xac/0x120) [] (clockevents_register_device) from [] (sh_mtu2_probe+0x230/0x350) [] (sh_mtu2_probe) from [] (platform_drv_probe+0x50/0x98) Reported-by: Chris Brandt Fixes: 19a9ffb ("clockevents/drivers/sh_mtu2: Migrate to new 'set-state' interface") Cc: Viresh Kumar Cc: Laurent Pinchart Signed-off-by: Magnus Damm Signed-off-by: Daniel Lezcano Acked-by: Viresh Kumar --- drivers/clocksource/sh_mtu2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c index f1985da..53aa7e9 100644 --- a/drivers/clocksource/sh_mtu2.c +++ b/drivers/clocksource/sh_mtu2.c @@ -280,7 +280,9 @@ static int sh_mtu2_clock_event_shutdown(struct clock_event_device *ced) { struct sh_mtu2_channel *ch = ced_to_sh_mtu2(ced); - sh_mtu2_disable(ch); + if (clockevent_state_periodic(ced)) + sh_mtu2_disable(ch); + return 0; }