Skip to content

Commit

Permalink
pwm: dwc: Use devm_pwmchip_add()
Browse files Browse the repository at this point in the history
Add the PWM chip using devm_pwmchip_add() to avoid having to manually
remove it. This is useful for subsequent patches adding platform device
support.

Signed-off-by: Ben Dooks <ben.dooks@sifive.com>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
  • Loading branch information
Ben Dooks authored and Thierry Reding committed Feb 20, 2023
1 parent a357d14 commit cf70d01
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions drivers/pwm/pwm-dwc.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ static int dwc_pwm_probe(struct pci_dev *pci, const struct pci_device_id *id)
return -ENOMEM;
}

ret = pwmchip_add(&dwc->chip);
ret = devm_pwmchip_add(dev, &dwc->chip);
if (ret)
return ret;

Expand All @@ -256,12 +256,8 @@ static int dwc_pwm_probe(struct pci_dev *pci, const struct pci_device_id *id)

static void dwc_pwm_remove(struct pci_dev *pci)
{
struct dwc_pwm *dwc = pci_get_drvdata(pci);

pm_runtime_forbid(&pci->dev);
pm_runtime_get_noresume(&pci->dev);

pwmchip_remove(&dwc->chip);
}

#ifdef CONFIG_PM_SLEEP
Expand Down

0 comments on commit cf70d01

Please sign in to comment.