pwm: meson: Convert to devm_platform_ioremap_resource()

Use devm_platform_ioremap_resource() to simplify code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
This commit is contained in:
Yangtao Li 2019-12-29 08:05:52 +00:00 committed by Thierry Reding
parent fd7c575ac6
commit 17076b10d4

View File

@ -537,15 +537,13 @@ static int meson_pwm_init_channels(struct meson_pwm *meson)
static int meson_pwm_probe(struct platform_device *pdev) static int meson_pwm_probe(struct platform_device *pdev)
{ {
struct meson_pwm *meson; struct meson_pwm *meson;
struct resource *regs;
int err; int err;
meson = devm_kzalloc(&pdev->dev, sizeof(*meson), GFP_KERNEL); meson = devm_kzalloc(&pdev->dev, sizeof(*meson), GFP_KERNEL);
if (!meson) if (!meson)
return -ENOMEM; return -ENOMEM;
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); meson->base = devm_platform_ioremap_resource(pdev, 0);
meson->base = devm_ioremap_resource(&pdev->dev, regs);
if (IS_ERR(meson->base)) if (IS_ERR(meson->base))
return PTR_ERR(meson->base); return PTR_ERR(meson->base);