aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/arch-v10
diff options
context:
space:
mode:
authorJesper Nilsson <jesper.nilsson@axis.com>2010-08-02 07:46:12 -0400
committerJesper Nilsson <jesper.nilsson@axis.com>2010-08-04 06:59:28 -0400
commit0e0aff21261aba52ee37b59fcf48202230fc7377 (patch)
treee607886797a051337309a221e6ab92d52b1eb5c1 /arch/cris/arch-v10
parent60362158e2419b20cc04d43a6ffa60c1845775dc (diff)
CRIS: v10: remove all BKL usage
We don't need to take the BKL here. Also fixes compile error after last commit (smp_lock.h was not included) Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
Diffstat (limited to 'arch/cris/arch-v10')
-rw-r--r--arch/cris/arch-v10/drivers/i2c.c39
1 files changed, 13 insertions, 26 deletions
diff --git a/arch/cris/arch-v10/drivers/i2c.c b/arch/cris/arch-v10/drivers/i2c.c
index 54e2e1adf085..77a941813819 100644
--- a/arch/cris/arch-v10/drivers/i2c.c
+++ b/arch/cris/arch-v10/drivers/i2c.c
@@ -59,8 +59,8 @@ static const char i2c_name[] = "i2c";
59 59
60#define SDABIT CONFIG_ETRAX_I2C_DATA_PORT 60#define SDABIT CONFIG_ETRAX_I2C_DATA_PORT
61#define SCLBIT CONFIG_ETRAX_I2C_CLK_PORT 61#define SCLBIT CONFIG_ETRAX_I2C_CLK_PORT
62#define i2c_enable() 62#define i2c_enable()
63#define i2c_disable() 63#define i2c_disable()
64 64
65/* enable or disable output-enable, to select output or input on the i2c bus */ 65/* enable or disable output-enable, to select output or input on the i2c bus */
66 66
@@ -90,7 +90,7 @@ static const char i2c_name[] = "i2c";
90 90
91#define i2c_dir_out() \ 91#define i2c_dir_out() \
92 *R_PORT_PB_I2C = (port_pb_i2c_shadow &= ~IO_MASK(R_PORT_PB_I2C, i2c_oe_)); \ 92 *R_PORT_PB_I2C = (port_pb_i2c_shadow &= ~IO_MASK(R_PORT_PB_I2C, i2c_oe_)); \
93 REG_SHADOW_SET(R_PORT_PB_DIR, port_pb_dir_shadow, 0, 1); 93 REG_SHADOW_SET(R_PORT_PB_DIR, port_pb_dir_shadow, 0, 1);
94#define i2c_dir_in() \ 94#define i2c_dir_in() \
95 *R_PORT_PB_I2C = (port_pb_i2c_shadow |= IO_MASK(R_PORT_PB_I2C, i2c_oe_)); \ 95 *R_PORT_PB_I2C = (port_pb_i2c_shadow |= IO_MASK(R_PORT_PB_I2C, i2c_oe_)); \
96 REG_SHADOW_SET(R_PORT_PB_DIR, port_pb_dir_shadow, 0, 0); 96 REG_SHADOW_SET(R_PORT_PB_DIR, port_pb_dir_shadow, 0, 0);
@@ -188,7 +188,7 @@ i2c_outbyte(unsigned char x)
188 } else { 188 } else {
189 i2c_data(I2C_DATA_LOW); 189 i2c_data(I2C_DATA_LOW);
190 } 190 }
191 191
192 i2c_delay(CLOCK_LOW_TIME/2); 192 i2c_delay(CLOCK_LOW_TIME/2);
193 i2c_clk(I2C_CLOCK_HIGH); 193 i2c_clk(I2C_CLOCK_HIGH);
194 i2c_delay(CLOCK_HIGH_TIME); 194 i2c_delay(CLOCK_HIGH_TIME);
@@ -415,7 +415,7 @@ i2c_sendnack(void)
415*# 415*#
416*#--------------------------------------------------------------------------*/ 416*#--------------------------------------------------------------------------*/
417int 417int
418i2c_writereg(unsigned char theSlave, unsigned char theReg, 418i2c_writereg(unsigned char theSlave, unsigned char theReg,
419 unsigned char theValue) 419 unsigned char theValue)
420{ 420{
421 int error, cntr = 3; 421 int error, cntr = 3;
@@ -467,7 +467,7 @@ i2c_writereg(unsigned char theSlave, unsigned char theReg,
467 * enable interrupt again 467 * enable interrupt again
468 */ 468 */
469 local_irq_restore(flags); 469 local_irq_restore(flags);
470 470
471 } while(error && cntr--); 471 } while(error && cntr--);
472 472
473 i2c_delay(CLOCK_LOW_TIME); 473 i2c_delay(CLOCK_LOW_TIME);
@@ -503,7 +503,7 @@ i2c_readreg(unsigned char theSlave, unsigned char theReg)
503 * generate start condition 503 * generate start condition
504 */ 504 */
505 i2c_start(); 505 i2c_start();
506 506
507 /* 507 /*
508 * send slave address 508 * send slave address
509 */ 509 */
@@ -554,7 +554,7 @@ i2c_readreg(unsigned char theSlave, unsigned char theReg)
554 * enable interrupt again 554 * enable interrupt again
555 */ 555 */
556 local_irq_restore(flags); 556 local_irq_restore(flags);
557 557
558 } while(error && cntr--); 558 } while(error && cntr--);
559 559
560 spin_unlock(&i2c_lock); 560 spin_unlock(&i2c_lock);
@@ -577,8 +577,7 @@ i2c_release(struct inode *inode, struct file *filp)
577/* Main device API. ioctl's to write or read to/from i2c registers. 577/* Main device API. ioctl's to write or read to/from i2c registers.
578 */ 578 */
579 579
580static int 580static long i2c_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
581i2c_ioctl_unlocked(struct file *file, unsigned int cmd, unsigned long arg)
582{ 581{
583 if(_IOC_TYPE(cmd) != ETRAXI2C_IOCTYPE) { 582 if(_IOC_TYPE(cmd) != ETRAXI2C_IOCTYPE) {
584 return -EINVAL; 583 return -EINVAL;
@@ -587,7 +586,7 @@ i2c_ioctl_unlocked(struct file *file, unsigned int cmd, unsigned long arg)
587 switch (_IOC_NR(cmd)) { 586 switch (_IOC_NR(cmd)) {
588 case I2C_WRITEREG: 587 case I2C_WRITEREG:
589 /* write to an i2c slave */ 588 /* write to an i2c slave */
590 D(printk("i2cw %d %d %d\n", 589 D(printk(KERN_DEBUG "i2cw %d %d %d\n",
591 I2C_ARGSLAVE(arg), 590 I2C_ARGSLAVE(arg),
592 I2C_ARGREG(arg), 591 I2C_ARGREG(arg),
593 I2C_ARGVALUE(arg))); 592 I2C_ARGVALUE(arg)));
@@ -599,32 +598,20 @@ i2c_ioctl_unlocked(struct file *file, unsigned int cmd, unsigned long arg)
599 { 598 {
600 unsigned char val; 599 unsigned char val;
601 /* read from an i2c slave */ 600 /* read from an i2c slave */
602 D(printk("i2cr %d %d ", 601 D(printk(KERN_DEBUG "i2cr %d %d ",
603 I2C_ARGSLAVE(arg), 602 I2C_ARGSLAVE(arg),
604 I2C_ARGREG(arg))); 603 I2C_ARGREG(arg)));
605 val = i2c_readreg(I2C_ARGSLAVE(arg), I2C_ARGREG(arg)); 604 val = i2c_readreg(I2C_ARGSLAVE(arg), I2C_ARGREG(arg));
606 D(printk("= %d\n", val)); 605 D(printk(KERN_DEBUG "= %d\n", val));
607 return val; 606 return val;
608 } 607 }
609 default: 608 default:
610 return -EINVAL; 609 return -EINVAL;
611 610
612 } 611 }
613
614 return 0; 612 return 0;
615} 613}
616 614
617static long i2c_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
618{
619 long ret;
620
621 lock_kernel();
622 ret = i2c_ioctl_unlocked(file, cmd, arg);
623 unlock_kernel();
624
625 return ret;
626}
627
628static const struct file_operations i2c_fops = { 615static const struct file_operations i2c_fops = {
629 .owner = THIS_MODULE, 616 .owner = THIS_MODULE,
630 .unlocked_ioctl = i2c_ioctl, 617 .unlocked_ioctl = i2c_ioctl,