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

leds: leds-fsg: use devm_ioremap

The devm_ functions allocate memory that is released when a driver
detaches. This patch uses devm_ioremap() for these functions.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>

authored by

Jingoo Han and committed by
Bryan Wu
aa2dcf9d b0053aaa

+5 -10
+5 -10
drivers/leds/leds-fsg.c
··· 20 20 #include <linux/platform_device.h> 21 21 #include <linux/leds.h> 22 22 #include <linux/module.h> 23 + #include <linux/io.h> 23 24 #include <mach/hardware.h> 24 - #include <asm/io.h> 25 25 26 26 #define FSG_LED_WLAN_BIT 0 27 27 #define FSG_LED_WAN_BIT 1 ··· 149 149 int ret; 150 150 151 151 /* Map the LED chip select address space */ 152 - latch_address = (unsigned short *) ioremap(IXP4XX_EXP_BUS_BASE(2), 512); 153 - if (!latch_address) { 154 - ret = -ENOMEM; 155 - goto failremap; 156 - } 152 + latch_address = (unsigned short *) devm_ioremap(&pdev->dev, 153 + IXP4XX_EXP_BUS_BASE(2), 512); 154 + if (!latch_address) 155 + return -ENOMEM; 157 156 158 157 latch_value = 0xffff; 159 158 *latch_address = latch_value; ··· 194 195 failwan: 195 196 led_classdev_unregister(&fsg_wlan_led); 196 197 failwlan: 197 - iounmap(latch_address); 198 - failremap: 199 198 200 199 return ret; 201 200 } ··· 206 209 led_classdev_unregister(&fsg_usb_led); 207 210 led_classdev_unregister(&fsg_sync_led); 208 211 led_classdev_unregister(&fsg_ring_led); 209 - 210 - iounmap(latch_address); 211 212 212 213 return 0; 213 214 }