diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-21 22:37:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-21 22:37:45 -0400 |
commit | e8bebe2f71d26871b0970ae1d9cf0ed3cdd9569d (patch) | |
tree | c0d82cbd11daaf579b74121c6641d58947091094 /arch | |
parent | 6109e2ce2600e2db26cd0424bb9c6ed019723288 (diff) | |
parent | 82f3952c02add60b15eea9151d4d99b6b82066c6 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (69 commits)
fix handling of offsets in cris eeprom.c, get rid of fake on-stack files
get rid of home-grown mutex in cris eeprom.c
switch ecryptfs_write() to struct inode *, kill on-stack fake files
switch ecryptfs_get_locked_page() to struct inode *
simplify access to ecryptfs inodes in ->readpage() and friends
AFS: Don't put struct file on the stack
Ban ecryptfs over ecryptfs
logfs: replace inode uid,gid,mode initialization with helper function
ufs: replace inode uid,gid,mode initialization with helper function
udf: replace inode uid,gid,mode init with helper
ubifs: replace inode uid,gid,mode initialization with helper function
sysv: replace inode uid,gid,mode initialization with helper function
reiserfs: replace inode uid,gid,mode initialization with helper function
ramfs: replace inode uid,gid,mode initialization with helper function
omfs: replace inode uid,gid,mode initialization with helper function
bfs: replace inode uid,gid,mode initialization with helper function
ocfs2: replace inode uid,gid,mode initialization with helper function
nilfs2: replace inode uid,gid,mode initialization with helper function
minix: replace inode uid,gid,mode init with helper
ext4: replace inode uid,gid,mode init with helper
...
Trivial conflict in fs/fs-writeback.c (mark bitfields unsigned)
Diffstat (limited to 'arch')
-rw-r--r-- | arch/cris/arch-v10/drivers/eeprom.c | 48 |
1 files changed, 15 insertions, 33 deletions
diff --git a/arch/cris/arch-v10/drivers/eeprom.c b/arch/cris/arch-v10/drivers/eeprom.c index 1f2ae909d3e6..c3405507a3d1 100644 --- a/arch/cris/arch-v10/drivers/eeprom.c +++ b/arch/cris/arch-v10/drivers/eeprom.c | |||
@@ -73,8 +73,7 @@ struct eeprom_type | |||
73 | int adapt_state; /* 1 = To high , 0 = Even, -1 = To low */ | 73 | int adapt_state; /* 1 = To high , 0 = Even, -1 = To low */ |
74 | 74 | ||
75 | /* this one is to keep the read/write operations atomic */ | 75 | /* this one is to keep the read/write operations atomic */ |
76 | wait_queue_head_t wait_q; | 76 | struct mutex lock; |
77 | volatile int busy; | ||
78 | int retry_cnt_addr; /* Used to keep track of number of retries for | 77 | int retry_cnt_addr; /* Used to keep track of number of retries for |
79 | adaptive timing adjustments */ | 78 | adaptive timing adjustments */ |
80 | int retry_cnt_read; | 79 | int retry_cnt_read; |
@@ -115,8 +114,7 @@ const struct file_operations eeprom_fops = | |||
115 | 114 | ||
116 | int __init eeprom_init(void) | 115 | int __init eeprom_init(void) |
117 | { | 116 | { |
118 | init_waitqueue_head(&eeprom.wait_q); | 117 | mutex_init(&eeprom.lock); |
119 | eeprom.busy = 0; | ||
120 | 118 | ||
121 | #ifdef CONFIG_ETRAX_I2C_EEPROM_PROBE | 119 | #ifdef CONFIG_ETRAX_I2C_EEPROM_PROBE |
122 | #define EETEXT "Found" | 120 | #define EETEXT "Found" |
@@ -439,10 +437,7 @@ static loff_t eeprom_lseek(struct file * file, loff_t offset, int orig) | |||
439 | 437 | ||
440 | static int eeprom_read_buf(loff_t addr, char * buf, int count) | 438 | static int eeprom_read_buf(loff_t addr, char * buf, int count) |
441 | { | 439 | { |
442 | struct file f; | 440 | return eeprom_read(NULL, buf, count, &addr); |
443 | |||
444 | f.f_pos = addr; | ||
445 | return eeprom_read(&f, buf, count, &addr); | ||
446 | } | 441 | } |
447 | 442 | ||
448 | 443 | ||
@@ -452,7 +447,7 @@ static int eeprom_read_buf(loff_t addr, char * buf, int count) | |||
452 | static ssize_t eeprom_read(struct file * file, char * buf, size_t count, loff_t *off) | 447 | static ssize_t eeprom_read(struct file * file, char * buf, size_t count, loff_t *off) |
453 | { | 448 | { |
454 | int read=0; | 449 | int read=0; |
455 | unsigned long p = file->f_pos; | 450 | unsigned long p = *off; |
456 | 451 | ||
457 | unsigned char page; | 452 | unsigned char page; |
458 | 453 | ||
@@ -461,12 +456,9 @@ static ssize_t eeprom_read(struct file * file, char * buf, size_t count, loff_t | |||
461 | return -EFAULT; | 456 | return -EFAULT; |
462 | } | 457 | } |
463 | 458 | ||
464 | wait_event_interruptible(eeprom.wait_q, !eeprom.busy); | 459 | if (mutex_lock_interruptible(&eeprom.lock)) |
465 | if (signal_pending(current)) | ||
466 | return -EINTR; | 460 | return -EINTR; |
467 | 461 | ||
468 | eeprom.busy++; | ||
469 | |||
470 | page = (unsigned char) (p >> 8); | 462 | page = (unsigned char) (p >> 8); |
471 | 463 | ||
472 | if(!eeprom_address(p)) | 464 | if(!eeprom_address(p)) |
@@ -476,8 +468,7 @@ static ssize_t eeprom_read(struct file * file, char * buf, size_t count, loff_t | |||
476 | i2c_stop(); | 468 | i2c_stop(); |
477 | 469 | ||
478 | /* don't forget to wake them up */ | 470 | /* don't forget to wake them up */ |
479 | eeprom.busy--; | 471 | mutex_unlock(&eeprom.lock); |
480 | wake_up_interruptible(&eeprom.wait_q); | ||
481 | return -EFAULT; | 472 | return -EFAULT; |
482 | } | 473 | } |
483 | 474 | ||
@@ -501,11 +492,10 @@ static ssize_t eeprom_read(struct file * file, char * buf, size_t count, loff_t | |||
501 | 492 | ||
502 | if(read > 0) | 493 | if(read > 0) |
503 | { | 494 | { |
504 | file->f_pos += read; | 495 | *off += read; |
505 | } | 496 | } |
506 | 497 | ||
507 | eeprom.busy--; | 498 | mutex_unlock(&eeprom.lock); |
508 | wake_up_interruptible(&eeprom.wait_q); | ||
509 | return read; | 499 | return read; |
510 | } | 500 | } |
511 | 501 | ||
@@ -513,11 +503,7 @@ static ssize_t eeprom_read(struct file * file, char * buf, size_t count, loff_t | |||
513 | 503 | ||
514 | static int eeprom_write_buf(loff_t addr, const char * buf, int count) | 504 | static int eeprom_write_buf(loff_t addr, const char * buf, int count) |
515 | { | 505 | { |
516 | struct file f; | 506 | return eeprom_write(NULL, buf, count, &addr); |
517 | |||
518 | f.f_pos = addr; | ||
519 | |||
520 | return eeprom_write(&f, buf, count, &addr); | ||
521 | } | 507 | } |
522 | 508 | ||
523 | 509 | ||
@@ -534,16 +520,14 @@ static ssize_t eeprom_write(struct file * file, const char * buf, size_t count, | |||
534 | return -EFAULT; | 520 | return -EFAULT; |
535 | } | 521 | } |
536 | 522 | ||
537 | wait_event_interruptible(eeprom.wait_q, !eeprom.busy); | ||
538 | /* bail out if we get interrupted */ | 523 | /* bail out if we get interrupted */ |
539 | if (signal_pending(current)) | 524 | if (mutex_lock_interruptible(&eeprom.lock)) |
540 | return -EINTR; | 525 | return -EINTR; |
541 | eeprom.busy++; | ||
542 | for(i = 0; (i < EEPROM_RETRIES) && (restart > 0); i++) | 526 | for(i = 0; (i < EEPROM_RETRIES) && (restart > 0); i++) |
543 | { | 527 | { |
544 | restart = 0; | 528 | restart = 0; |
545 | written = 0; | 529 | written = 0; |
546 | p = file->f_pos; | 530 | p = *off; |
547 | 531 | ||
548 | 532 | ||
549 | while( (written < count) && (p < eeprom.size)) | 533 | while( (written < count) && (p < eeprom.size)) |
@@ -556,8 +540,7 @@ static ssize_t eeprom_write(struct file * file, const char * buf, size_t count, | |||
556 | i2c_stop(); | 540 | i2c_stop(); |
557 | 541 | ||
558 | /* don't forget to wake them up */ | 542 | /* don't forget to wake them up */ |
559 | eeprom.busy--; | 543 | mutex_unlock(&eeprom.lock); |
560 | wake_up_interruptible(&eeprom.wait_q); | ||
561 | return -EFAULT; | 544 | return -EFAULT; |
562 | } | 545 | } |
563 | #ifdef EEPROM_ADAPTIVE_TIMING | 546 | #ifdef EEPROM_ADAPTIVE_TIMING |
@@ -669,12 +652,11 @@ static ssize_t eeprom_write(struct file * file, const char * buf, size_t count, | |||
669 | } /* while */ | 652 | } /* while */ |
670 | } /* for */ | 653 | } /* for */ |
671 | 654 | ||
672 | eeprom.busy--; | 655 | mutex_unlock(&eeprom.lock); |
673 | wake_up_interruptible(&eeprom.wait_q); | 656 | if (written == 0 && p >= eeprom.size){ |
674 | if (written == 0 && file->f_pos >= eeprom.size){ | ||
675 | return -ENOSPC; | 657 | return -ENOSPC; |
676 | } | 658 | } |
677 | file->f_pos += written; | 659 | *off = p; |
678 | return written; | 660 | return written; |
679 | } | 661 | } |
680 | 662 | ||