diff options
author | Tejun Heo <tj@kernel.org> | 2009-04-22 22:05:19 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-04-28 01:37:36 -0400 |
commit | f06d9a2b52e246a66b606130cea3f0d7b7be17a7 (patch) | |
tree | 020df1f9d54b00c72d8af02ac0827d496597e75a /drivers/block/paride | |
parent | 40cbbb781d3eba5d6ac0860db078af490e5c7c6b (diff) |
block: replace end_request() with [__]blk_end_request_cur()
end_request() has been kept around for backward compatibility;
however, it's about time for it to go away.
* There aren't too many users left.
* Its use of @updtodate is pretty confusing.
* In some cases, newer code ends up using mixture of end_request() and
[__]blk_end_request[_all](), which is way too confusing.
So, add [__]blk_end_request_cur() and replace end_request() with it.
Most conversions are straightforward. Noteworthy ones are...
* paride/pcd: next_request() updated to take 0/-errno instead of 1/0.
* paride/pf: pf_end_request() and next_request() updated to take
0/-errno instead of 1/0.
* xd: xd_readwrite() updated to return 0/-errno instead of 1/0.
* mtd/mtd_blkdevs: blktrans_discard_request() updated to return
0/-errno instead of 1/0. Unnecessary local variable res
initialization removed from mtd_blktrans_thread().
[ Impact: cleanup ]
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Joerg Dorchain <joerg@dorchain.net>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Laurent Vivier <Laurent@lvivier.info>
Cc: Tim Waugh <tim@cyberelk.net>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Markus Lidel <Markus.Lidel@shadowconnect.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Cc: unsik Kim <donari75@gmail.com>
Diffstat (limited to 'drivers/block/paride')
-rw-r--r-- | drivers/block/paride/pcd.c | 12 | ||||
-rw-r--r-- | drivers/block/paride/pd.c | 5 | ||||
-rw-r--r-- | drivers/block/paride/pf.c | 28 |
3 files changed, 23 insertions, 22 deletions
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c index e91d4b4b014f..9fd57c2aa463 100644 --- a/drivers/block/paride/pcd.c +++ b/drivers/block/paride/pcd.c | |||
@@ -735,16 +735,16 @@ static void do_pcd_request(struct request_queue * q) | |||
735 | ps_set_intr(do_pcd_read, NULL, 0, nice); | 735 | ps_set_intr(do_pcd_read, NULL, 0, nice); |
736 | return; | 736 | return; |
737 | } else | 737 | } else |
738 | end_request(pcd_req, 0); | 738 | __blk_end_request_cur(pcd_req, -EIO); |
739 | } | 739 | } |
740 | } | 740 | } |
741 | 741 | ||
742 | static inline void next_request(int success) | 742 | static inline void next_request(int err) |
743 | { | 743 | { |
744 | unsigned long saved_flags; | 744 | unsigned long saved_flags; |
745 | 745 | ||
746 | spin_lock_irqsave(&pcd_lock, saved_flags); | 746 | spin_lock_irqsave(&pcd_lock, saved_flags); |
747 | end_request(pcd_req, success); | 747 | __blk_end_request_cur(pcd_req, err); |
748 | pcd_busy = 0; | 748 | pcd_busy = 0; |
749 | do_pcd_request(pcd_queue); | 749 | do_pcd_request(pcd_queue); |
750 | spin_unlock_irqrestore(&pcd_lock, saved_flags); | 750 | spin_unlock_irqrestore(&pcd_lock, saved_flags); |
@@ -781,7 +781,7 @@ static void pcd_start(void) | |||
781 | 781 | ||
782 | if (pcd_command(pcd_current, rd_cmd, 2048, "read block")) { | 782 | if (pcd_command(pcd_current, rd_cmd, 2048, "read block")) { |
783 | pcd_bufblk = -1; | 783 | pcd_bufblk = -1; |
784 | next_request(0); | 784 | next_request(-EIO); |
785 | return; | 785 | return; |
786 | } | 786 | } |
787 | 787 | ||
@@ -796,7 +796,7 @@ static void do_pcd_read(void) | |||
796 | pcd_retries = 0; | 796 | pcd_retries = 0; |
797 | pcd_transfer(); | 797 | pcd_transfer(); |
798 | if (!pcd_count) { | 798 | if (!pcd_count) { |
799 | next_request(1); | 799 | next_request(0); |
800 | return; | 800 | return; |
801 | } | 801 | } |
802 | 802 | ||
@@ -815,7 +815,7 @@ static void do_pcd_read_drq(void) | |||
815 | return; | 815 | return; |
816 | } | 816 | } |
817 | pcd_bufblk = -1; | 817 | pcd_bufblk = -1; |
818 | next_request(0); | 818 | next_request(-EIO); |
819 | return; | 819 | return; |
820 | } | 820 | } |
821 | 821 | ||
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c index 9299455b0af6..0732df4e901a 100644 --- a/drivers/block/paride/pd.c +++ b/drivers/block/paride/pd.c | |||
@@ -410,7 +410,8 @@ static void run_fsm(void) | |||
410 | pd_claimed = 0; | 410 | pd_claimed = 0; |
411 | phase = NULL; | 411 | phase = NULL; |
412 | spin_lock_irqsave(&pd_lock, saved_flags); | 412 | spin_lock_irqsave(&pd_lock, saved_flags); |
413 | end_request(pd_req, res); | 413 | __blk_end_request_cur(pd_req, |
414 | res == Ok ? 0 : -EIO); | ||
414 | pd_req = elv_next_request(pd_queue); | 415 | pd_req = elv_next_request(pd_queue); |
415 | if (!pd_req) | 416 | if (!pd_req) |
416 | stop = 1; | 417 | stop = 1; |
@@ -477,7 +478,7 @@ static int pd_next_buf(void) | |||
477 | if (pd_count) | 478 | if (pd_count) |
478 | return 0; | 479 | return 0; |
479 | spin_lock_irqsave(&pd_lock, saved_flags); | 480 | spin_lock_irqsave(&pd_lock, saved_flags); |
480 | end_request(pd_req, 1); | 481 | __blk_end_request_cur(pd_req, 0); |
481 | pd_count = pd_req->current_nr_sectors; | 482 | pd_count = pd_req->current_nr_sectors; |
482 | pd_buf = pd_req->buffer; | 483 | pd_buf = pd_req->buffer; |
483 | spin_unlock_irqrestore(&pd_lock, saved_flags); | 484 | spin_unlock_irqrestore(&pd_lock, saved_flags); |
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c index bef3b997ba3e..3871e3586d6d 100644 --- a/drivers/block/paride/pf.c +++ b/drivers/block/paride/pf.c | |||
@@ -750,10 +750,10 @@ static int pf_ready(void) | |||
750 | 750 | ||
751 | static struct request_queue *pf_queue; | 751 | static struct request_queue *pf_queue; |
752 | 752 | ||
753 | static void pf_end_request(int uptodate) | 753 | static void pf_end_request(int err) |
754 | { | 754 | { |
755 | if (pf_req) { | 755 | if (pf_req) { |
756 | end_request(pf_req, uptodate); | 756 | __blk_end_request_cur(pf_req, err); |
757 | pf_req = NULL; | 757 | pf_req = NULL; |
758 | } | 758 | } |
759 | } | 759 | } |
@@ -773,7 +773,7 @@ repeat: | |||
773 | pf_count = pf_req->current_nr_sectors; | 773 | pf_count = pf_req->current_nr_sectors; |
774 | 774 | ||
775 | if (pf_block + pf_count > get_capacity(pf_req->rq_disk)) { | 775 | if (pf_block + pf_count > get_capacity(pf_req->rq_disk)) { |
776 | pf_end_request(0); | 776 | pf_end_request(-EIO); |
777 | goto repeat; | 777 | goto repeat; |
778 | } | 778 | } |
779 | 779 | ||
@@ -788,7 +788,7 @@ repeat: | |||
788 | pi_do_claimed(pf_current->pi, do_pf_write); | 788 | pi_do_claimed(pf_current->pi, do_pf_write); |
789 | else { | 789 | else { |
790 | pf_busy = 0; | 790 | pf_busy = 0; |
791 | pf_end_request(0); | 791 | pf_end_request(-EIO); |
792 | goto repeat; | 792 | goto repeat; |
793 | } | 793 | } |
794 | } | 794 | } |
@@ -805,7 +805,7 @@ static int pf_next_buf(void) | |||
805 | return 1; | 805 | return 1; |
806 | if (!pf_count) { | 806 | if (!pf_count) { |
807 | spin_lock_irqsave(&pf_spin_lock, saved_flags); | 807 | spin_lock_irqsave(&pf_spin_lock, saved_flags); |
808 | pf_end_request(1); | 808 | pf_end_request(0); |
809 | pf_req = elv_next_request(pf_queue); | 809 | pf_req = elv_next_request(pf_queue); |
810 | spin_unlock_irqrestore(&pf_spin_lock, saved_flags); | 810 | spin_unlock_irqrestore(&pf_spin_lock, saved_flags); |
811 | if (!pf_req) | 811 | if (!pf_req) |
@@ -816,12 +816,12 @@ static int pf_next_buf(void) | |||
816 | return 0; | 816 | return 0; |
817 | } | 817 | } |
818 | 818 | ||
819 | static inline void next_request(int success) | 819 | static inline void next_request(int err) |
820 | { | 820 | { |
821 | unsigned long saved_flags; | 821 | unsigned long saved_flags; |
822 | 822 | ||
823 | spin_lock_irqsave(&pf_spin_lock, saved_flags); | 823 | spin_lock_irqsave(&pf_spin_lock, saved_flags); |
824 | pf_end_request(success); | 824 | pf_end_request(err); |
825 | pf_busy = 0; | 825 | pf_busy = 0; |
826 | do_pf_request(pf_queue); | 826 | do_pf_request(pf_queue); |
827 | spin_unlock_irqrestore(&pf_spin_lock, saved_flags); | 827 | spin_unlock_irqrestore(&pf_spin_lock, saved_flags); |
@@ -844,7 +844,7 @@ static void do_pf_read_start(void) | |||
844 | pi_do_claimed(pf_current->pi, do_pf_read_start); | 844 | pi_do_claimed(pf_current->pi, do_pf_read_start); |
845 | return; | 845 | return; |
846 | } | 846 | } |
847 | next_request(0); | 847 | next_request(-EIO); |
848 | return; | 848 | return; |
849 | } | 849 | } |
850 | pf_mask = STAT_DRQ; | 850 | pf_mask = STAT_DRQ; |
@@ -863,7 +863,7 @@ static void do_pf_read_drq(void) | |||
863 | pi_do_claimed(pf_current->pi, do_pf_read_start); | 863 | pi_do_claimed(pf_current->pi, do_pf_read_start); |
864 | return; | 864 | return; |
865 | } | 865 | } |
866 | next_request(0); | 866 | next_request(-EIO); |
867 | return; | 867 | return; |
868 | } | 868 | } |
869 | pi_read_block(pf_current->pi, pf_buf, 512); | 869 | pi_read_block(pf_current->pi, pf_buf, 512); |
@@ -871,7 +871,7 @@ static void do_pf_read_drq(void) | |||
871 | break; | 871 | break; |
872 | } | 872 | } |
873 | pi_disconnect(pf_current->pi); | 873 | pi_disconnect(pf_current->pi); |
874 | next_request(1); | 874 | next_request(0); |
875 | } | 875 | } |
876 | 876 | ||
877 | static void do_pf_write(void) | 877 | static void do_pf_write(void) |
@@ -890,7 +890,7 @@ static void do_pf_write_start(void) | |||
890 | pi_do_claimed(pf_current->pi, do_pf_write_start); | 890 | pi_do_claimed(pf_current->pi, do_pf_write_start); |
891 | return; | 891 | return; |
892 | } | 892 | } |
893 | next_request(0); | 893 | next_request(-EIO); |
894 | return; | 894 | return; |
895 | } | 895 | } |
896 | 896 | ||
@@ -903,7 +903,7 @@ static void do_pf_write_start(void) | |||
903 | pi_do_claimed(pf_current->pi, do_pf_write_start); | 903 | pi_do_claimed(pf_current->pi, do_pf_write_start); |
904 | return; | 904 | return; |
905 | } | 905 | } |
906 | next_request(0); | 906 | next_request(-EIO); |
907 | return; | 907 | return; |
908 | } | 908 | } |
909 | pi_write_block(pf_current->pi, pf_buf, 512); | 909 | pi_write_block(pf_current->pi, pf_buf, 512); |
@@ -923,11 +923,11 @@ static void do_pf_write_done(void) | |||
923 | pi_do_claimed(pf_current->pi, do_pf_write_start); | 923 | pi_do_claimed(pf_current->pi, do_pf_write_start); |
924 | return; | 924 | return; |
925 | } | 925 | } |
926 | next_request(0); | 926 | next_request(-EIO); |
927 | return; | 927 | return; |
928 | } | 928 | } |
929 | pi_disconnect(pf_current->pi); | 929 | pi_disconnect(pf_current->pi); |
930 | next_request(1); | 930 | next_request(0); |
931 | } | 931 | } |
932 | 932 | ||
933 | static int __init pf_init(void) | 933 | static int __init pf_init(void) |