Skip to content

Commit 812a79b

Browse files
committed
platform/x86: x86-android-tablets: Fix serdev instantiation no longer working
After commit b286f4e ("serial: core: Move tty and serdev to be children of serial core port device") x86_instantiate_serdev() no longer works due to the serdev-controller-device moving in the device hierarchy from (e.g.) /sys/devices/pci0000:00/8086228A:00/serial0 to /sys/devices/pci0000:00/8086228A:00/8086228A:00:0/8086228A:00:0.0/serial0 Use the new get_serdev_controller() helper function to fix this. Fixes: b286f4e ("serial: core: Move tty and serdev to be children of serial core port device") Cc: Tony Lindgren <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent dc5afd7 commit 812a79b

File tree

1 file changed

+9
-26
lines changed
  • drivers/platform/x86/x86-android-tablets

1 file changed

+9
-26
lines changed

drivers/platform/x86/x86-android-tablets/core.c

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <linux/string.h>
2222

2323
#include "x86-android-tablets.h"
24+
#include "../serdev_helpers.h"
2425

2526
static struct platform_device *x86_android_tablet_device;
2627

@@ -232,38 +233,20 @@ static __init int x86_instantiate_spi_dev(const struct x86_dev_info *dev_info, i
232233

233234
static __init int x86_instantiate_serdev(const struct x86_serdev_info *info, int idx)
234235
{
235-
struct acpi_device *ctrl_adev, *serdev_adev;
236+
struct acpi_device *serdev_adev;
236237
struct serdev_device *serdev;
237238
struct device *ctrl_dev;
238239
int ret = -ENODEV;
239240

240-
ctrl_adev = acpi_dev_get_first_match_dev(info->ctrl_hid, info->ctrl_uid, -1);
241-
if (!ctrl_adev) {
242-
pr_err("error could not get %s/%s ctrl adev\n",
243-
info->ctrl_hid, info->ctrl_uid);
244-
return -ENODEV;
245-
}
241+
ctrl_dev = get_serdev_controller(info->ctrl_hid, info->ctrl_uid, 0,
242+
info->ctrl_devname);
243+
if (IS_ERR(ctrl_dev))
244+
return PTR_ERR(ctrl_dev);
246245

247246
serdev_adev = acpi_dev_get_first_match_dev(info->serdev_hid, NULL, -1);
248247
if (!serdev_adev) {
249248
pr_err("error could not get %s serdev adev\n", info->serdev_hid);
250-
goto put_ctrl_adev;
251-
}
252-
253-
/* get_first_physical_node() returns a weak ref, no need to put() it */
254-
ctrl_dev = acpi_get_first_physical_node(ctrl_adev);
255-
if (!ctrl_dev) {
256-
pr_err("error could not get %s/%s ctrl physical dev\n",
257-
info->ctrl_hid, info->ctrl_uid);
258-
goto put_serdev_adev;
259-
}
260-
261-
/* ctrl_dev now points to the controller's parent, get the controller */
262-
ctrl_dev = device_find_child_by_name(ctrl_dev, info->ctrl_devname);
263-
if (!ctrl_dev) {
264-
pr_err("error could not get %s/%s %s ctrl dev\n",
265-
info->ctrl_hid, info->ctrl_uid, info->ctrl_devname);
266-
goto put_serdev_adev;
249+
goto put_ctrl_dev;
267250
}
268251

269252
serdev = serdev_device_alloc(to_serdev_controller(ctrl_dev));
@@ -286,8 +269,8 @@ static __init int x86_instantiate_serdev(const struct x86_serdev_info *info, int
286269

287270
put_serdev_adev:
288271
acpi_dev_put(serdev_adev);
289-
put_ctrl_adev:
290-
acpi_dev_put(ctrl_adev);
272+
put_ctrl_dev:
273+
put_device(ctrl_dev);
291274
return ret;
292275
}
293276

0 commit comments

Comments
 (0)