From: Jonathan Cameron <jic23@kernel.org>
To: Caleb Connolly <caleb.connolly@linaro.org>,
Lars-Peter Clausen <lars@metafoo.de>
Cc: Rob Herring <robh+dt@kernel.org>, Andy Gross <agross@kernel.org>,
Bjorn Andersson <bjorn.andersson@linaro.org>,
Lee Jones <lee.jones@linaro.org>, Stephen Boyd <sboyd@kernel.org>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-msm@vger.kernel.org, sumit.semwal@linaro.org,
amit.pundir@linaro.org, john.stultz@linaro.org
Subject: Re: [PATCH v8 1/9] spmi: add a helper to look up an SPMI device from a device node
Date: Sat, 26 Feb 2022 17:03:39 +0000 [thread overview]
Message-ID: <20220226170339.6a69a041@jic23-huawei> (raw)
In-Reply-To: <20220221220743.541704-2-caleb.connolly@linaro.org>
On Mon, 21 Feb 2022 22:07:35 +0000
Caleb Connolly <caleb.connolly@linaro.org> wrote:
> The helper function spmi_device_from_of() takes a device node and
> returns the SPMI device associated with it.
> This is like of_find_device_by_node but for SPMI devices.
>
> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Hi
I'm assuming this series will end up going in through my IIO tree.
So with that in mind, looking for an Ack from Stephen for this one.
One comment below.
Also, I vaguely wondered about whether this should switch to generic
struct fwnode rather than of/dt specific but that's probably
a question for Stephen.
Thanks,
Jonathan
> ---
> drivers/spmi/spmi.c | 17 +++++++++++++++++
> include/linux/spmi.h | 2 ++
> 2 files changed, 19 insertions(+)
>
> diff --git a/drivers/spmi/spmi.c b/drivers/spmi/spmi.c
> index b37ead9e2fad..de550b777451 100644
> --- a/drivers/spmi/spmi.c
> +++ b/drivers/spmi/spmi.c
> @@ -386,6 +386,23 @@ static struct bus_type spmi_bus_type = {
> .uevent = spmi_drv_uevent,
> };
>
> +/**
> + * spmi_device_from_of() - get the associated SPMI device from a device node
> + *
> + * @np: device node
> + *
> + * Returns the struct spmi_device associated with a device node or NULL.
> + */
> +inline struct spmi_device *spmi_device_from_of(struct device_node *np)
Drop the inline. You are exporting it which would make inline rather
hard to do and in general inline markings should be used only where there
is a clear performance argument and there isn't one here.
> +{
> + struct device *dev = bus_find_device_by_of_node(&spmi_bus_type, np);
> +
> + if (dev)
> + return to_spmi_device(dev);
> + return NULL;
> +}
> +EXPORT_SYMBOL_GPL(spmi_device_from_of);
> +
> /**
> * spmi_controller_alloc() - Allocate a new SPMI device
> * @ctrl: associated controller
> diff --git a/include/linux/spmi.h b/include/linux/spmi.h
> index 729bcbf9f5ad..6ee476bc1cd6 100644
> --- a/include/linux/spmi.h
> +++ b/include/linux/spmi.h
> @@ -7,6 +7,7 @@
> #include <linux/types.h>
> #include <linux/device.h>
> #include <linux/mod_devicetable.h>
> +#include <linux/of.h>
>
> /* Maximum slave identifier */
> #define SPMI_MAX_SLAVE_ID 16
> @@ -164,6 +165,7 @@ static inline void spmi_driver_unregister(struct spmi_driver *sdrv)
> module_driver(__spmi_driver, spmi_driver_register, \
> spmi_driver_unregister)
>
> +inline struct spmi_device *spmi_device_from_of(struct device_node *np);
> int spmi_register_read(struct spmi_device *sdev, u8 addr, u8 *buf);
> int spmi_ext_register_read(struct spmi_device *sdev, u8 addr, u8 *buf,
> size_t len);
next prev parent reply other threads:[~2022-02-26 16:56 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-21 22:07 [PATCH v8 0/9] iio: adc: introduce Qualcomm SPMI Round Robin ADC Caleb Connolly
2022-02-21 22:07 ` [PATCH v8 1/9] spmi: add a helper to look up an SPMI device from a device node Caleb Connolly
2022-02-26 17:03 ` Jonathan Cameron [this message]
2022-02-21 22:07 ` [PATCH v8 2/9] mfd: qcom-spmi-pmic: expose the PMIC revid information to clients Caleb Connolly
2022-02-24 20:43 ` Bjorn Andersson
2022-02-25 8:50 ` Lee Jones
2022-02-25 9:04 ` Dan Carpenter
2022-02-25 9:23 ` Lee Jones
2022-02-25 9:40 ` Dan Carpenter
2022-03-03 2:20 ` Caleb Connolly
2022-03-03 2:28 ` Philip Li
2022-03-03 9:05 ` Dan Carpenter
2022-03-03 9:52 ` Lee Jones
2022-02-25 22:32 ` Bjorn Andersson
2022-02-26 17:11 ` Jonathan Cameron
2022-02-26 18:09 ` Dmitry Baryshkov
2022-02-28 18:08 ` Caleb Connolly
2022-02-28 18:57 ` Dmitry Baryshkov
2022-02-21 22:07 ` [PATCH v8 3/9] mfd: qcom-spmi-pmic: read fab id on supported PMICs Caleb Connolly
2022-02-21 22:07 ` [PATCH v8 4/9] dt-bindings: iio: adc: document qcom-spmi-rradc Caleb Connolly
2022-02-21 22:07 ` [PATCH v8 5/9] iio: adc: qcom-spmi-rradc: introduce round robin adc Caleb Connolly
2022-02-26 17:35 ` Jonathan Cameron
2022-02-26 17:36 ` Jonathan Cameron
2022-02-21 22:07 ` [PATCH v8 6/9] arm64: dts: qcom: pmi8998: add rradc node Caleb Connolly
2022-02-21 22:07 ` [PATCH v8 7/9] arm64: dts: qcom: sdm845-oneplus: enable rradc Caleb Connolly
2022-02-21 22:07 ` [PATCH v8 8/9] arm64: dts: qcom: sdm845-db845c: " Caleb Connolly
2022-02-21 22:07 ` [PATCH v8 9/9] arm64: dts: qcom: sdm845-xiaomi-beryllium: " Caleb Connolly
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=20220226170339.6a69a041@jic23-huawei \
--to=jic23@kernel.org \
--cc=agross@kernel.org \
--cc=amit.pundir@linaro.org \
--cc=bjorn.andersson@linaro.org \
--cc=caleb.connolly@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=john.stultz@linaro.org \
--cc=lars@metafoo.de \
--cc=lee.jones@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=sboyd@kernel.org \
--cc=sumit.semwal@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;
as well as URLs for NNTP newsgroup(s).