From patchwork Tue Aug 2 10:17:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 73155 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp78795qga; Tue, 2 Aug 2016 03:29:51 -0700 (PDT) X-Received: by 10.66.189.104 with SMTP id gh8mr103416101pac.125.1470133791798; Tue, 02 Aug 2016 03:29:51 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m75si2513685pfa.29.2016.08.02.03.29.51; Tue, 02 Aug 2016 03:29:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753092AbcHBK3m (ORCPT + 4 others); Tue, 2 Aug 2016 06:29:42 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:23877 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753089AbcHBK3j (ORCPT ); Tue, 2 Aug 2016 06:29:39 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OBA00GAD1YXO260@mailout1.w1.samsung.com>; Tue, 02 Aug 2016 11:18:33 +0100 (BST) X-AuditID: cbfec7f4-f796c6d000001486-0e-57a07379b3df Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id E9.75.05254.97370A75; Tue, 2 Aug 2016 11:18:33 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OBA00JG21YUT340@eusync3.samsung.com>; Tue, 02 Aug 2016 11:18:33 +0100 (BST) From: Marek Szyprowski To: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Kishon Vijay Abraham I , Krzysztof Kozlowski Subject: [PATCH] phy: exynos-mipi-video: simplify check for coupled phy status Date: Tue, 02 Aug 2016 12:17:34 +0200 Message-id: <1470133054-31957-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1470127956-22476-1-git-send-email-m.szyprowski@samsung.com> References: <1470127956-22476-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplluLIzCtJLcpLzFFi42I5/e/4Vd3K4gXhBo/nS1tsnLGe1WLS/Qks Fq9fGFpceNrDZnF51xw2ixnn9zFZrD1yl93i8Jt2VgcOj74tqxg9jt/YzuTxeZNcAHMUl01K ak5mWWqRvl0CV8bz5VMZCxp5K6Y93cHUwPiMq4uRk0NCwETi8stFbBC2mMSFe+vBbCGBpYwS U2ewdDFyAdlNTBJfLzxnBUmwCRhKdL3tAisSEXCWuP3hG1gRs8BORok/N7rBioQF/CR2nLsJ VsQioCoxafUhJhCbV8BD4tv1S+wQ2+QkTh6bDFTPwcEp4Clx64gDxGIPiR8dHYwTGHkXMDKs YhRNLU0uKE5KzzXUK07MLS7NS9dLzs/dxAgJpC87GBcfszrEKMDBqMTDG5A7P1yINbGsuDL3 EKMEB7OSCK9t0YJwId6UxMqq1KL8+KLSnNTiQ4zSHCxK4rxzd70PERJITyxJzU5NLUgtgsky cXBKNTAK3Arw7fo6b9slvkkzZD2jVno7+AoVH1zU5+naLDJlz42JdVN6r9Ut/pnf+2n95VOK uQc8rOeo3eYMvDQ3zuPs2Wu5zM1bRAVnRhZ4x/zjWsDV6pzgbMOfM+dHj1tDvYdblED/6Yjo JOGCHd/89vPd92LkVDGXZl/HxyPjaZsZ8fjc+/feV5VYijMSDbWYi4oTAbLdRfogAgAA Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org There is no need to access regmap of coupled phy to check its state - such information is already in the phy device itself, so use it directly. This let us to avoid possible access to registers of the device in the disabled power domain if the coupled phy is already disabled. Signed-off-by: Marek Szyprowski Acked-by: Sylwester Nawrocki --- drivers/phy/phy-exynos-mipi-video.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c index 8b851f7..6bee04c 100644 --- a/drivers/phy/phy-exynos-mipi-video.c +++ b/drivers/phy/phy-exynos-mipi-video.c @@ -229,19 +229,6 @@ struct exynos_mipi_video_phy { spinlock_t slock; }; -static inline int __is_running(const struct exynos_mipi_phy_desc *data, - struct exynos_mipi_video_phy *state) -{ - u32 val; - int ret; - - ret = regmap_read(state->regmaps[data->resetn_map], data->resetn_reg, &val); - if (ret) - return 0; - - return val & data->resetn_val; -} - static int __set_phy_state(const struct exynos_mipi_phy_desc *data, struct exynos_mipi_video_phy *state, unsigned int on) { @@ -251,7 +238,7 @@ static int __set_phy_state(const struct exynos_mipi_phy_desc *data, /* disable in PMU sysreg */ if (!on && data->coupled_phy_id >= 0 && - !__is_running(state->phys[data->coupled_phy_id].data, state)) { + state->phys[data->coupled_phy_id].phy->power_count == 0) { regmap_read(state->regmaps[data->enable_map], data->enable_reg, &val); val &= ~data->enable_val;