From: khilman@ti•com (Kevin Hilman)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH v6 09/16] OMAP2+: UART: Add runtime pm support for omap-serial driver
Date: Mon, 10 Oct 2011 16:42:07 -0700 [thread overview]
Message-ID: <8739f0ct2o.fsf@ti.com> (raw)
In-Reply-To: <1317380495-584-9-git-send-email-govindraj.raja@ti.com> (Govindraj R.'s message of "Fri, 30 Sep 2011 16:31:35 +0530")
"Govindraj.R" <govindraj.raja@ti•com> writes:
> Adapts omap-serial driver to use pm_runtime API's.
[...]
> @@ -1065,19 +1123,18 @@ static struct uart_driver serial_omap_reg = {
> .cons = OMAP_CONSOLE,
> };
>
> -static int
> -serial_omap_suspend(struct platform_device *pdev, pm_message_t state)
> +static int serial_omap_suspend(struct device *dev)
> {
> - struct uart_omap_port *up = platform_get_drvdata(pdev);
> + struct uart_omap_port *up = dev_get_drvdata(dev);
>
> if (up)
> uart_suspend_port(&serial_omap_reg, &up->port);
> return 0;
> }
>
> -static int serial_omap_resume(struct platform_device *dev)
> +static int serial_omap_resume(struct device *dev)
> {
> - struct uart_omap_port *up = platform_get_drvdata(dev);
> + struct uart_omap_port *up = dev_get_drvdata(dev);
>
> if (up)
> uart_resume_port(&serial_omap_reg, &up->port);
These functions need to be wrapped in #ifdef CONFIG_SUSPEND, otherwise,
when building with !CONFIG_SUSPEND you'll get :
/work/kernel/omap/pm/drivers/tty/serial/omap-serial.c:1134:12: warning: 'serial_omap_suspend' defined but not used
/work/kernel/omap/pm/drivers/tty/serial/omap-serial.c:1150:12: warning: 'serial_omap_resume' defined but not used
[...]
> +static int serial_omap_runtime_suspend(struct device *dev)
> +{
> + struct uart_omap_port *up = dev_get_drvdata(dev);
> + struct omap_uart_port_info *pdata = dev->platform_data;
> +
> + if (!up)
> + return -EINVAL;
> +
> + if (!pdata->enable_wakeup || !pdata->get_context_loss_count)
> + return 0;
> +
> + if (pdata->get_context_loss_count)
> + up->context_loss_cnt = pdata->get_context_loss_count(dev);
> +
> + if (device_may_wakeup(dev)) {
> + if (!up->wakeups_enabled) {
> + pdata->enable_wakeup(up->pdev, true);
> + up->wakeups_enabled = true;
> + }
> + } else {
> + if (up->wakeups_enabled) {
> + pdata->enable_wakeup(up->pdev, false);
> + up->wakeups_enabled = false;
> + }
> + }
> +
> + return 0;
> +}
> +
> +static int serial_omap_runtime_resume(struct device *dev)
> +{
> + struct uart_omap_port *up = dev_get_drvdata(dev);
> + struct omap_uart_port_info *pdata = dev->platform_data;
> +
> + if (up) {
> + if (pdata->get_context_loss_count) {
> + u32 loss_cnt = pdata->get_context_loss_count(dev);
> +
> + if (up->context_loss_cnt != loss_cnt)
> + serial_omap_restore_context(up);
> + }
> + }
> +
> return 0;
> }
Similarily, thse need to be wrapped with #ifdef CONFIG_PM_RUNTIME,
otherwise, when !CONFIG_PM_RUNTIME:
/work/kernel/omap/pm/drivers/tty/serial/omap-serial.c:1498:12: warning: 'serial_omap_runtime_suspend' defined but not used
/work/kernel/omap/pm/drivers/tty/serial/omap-serial.c:1531:12: warning: 'serial_omap_runtime_resume' defined but not used
> +static const struct dev_pm_ops serial_omap_dev_pm_ops = {
> + SET_SYSTEM_SLEEP_PM_OPS(serial_omap_suspend, serial_omap_resume)
> + SET_RUNTIME_PM_OPS(serial_omap_runtime_suspend,
> + serial_omap_runtime_resume, NULL)
> +};
> +
Note that you don't need #else parts to the above #ifdefs since
the SET_*_OPS() macros used here take care of that.
Kevin
next prev parent reply other threads:[~2011-10-10 23:42 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-30 11:01 [PATCH v6 01/16] OMAP2+: hwmod: Add API to enable IO ring wakeup Govindraj.R
2011-09-30 11:01 ` [PATCH v6 02/16] OMAP2+: hwmod: Add API to check IO PAD wakeup status Govindraj.R
2011-10-01 14:33 ` Rajendra Nayak
2011-10-03 5:00 ` Govindraj
2011-10-03 5:23 ` Rajendra Nayak
2011-10-03 5:56 ` Govindraj
2011-10-10 22:24 ` Kevin Hilman
2011-10-11 6:17 ` Govindraj
2011-09-30 11:01 ` [PATCH v6 03/16] OMAP2+: UART: cleanup + remove uart pm specific API Govindraj.R
2011-09-30 11:01 ` [PATCH v6 04/16] OMAP2+: UART: cleanup 8250 console driver support Govindraj.R
2011-10-04 21:42 ` Kevin Hilman
2011-10-05 6:54 ` Govindraj
2011-10-05 18:42 ` Kevin Hilman
2011-10-06 8:16 ` Govindraj
2011-09-30 11:01 ` [PATCH v6 05/16] OMAP2+: UART: Cleanup part of clock gating mechanism for uart Govindraj.R
2011-10-10 22:30 ` Kevin Hilman
2011-10-11 6:45 ` Govindraj
2011-09-30 11:01 ` [PATCH v6 06/16] OMAP2+: UART: Remove certain feilds from omap_uart_state struct Govindraj.R
2011-10-10 23:31 ` Kevin Hilman
2011-10-12 10:25 ` Govindraj
2011-09-30 11:01 ` [PATCH v6 07/16] OMAP2+: UART: Add default mux for all uarts Govindraj.R
2011-10-05 19:04 ` Kevin Hilman
2011-10-06 8:21 ` Govindraj
2011-09-30 11:01 ` [PATCH v6 08/16] OMAP2+: UART: Store certain reg values to port structure Govindraj.R
2011-10-10 23:58 ` Kevin Hilman
2011-10-11 13:21 ` Govindraj
2011-09-30 11:01 ` [PATCH v6 09/16] OMAP2+: UART: Add runtime pm support for omap-serial driver Govindraj.R
2011-10-10 23:42 ` Kevin Hilman [this message]
2011-10-12 10:37 ` Govindraj
2011-10-10 23:56 ` Kevin Hilman
2011-10-12 10:35 ` Govindraj
2011-10-13 0:06 ` Kevin Hilman
2011-10-13 1:28 ` Govindraj
2011-10-13 21:22 ` Kevin Hilman
2011-10-14 12:32 ` Govindraj
2011-10-14 17:04 ` Kevin Hilman
2011-10-14 18:29 ` Govindraj
2011-10-01 13:41 ` [PATCH v6 01/16] OMAP2+: hwmod: Add API to enable IO ring wakeup Rajendra Nayak
2011-10-03 15:10 ` Vishwanath Sripathy
2011-10-04 21:03 ` Kevin Hilman
2011-10-05 11:57 ` Rajendra Nayak
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=8739f0ct2o.fsf@ti.com \
--to=khilman@ti$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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