Commit d85b9ce1 authored by Thierry Reding's avatar Thierry Reding

pwm: atmel: Remove unneeded check for match data

Since the driver is now exclusively DT, it only binds if it finds a
match in the of_device_id table. But in that case the associated data
can never be NULL, so drop the unnecessary check.

While at it, drop the extra local variable and store the pointer to
this per-SoC data in the driver data directly.
Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
parent 3d4d8574
...@@ -339,19 +339,16 @@ MODULE_DEVICE_TABLE(of, atmel_pwm_dt_ids); ...@@ -339,19 +339,16 @@ MODULE_DEVICE_TABLE(of, atmel_pwm_dt_ids);
static int atmel_pwm_probe(struct platform_device *pdev) static int atmel_pwm_probe(struct platform_device *pdev)
{ {
const struct atmel_pwm_data *data;
struct atmel_pwm_chip *atmel_pwm; struct atmel_pwm_chip *atmel_pwm;
struct resource *res; struct resource *res;
int ret; int ret;
data = of_device_get_match_data(&pdev->dev);
if (!data)
return -ENODEV;
atmel_pwm = devm_kzalloc(&pdev->dev, sizeof(*atmel_pwm), GFP_KERNEL); atmel_pwm = devm_kzalloc(&pdev->dev, sizeof(*atmel_pwm), GFP_KERNEL);
if (!atmel_pwm) if (!atmel_pwm)
return -ENOMEM; return -ENOMEM;
atmel_pwm->data = of_device_get_match_data(&pdev->dev);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
atmel_pwm->base = devm_ioremap_resource(&pdev->dev, res); atmel_pwm->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(atmel_pwm->base)) if (IS_ERR(atmel_pwm->base))
...@@ -375,7 +372,6 @@ static int atmel_pwm_probe(struct platform_device *pdev) ...@@ -375,7 +372,6 @@ static int atmel_pwm_probe(struct platform_device *pdev)
atmel_pwm->chip.base = -1; atmel_pwm->chip.base = -1;
atmel_pwm->chip.npwm = 4; atmel_pwm->chip.npwm = 4;
atmel_pwm->data = data;
atmel_pwm->updated_pwms = 0; atmel_pwm->updated_pwms = 0;
mutex_init(&atmel_pwm->isr_lock); mutex_init(&atmel_pwm->isr_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment