unsigned int num_channels;
int i, err;
int stride;
- struct resource *res;
if (of_property_read_u32(np, "fsl,num-channels", &num_channels))
return -EINVAL;
spin_lock_init(&priv->reg_lock);
- res = platform_get_resource(ofdev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENXIO;
- priv->reg = devm_ioremap(dev, res->start, resource_size(res));
- if (!priv->reg) {
+ priv->reg = devm_platform_ioremap_resource(ofdev, 0);
+ if (IS_ERR(priv->reg)) {
dev_err(dev, "failed to of_iomap\n");
- err = -ENOMEM;
+ err = PTR_ERR(priv->reg);
goto err_out;
}