diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-07 13:11:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-07 13:11:22 +0000 |
commit | b20732900e4636a467c0183a47f7396700f5f743 (patch) | |
tree | 42f079ff82e701ebcb76829974b4caca3e5b6798 /drivers/pwm/pwm-intel-lgm.c | |
parent | Adding upstream version 6.8.12. (diff) | |
download | linux-b20732900e4636a467c0183a47f7396700f5f743.tar.xz linux-b20732900e4636a467c0183a47f7396700f5f743.zip |
Adding upstream version 6.9.7.upstream/6.9.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | drivers/pwm/pwm-intel-lgm.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/pwm/pwm-intel-lgm.c b/drivers/pwm/pwm-intel-lgm.c index 54ecae7f93..f9cc7c17c8 100644 --- a/drivers/pwm/pwm-intel-lgm.c +++ b/drivers/pwm/pwm-intel-lgm.c @@ -42,14 +42,13 @@ #define LGM_PWM_PERIOD_2WIRE_NS (40 * NSEC_PER_MSEC) struct lgm_pwm_chip { - struct pwm_chip chip; struct regmap *regmap; u32 period; }; static inline struct lgm_pwm_chip *to_lgm_pwm_chip(struct pwm_chip *chip) { - return container_of(chip, struct lgm_pwm_chip, chip); + return pwmchip_get_drvdata(chip); } static int lgm_pwm_enable(struct pwm_chip *chip, bool enable) @@ -168,14 +167,16 @@ static int lgm_pwm_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct reset_control *rst; + struct pwm_chip *chip; struct lgm_pwm_chip *pc; void __iomem *io_base; struct clk *clk; int ret; - pc = devm_kzalloc(dev, sizeof(*pc), GFP_KERNEL); - if (!pc) - return -ENOMEM; + chip = devm_pwmchip_alloc(dev, 1, sizeof(*pc)); + if (IS_ERR(chip)) + return PTR_ERR(chip); + pc = to_lgm_pwm_chip(chip); io_base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(io_base)) @@ -203,13 +204,11 @@ static int lgm_pwm_probe(struct platform_device *pdev) if (ret) return dev_err_probe(dev, ret, "cannot deassert reset control\n"); - pc->chip.dev = dev; - pc->chip.ops = &lgm_pwm_ops; - pc->chip.npwm = 1; + chip->ops = &lgm_pwm_ops; lgm_pwm_init(pc); - ret = devm_pwmchip_add(dev, &pc->chip); + ret = devm_pwmchip_add(dev, chip); if (ret < 0) return dev_err_probe(dev, ret, "failed to add PWM chip\n"); |