Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

phy: exynos-mipi-video: simplify check for coupled phy status

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 <m.szyprowski@samsung.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

authored by

Marek Szyprowski and committed by
Kishon Vijay Abraham I
b3e78cbc 9bb86777

+1 -14
+1 -14
drivers/phy/phy-exynos-mipi-video.c
··· 229 229 spinlock_t slock; 230 230 }; 231 231 232 - static inline int __is_running(const struct exynos_mipi_phy_desc *data, 233 - struct exynos_mipi_video_phy *state) 234 - { 235 - u32 val; 236 - int ret; 237 - 238 - ret = regmap_read(state->regmaps[data->resetn_map], data->resetn_reg, &val); 239 - if (ret) 240 - return 0; 241 - 242 - return val & data->resetn_val; 243 - } 244 - 245 232 static int __set_phy_state(const struct exynos_mipi_phy_desc *data, 246 233 struct exynos_mipi_video_phy *state, unsigned int on) 247 234 { ··· 238 251 239 252 /* disable in PMU sysreg */ 240 253 if (!on && data->coupled_phy_id >= 0 && 241 - !__is_running(state->phys[data->coupled_phy_id].data, state)) { 254 + state->phys[data->coupled_phy_id].phy->power_count == 0) { 242 255 regmap_read(state->regmaps[data->enable_map], data->enable_reg, 243 256 &val); 244 257 val &= ~data->enable_val;