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

Configure Feed

Select the types of activity you want to include in your feed.

soc/tegra: pmc: Pass struct tegra_pmc to tegra_powergate_state()

By using the generic read_poll_timeout() instead of readx_poll_timeout()
we can pass additional parameters, which allows us to pass an additional
PMC context structure and avoid relying on a global variable for this.

Signed-off-by: Thierry Reding <treding@nvidia.com>

+9 -12
+9 -12
drivers/soc/tegra/pmc.c
··· 546 546 writel(value, pmc->scratch + offset); 547 547 } 548 548 549 - /* 550 - * TODO Figure out a way to call this with the struct tegra_pmc * passed in. 551 - * This currently doesn't work because readx_poll_timeout() can only operate 552 - * on functions that take a single argument. 553 - */ 554 - static inline bool tegra_powergate_state(int id) 549 + static inline bool tegra_powergate_state(struct tegra_pmc *pmc, int id) 555 550 { 556 551 if (id == TEGRA_POWERGATE_3D && pmc->soc->has_gpu_clamps) 557 552 return (tegra_pmc_readl(pmc, GPU_RG_CNTRL) & 0x1) == 0; ··· 598 603 tegra_pmc_writel(pmc, PWRGATE_TOGGLE_START | id, PWRGATE_TOGGLE); 599 604 600 605 /* wait for PMC to execute the command */ 601 - ret = readx_poll_timeout(tegra_powergate_state, id, status, 602 - status == new_state, 1, 10); 606 + ret = read_poll_timeout(tegra_powergate_state, status, 607 + status == new_state, 1, 10, false, 608 + pmc, id); 603 609 } while (ret == -ETIMEDOUT && retries--); 604 610 605 611 return ret; ··· 632 636 return err; 633 637 634 638 /* wait for PMC to execute the command */ 635 - err = readx_poll_timeout(tegra_powergate_state, id, status, 636 - status == new_state, 10, 100000); 639 + err = read_poll_timeout(tegra_powergate_state, status, 640 + status == new_state, 10, 100000, false, 641 + pmc, id); 637 642 if (err) 638 643 return err; 639 644 ··· 657 660 658 661 mutex_lock(&pmc->powergates_lock); 659 662 660 - if (tegra_powergate_state(id) == new_state) { 663 + if (tegra_powergate_state(pmc, id) == new_state) { 661 664 mutex_unlock(&pmc->powergates_lock); 662 665 return 0; 663 666 } ··· 978 981 if (!tegra_powergate_is_valid(pmc, id)) 979 982 return -EINVAL; 980 983 981 - return tegra_powergate_state(id); 984 + return tegra_powergate_state(pmc, id); 982 985 } 983 986 984 987 /**