aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/can/cc770/cc770_isa.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/can/cc770/cc770_isa.c')
-rw-r--r--drivers/net/can/cc770/cc770_isa.c16
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 4be5fe2c40a5..9f3a25ccd665 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])");
110#define CC770_IOSIZE 0x20 110#define CC770_IOSIZE 0x20
111#define CC770_IOSIZE_INDIRECT 0x02 111#define CC770_IOSIZE_INDIRECT 0x02
112 112
113/* Spinlock for cc770_isa_port_write_reg_indirect
114 * and cc770_isa_port_read_reg_indirect
115 */
116static DEFINE_SPINLOCK(cc770_isa_port_lock);
117
113static struct platform_device *cc770_isa_devs[MAXDEV]; 118static struct platform_device *cc770_isa_devs[MAXDEV];
114 119
115static u8 cc770_isa_mem_read_reg(const struct cc770_priv *priv, int reg) 120static 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,
138 int reg) 143 int reg)
139{ 144{
140 unsigned long base = (unsigned long)priv->reg_base; 145 unsigned long base = (unsigned long)priv->reg_base;
146 unsigned long flags;
147 u8 val;
141 148
149 spin_lock_irqsave(&cc770_isa_port_lock, flags);
142 outb(reg, base); 150 outb(reg, base);
143 return inb(base + 1); 151 val = inb(base + 1);
152 spin_unlock_irqrestore(&cc770_isa_port_lock, flags);
153
154 return val;
144} 155}
145 156
146static void cc770_isa_port_write_reg_indirect(const struct cc770_priv *priv, 157static void cc770_isa_port_write_reg_indirect(const struct cc770_priv *priv,
147 int reg, u8 val) 158 int reg, u8 val)
148{ 159{
149 unsigned long base = (unsigned long)priv->reg_base; 160 unsigned long base = (unsigned long)priv->reg_base;
161 unsigned long flags;
150 162
163 spin_lock_irqsave(&cc770_isa_port_lock, flags);
151 outb(reg, base); 164 outb(reg, base);
152 outb(val, base + 1); 165 outb(val, base + 1);
166 spin_unlock_irqrestore(&cc770_isa_port_lock, flags);
153} 167}
154 168
155static int __devinit cc770_isa_probe(struct platform_device *pdev) 169static int __devinit cc770_isa_probe(struct platform_device *pdev)