mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-16 05:26:07 +00:00
pwm: xilinx: Prepare removing pwm_chip from driver data
This prepares the driver for further changes that will drop struct pwm_chip chip from struct xilinx_pwm_device. Use the pwm_chip as driver data instead of the xilinx_pwm_device to get access to the pwm_chip in xilinx_pwm_remove() without using xilinx_pwm->chip. Link: https://lore.kernel.org/r/738b9929c1d13bde64050f8bbc4ce8d85f58cc7a.1707900770.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
This commit is contained in:
parent
ae8635e99c
commit
4caa211522
@ -214,6 +214,7 @@ static int xilinx_pwm_probe(struct platform_device *pdev)
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *np = dev->of_node;
|
||||
struct xilinx_timer_priv *priv;
|
||||
struct pwm_chip *chip;
|
||||
struct xilinx_pwm_device *xilinx_pwm;
|
||||
u32 pwm_cells, one_timer, width;
|
||||
void __iomem *regs;
|
||||
@ -228,8 +229,9 @@ static int xilinx_pwm_probe(struct platform_device *pdev)
|
||||
xilinx_pwm = devm_kzalloc(dev, sizeof(*xilinx_pwm), GFP_KERNEL);
|
||||
if (!xilinx_pwm)
|
||||
return -ENOMEM;
|
||||
platform_set_drvdata(pdev, xilinx_pwm);
|
||||
priv = &xilinx_pwm->priv;
|
||||
chip = &xilinx_pwm->chip;
|
||||
platform_set_drvdata(pdev, chip);
|
||||
|
||||
regs = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(regs))
|
||||
@ -278,10 +280,10 @@ static int xilinx_pwm_probe(struct platform_device *pdev)
|
||||
return dev_err_probe(dev, ret, "Clock enable failed\n");
|
||||
clk_rate_exclusive_get(priv->clk);
|
||||
|
||||
xilinx_pwm->chip.dev = dev;
|
||||
xilinx_pwm->chip.ops = &xilinx_pwm_ops;
|
||||
xilinx_pwm->chip.npwm = 1;
|
||||
ret = pwmchip_add(&xilinx_pwm->chip);
|
||||
chip->dev = dev;
|
||||
chip->ops = &xilinx_pwm_ops;
|
||||
chip->npwm = 1;
|
||||
ret = pwmchip_add(chip);
|
||||
if (ret) {
|
||||
clk_rate_exclusive_put(priv->clk);
|
||||
clk_disable_unprepare(priv->clk);
|
||||
@ -293,11 +295,12 @@ static int xilinx_pwm_probe(struct platform_device *pdev)
|
||||
|
||||
static void xilinx_pwm_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct xilinx_pwm_device *xilinx_pwm = platform_get_drvdata(pdev);
|
||||
struct pwm_chip *chip = platform_get_drvdata(pdev);
|
||||
struct xilinx_timer_priv *priv = xilinx_pwm_chip_to_priv(chip);
|
||||
|
||||
pwmchip_remove(&xilinx_pwm->chip);
|
||||
clk_rate_exclusive_put(xilinx_pwm->priv.clk);
|
||||
clk_disable_unprepare(xilinx_pwm->priv.clk);
|
||||
pwmchip_remove(chip);
|
||||
clk_rate_exclusive_put(priv->clk);
|
||||
clk_disable_unprepare(priv->clk);
|
||||
}
|
||||
|
||||
static const struct of_device_id xilinx_pwm_of_match[] = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user