public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hansg@kernel.org>
To: manivannan.sadhasivam@oss.qualcomm.com,
	"Rob Herring" <robh@kernel.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Nicolas Schier" <nicolas.schier@linux.dev>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Mark Pearson" <mpearson-lenovo@squebb.ca>,
	"Derek J. Clark" <derekjohn.clark@gmail.com>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Marcel Holtmann" <marcel@holtmann.org>,
	"Luiz Augusto von Dentz" <luiz.dentz@gmail.com>,
	"Bartosz Golaszewski" <brgl@bgdev.pl>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Bartosz Golaszewski" <brgl@kernel.org>
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kbuild@vger.kernel.org,
	platform-driver-x86@vger.kernel.org, linux-pci@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-bluetooth@vger.kernel.org, linux-pm@vger.kernel.org,
	Stephan Gerhold <stephan.gerhold@linaro.org>,
	Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
	linux-acpi@vger.kernel.org
Subject: Re: [PATCH v4 2/9] serdev: Add an API to find the serdev controller associated with the devicetree node
Date: Wed, 14 Jan 2026 15:01:51 +0100	[thread overview]
Message-ID: <2a44e967-ebae-4641-88d7-ccb4536ee3b7@kernel.org> (raw)
In-Reply-To: <20260112-pci-m2-e-v4-2-eff84d2c6d26@oss.qualcomm.com>

Hi Mani,

Thank you for your work in this.

On 12-Jan-26 17:26, Manivannan Sadhasivam via B4 Relay wrote:
> From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
> 
> Add of_find_serdev_controller_by_node() API to find the serdev controller
> device associated with the devicetree node.
> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
> ---
>  drivers/tty/serdev/core.c | 16 ++++++++++++++++
>  include/linux/serdev.h    |  9 +++++++++
>  2 files changed, 25 insertions(+)
> 
> diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
> index b33e708cb245..25382c2d63e6 100644
> --- a/drivers/tty/serdev/core.c
> +++ b/drivers/tty/serdev/core.c
> @@ -504,6 +504,22 @@ struct serdev_controller *serdev_controller_alloc(struct device *host,
>  }
>  EXPORT_SYMBOL_GPL(serdev_controller_alloc);
>  
> +/**
> + * of_find_serdev_controller_by_node() - Find the serdev controller associated
> + *					 with the devicetree node
> + * @node:	Devicetree node
> + *
> + * Return: Pointer to the serdev controller associated with the node. NULL if
> + * the controller is not found.
> + */
> +struct serdev_controller *of_find_serdev_controller_by_node(struct device_node *node)
> +{
> +	struct device *dev = bus_find_device_by_of_node(&serdev_bus_type, node);
> +
> +	return (dev && dev->type == &serdev_ctrl_type) ? to_serdev_controller(dev) : NULL;
> +}
> +EXPORT_SYMBOL_GPL(of_find_serdev_controller_by_node);
> +

This new of_find_serdev_controller_by_node() function needs:

#ifdef CONFIG_OF ... #endif

around it, to match the stubbing you are doing in serdev.h

>  static int of_serdev_register_devices(struct serdev_controller *ctrl)
>  {
>  	struct device_node *node;
> diff --git a/include/linux/serdev.h b/include/linux/serdev.h
> index ecde0ad3e248..db9bfaba0662 100644
> --- a/include/linux/serdev.h
> +++ b/include/linux/serdev.h
> @@ -333,4 +333,13 @@ static inline bool serdev_acpi_get_uart_resource(struct acpi_resource *ares,
>  }
>  #endif /* CONFIG_ACPI */
>  
> +#ifdef CONFIG_OF
> +struct serdev_controller *of_find_serdev_controller_by_node(struct device_node *node);
> +#else
> +struct serdev_controller *of_find_serdev_controller_by_node(struct device_node *node)
> +{
> +	return NULL;
> +}

stubs like this one should be static inline to avoid warnings like this one:

In file included from drivers/tty/serdev/core.c:21:
./include/linux/serdev.h:339:27: warning: no previous prototype for ‘of_find_serdev_controller_by_node’ [-Wmissing-prototypes]
  339 | struct serdev_controller *of_find_serdev_controller_by_node(struct device_node *node)
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Regards,

Hans



  parent reply	other threads:[~2026-01-14 14:01 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-12 16:25 [PATCH v4 0/9] Add support for handling PCIe M.2 Key E connectors in devicetree Manivannan Sadhasivam via B4 Relay
2026-01-12 16:26 ` [PATCH v4 1/9] serdev: Convert to_serdev_*() helpers to macros and use container_of_const() Manivannan Sadhasivam via B4 Relay
2026-01-12 16:26 ` [PATCH v4 2/9] serdev: Add an API to find the serdev controller associated with the devicetree node Manivannan Sadhasivam via B4 Relay
2026-01-13 13:54   ` Bartosz Golaszewski
2026-01-14 15:57     ` Manivannan Sadhasivam
2026-01-14 14:01   ` Hans de Goede [this message]
2026-01-14 16:00     ` Manivannan Sadhasivam
2026-01-12 16:26 ` [PATCH v4 3/9] serdev: Do not return -ENODEV from of_serdev_register_devices() if external connector is used Manivannan Sadhasivam via B4 Relay
2026-01-12 19:23   ` Andy Shevchenko
2026-01-14 16:02     ` Manivannan Sadhasivam
2026-01-12 16:26 ` [PATCH v4 4/9] dt-bindings: serial: Document the graph port Manivannan Sadhasivam via B4 Relay
2026-01-13 13:55   ` Bartosz Golaszewski
2026-01-13 16:43   ` Rob Herring (Arm)
2026-01-12 16:26 ` [PATCH v4 5/9] dt-bindings: connector: Add PCIe M.2 Mechanical Key E connector Manivannan Sadhasivam via B4 Relay
2026-01-13 17:14   ` Rob Herring
2026-01-14 16:14     ` Manivannan Sadhasivam
2026-01-14 17:45       ` Rob Herring
2026-01-15 10:42         ` Manivannan Sadhasivam
2026-01-16 14:19           ` Rob Herring
2026-01-16 14:42             ` Manivannan Sadhasivam
2026-01-16 17:30               ` Rob Herring
2026-01-13 17:16   ` Rob Herring
2026-01-15 10:44     ` Manivannan Sadhasivam
2026-01-12 16:26 ` [PATCH v4 6/9] dt-bindings: connector: m2: Add M.2 1620 LGA soldered down connector Manivannan Sadhasivam via B4 Relay
2026-01-13 17:25   ` Rob Herring
2026-01-15 10:43     ` Manivannan Sadhasivam
2026-01-12 16:26 ` [PATCH v4 7/9] Bluetooth: hci_qca: Add M.2 Bluetooth device support using pwrseq Manivannan Sadhasivam via B4 Relay
2026-01-13 13:56   ` Bartosz Golaszewski
2026-01-12 16:26 ` [PATCH v4 8/9] power: sequencing: pcie-m2: Add support for PCIe M.2 Key E connectors Manivannan Sadhasivam via B4 Relay
2026-01-13 14:00   ` Bartosz Golaszewski
2026-01-13 15:26   ` Sean Anderson
2026-01-13 16:34     ` Manivannan Sadhasivam
2026-01-12 16:26 ` [PATCH v4 9/9] power: sequencing: pcie-m2: Create serdev device for WCN7850 bluetooth Manivannan Sadhasivam via B4 Relay
2026-01-12 16:43   ` [PATCH v3 03/14] software node: Implement device_get_match_data fwnode callback Manivannan Sadhasivam
2026-01-12 19:22   ` [PATCH v4 9/9] power: sequencing: pcie-m2: Create serdev device for WCN7850 bluetooth Andy Shevchenko
2026-01-13 14:11   ` Bartosz Golaszewski
2026-01-12 19:29 ` [PATCH v4 0/9] Add support for handling PCIe M.2 Key E connectors in devicetree Andy Shevchenko
2026-01-15 10:30 ` 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=2a44e967-ebae-4641-88d7-ccb4536ee3b7@kernel.org \
    --to=hansg@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=brgl@bgdev.pl \
    --cc=brgl@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=derekjohn.clark@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=mani@kernel.org \
    --cc=manivannan.sadhasivam@oss.qualcomm.com \
    --cc=marcel@holtmann.org \
    --cc=mpearson-lenovo@squebb.ca \
    --cc=nathan@kernel.org \
    --cc=nicolas.schier@linux.dev \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=stephan.gerhold@linaro.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