@@ -32,6 +32,10 @@ static const struct acpi_device_id acpi_platform_device_ids[] = {
3232 { "ACPI0003" },
3333 { "VPC2004" },
3434 { "BCM4752" },
35+ { "LNV4752" },
36+ { "BCM2E1A" },
37+ { "BCM2E39" },
38+ { "BCM2E3D" },
3539
3640 /* Intel Smart Sound Technology */
3741 { "INT33C8" },
@@ -43,16 +47,14 @@ static const struct acpi_device_id acpi_platform_device_ids[] = {
4347/**
4448 * acpi_create_platform_device - Create platform device for ACPI device node
4549 * @adev: ACPI device node to create a platform device for.
46- * @id: ACPI device ID used to match @adev.
4750 *
4851 * Check if the given @adev can be represented as a platform device and, if
4952 * that's the case, create and register a platform device, populate its common
5053 * resources and returns a pointer to it. Otherwise, return %NULL.
5154 *
5255 * Name of the platform device will be the same as @adev's.
5356 */
54- int acpi_create_platform_device (struct acpi_device * adev ,
55- const struct acpi_device_id * id )
57+ struct platform_device * acpi_create_platform_device (struct acpi_device * adev )
5658{
5759 struct platform_device * pdev = NULL ;
5860 struct acpi_device * acpi_parent ;
@@ -64,19 +66,19 @@ int acpi_create_platform_device(struct acpi_device *adev,
6466
6567 /* If the ACPI node already has a physical device attached, skip it. */
6668 if (adev -> physical_node_count )
67- return 0 ;
69+ return NULL ;
6870
6971 INIT_LIST_HEAD (& resource_list );
7072 count = acpi_dev_get_resources (adev , & resource_list , NULL , NULL );
7173 if (count < 0 ) {
72- return 0 ;
74+ return NULL ;
7375 } else if (count > 0 ) {
7476 resources = kmalloc (count * sizeof (struct resource ),
7577 GFP_KERNEL );
7678 if (!resources ) {
7779 dev_err (& adev -> dev , "No memory for resources\n" );
7880 acpi_dev_free_resource_list (& resource_list );
79- return - ENOMEM ;
81+ return ERR_PTR ( - ENOMEM ) ;
8082 }
8183 count = 0 ;
8284 list_for_each_entry (rentry , & resource_list , node )
@@ -113,22 +115,27 @@ int acpi_create_platform_device(struct acpi_device *adev,
113115 pdevinfo .num_res = count ;
114116 pdevinfo .acpi_node .companion = adev ;
115117 pdev = platform_device_register_full (& pdevinfo );
116- if (IS_ERR (pdev )) {
118+ if (IS_ERR (pdev ))
117119 dev_err (& adev -> dev , "platform device creation failed: %ld\n" ,
118120 PTR_ERR (pdev ));
119- pdev = NULL ;
120- } else {
121+ else
121122 dev_dbg (& adev -> dev , "created platform device %s\n" ,
122123 dev_name (& pdev -> dev ));
123- }
124124
125125 kfree (resources );
126+ return pdev ;
127+ }
128+
129+ static int acpi_platform_attach (struct acpi_device * adev ,
130+ const struct acpi_device_id * id )
131+ {
132+ acpi_create_platform_device (adev );
126133 return 1 ;
127134}
128135
129136static struct acpi_scan_handler platform_handler = {
130137 .ids = acpi_platform_device_ids ,
131- .attach = acpi_create_platform_device ,
138+ .attach = acpi_platform_attach ,
132139};
133140
134141void __init acpi_platform_init (void )
0 commit comments