Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934199AbcKONds (ORCPT ); Tue, 15 Nov 2016 08:33:48 -0500 Received: from fllnx209.ext.ti.com ([198.47.19.16]:62026 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752603AbcKONdq (ORCPT ); Tue, 15 Nov 2016 08:33:46 -0500 Subject: Re: [PATCH RESEND] phy: exynos-mipi-video: simplify check for coupled phy status To: Marek Szyprowski , , References: <1478515712-650-1-git-send-email-m.szyprowski@samsung.com> CC: Sylwester Nawrocki , Krzysztof Kozlowski From: Kishon Vijay Abraham I Message-ID: <582B0EAC.7070805@ti.com> Date: Tue, 15 Nov 2016 19:03:32 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <1478515712-650-1-git-send-email-m.szyprowski@samsung.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1798 Lines: 53 On Monday 07 November 2016 04:18 PM, Marek Szyprowski wrote: > 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 merged to phy -next. Thanks Kishon > --- > drivers/phy/phy-exynos-mipi-video.c | 15 +-------------- > 1 file changed, 1 insertion(+), 14 deletions(-) > > 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; >