aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/pci-gart_64.c2
-rw-r--r--drivers/ata/libata-core.c1
-rw-r--r--drivers/mmc/host/imxmmc.c2
-rw-r--r--drivers/s390/scsi/zfcp_def.h5
-rw-r--r--drivers/scsi/sg.c1
-rw-r--r--include/linux/scatterlist.h10
6 files changed, 14 insertions, 7 deletions
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index ae7e0161ce46..79b514b381b1 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -435,7 +435,7 @@ static int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents,
435 435
436error: 436error:
437 flush_gart(); 437 flush_gart();
438 gart_unmap_sg(dev, sg, nents, dir); 438 gart_unmap_sg(dev, sg, out, dir);
439 /* When it was forced or merged try again in a dumb way */ 439 /* When it was forced or merged try again in a dumb way */
440 if (force_iommu || iommu_merge) { 440 if (force_iommu || iommu_merge) {
441 out = dma_map_sg_nonforce(dev, sg, nents, dir); 441 out = dma_map_sg_nonforce(dev, sg, nents, dir);
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 081e3dfb64d4..7ef515b3382d 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4689,6 +4689,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
4689 * data in this function or read data in ata_sg_clean. 4689 * data in this function or read data in ata_sg_clean.
4690 */ 4690 */
4691 offset = lsg->offset + lsg->length - qc->pad_len; 4691 offset = lsg->offset + lsg->length - qc->pad_len;
4692 sg_init_table(psg, 1);
4692 sg_set_page(psg, nth_page(sg_page(lsg), offset >> PAGE_SHIFT), 4693 sg_set_page(psg, nth_page(sg_page(lsg), offset >> PAGE_SHIFT),
4693 qc->pad_len, offset_in_page(offset)); 4694 qc->pad_len, offset_in_page(offset));
4694 4695
diff --git a/drivers/mmc/host/imxmmc.c b/drivers/mmc/host/imxmmc.c
index fc72e1fadb6a..f2070a19cfa7 100644
--- a/drivers/mmc/host/imxmmc.c
+++ b/drivers/mmc/host/imxmmc.c
@@ -262,7 +262,7 @@ static void imxmci_setup_data(struct imxmci_host *host, struct mmc_data *data)
262 } 262 }
263 263
264 /* Convert back to virtual address */ 264 /* Convert back to virtual address */
265 host->data_ptr = (u16*)sg_virt(sg); 265 host->data_ptr = (u16*)sg_virt(data->sg);
266 host->data_cnt = 0; 266 host->data_cnt = 0;
267 267
268 clear_bit(IMXMCI_PEND_DMA_DATA_b, &host->pending_events); 268 clear_bit(IMXMCI_PEND_DMA_DATA_b, &host->pending_events);
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 0754542978b6..e268f79bdbd2 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -70,11 +70,12 @@ zfcp_sg_to_address(struct scatterlist *list)
70 * zfcp_address_to_sg - set up struct scatterlist from kernel address 70 * zfcp_address_to_sg - set up struct scatterlist from kernel address
71 * @address: kernel address 71 * @address: kernel address
72 * @list: struct scatterlist 72 * @list: struct scatterlist
73 * @size: buffer size
73 */ 74 */
74static inline void 75static inline void
75zfcp_address_to_sg(void *address, struct scatterlist *list) 76zfcp_address_to_sg(void *address, struct scatterlist *list, unsigned int size)
76{ 77{
77 sg_set_buf(list, address, 0); 78 sg_set_buf(list, address, size);
78} 79}
79 80
80#define REQUEST_LIST_SIZE 128 81#define REQUEST_LIST_SIZE 128
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index b5fa4f091387..f1871ea04045 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1652,6 +1652,7 @@ sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp, int tablesize)
1652 schp->buffer = kzalloc(sg_bufflen, gfp_flags); 1652 schp->buffer = kzalloc(sg_bufflen, gfp_flags);
1653 if (!schp->buffer) 1653 if (!schp->buffer)
1654 return -ENOMEM; 1654 return -ENOMEM;
1655 sg_init_table(schp->buffer, tablesize);
1655 schp->sglist_len = sg_bufflen; 1656 schp->sglist_len = sg_bufflen;
1656 return tablesize; /* number of scat_gath elements allocated */ 1657 return tablesize; /* number of scat_gath elements allocated */
1657} 1658}
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 457123171389..32326c293d7b 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -150,7 +150,7 @@ static inline struct scatterlist *sg_last(struct scatterlist *sgl,
150 struct scatterlist *ret = &sgl[nents - 1]; 150 struct scatterlist *ret = &sgl[nents - 1];
151#else 151#else
152 struct scatterlist *sg, *ret = NULL; 152 struct scatterlist *sg, *ret = NULL;
153 int i; 153 unsigned int i;
154 154
155 for_each_sg(sgl, sg, nents, i) 155 for_each_sg(sgl, sg, nents, i)
156 ret = sg; 156 ret = sg;
@@ -179,7 +179,11 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
179#ifndef ARCH_HAS_SG_CHAIN 179#ifndef ARCH_HAS_SG_CHAIN
180 BUG(); 180 BUG();
181#endif 181#endif
182 prv[prv_nents - 1].page_link = (unsigned long) sgl | 0x01; 182 /*
183 * Set lowest bit to indicate a link pointer, and make sure to clear
184 * the termination bit if it happens to be set.
185 */
186 prv[prv_nents - 1].page_link = ((unsigned long) sgl | 0x01) & ~0x02;
183} 187}
184 188
185/** 189/**
@@ -239,7 +243,7 @@ static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
239 sg_mark_end(sgl, nents); 243 sg_mark_end(sgl, nents);
240#ifdef CONFIG_DEBUG_SG 244#ifdef CONFIG_DEBUG_SG
241 { 245 {
242 int i; 246 unsigned int i;
243 for (i = 0; i < nents; i++) 247 for (i = 0; i < nents; i++)
244 sgl[i].sg_magic = SG_MAGIC; 248 sgl[i].sg_magic = SG_MAGIC;
245 } 249 }