From: Vinod Koul <vkoul@kernel.org>
To: srinivas.kandagatla@oss.qualcomm.com
Cc: broonie@kernel.org, yung-chuan.liao@linux.intel.com,
pierre-louis.bossart@linux.dev, lgirdwood@gmail.com,
perex@perex.cz, tiwai@suse.com, krzysztof.kozlowski@linaro.org,
linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org,
linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH 1/4] soundwire: bus: add of_sdw_find_device_by_node helper
Date: Fri, 27 Jun 2025 10:46:58 -0700 [thread overview]
Message-ID: <aF7ZEi9qQxshnWed@vaman> (raw)
In-Reply-To: <20250627155103.441547-2-srinivas.kandagatla@oss.qualcomm.com>
On 27-06-25, 16:51, srinivas.kandagatla@oss.qualcomm.com wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
>
> There has been more than 3 instances of this helper in multiple codec
> drivers, it does not make sense to keep duplicating this part of code.
>
> Lets add a helper of_sdw_find_device_by_node for codec drivers to use it.
>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
> ---
> drivers/soundwire/slave.c | 6 ++++++
> include/linux/soundwire/sdw.h | 9 +++++++++
> 2 files changed, 15 insertions(+)
>
> diff --git a/drivers/soundwire/slave.c b/drivers/soundwire/slave.c
> index d2d99555ec5a..3d4d00188c26 100644
> --- a/drivers/soundwire/slave.c
> +++ b/drivers/soundwire/slave.c
> @@ -273,4 +273,10 @@ int sdw_of_find_slaves(struct sdw_bus *bus)
> return 0;
> }
>
> +struct device *of_sdw_find_device_by_node(struct device_node *np)
> +{
> + return bus_find_device_by_of_node(&sdw_bus_type, np);
> +}
> +EXPORT_SYMBOL_GPL(of_sdw_find_device_by_node);
Helper for single code lines?? why!
> +
> MODULE_IMPORT_NS("SND_SOC_SDCA");
> diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h
> index 2362f621d94c..84d1a101b155 100644
> --- a/include/linux/soundwire/sdw.h
> +++ b/include/linux/soundwire/sdw.h
> @@ -18,6 +18,7 @@
>
> struct dentry;
> struct fwnode_handle;
> +struct device_node;
>
> struct sdw_bus;
> struct sdw_slave;
> @@ -1080,6 +1081,8 @@ int sdw_stream_add_slave(struct sdw_slave *slave,
> int sdw_stream_remove_slave(struct sdw_slave *slave,
> struct sdw_stream_runtime *stream);
>
> +struct device *of_sdw_find_device_by_node(struct device_node *np);
> +
> int sdw_slave_get_scale_index(struct sdw_slave *slave, u8 *base);
>
> /* messaging and data APIs */
> @@ -1113,6 +1116,12 @@ static inline int sdw_stream_remove_slave(struct sdw_slave *slave,
> return -EINVAL;
> }
>
> +static inline struct device *of_sdw_find_device_by_node(struct device_node *np)
> +{
> + WARN_ONCE(1, "SoundWire API is disabled");
> + return NULL;
> +}
> +
> /* messaging and data APIs */
> static inline int sdw_read(struct sdw_slave *slave, u32 addr)
> {
> --
> 2.49.0
--
~Vinod
next prev parent reply other threads:[~2025-06-27 17:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-27 15:50 [PATCH 0/4] ASoC: codecs: wcd937x/8x/9x: cleanup srinivas.kandagatla
2025-06-27 15:51 ` [PATCH 1/4] soundwire: bus: add of_sdw_find_device_by_node helper srinivas.kandagatla
2025-06-27 16:29 ` Konrad Dybcio
2025-06-27 17:46 ` Vinod Koul [this message]
2025-06-28 20:29 ` Srinivas Kandagatla
2025-06-28 2:02 ` Dmitry Baryshkov
2025-06-27 15:51 ` [PATCH 2/4] soundwire: bus: add sdw_slave_get_current_bank helper srinivas.kandagatla
2025-06-27 15:54 ` Konrad Dybcio
2025-06-27 16:20 ` Srinivas Kandagatla
2025-06-27 15:51 ` [PATCH 3/4] ASoC: codecs: wcdxxxx: use of_sdw_find_device_by_node helper srinivas.kandagatla
2025-06-28 2:01 ` Dmitry Baryshkov
2025-06-27 15:51 ` [PATCH 4/4] ASoC: codecs: wcdxxxx: use sdw_slave_get_current_bank helper srinivas.kandagatla
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=aF7ZEi9qQxshnWed@vaman \
--to=vkoul@kernel.org \
--cc=broonie@kernel.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=pierre-louis.bossart@linux.dev \
--cc=srinivas.kandagatla@oss.qualcomm.com \
--cc=tiwai@suse.com \
--cc=yung-chuan.liao@linux.intel.com \
/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®