Skip to content

Commit 3022f4d

Browse files
committed
Merge branch 'acpi-platform' into acpi-lpss
2 parents ed3a872 + 8ce62f8 commit 3022f4d

File tree

3 files changed

+30
-19
lines changed

3 files changed

+30
-19
lines changed

drivers/acpi/acpi_lpss.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,12 +305,14 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
305305
struct lpss_private_data *pdata;
306306
struct resource_list_entry *rentry;
307307
struct list_head resource_list;
308+
struct platform_device *pdev;
308309
int ret;
309310

310311
dev_desc = (struct lpss_device_desc *)id->driver_data;
311-
if (!dev_desc)
312-
return acpi_create_platform_device(adev, id);
313-
312+
if (!dev_desc) {
313+
pdev = acpi_create_platform_device(adev);
314+
return IS_ERR_OR_NULL(pdev) ? PTR_ERR(pdev) : 1;
315+
}
314316
pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
315317
if (!pdata)
316318
return -ENOMEM;
@@ -360,10 +362,13 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
360362
dev_desc->setup(pdata);
361363

362364
adev->driver_data = pdata;
363-
ret = acpi_create_platform_device(adev, id);
364-
if (ret > 0)
365-
return ret;
365+
pdev = acpi_create_platform_device(adev);
366+
if (!IS_ERR_OR_NULL(pdev)) {
367+
device_enable_async_suspend(&pdev->dev);
368+
return 1;
369+
}
366370

371+
ret = PTR_ERR(pdev);
367372
adev->driver_data = NULL;
368373

369374
err_out:

drivers/acpi/acpi_platform.c

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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

129136
static 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

134141
void __init acpi_platform_init(void)

drivers/acpi/internal.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,7 @@ static inline void suspend_nvs_restore(void) {}
180180
-------------------------------------------------------------------------- */
181181
struct platform_device;
182182

183-
int acpi_create_platform_device(struct acpi_device *adev,
184-
const struct acpi_device_id *id);
183+
struct platform_device *acpi_create_platform_device(struct acpi_device *adev);
185184

186185
/*--------------------------------------------------------------------------
187186
Video

0 commit comments

Comments
 (0)