Commit 7a72f33b authored by Yangtao Li's avatar Yangtao Li Committed by Lee Jones

leds: ip30: Convert to devm_platform_ioremap_resource()

Use devm_platform_ioremap_resource() to simplify code.
Signed-off-by: default avatarYangtao Li <frank.li@vivo.com>
Link: https://lore.kernel.org/r/20230704094745.25665-1-frank.li@vivo.comSigned-off-by: default avatarLee Jones <lee@kernel.org>
parent 07a476e0
......@@ -27,22 +27,16 @@ static void ip30led_set(struct led_classdev *led_cdev,
static int ip30led_create(struct platform_device *pdev, int num)
{
struct resource *res;
struct ip30_led *data;
res = platform_get_resource(pdev, IORESOURCE_MEM, num);
if (!res)
return -EBUSY;
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;
data->reg = devm_ioremap_resource(&pdev->dev, res);
data->reg = devm_platform_ioremap_resource(pdev, num);
if (IS_ERR(data->reg))
return PTR_ERR(data->reg);
switch (num) {
case IP30_LED_SYSTEM:
data->cdev.name = "white:power";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment