From patchwork Tue Aug 2 08:52:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 73149 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp38708qga; Tue, 2 Aug 2016 01:58:25 -0700 (PDT) X-Received: by 10.66.21.137 with SMTP id v9mr23384935pae.58.1470128305238; Tue, 02 Aug 2016 01:58:25 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u79si2092055pfj.150.2016.08.02.01.58.24; Tue, 02 Aug 2016 01:58:25 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752905AbcHBI40 (ORCPT + 27 others); Tue, 2 Aug 2016 04:56:26 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:34997 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751929AbcHBIzn (ORCPT ); Tue, 2 Aug 2016 04:55:43 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OB9008RXXZZUB30@mailout4.w1.samsung.com>; Tue, 02 Aug 2016 09:52:47 +0100 (BST) X-AuditID: cbfec7f5-f792a6d000001302-e3-57a05f5f9fbb Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 5B.DA.04866.F5F50A75; Tue, 2 Aug 2016 09:52:47 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OB900ENYXZVL590@eusync4.samsung.com>; Tue, 02 Aug 2016 09:52:47 +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 10:52:36 +0200 Message-id: <1470127956-22476-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrGJMWRmVeSWpSXmKPExsVy+t/xa7rx8QvCDdbeNLHYOGM9q8Wk+xNY LF6/MLS48LSHzeLyrjlsFjPO72OyWHvkLrvF4TftrA4cHn1bVjF6HL+xncnj8ya5AOYoLpuU 1JzMstQifbsErozZO6cxFxzjqejZfYGtgXEDVxcjJ4eEgInE0kMf2SBsMYkL99aD2UICSxkl Jh4M72LkArKbmCSmz+5gAkmwCRhKdL3tAisSEXCWuP3hGwtIEbPATkaJPze6WUESwgJ+EjvO 3QQrYhFQlZjy8B2YzSvgITHn6EFGiG1yEiePTWadwMi9gJFhFaNoamlyQXFSeq6RXnFibnFp Xrpecn7uJkZIaHzdwbj0mNUhRgEORiUe3oDc+eFCrIllxZW5hxglOJiVRHiXRS0IF+JNSays Si3Kjy8qzUktPsQozcGiJM47c9f7ECGB9MSS1OzU1ILUIpgsEwenVANjz7/Gy0c3rhQ0z1vZ X2SYtdcyLFzyS3681oqvTE9KmDpSVKz9xewe5jkxXtpf8W+ZTL3rQyd723yZfce/7Nww98rp JQZFc2dXHv14ZumJ+0xRXB9L7ujZXWKfX6W2gfnPwYk7wvwbk7Yc5o6Y5pX9dN/zKUvWlLH0 GGd13hG6UDlTqOnbHflAJZbijERDLeai4kQAlnt4vgkCAAA= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 --- drivers/phy/phy-exynos-mipi-video.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) -- 1.9.1 diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c index 8b851f7..e185234 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_id].phy->power_count == 0) { regmap_read(state->regmaps[data->enable_map], data->enable_reg, &val); val &= ~data->enable_val;