提交 01f7ab34 编写于 作者: R Ralf Baechle

MIPS: SEAD3: Collect LED platform device registration in a single file.

Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
Cc: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: Bryan Wu <cooloney@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: linux-leds@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/8203/
上级 8a5f1efb
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
#define DRVNAME "sead3-led" #define DRVNAME "sead3-led"
static struct platform_device *pdev;
static void sead3_pled_set(struct led_classdev *led_cdev, static void sead3_pled_set(struct led_classdev *led_cdev,
enum led_brightness value) enum led_brightness value)
{ {
...@@ -75,26 +73,11 @@ static struct platform_driver sead3_led_driver = { ...@@ -75,26 +73,11 @@ static struct platform_driver sead3_led_driver = {
static int __init sead3_led_init(void) static int __init sead3_led_init(void)
{ {
int ret; return platform_driver_register(&sead3_led_driver);
ret = platform_driver_register(&sead3_led_driver);
if (ret < 0)
goto out;
pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0);
if (IS_ERR(pdev)) {
ret = PTR_ERR(pdev);
platform_driver_unregister(&sead3_led_driver);
goto out;
}
out:
return ret;
} }
static void __exit sead3_led_exit(void) static void __exit sead3_led_exit(void)
{ {
platform_device_unregister(pdev);
platform_driver_unregister(&sead3_led_driver); platform_driver_unregister(&sead3_led_driver);
} }
......
...@@ -70,10 +70,20 @@ static struct platform_device fled_device = { ...@@ -70,10 +70,20 @@ static struct platform_device fled_device = {
.resource = fled_resources .resource = fled_resources
}; };
static int __init led_init(void) static struct platform_device sead3_led_device = {
.name = "sead3-led",
.id = -1,
};
struct platform_device *sead3_led_devices[] = {
&pled_device,
&fled_device,
&sead3_led_device,
};
static int __init sead3_led_init(void)
{ {
platform_device_register(&pled_device); return platform_add_devices(sead3_led_devices, ARRAY_SIZE(sead3_led_devices));
return platform_device_register(&fled_device);
} }
device_initcall(led_init); device_initcall(sead3_led_init);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册