From: Jeffy Chen <jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: briannorris-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
Jeffy Chen <jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>,
Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [RFC PATCH v3 1/6] spi: core: add support for wakeup-source dts property
Date: Wed, 21 Jun 2017 18:01:48 +0800 [thread overview]
Message-ID: <1498039313-24220-2-git-send-email-jeffy.chen@rock-chips.com> (raw)
In-Reply-To: <1498039313-24220-1-git-send-email-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
Use generic wakeup-source property to enable spi device wakeup.
Signed-off-by: Jeffy Chen <jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---
Changes in v3: None
drivers/spi/spi.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index c3f6b52..a510bba 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -547,11 +547,16 @@ int spi_add_device(struct spi_device *spi)
/* Device may be bound to an active driver when this returns */
status = device_add(&spi->dev);
- if (status < 0)
+ if (status < 0) {
dev_err(dev, "can't add %s, status %d\n",
- dev_name(&spi->dev), status);
- else
- dev_dbg(dev, "registered child %s\n", dev_name(&spi->dev));
+ dev_name(&spi->dev), status);
+ goto done;
+ }
+
+ dev_dbg(dev, "registered child %s\n", dev_name(&spi->dev));
+
+ if (device_property_read_bool(&spi->dev, "wakeup-source"))
+ device_init_wakeup(&spi->dev, true);
done:
mutex_unlock(&spi_add_lock);
@@ -638,6 +643,8 @@ void spi_unregister_device(struct spi_device *spi)
if (!spi)
return;
+ device_init_wakeup(&spi->dev, false);
+
if (spi->dev.of_node) {
of_node_clear_flag(spi->dev.of_node, OF_POPULATED);
of_node_put(spi->dev.of_node);
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-06-21 10:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-21 10:01 [RFC PATCH v3 0/6] Report wakeup events in cros_ec_keyb and make cros-ec-spi wakeup optional Jeffy Chen
[not found] ` <1498039313-24220-1-git-send-email-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-06-21 10:01 ` Jeffy Chen [this message]
2017-06-21 10:52 ` [RFC PATCH v3 1/6] spi: core: add support for wakeup-source dts property Mark Brown
2017-06-21 10:01 ` [RFC PATCH v3 2/6] dt-bindings: spi/core: add wakeup-source optional property Jeffy Chen
[not found] ` <1498039313-24220-3-git-send-email-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-06-26 16:00 ` Rob Herring
2017-06-26 16:40 ` Dmitry Torokhov
2017-06-27 2:04 ` jeffy
2017-06-30 14:44 ` Rob Herring
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=1498039313-24220-2-git-send-email-jeffy.chen@rock-chips.com \
--to=jeffy.chen-tnx95d0mmh7dzftrwevzcw@public.gmane.org \
--cc=briannorris-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.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).