Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1299362imu; Wed, 16 Jan 2019 16:42:15 -0800 (PST) X-Google-Smtp-Source: ALg8bN7bL9ABpPNL15X+GHO2OfKSuPTXBGjTXQjq6+wAqmEgWySiKOSJkGjYzh+KaOW5Nw6LG7Dv X-Received: by 2002:a63:ec13:: with SMTP id j19mr11398877pgh.6.1547685735371; Wed, 16 Jan 2019 16:42:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547685735; cv=none; d=google.com; s=arc-20160816; b=UCQMh1a9T/u2+e3QQWRuA2fbZXfIESA1TqnNpY7oojQCaN57Ut148FOLPDVM0ZH8D8 mTli8lVPWmu89VUYmqdDmXxl7CyBbUtkuoAnWZEaTYroultinpkZjRvvG9ppSuTml3kx B8NiG59lfN2AW8K1nCjUirAxLpDjqml8pcoah4SCGTUMHNAe/JSoZfL20If6WPg9CcxG xS8zw/uSH2YtaZLuyDMn7GEP/ZJUgB3NzA6bR9DTHaupm/cXjOVKtQ8Mwr0LDOnBFNcn XEQMWKxhi6vcVt15vYJ+nB38dtqoaoGL2B+oV2OTjk3oyrizPEPZAy6buTXCFeXBwc1f 2Gig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=WXds+0lDhrbxDFvkp+UhCojJxIFBCbMZxCTk3UNSSQQ=; b=rggbLWQacCNmJgFp6DrybR5zkGC5h2cdCtWGe+x4sUgNu8kGz8rRGFGWywxaskQy+b c0clnz/O4FhFJjC+cXTZbJ4ag8zQQ3M7KWWWodAu8B1sdLYQgktAG3cuImaWJC1pbWOx jLKvFDLLe02fCdDUx1lNsP2lBH4qRCGLGR3sCvqaU9CeqeJjrR7qZHrII9Xyzv0APmYJ YGsHTEYFEJFP6q+i6Wz+08vLi/TPVv4o1KD14CYy1nrLfnpcvTwwGgiPHmt2vglEgLlU 7ewkKBivYhwTutUwbIXjQOsdE82l+SVfS7/YHFW0tXx19JTIoSmhZtat/sPhqEwtWpJ3 ia1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kemnade.info header.s=20180802 header.b=Dxw+LUUR; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u72si7324600pgc.360.2019.01.16.16.41.57; Wed, 16 Jan 2019 16:42:15 -0800 (PST) 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; dkim=fail header.i=@kemnade.info header.s=20180802 header.b=Dxw+LUUR; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732698AbfAPWEn (ORCPT + 99 others); Wed, 16 Jan 2019 17:04:43 -0500 Received: from mail.andi.de1.cc ([85.214.239.24]:55770 "EHLO h2641619.stratoserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732159AbfAPWEl (ORCPT ); Wed, 16 Jan 2019 17:04:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kemnade.info; s=20180802; h=References:In-Reply-To:Message-Id:Date:Subject: Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=WXds+0lDhrbxDFvkp+UhCojJxIFBCbMZxCTk3UNSSQQ=; b=Dxw+LUURMGDCGydQL113B7jAx dyIBnAthJaiBatdnSpH41x4h8EMB9fK5PH2mOdNd08AYJqh713vazLLb2lnuk6hzqMNB/7AghCkZj +6yZ2o9Xk4gCCB5zYwp/wbiwbiOO4jqZwcitLj5OEFw0fekmmLVtxXaW0uwzYmUFPc9x8=; Received: from p200300ccfbcc8e001a3da2fffebfd33a.dip0.t-ipconnect.de ([2003:cc:fbcc:8e00:1a3d:a2ff:febf:d33a] helo=aktux) by h2641619.stratoserver.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gjtIX-0006lc-BY; Wed, 16 Jan 2019 23:04:33 +0100 Received: from andi by aktux with local (Exim 4.89) (envelope-from ) id 1gjtIX-0002PU-3p; Wed, 16 Jan 2019 23:04:33 +0100 From: Andreas Kemnade To: t-kristo@ti.com, mturquette@baylibre.com, sboyd@kernel.org, linux-omap@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, bcousson@baylibre.com, paul@pwsan.com, tony@atomide.com, letux-kernel@openphoenux.org Cc: Andreas Kemnade Subject: [PATCH v3 2/3] clk: ti: check clock type before doing autoidle ops Date: Wed, 16 Jan 2019 23:04:28 +0100 Message-Id: <20190116220429.9136-3-andreas@kemnade.info> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190116220429.9136-1-andreas@kemnade.info> References: <20190116220429.9136-1-andreas@kemnade.info> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Code might use autoidle api with clocks not being omap2 clocks, so check if clock type is really omap2. Signed-off-by: Andreas Kemnade --- v3: replace CLK_IS_BASIC check New in v2 drivers/clk/ti/autoidle.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/clk/ti/autoidle.c b/drivers/clk/ti/autoidle.c index 964e97b5478a..1cae226759dd 100644 --- a/drivers/clk/ti/autoidle.c +++ b/drivers/clk/ti/autoidle.c @@ -82,9 +82,15 @@ static int _omap2_clk_allow_idle(struct clk_hw_omap *clk) */ int omap2_clk_deny_idle(struct clk *clk) { - struct clk_hw_omap *c = to_clk_hw_omap(__clk_get_hw(clk)); + struct clk_hw *hw = __clk_get_hw(clk); - return _omap2_clk_deny_idle(c); + if (omap2_clk_is_hw_omap(hw)) { + struct clk_hw_omap *c = to_clk_hw_omap(hw); + + return _omap2_clk_deny_idle(c); + } + + return -EINVAL; } /** @@ -95,9 +101,15 @@ int omap2_clk_deny_idle(struct clk *clk) */ int omap2_clk_allow_idle(struct clk *clk) { - struct clk_hw_omap *c = to_clk_hw_omap(__clk_get_hw(clk)); + struct clk_hw *hw = __clk_get_hw(clk); + + if (omap2_clk_is_hw_omap(hw)) { + struct clk_hw_omap *c = to_clk_hw_omap(hw); + + return _omap2_clk_allow_idle(c); + } - return _omap2_clk_allow_idle(c); + return -EINVAL; } static void _allow_autoidle(struct clk_ti_autoidle *clk) -- 2.11.0