From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF49F2D8371; Wed, 14 Jan 2026 14:01:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768399319; cv=none; b=XQiOvRnxHTqWGontaEdcXhPAfLJ/mnWZBkE6Yydz3EhmCDEOxV4VqudEDm4VMxUt1EG3QfQyUSm1gmivjb805041wQCV+/Xc7NVmU4ueyi8kFqD4Jl6JsPClIpyrhjXdXXMnGDyHFBAon/NHbSaQlKUso5hUmrFWzHlXRIHReXE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768399319; c=relaxed/simple; bh=YThRr+SqFQrj1xWYbkZyAQfpTQhSxOJrEz7Vmu8eYO0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=D9vQBa5OfCgazENkjB0mwTCmeN0N5uI2g4mu9qPFtlpNLEV6HFB75GGCyg/5BUd6MTRQ5LDeH9DJJ3Y6e3u1euYS/J+ItnsGT/UDxC8TUUInzeIA7jD5i8GjoE8c91cpVvlT0eEWvV9vB3tg5VQTFyqwg1y054cJ75T+RaoG//8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GamcmtOM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GamcmtOM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62176C19423; Wed, 14 Jan 2026 14:01:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768399318; bh=YThRr+SqFQrj1xWYbkZyAQfpTQhSxOJrEz7Vmu8eYO0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=GamcmtOMZjUjnBtKP0uhc41XsMqZ5fSe9+uXZ30TVeZpZSpRIIMXLIZ6LSMmqmxZJ NMpWBOrVCw5ay9J9pII8Hg/QzzTF8slSB/w2unqe4TNoWuGWzngFiEoJoUAvAmqFB5 Iwga7pBiI5Zhqw1J+tOTc30FaWvGC89yLrq+JlbFxL2kl2s3LxRjEpWvdFoSPyfKHh jTw7x+USzU8jCMBBzyudL54Ry+Ze3oj0BmfkDgneM6dbU0fXZXjVgZ4iNhOuJykciN khzGT4OdT3Wu+wQV1jAF14IH2be73WBLizVZPZCNbT/eImzvDLUXbcLvK5UdivHV/a mq/qzYKU6Fp5w== Message-ID: <2a44e967-ebae-4641-88d7-ccb4536ee3b7@kernel.org> Date: Wed, 14 Jan 2026 15:01:51 +0100 Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 2/9] serdev: Add an API to find the serdev controller associated with the devicetree node To: manivannan.sadhasivam@oss.qualcomm.com, Rob Herring , Greg Kroah-Hartman , Jiri Slaby , Nathan Chancellor , Nicolas Schier , =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , Mark Pearson , "Derek J. Clark" , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley , Marcel Holtmann , Luiz Augusto von Dentz , Bartosz Golaszewski , Andy Shevchenko , Bartosz Golaszewski 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 , Dmitry Baryshkov , linux-acpi@vger.kernel.org References: <20260112-pci-m2-e-v4-0-eff84d2c6d26@oss.qualcomm.com> <20260112-pci-m2-e-v4-2-eff84d2c6d26@oss.qualcomm.com> From: Hans de Goede Content-Language: en-US, nl In-Reply-To: <20260112-pci-m2-e-v4-2-eff84d2c6d26@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi Mani, Thank you for your work in this. On 12-Jan-26 17:26, Manivannan Sadhasivam via B4 Relay wrote: > From: Manivannan Sadhasivam > > Add of_find_serdev_controller_by_node() API to find the serdev controller > device associated with the devicetree node. > > Signed-off-by: Manivannan Sadhasivam > --- > 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