Re: [PATCH RFC 1/4] serdev: Export internal is_serdev_device() for drivers
From: Danilo Krummrich
Date: Sun Dec 21 2025 - 12:40:43 EST
On Sat Dec 20, 2025 at 7:44 PM CET, Markus Probst wrote:
> diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
> index b33e708cb245..1f6bf8e826d8 100644
> --- a/drivers/tty/serdev/core.c
> +++ b/drivers/tty/serdev/core.c
> @@ -69,10 +69,11 @@ static const struct device_type serdev_device_type = {
> .release = serdev_device_release,
> };
>
> -static bool is_serdev_device(const struct device *dev)
> +bool is_serdev_device(const struct device *dev)
> {
> return dev->type == &serdev_device_type;
> }
> +EXPORT_SYMBOL_GPL(is_serdev_device);
>
> static void serdev_ctrl_release(struct device *dev)
> {
> diff --git a/include/linux/serdev.h b/include/linux/serdev.h
> index 34562eb99931..0043b6cc6d01 100644
> --- a/include/linux/serdev.h
> +++ b/include/linux/serdev.h
> @@ -116,6 +116,8 @@ static inline struct serdev_controller *to_serdev_controller(struct device *d)
> return container_of(d, struct serdev_controller, dev);
> }
>
> +bool is_serdev_device(const struct device *dev);
> +
> static inline void *serdev_device_get_drvdata(const struct serdev_device *serdev)
> {
> return dev_get_drvdata(&serdev->dev);
Besides what I mentioned in [1] (which should make the patch obsolete anyways),
I want to point out that such cases should be solved with a helper in
rust/helpers/ instead.
[1] https://lore.kernel.org/lkml/DF42RR0I52L3.1JET4R0KFDPPH@xxxxxxxxxx/