[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220604172905.36483a52@jic23-huawei>
Date: Sat, 4 Jun 2022 17:29:05 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Caleb Connolly <caleb.connolly@...aro.org>
Cc: Lars-Peter Clausen <lars@...afoo.de>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Andy Gross <agross@...nel.org>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Lee Jones <lee.jones@...aro.org>,
Stephen Boyd <sboyd@...nel.org>, linux-iio@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-msm@...r.kernel.org,
Jami Kettunen <jami.kettunen@...ainline.org>,
Sumit Semwal <sumit.semwal@...aro.org>
Subject: Re: [PATCH v14 01/10] spmi: add a helper to look up an SPMI device
from a device node
On Sun, 1 May 2022 18:23:23 +0100
Jonathan Cameron <jic23@...nel.org> wrote:
> On Fri, 29 Apr 2022 23:08:56 +0100
> Caleb Connolly <caleb.connolly@...aro.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@...aro.org>
>
> Stephen, are you fine with this addition to spmi?
Stephen. This is still waiting for an SPMI ack.
Thanks,
Jonathan
>
> Given bulk of this series in in IIO I'm planning to pick up once
> everyone is happy with it.
>
> Thanks,
>
> Jonathan
>
>
> > ---
> > drivers/spmi/spmi.c | 17 +++++++++++++++++
> > include/linux/spmi.h | 3 +++
> > 2 files changed, 20 insertions(+)
> >
> > diff --git a/drivers/spmi/spmi.c b/drivers/spmi/spmi.c
> > index b37ead9e2fad..a456ce5141e1 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.
> > + */
> > +struct spmi_device *spmi_device_from_of(struct device_node *np)
> > +{
> > + 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..eac1956a8727 100644
> > --- a/include/linux/spmi.h
> > +++ b/include/linux/spmi.h
> > @@ -164,6 +164,9 @@ static inline void spmi_driver_unregister(struct spmi_driver *sdrv)
> > module_driver(__spmi_driver, spmi_driver_register, \
> > spmi_driver_unregister)
> >
> > +struct device_node;
> > +
> > +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);
>
Powered by blists - more mailing lists