Commit 20dc9f01 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'sg' of git://git.kernel.dk/linux-2.6-block

* 'sg' of git://git.kernel.dk/linux-2.6-block:
  Correction of "Update drivers to use sg helpers" patch for IMXMMC driver
  sg_init_table() should use unsigned loop index variable
  sg_last() should use unsigned loop index variable
  Initialise scatter/gather list in sg driver
  Initialise scatter/gather list in ata_sg_setup
  x86: fix pci-gart failure handling
  SG: s390-scsi: missing size parameter in zfcp_address_to_sg()
  SG: clear termination bit in sg_chain()
parents 93400708 e1efa2a3
...@@ -435,7 +435,7 @@ static int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, ...@@ -435,7 +435,7 @@ static int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents,
error: error:
flush_gart(); flush_gart();
gart_unmap_sg(dev, sg, nents, dir); gart_unmap_sg(dev, sg, out, dir);
/* When it was forced or merged try again in a dumb way */ /* When it was forced or merged try again in a dumb way */
if (force_iommu || iommu_merge) { if (force_iommu || iommu_merge) {
out = dma_map_sg_nonforce(dev, sg, nents, dir); out = dma_map_sg_nonforce(dev, sg, nents, dir);
......
...@@ -4689,6 +4689,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc) ...@@ -4689,6 +4689,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
* data in this function or read data in ata_sg_clean. * data in this function or read data in ata_sg_clean.
*/ */
offset = lsg->offset + lsg->length - qc->pad_len; offset = lsg->offset + lsg->length - qc->pad_len;
sg_init_table(psg, 1);
sg_set_page(psg, nth_page(sg_page(lsg), offset >> PAGE_SHIFT), sg_set_page(psg, nth_page(sg_page(lsg), offset >> PAGE_SHIFT),
qc->pad_len, offset_in_page(offset)); qc->pad_len, offset_in_page(offset));
......
...@@ -262,7 +262,7 @@ static void imxmci_setup_data(struct imxmci_host *host, struct mmc_data *data) ...@@ -262,7 +262,7 @@ static void imxmci_setup_data(struct imxmci_host *host, struct mmc_data *data)
} }
/* Convert back to virtual address */ /* Convert back to virtual address */
host->data_ptr = (u16*)sg_virt(sg); host->data_ptr = (u16*)sg_virt(data->sg);
host->data_cnt = 0; host->data_cnt = 0;
clear_bit(IMXMCI_PEND_DMA_DATA_b, &host->pending_events); clear_bit(IMXMCI_PEND_DMA_DATA_b, &host->pending_events);
......
...@@ -70,11 +70,12 @@ zfcp_sg_to_address(struct scatterlist *list) ...@@ -70,11 +70,12 @@ zfcp_sg_to_address(struct scatterlist *list)
* zfcp_address_to_sg - set up struct scatterlist from kernel address * zfcp_address_to_sg - set up struct scatterlist from kernel address
* @address: kernel address * @address: kernel address
* @list: struct scatterlist * @list: struct scatterlist
* @size: buffer size
*/ */
static inline void static inline void
zfcp_address_to_sg(void *address, struct scatterlist *list) zfcp_address_to_sg(void *address, struct scatterlist *list, unsigned int size)
{ {
sg_set_buf(list, address, 0); sg_set_buf(list, address, size);
} }
#define REQUEST_LIST_SIZE 128 #define REQUEST_LIST_SIZE 128
......
...@@ -1652,6 +1652,7 @@ sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp, int tablesize) ...@@ -1652,6 +1652,7 @@ sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp, int tablesize)
schp->buffer = kzalloc(sg_bufflen, gfp_flags); schp->buffer = kzalloc(sg_bufflen, gfp_flags);
if (!schp->buffer) if (!schp->buffer)
return -ENOMEM; return -ENOMEM;
sg_init_table(schp->buffer, tablesize);
schp->sglist_len = sg_bufflen; schp->sglist_len = sg_bufflen;
return tablesize; /* number of scat_gath elements allocated */ return tablesize; /* number of scat_gath elements allocated */
} }
......
...@@ -150,7 +150,7 @@ static inline struct scatterlist *sg_last(struct scatterlist *sgl, ...@@ -150,7 +150,7 @@ static inline struct scatterlist *sg_last(struct scatterlist *sgl,
struct scatterlist *ret = &sgl[nents - 1]; struct scatterlist *ret = &sgl[nents - 1];
#else #else
struct scatterlist *sg, *ret = NULL; struct scatterlist *sg, *ret = NULL;
int i; unsigned int i;
for_each_sg(sgl, sg, nents, i) for_each_sg(sgl, sg, nents, i)
ret = sg; ret = sg;
...@@ -179,7 +179,11 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents, ...@@ -179,7 +179,11 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
#ifndef ARCH_HAS_SG_CHAIN #ifndef ARCH_HAS_SG_CHAIN
BUG(); BUG();
#endif #endif
prv[prv_nents - 1].page_link = (unsigned long) sgl | 0x01; /*
* Set lowest bit to indicate a link pointer, and make sure to clear
* the termination bit if it happens to be set.
*/
prv[prv_nents - 1].page_link = ((unsigned long) sgl | 0x01) & ~0x02;
} }
/** /**
...@@ -239,7 +243,7 @@ static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents) ...@@ -239,7 +243,7 @@ static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
sg_mark_end(sgl, nents); sg_mark_end(sgl, nents);
#ifdef CONFIG_DEBUG_SG #ifdef CONFIG_DEBUG_SG
{ {
int i; unsigned int i;
for (i = 0; i < nents; i++) for (i = 0; i < nents; i++)
sgl[i].sg_magic = SG_MAGIC; sgl[i].sg_magic = SG_MAGIC;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment