Hi,

On Tue, May 6, 2025 at 5:51 AM Roxana Nicolescu
<nicolescu.rox...@protonmail.com> wrote:
>
> The kgdboc uses a "fake" platform device to handle tty drivers showing
> up late. In case the tty device is not detected during probe, it will
> return EPROBE_DEFER which means the probe will be called later when the
> tty device might be there. Before this, the kgdboc driver
> would be initialized early in the process (useful for early boot
> debugging) but then the tty device wouldn't be there, and retry wouldn't be
> done later. For a better explanation, see commit
> '68e55f61c138: ("kgdboc: Use a platform device to handle tty drivers
> showing up late")'.
>
> This replaces the platform_device usage with faux_device which was
> introduced recently for scenarios like this, where there is not real
> platform device needed. Moreover, it makes the code cleaner than before.
>
> Signed-off-by: Roxana Nicolescu <nicolescu.rox...@protonmail.com>
> ---
>  drivers/tty/serial/kgdboc.c | 50 +++++++++++--------------------------
>  1 file changed, 14 insertions(+), 36 deletions(-)
>
> diff --git a/drivers/tty/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c
> index 85f6c5a76e0f..d1ffe6186685 100644
> --- a/drivers/tty/serial/kgdboc.c
> +++ b/drivers/tty/serial/kgdboc.c
> @@ -21,7 +21,7 @@
>  #include <linux/input.h>
>  #include <linux/irq_work.h>
>  #include <linux/module.h>
> -#include <linux/platform_device.h>
> +#include <linux/device/faux.h>
>  #include <linux/serial_core.h>
>
>  #define MAX_CONFIG_LEN         40
> @@ -42,7 +42,7 @@ static int kgdboc_use_kms;  /* 1 if we use kernel mode 
> switching */
>  static struct tty_driver       *kgdb_tty_driver;
>  static int                     kgdb_tty_line;
>
> -static struct platform_device *kgdboc_pdev;
> +static struct faux_device *kgdboc_fdev;
>
>  #if IS_BUILTIN(CONFIG_KGDB_SERIAL_CONSOLE)
>  static struct kgdb_io          kgdboc_earlycon_io_ops;
> @@ -259,7 +259,7 @@ static int configure_kgdboc(void)
>         return err;
>  }
>
> -static int kgdboc_probe(struct platform_device *pdev)
> +static int kgdboc_probe(struct faux_device *fdev)
>  {
>         int ret = 0;
>
> @@ -276,47 +276,26 @@ static int kgdboc_probe(struct platform_device *pdev)
>         return ret;
>  }
>
> -static struct platform_driver kgdboc_platform_driver = {
> +struct faux_device_ops kgdboc_driver = {

nit: s/kgdboc_driver/kgdboc_faux_ops/ ?

Other than that, this seems reasonable to me. I guess I'd assume that
Greg would chime in at some point since patch #1 in this series would
need to go through him.

-Doug


_______________________________________________
Kgdb-bugreport mailing list
Kgdb-bugreport@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

Reply via email to