Skip to content

Commit

Permalink
Merge branch 'sg' of git://git.kernel.dk/linux-2.6-block
Browse files Browse the repository at this point in the history
* '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()
  • Loading branch information
Linus Torvalds committed Oct 29, 2007
2 parents 9340070 + e1efa2a commit 20dc9f0
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion arch/x86/kernel/pci-gart_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ static int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents,

error:
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 */
if (force_iommu || iommu_merge) {
out = dma_map_sg_nonforce(dev, sg, nents, dir);
Expand Down
1 change: 1 addition & 0 deletions drivers/ata/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
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),
qc->pad_len, offset_in_page(offset));

Expand Down
2 changes: 1 addition & 1 deletion drivers/mmc/host/imxmmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ static void imxmci_setup_data(struct imxmci_host *host, struct mmc_data *data)
}

/* Convert back to virtual address */
host->data_ptr = (u16*)sg_virt(sg);
host->data_ptr = (u16*)sg_virt(data->sg);
host->data_cnt = 0;

clear_bit(IMXMCI_PEND_DMA_DATA_b, &host->pending_events);
Expand Down
5 changes: 3 additions & 2 deletions drivers/s390/scsi/zfcp_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ zfcp_sg_to_address(struct scatterlist *list)
* zfcp_address_to_sg - set up struct scatterlist from kernel address
* @address: kernel address
* @list: struct scatterlist
* @size: buffer size
*/
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
Expand Down
1 change: 1 addition & 0 deletions drivers/scsi/sg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1652,6 +1652,7 @@ sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp, int tablesize)
schp->buffer = kzalloc(sg_bufflen, gfp_flags);
if (!schp->buffer)
return -ENOMEM;
sg_init_table(schp->buffer, tablesize);
schp->sglist_len = sg_bufflen;
return tablesize; /* number of scat_gath elements allocated */
}
Expand Down
10 changes: 7 additions & 3 deletions include/linux/scatterlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ static inline struct scatterlist *sg_last(struct scatterlist *sgl,
struct scatterlist *ret = &sgl[nents - 1];
#else
struct scatterlist *sg, *ret = NULL;
int i;
unsigned int i;

for_each_sg(sgl, sg, nents, i)
ret = sg;
Expand Down Expand Up @@ -179,7 +179,11 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
#ifndef ARCH_HAS_SG_CHAIN
BUG();
#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;
}

/**
Expand Down Expand Up @@ -239,7 +243,7 @@ static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
sg_mark_end(sgl, nents);
#ifdef CONFIG_DEBUG_SG
{
int i;
unsigned int i;
for (i = 0; i < nents; i++)
sgl[i].sg_magic = SG_MAGIC;
}
Expand Down

0 comments on commit 20dc9f0

Please sign in to comment.