From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-ide@vger.kernel.org
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] pata_oldpiix: add locking for parallel scanning
Date: Thu, 18 Feb 2010 19:59:28 +0100 [thread overview]
Message-ID: <20100218185928.16594.4054.sendpatchset@localhost> (raw)
In-Reply-To: <20100218185914.16594.61415.sendpatchset@localhost>
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] pata_oldpiix: add locking for parallel scanning
Add an extra locking for parallel scanning.
This is similar change as commit 60c3be3 for ata_piix host driver
and while pata_oldpiix doesn't enable parallel scan yet the race
could probably also be triggered by requesting re-scanning of both
ports at the same time using SCSI sysfs interface.
Fix documentation while at it.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ata/pata_oldpiix.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
Index: b/drivers/ata/pata_oldpiix.c
===================================================================
--- a/drivers/ata/pata_oldpiix.c
+++ b/drivers/ata/pata_oldpiix.c
@@ -1,7 +1,8 @@
/*
- * pata_oldpiix.c - Intel PATA/SATA controllers
+ * pata_oldpiix.c - older Intel PATA controllers
*
* (C) 2005 Red Hat
+ * (C) 2010 Bartlomiej Zolnierkiewicz
*
* Some parts based on ata_piix.c by Jeff Garzik and others.
*
@@ -50,10 +51,13 @@ static int oldpiix_pre_reset(struct ata_
return ata_sff_prereset(link, deadline);
}
+static DEFINE_SPINLOCK(piix_lock);
+
static void oldpiix_set_timings(struct ata_port *ap, struct ata_device *adev,
u8 pio, bool use_mwdma)
{
struct pci_dev *dev = to_pci_dev(ap->host->dev);
+ unsigned long flags;
unsigned int idetm_port= ap->port_no ? 0x42 : 0x40;
u16 idetm_data;
int control = 0;
@@ -84,6 +88,8 @@ static void oldpiix_set_timings(struct a
/* Enable DMA timing only */
control |= 8; /* PIO cycles in PIO0 */
+ spin_lock_irqsave(&piix_lock, flags);
+
pci_read_config_word(dev, idetm_port, &idetm_data);
/*
@@ -101,6 +107,8 @@ static void oldpiix_set_timings(struct a
(timings[pio][1] << 8);
pci_write_config_word(dev, idetm_port, idetm_data);
+ spin_unlock_irqrestore(&piix_lock, flags);
+
/* Track which port is configured */
ap->private_data = adev;
}
next prev parent reply other threads:[~2010-02-18 18:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-18 18:59 [git patches] atang tree: parallel scanning improvements Bartlomiej Zolnierkiewicz
2010-02-18 18:59 ` [PATCH 1/3] libata: pass host flags into __ata_pci_sff_init_one() helper Bartlomiej Zolnierkiewicz
2010-02-18 21:44 ` Alan Cox
2010-02-18 22:41 ` Bartlomiej Zolnierkiewicz
2010-02-18 23:33 ` Alan Cox
2010-02-19 0:00 ` Jeff Garzik
2010-02-18 18:59 ` Bartlomiej Zolnierkiewicz [this message]
2010-02-18 21:45 ` [PATCH 2/3] pata_oldpiix: add locking for parallel scanning Alan Cox
2010-02-18 18:59 ` [PATCH 3/3] pata_oldpiix: enable parallel scan Bartlomiej Zolnierkiewicz
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=20100218185928.16594.4054.sendpatchset@localhost \
--to=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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).