Skip to content

Commit

Permalink
pwm: lpss: Simplify using devm_pwmchip_add()
Browse files Browse the repository at this point in the history
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
  • Loading branch information
Uwe Kleine-König authored and Thierry Reding committed Jun 28, 2021
1 parent bcda91b commit d1e487b
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 15 deletions.
4 changes: 0 additions & 4 deletions drivers/pwm/pwm-lpss-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,8 @@ static int pwm_lpss_probe_pci(struct pci_dev *pdev,

static void pwm_lpss_remove_pci(struct pci_dev *pdev)
{
struct pwm_lpss_chip *lpwm = pci_get_drvdata(pdev);

pm_runtime_forbid(&pdev->dev);
pm_runtime_get_sync(&pdev->dev);

pwm_lpss_remove(lpwm);
}

#ifdef CONFIG_PM
Expand Down
4 changes: 1 addition & 3 deletions drivers/pwm/pwm-lpss-platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,8 @@ static int pwm_lpss_probe_platform(struct platform_device *pdev)

static int pwm_lpss_remove_platform(struct platform_device *pdev)
{
struct pwm_lpss_chip *lpwm = platform_get_drvdata(pdev);

pm_runtime_disable(&pdev->dev);
return pwm_lpss_remove(lpwm);
return 0;
}

static const struct acpi_device_id pwm_lpss_acpi_match[] = {
Expand Down
8 changes: 1 addition & 7 deletions drivers/pwm/pwm-lpss.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, struct resource *r,
lpwm->chip.ops = &pwm_lpss_ops;
lpwm->chip.npwm = info->npwm;

ret = pwmchip_add(&lpwm->chip);
ret = devm_pwmchip_add(dev, &lpwm->chip);
if (ret) {
dev_err(dev, "failed to add PWM chip: %d\n", ret);
return ERR_PTR(ret);
Expand All @@ -252,12 +252,6 @@ struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, struct resource *r,
}
EXPORT_SYMBOL_GPL(pwm_lpss_probe);

int pwm_lpss_remove(struct pwm_lpss_chip *lpwm)
{
return pwmchip_remove(&lpwm->chip);
}
EXPORT_SYMBOL_GPL(pwm_lpss_remove);

MODULE_DESCRIPTION("PWM driver for Intel LPSS");
MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>");
MODULE_LICENSE("GPL v2");
1 change: 0 additions & 1 deletion drivers/pwm/pwm-lpss.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,5 @@ struct pwm_lpss_boardinfo {

struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, struct resource *r,
const struct pwm_lpss_boardinfo *info);
int pwm_lpss_remove(struct pwm_lpss_chip *lpwm);

#endif /* __PWM_LPSS_H */

0 comments on commit d1e487b

Please sign in to comment.