From: Tony Lindgren <tony@atomide.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Andy Shevchenko" <andy@kernel.org>,
platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH 2/4] platform/x86: Add new get_serdev_controller() helper
Date: Thu, 29 Feb 2024 08:12:32 +0200 [thread overview]
Message-ID: <20240229061232.GA5299@atomide.com> (raw)
In-Reply-To: <20240216201721.239791-3-hdegoede@redhat.com>
* Hans de Goede <hdegoede@redhat.com> [240216 20:17]:
> +static inline struct device *
> +get_serdev_controller(const char *serial_ctrl_hid,
> + const char *serial_ctrl_uid,
> + int serial_ctrl_port,
> + const char *serdev_ctrl_name)
> +{
> + struct device *ctrl_dev, *child;
> + struct acpi_device *ctrl_adev;
> + char name[32];
> + int i;
> +
> + ctrl_adev = acpi_dev_get_first_match_dev(serial_ctrl_hid, serial_ctrl_uid, -1);
> + if (!ctrl_adev) {
> + pr_err("error could not get %s/%s serial-ctrl adev\n",
> + serial_ctrl_hid, serial_ctrl_uid);
> + return ERR_PTR(-ENODEV);
> + }
Maybe split get_serdev_controller() into two functions, an acpi specific
function, and a serdev specific function? And I also think these should
not be in the header file, maybe splitting will also help with that :)
> + /* get_first_physical_node() returns a weak ref */
> + ctrl_dev = get_device(acpi_get_first_physical_node(ctrl_adev));
> + if (!ctrl_dev) {
> + pr_err("error could not get %s/%s serial-ctrl physical node\n",
> + serial_ctrl_hid, serial_ctrl_uid);
> + ctrl_dev = ERR_PTR(-ENODEV);
> + goto put_ctrl_adev;
> + }
> +
> + /* Walk host -> uart-ctrl -> port -> serdev-ctrl */
> + for (i = 0; i < 3; i++) {
> + switch (i) {
> + case 0:
> + snprintf(name, sizeof(name), "%s:0", dev_name(ctrl_dev));
Note that in theory it's possible we will encounter a device that has
multiple serial core controller instances as noted by Jiri earlier.
And each controller may have one or more ports. For the multiport test
case, you can use qemu with options like below FYI:
-chardev null,id=s1 -chardev null,id=s2 \
-device pci-serial-2x,chardev1=s1,chardev2=s2
Regards,
Tony
next prev parent reply other threads:[~2024-02-29 6:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-16 20:17 [PATCH 0/4] platform/x86: x86-android-tablets: 2 regression fixes Hans de Goede
2024-02-16 20:17 ` [PATCH 1/4] platform/x86: x86-android-tablets: Fix keyboard touchscreen on Lenovo Yogabook1 X90 Hans de Goede
2024-02-16 20:17 ` [PATCH 2/4] platform/x86: Add new get_serdev_controller() helper Hans de Goede
2024-02-16 21:24 ` Andy Shevchenko
2024-02-16 22:36 ` Hans de Goede
2024-02-17 18:09 ` Andy Shevchenko
2024-02-18 13:25 ` Hans de Goede
2024-02-29 6:12 ` Tony Lindgren [this message]
2024-02-16 20:17 ` [PATCH 3/4] platform/x86: x86-android-tablets: Fix serdev instantiation no longer working Hans de Goede
2024-02-16 21:26 ` Andy Shevchenko
2024-02-16 20:17 ` [PATCH 4/4] platform/x86: x86-android-tablets: Fix acer_b1_750_goodix_gpios name Hans de Goede
2024-02-19 12:53 ` [PATCH 0/4] platform/x86: x86-android-tablets: 2 regression fixes Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240229061232.GA5299@atomide.com \
--to=tony@atomide.com \
--cc=andy@kernel.org \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.