* [PATCH wg-linux-can-next devel 1/1] can: cc770: Fix indirect access deadlock on ISA cards
@ 2012-01-15 12:21 Wolfgang Zarre
2012-01-16 9:26 ` Wolfgang Grandegger
2012-01-31 22:13 ` Marc Kleine-Budde
0 siblings, 2 replies; 4+ messages in thread
From: Wolfgang Zarre @ 2012-01-15 12:21 UTC (permalink / raw)
To: Wolfgang Grandegger
Cc: David S. Miller, Marc Kleine-Budde, socketcan-users,
Wolfgang Zarre, linux-can, netdev
This fix avoids a deadlock if an interrupt occurs
during consecutive port operations on ISA cards
utilising indirect access via address and data
port.
Tested on a B&R ISA card.
CC: linux-can@vger.kernel.org
CC: netdev@vger.kernel.org
Signed-off-by: Wolfgang Zarre <lkdev@essax.com>
---
drivers/net/can/cc770/cc770_isa.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/drivers/net/can/cc770/cc770_isa.c b/drivers/net/can/cc770/cc770_isa.c
index 4be5fe2..9f3a25c 100644
--- a/drivers/net/can/cc770/cc770_isa.c
+++ b/drivers/net/can/cc770/cc770_isa.c
@@ -110,6 +110,11 @@ MODULE_PARM_DESC(bcr, "Bus configuration register (default=0x40 [CBY])");
#define CC770_IOSIZE 0x20
#define CC770_IOSIZE_INDIRECT 0x02
+/* Spinlock for cc770_isa_port_write_reg_indirect
+ * and cc770_isa_port_read_reg_indirect
+ */
+static DEFINE_SPINLOCK(cc770_isa_port_lock);
+
static struct platform_device *cc770_isa_devs[MAXDEV];
static u8 cc770_isa_mem_read_reg(const struct cc770_priv *priv, int reg)
@@ -138,18 +143,27 @@ static u8 cc770_isa_port_read_reg_indirect(const struct cc770_priv *priv,
int reg)
{
unsigned long base = (unsigned long)priv->reg_base;
+ unsigned long flags;
+ u8 val;
+ spin_lock_irqsave(&cc770_isa_port_lock, flags);
outb(reg, base);
- return inb(base + 1);
+ val = inb(base + 1);
+ spin_unlock_irqrestore(&cc770_isa_port_lock, flags);
+
+ return val;
}
static void cc770_isa_port_write_reg_indirect(const struct cc770_priv *priv,
int reg, u8 val)
{
unsigned long base = (unsigned long)priv->reg_base;
+ unsigned long flags;
+ spin_lock_irqsave(&cc770_isa_port_lock, flags);
outb(reg, base);
outb(val, base + 1);
+ spin_unlock_irqrestore(&cc770_isa_port_lock, flags);
}
static int __devinit cc770_isa_probe(struct platform_device *pdev)
--
1.7.7.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH wg-linux-can-next devel 1/1] can: cc770: Fix indirect access deadlock on ISA cards
2012-01-15 12:21 [PATCH wg-linux-can-next devel 1/1] can: cc770: Fix indirect access deadlock on ISA cards Wolfgang Zarre
@ 2012-01-16 9:26 ` Wolfgang Grandegger
2012-01-17 12:10 ` Wolfgang Zarre
2012-01-31 22:13 ` Marc Kleine-Budde
1 sibling, 1 reply; 4+ messages in thread
From: Wolfgang Grandegger @ 2012-01-16 9:26 UTC (permalink / raw)
To: Wolfgang Zarre
Cc: David S. Miller, Marc Kleine-Budde, socketcan-users, linux-can,
netdev
On 01/15/2012 01:21 PM, Wolfgang Zarre wrote:
> This fix avoids a deadlock if an interrupt occurs
> during consecutive port operations on ISA cards
> utilising indirect access via address and data
> port.
>
> Tested on a B&R ISA card.
>
> CC: linux-can@vger.kernel.org
> CC: netdev@vger.kernel.org
> Signed-off-by: Wolfgang Zarre <lkdev@essax.com>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Next time, please drop the CC to the old BerliOS Socketcan mailing
lists. Marc, Oliver? Do we, should we, still send patches to the
"netdev@vger.kernel.org" as well.
Wolfgang.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH wg-linux-can-next devel 1/1] can: cc770: Fix indirect access deadlock on ISA cards
2012-01-16 9:26 ` Wolfgang Grandegger
@ 2012-01-17 12:10 ` Wolfgang Zarre
0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Zarre @ 2012-01-17 12:10 UTC (permalink / raw)
To: Wolfgang Grandegger
Cc: David S. Miller, Marc Kleine-Budde, socketcan-users, linux-can,
netdev
Hello Wolfgang,
> On 01/15/2012 01:21 PM, Wolfgang Zarre wrote:
>> This fix avoids a deadlock if an interrupt occurs
>> during consecutive port operations on ISA cards
>> utilising indirect access via address and data
>> port.
>>
>> Tested on a B&R ISA card.
>>
>> CC: linux-can@vger.kernel.org
>> CC: netdev@vger.kernel.org
>> Signed-off-by: Wolfgang Zarre<lkdev@essax.com>
>
> Acked-by: Wolfgang Grandegger<wg@grandegger.com>
Thanks.
>
> Next time, please drop the CC to the old BerliOS Socketcan mailing
> lists. Marc, Oliver? Do we, should we, still send patches to the
> "netdev@vger.kernel.org" as well.
Hmmm, actually I dropped to the old BerliOS Socketcan mailing list but
not as CC statement in the email body , however, please let me know
if You prefer to have it there included as well.
Thanks.
>
> Wolfgang.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH wg-linux-can-next devel 1/1] can: cc770: Fix indirect access deadlock on ISA cards
2012-01-15 12:21 [PATCH wg-linux-can-next devel 1/1] can: cc770: Fix indirect access deadlock on ISA cards Wolfgang Zarre
2012-01-16 9:26 ` Wolfgang Grandegger
@ 2012-01-31 22:13 ` Marc Kleine-Budde
1 sibling, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2012-01-31 22:13 UTC (permalink / raw)
To: Wolfgang Zarre; +Cc: Wolfgang Grandegger, linux-can
[-- Attachment #1: Type: text/plain, Size: 672 bytes --]
On 01/15/2012 01:21 PM, Wolfgang Zarre wrote:
> This fix avoids a deadlock if an interrupt occurs
> during consecutive port operations on ISA cards
> utilising indirect access via address and data
> port.
>
> Tested on a B&R ISA card.
>
> CC: linux-can@vger.kernel.org
> CC: netdev@vger.kernel.org
> Signed-off-by: Wolfgang Zarre <lkdev@essax.com>
Applied to can-next.
tnx Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-01-31 22:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-15 12:21 [PATCH wg-linux-can-next devel 1/1] can: cc770: Fix indirect access deadlock on ISA cards Wolfgang Zarre
2012-01-16 9:26 ` Wolfgang Grandegger
2012-01-17 12:10 ` Wolfgang Zarre
2012-01-31 22:13 ` Marc Kleine-Budde
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).