mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Probst <markus.probst@posteo.de>
To: ChunAn Wu <an.wu@canonical.com>,
	linux-serial@vger.kernel.org,
	 platform-driver-x86@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
	 jirislaby@kernel.org, hansg@kernel.org,
	ilpo.jarvinen@linux.intel.com,  mpearson-lenovo@squebb.ca,
	derekjohn.clark@gmail.com
Subject: Re: [PATCH v5 3/3] platform/x86: lenovo-yoga-tab2-pro-1380-fastcharger: Bind through normal serdev matching
Date: Sat, 24 Oct 2026 13:11:56 +0000	[thread overview]
Message-ID: <3cb4f43b2fc95c348f0646edce338064ec7add69.camel@posteo.de> (raw)
In-Reply-To: <5e70a181599ada304c6aa6589cc61662f1a8d710.1792831564.git.an.wu@canonical.com>

[-- Attachment #1: Type: text/plain, Size: 3433 bytes --]

On Sat, 2026-10-24 at 20:04 +0800, ChunAn Wu wrote:
> The software-node-backed serdev client cannot be matched through ACPI or
> device tree and is force-attached to its driver.
> 
> Pass the modalias to serdev_device_add() and give the serdev driver a
> matching id_table, so that the serdev core binds the two through normal
> matching. Deferred probing is then handled by the driver core, so the
> -EAGAIN translation is no longer needed.
> 
> A failing serdev probe no longer propagates out of the platform probe;
> as for any other bus, the client is simply left unbound.
> 
> Signed-off-by: ChunAn Wu <an.wu@canonical.com>
> ---
>  .../lenovo/yoga-tab2-pro-1380-fastcharger.c   | 25 +++++++------------
>  1 file changed, 9 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c b/drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c
> index 8551ab4d2c7d..d0bd9d4e3137 100644
> --- a/drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c
> +++ b/drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c
> @@ -219,11 +219,17 @@ static int yt2_1380_fc_serdev_probe(struct serdev_device *serdev)
>  	return 0;
>  }
>  
> +static const struct serdev_device_id yt2_1380_fc_serdev_id[] = {
> +	{ KBUILD_MODNAME },
> +	{ }
> +};
> +
>  static struct serdev_device_driver yt2_1380_fc_serdev_driver = {
>  	.probe = yt2_1380_fc_serdev_probe,
>  	.driver = {
>  		.name = KBUILD_MODNAME,
>  	},
> +	.id_table = yt2_1380_fc_serdev_id,
>  };
>  
>  static const struct pinctrl_map yt2_1380_fc_pinctrl_map[] = {
> @@ -260,25 +266,12 @@ static int yt2_1380_fc_pdev_probe(struct platform_device *pdev)
>  	/* The fwnode is a managed node, so it will be auto-put on serdev_device_put() */
>  	fwnode_handle_get(dev_fwnode(&serdev->dev));
>  
> -	ret = serdev_device_add(serdev);
> +	ret = serdev_device_add(serdev, KBUILD_MODNAME);
>  	if (ret) {
>  		serdev_device_put(serdev);
>  		return dev_err_probe(&pdev->dev, ret, "adding serdev\n");
>  	}
>  
> -	/*
> -	 * serdev device <-> driver matching relies on OF or ACPI matches and
> -	 * neither is available here, manually bind the driver.
> -	 */
> -	ret = device_driver_attach(&yt2_1380_fc_serdev_driver.driver, &serdev->dev);
> -	if (ret) {
> -		/* device_driver_attach() maps EPROBE_DEFER to EAGAIN, map it back */
> -		serdev_device_remove(serdev);
> -		return dev_err_probe(&pdev->dev,
> -				     (ret == -EAGAIN) ? -EPROBE_DEFER : ret,
> -				     "attaching serdev driver\n");
> -	}
> -
>  	/* So that yt2_1380_fc_pdev_remove() can remove the serdev */
>  	platform_set_drvdata(pdev, serdev);
>  	return 0;
> @@ -305,8 +298,8 @@ static int __init yt2_1380_fc_module_init(void)
>  	int ret;
>  
>  	/*
> -	 * serdev driver MUST be registered first because pdev driver calls
> -	 * device_driver_attach() on the serdev, serdev-driver pair.
> +	 * serdev driver MUST be registered first so that the serdev device
> +	 * created by the pdev probe binds to it via the id_table match.
>  	 */
NIT: I think the order doesn't matter anymore, since it will bind
regardless whether driver or device is registered/added first. I think
you can remove the comment.

Reviewed-by: Markus Probst <markus.probst@posteo.de>

Thanks
- Markus Probst



>  	ret = serdev_device_driver_register(&yt2_1380_fc_serdev_driver);
>  	if (ret)



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 870 bytes --]

      reply	other threads:[~2026-10-24 13:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-24 12:04 [PATCH v5 0/3] serdev: handle devices without an ACPI or device tree node ChunAn Wu
2026-10-24 12:04 ` [PATCH v5 1/3] " ChunAn Wu
2026-10-24 12:58   ` Markus Probst
2026-10-24 13:03     ` An Wu
2026-10-24 12:04 ` [PATCH v5 2/3] platform/x86: dell-uart-backlight: Bind through normal serdev matching ChunAn Wu
2026-10-24 13:03   ` Markus Probst
2026-10-24 12:04 ` [PATCH v5 3/3] platform/x86: lenovo-yoga-tab2-pro-1380-fastcharger: " ChunAn Wu
2026-10-24 13:11   ` Markus Probst [this message]

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=3cb4f43b2fc95c348f0646edce338064ec7add69.camel@posteo.de \
    --to=markus.probst@posteo.de \
    --cc=an.wu@canonical.com \
    --cc=derekjohn.clark@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mpearson-lenovo@squebb.ca \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®