From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeffy Chen Subject: [RFC PATCH v3 1/6] spi: core: add support for wakeup-source dts property Date: Wed, 21 Jun 2017 18:01:48 +0800 Message-ID: <1498039313-24220-2-git-send-email-jeffy.chen@rock-chips.com> References: <1498039313-24220-1-git-send-email-jeffy.chen@rock-chips.com> Cc: briannorris-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org, dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org, Jeffy Chen , Mark Brown , linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Return-path: In-Reply-To: <1498039313-24220-1-git-send-email-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org> Sender: linux-spi-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Use generic wakeup-source property to enable spi device wakeup. Signed-off-by: Jeffy Chen --- 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