From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Andrew Morton <akpm@osdl.org>
Cc: Linus Torvalds <torvalds@osdl.org>,
Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: [PATCH] pmac_zilog: sleep fix
Date: Mon, 22 Mar 2004 09:36:35 +1100 [thread overview]
Message-ID: <1079908594.911.150.camel@gaston> (raw)
Hi !
This patch fix a problem with semaphore usage on wakeup from
sleep in pmac_zilog (crashing some laptops on wakeup).
Please apply,
Ben.
===== drivers/serial/pmac_zilog.c 1.6 vs edited =====
--- 1.6/drivers/serial/pmac_zilog.c Wed Mar 10 21:18:32 2004
+++ edited/drivers/serial/pmac_zilog.c Mon Mar 22 09:35:13 2004
@@ -1563,15 +1563,21 @@
static int pmz_suspend(struct macio_dev *mdev, u32 pm_state)
{
struct uart_pmac_port *uap = dev_get_drvdata(&mdev->ofdev.dev);
- struct uart_state *state = pmz_uart_reg.state + uap->port.line;
+ struct uart_state *state;
unsigned long flags;
- if (uap == NULL)
+ if (uap == NULL) {
+ printk("HRM... pmz_suspend with NULL uap\n");
return 0;
+ }
if (pm_state == mdev->ofdev.dev.power_state || pm_state < 2)
return 0;
+ pmz_debug("suspend, switching to state %d\n", pm_state);
+
+ state = pmz_uart_reg.state + uap->port.line;
+
down(&pmz_irq_sem);
down(&state->sem);
@@ -1607,6 +1613,8 @@
up(&state->sem);
up(&pmz_irq_sem);
+ pmz_debug("suspend, switching complete\n");
+
mdev->ofdev.dev.power_state = pm_state;
return 0;
@@ -1616,7 +1624,7 @@
static int pmz_resume(struct macio_dev *mdev)
{
struct uart_pmac_port *uap = dev_get_drvdata(&mdev->ofdev.dev);
- struct uart_state *state = pmz_uart_reg.state + uap->port.line;
+ struct uart_state *state;
unsigned long flags;
int pwr_delay;
@@ -1626,6 +1634,10 @@
if (mdev->ofdev.dev.power_state == 0)
return 0;
+ pmz_debug("resume, switching to state 0\n");
+
+ state = pmz_uart_reg.state + uap->port.line;
+
down(&pmz_irq_sem);
down(&state->sem);
@@ -1658,6 +1670,7 @@
enable_irq(uap->port.irq);
}
+ bail:
up(&state->sem);
up(&pmz_irq_sem);
@@ -1670,7 +1683,8 @@
schedule_timeout((pwr_delay * HZ)/1000);
}
- bail:
+ pmz_debug("resume, switching complete\n");
+
mdev->ofdev.dev.power_state = 0;
return 0;
reply other threads:[~2004-03-21 22:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1079908594.911.150.camel@gaston \
--to=benh@kernel.crashing.org \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.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
all inboxes | Powered by JetHome®