Commit aa2dcf9dc150d4d077d8fa4a19f6e05196e9b9a5

Authored by Jingoo Han
Committed by Bryan Wu
1 parent b0053aaa23

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>

Showing 1 changed file with 5 additions and 10 deletions Side-by-side Diff

drivers/leds/leds-fsg.c
... ... @@ -20,8 +20,8 @@
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,11 +149,10 @@
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;
... ... @@ -195,8 +194,6 @@
195 194 failwan:
196 195 led_classdev_unregister(&fsg_wlan_led);
197 196 failwlan:
198   - iounmap(latch_address);
199   - failremap:
200 197  
201 198 return ret;
202 199 }
... ... @@ -209,8 +206,6 @@
209 206 led_classdev_unregister(&fsg_usb_led);
210 207 led_classdev_unregister(&fsg_sync_led);
211 208 led_classdev_unregister(&fsg_ring_led);
212   -
213   - iounmap(latch_address);
214 209  
215 210 return 0;
216 211 }