aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage/alauda.c
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-05-11 06:33:09 -0400
committerJens Axboe <jens.axboe@oracle.com>2007-10-16 05:20:59 -0400
commit1f6f31a03e3aed0854a6aa3ab763c3d3b2ff42ff (patch)
treebdb94c08e0bce7c17f686aabc274a7554718407b /drivers/usb/storage/alauda.c
parent53d412fce05e73dd0b25b0ebfa83c7ee94f16451 (diff)
USB storage: sg chaining support
[PATCH] USB storage: sg chaining support Modify usb_stor_access_xfer_buf() to take a pointer to an sg entry pointer, so we can keep track of that instead of passing around an integer index (which we can't use when dealing with multiple scatterlist arrays). Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/usb/storage/alauda.c')
-rw-r--r--drivers/usb/storage/alauda.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c
index 4d3cbb12b71..8d3711a7ff0 100644
--- a/drivers/usb/storage/alauda.c
+++ b/drivers/usb/storage/alauda.c
@@ -798,12 +798,13 @@ static int alauda_read_data(struct us_data *us, unsigned long address,
798{ 798{
799 unsigned char *buffer; 799 unsigned char *buffer;
800 u16 lba, max_lba; 800 u16 lba, max_lba;
801 unsigned int page, len, index, offset; 801 unsigned int page, len, offset;
802 unsigned int blockshift = MEDIA_INFO(us).blockshift; 802 unsigned int blockshift = MEDIA_INFO(us).blockshift;
803 unsigned int pageshift = MEDIA_INFO(us).pageshift; 803 unsigned int pageshift = MEDIA_INFO(us).pageshift;
804 unsigned int blocksize = MEDIA_INFO(us).blocksize; 804 unsigned int blocksize = MEDIA_INFO(us).blocksize;
805 unsigned int pagesize = MEDIA_INFO(us).pagesize; 805 unsigned int pagesize = MEDIA_INFO(us).pagesize;
806 unsigned int uzonesize = MEDIA_INFO(us).uzonesize; 806 unsigned int uzonesize = MEDIA_INFO(us).uzonesize;
807 struct scatterlist *sg;
807 int result; 808 int result;
808 809
809 /* 810 /*
@@ -827,7 +828,8 @@ static int alauda_read_data(struct us_data *us, unsigned long address,
827 max_lba = MEDIA_INFO(us).capacity >> (blockshift + pageshift); 828 max_lba = MEDIA_INFO(us).capacity >> (blockshift + pageshift);
828 829
829 result = USB_STOR_TRANSPORT_GOOD; 830 result = USB_STOR_TRANSPORT_GOOD;
830 index = offset = 0; 831 offset = 0;
832 sg = NULL;
831 833
832 while (sectors > 0) { 834 while (sectors > 0) {
833 unsigned int zone = lba / uzonesize; /* integer division */ 835 unsigned int zone = lba / uzonesize; /* integer division */
@@ -873,7 +875,7 @@ static int alauda_read_data(struct us_data *us, unsigned long address,
873 875
874 /* Store the data in the transfer buffer */ 876 /* Store the data in the transfer buffer */
875 usb_stor_access_xfer_buf(buffer, len, us->srb, 877 usb_stor_access_xfer_buf(buffer, len, us->srb,
876 &index, &offset, TO_XFER_BUF); 878 &sg, &offset, TO_XFER_BUF);
877 879
878 page = 0; 880 page = 0;
879 lba++; 881 lba++;
@@ -891,11 +893,12 @@ static int alauda_write_data(struct us_data *us, unsigned long address,
891 unsigned int sectors) 893 unsigned int sectors)
892{ 894{
893 unsigned char *buffer, *blockbuffer; 895 unsigned char *buffer, *blockbuffer;
894 unsigned int page, len, index, offset; 896 unsigned int page, len, offset;
895 unsigned int blockshift = MEDIA_INFO(us).blockshift; 897 unsigned int blockshift = MEDIA_INFO(us).blockshift;
896 unsigned int pageshift = MEDIA_INFO(us).pageshift; 898 unsigned int pageshift = MEDIA_INFO(us).pageshift;
897 unsigned int blocksize = MEDIA_INFO(us).blocksize; 899 unsigned int blocksize = MEDIA_INFO(us).blocksize;
898 unsigned int pagesize = MEDIA_INFO(us).pagesize; 900 unsigned int pagesize = MEDIA_INFO(us).pagesize;
901 struct scatterlist *sg;
899 u16 lba, max_lba; 902 u16 lba, max_lba;
900 int result; 903 int result;
901 904
@@ -929,7 +932,8 @@ static int alauda_write_data(struct us_data *us, unsigned long address,
929 max_lba = MEDIA_INFO(us).capacity >> (pageshift + blockshift); 932 max_lba = MEDIA_INFO(us).capacity >> (pageshift + blockshift);
930 933
931 result = USB_STOR_TRANSPORT_GOOD; 934 result = USB_STOR_TRANSPORT_GOOD;
932 index = offset = 0; 935 offset = 0;
936 sg = NULL;
933 937
934 while (sectors > 0) { 938 while (sectors > 0) {
935 /* Write as many sectors as possible in this block */ 939 /* Write as many sectors as possible in this block */
@@ -946,7 +950,7 @@ static int alauda_write_data(struct us_data *us, unsigned long address,
946 950
947 /* Get the data from the transfer buffer */ 951 /* Get the data from the transfer buffer */
948 usb_stor_access_xfer_buf(buffer, len, us->srb, 952 usb_stor_access_xfer_buf(buffer, len, us->srb,
949 &index, &offset, FROM_XFER_BUF); 953 &sg, &offset, FROM_XFER_BUF);
950 954
951 result = alauda_write_lba(us, lba, page, pages, buffer, 955 result = alauda_write_lba(us, lba, page, pages, buffer,
952 blockbuffer); 956 blockbuffer);