mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-01-20 05:16:14 -05:00
pwm: tegra: Prepare removing pwm_chip from driver data
This prepares the driver for further changes that will drop struct pwm_chip chip from struct tegra_pwm_chip. Use the pwm_chip as driver data instead of the tegra_pwm_chip to get access to the pwm_chip in tegra_pwm_remove() without using pc->chip. Link: https://lore.kernel.org/r/2813c63bf1317dee808f4c5c4a9411999f2d5746.1707900770.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
This commit is contained in:
@@ -271,12 +271,14 @@ static const struct pwm_ops tegra_pwm_ops = {
|
||||
|
||||
static int tegra_pwm_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct pwm_chip *chip;
|
||||
struct tegra_pwm_chip *pc;
|
||||
int ret;
|
||||
|
||||
pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL);
|
||||
if (!pc)
|
||||
return -ENOMEM;
|
||||
chip = &pc->chip;
|
||||
|
||||
pc->soc = of_device_get_match_data(&pdev->dev);
|
||||
|
||||
@@ -284,7 +286,7 @@ static int tegra_pwm_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(pc->regs))
|
||||
return PTR_ERR(pc->regs);
|
||||
|
||||
platform_set_drvdata(pdev, pc);
|
||||
platform_set_drvdata(pdev, chip);
|
||||
|
||||
pc->clk = devm_clk_get(&pdev->dev, NULL);
|
||||
if (IS_ERR(pc->clk))
|
||||
@@ -326,11 +328,11 @@ static int tegra_pwm_probe(struct platform_device *pdev)
|
||||
|
||||
reset_control_deassert(pc->rst);
|
||||
|
||||
pc->chip.dev = &pdev->dev;
|
||||
pc->chip.ops = &tegra_pwm_ops;
|
||||
pc->chip.npwm = pc->soc->num_channels;
|
||||
chip->dev = &pdev->dev;
|
||||
chip->ops = &tegra_pwm_ops;
|
||||
chip->npwm = pc->soc->num_channels;
|
||||
|
||||
ret = pwmchip_add(&pc->chip);
|
||||
ret = pwmchip_add(chip);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "pwmchip_add() failed: %d\n", ret);
|
||||
reset_control_assert(pc->rst);
|
||||
@@ -348,9 +350,10 @@ static int tegra_pwm_probe(struct platform_device *pdev)
|
||||
|
||||
static void tegra_pwm_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct tegra_pwm_chip *pc = platform_get_drvdata(pdev);
|
||||
struct pwm_chip *chip = platform_get_drvdata(pdev);
|
||||
struct tegra_pwm_chip *pc = to_tegra_pwm_chip(chip);
|
||||
|
||||
pwmchip_remove(&pc->chip);
|
||||
pwmchip_remove(chip);
|
||||
|
||||
reset_control_assert(pc->rst);
|
||||
|
||||
@@ -359,7 +362,8 @@ static void tegra_pwm_remove(struct platform_device *pdev)
|
||||
|
||||
static int __maybe_unused tegra_pwm_runtime_suspend(struct device *dev)
|
||||
{
|
||||
struct tegra_pwm_chip *pc = dev_get_drvdata(dev);
|
||||
struct pwm_chip *chip = dev_get_drvdata(dev);
|
||||
struct tegra_pwm_chip *pc = to_tegra_pwm_chip(chip);
|
||||
int err;
|
||||
|
||||
clk_disable_unprepare(pc->clk);
|
||||
@@ -375,7 +379,8 @@ static int __maybe_unused tegra_pwm_runtime_suspend(struct device *dev)
|
||||
|
||||
static int __maybe_unused tegra_pwm_runtime_resume(struct device *dev)
|
||||
{
|
||||
struct tegra_pwm_chip *pc = dev_get_drvdata(dev);
|
||||
struct pwm_chip *chip = dev_get_drvdata(dev);
|
||||
struct tegra_pwm_chip *pc = to_tegra_pwm_chip(chip);
|
||||
int err;
|
||||
|
||||
err = pinctrl_pm_select_default_state(dev);
|
||||
|
||||
Reference in New Issue
Block a user