Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fbdev: wmt_ge_rops: use devm_platform_ioremap_resource()

Replace the open-coded platform_get_resource() + ioremap() pair with
devm_platform_ioremap_resource(), which requests the memory region and
maps it in a single call, with automatic cleanup on device removal.

Also reset regbase to NULL in remove() so that the single-instance
guard in probe() works correctly if the device is re-probed.

Signed-off-by: Amin GATTOUT <amin.gattout@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>

authored by

Amin GATTOUT and committed by
Helge Deller
f630c79a 8d10dd89

+4 -14
+4 -14
drivers/video/fbdev/wmt_ge_rops.c
··· 148 148 149 149 static int wmt_ge_rops_probe(struct platform_device *pdev) 150 150 { 151 - struct resource *res; 152 - 153 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 154 - if (res == NULL) { 155 - dev_err(&pdev->dev, "no I/O memory resource defined\n"); 156 - return -ENODEV; 157 - } 158 - 159 151 /* Only one ROP engine is presently supported. */ 160 152 if (unlikely(regbase)) { 161 153 WARN_ON(1); 162 154 return -EBUSY; 163 155 } 164 156 165 - regbase = ioremap(res->start, resource_size(res)); 166 - if (regbase == NULL) { 167 - dev_err(&pdev->dev, "failed to map I/O memory\n"); 168 - return -EBUSY; 169 - } 157 + regbase = devm_platform_ioremap_resource(pdev, 0); 158 + if (IS_ERR(regbase)) 159 + return PTR_ERR(regbase); 170 160 171 161 writel(1, regbase + GE_ENABLE_OFF); 172 162 printk(KERN_INFO "Enabled support for WMT GE raster acceleration\n"); ··· 166 176 167 177 static void wmt_ge_rops_remove(struct platform_device *pdev) 168 178 { 169 - iounmap(regbase); 179 + regbase = NULL; 170 180 } 171 181 172 182 static const struct of_device_id wmt_dt_ids[] = {