Loading drivers/mmc/wbsd.c +10 −30 Original line number Original line Diff line number Diff line Loading @@ -272,16 +272,9 @@ static inline int wbsd_next_sg(struct wbsd_host *host) return host->num_sg; return host->num_sg; } } static inline char *wbsd_kmap_sg(struct wbsd_host *host) static inline char *wbsd_sg_to_buffer(struct wbsd_host *host) { { host->mapped_sg = kmap_atomic(host->cur_sg->page, KM_BIO_SRC_IRQ) + return page_address(host->cur_sg->page) + host->cur_sg->offset; host->cur_sg->offset; return host->mapped_sg; } static inline void wbsd_kunmap_sg(struct wbsd_host *host) { kunmap_atomic(host->mapped_sg, KM_BIO_SRC_IRQ); } } static inline void wbsd_sg_to_dma(struct wbsd_host *host, struct mmc_data *data) static inline void wbsd_sg_to_dma(struct wbsd_host *host, struct mmc_data *data) Loading @@ -302,12 +295,11 @@ static inline void wbsd_sg_to_dma(struct wbsd_host *host, struct mmc_data *data) * we do not transfer too much. * we do not transfer too much. */ */ for (i = 0; i < len; i++) { for (i = 0; i < len; i++) { sgbuf = kmap_atomic(sg[i].page, KM_BIO_SRC_IRQ) + sg[i].offset; sgbuf = page_address(sg[i].page) + sg[i].offset; if (size < sg[i].length) if (size < sg[i].length) memcpy(dmabuf, sgbuf, size); memcpy(dmabuf, sgbuf, size); else else memcpy(dmabuf, sgbuf, sg[i].length); memcpy(dmabuf, sgbuf, sg[i].length); kunmap_atomic(sgbuf, KM_BIO_SRC_IRQ); dmabuf += sg[i].length; dmabuf += sg[i].length; if (size < sg[i].length) if (size < sg[i].length) Loading Loading @@ -347,7 +339,7 @@ static inline void wbsd_dma_to_sg(struct wbsd_host *host, struct mmc_data *data) * we do not transfer too much. * we do not transfer too much. */ */ for (i = 0; i < len; i++) { for (i = 0; i < len; i++) { sgbuf = kmap_atomic(sg[i].page, KM_BIO_SRC_IRQ) + sg[i].offset; sgbuf = page_address(sg[i].page) + sg[i].offset; if (size < sg[i].length) if (size < sg[i].length) memcpy(sgbuf, dmabuf, size); memcpy(sgbuf, dmabuf, size); else else Loading Loading @@ -497,7 +489,7 @@ static void wbsd_empty_fifo(struct wbsd_host *host) if (data->bytes_xfered == host->size) if (data->bytes_xfered == host->size) return; return; buffer = wbsd_kmap_sg(host) + host->offset; buffer = wbsd_sg_to_buffer(host) + host->offset; /* /* * Drain the fifo. This has a tendency to loop longer * Drain the fifo. This has a tendency to loop longer Loading Loading @@ -526,17 +518,13 @@ static void wbsd_empty_fifo(struct wbsd_host *host) /* /* * Transfer done? * Transfer done? */ */ if (data->bytes_xfered == host->size) { if (data->bytes_xfered == host->size) wbsd_kunmap_sg(host); return; return; } /* /* * End of scatter list entry? * End of scatter list entry? */ */ if (host->remain == 0) { if (host->remain == 0) { wbsd_kunmap_sg(host); /* /* * Get next entry. Check if last. * Get next entry. Check if last. */ */ Loading @@ -554,13 +542,11 @@ static void wbsd_empty_fifo(struct wbsd_host *host) return; return; } } buffer = wbsd_kmap_sg(host); buffer = wbsd_sg_to_buffer(host); } } } } } } wbsd_kunmap_sg(host); /* /* * This is a very dirty hack to solve a * This is a very dirty hack to solve a * hardware problem. The chip doesn't trigger * hardware problem. The chip doesn't trigger Loading @@ -583,7 +569,7 @@ static void wbsd_fill_fifo(struct wbsd_host *host) if (data->bytes_xfered == host->size) if (data->bytes_xfered == host->size) return; return; buffer = wbsd_kmap_sg(host) + host->offset; buffer = wbsd_sg_to_buffer(host) + host->offset; /* /* * Fill the fifo. This has a tendency to loop longer * Fill the fifo. This has a tendency to loop longer Loading Loading @@ -612,17 +598,13 @@ static void wbsd_fill_fifo(struct wbsd_host *host) /* /* * Transfer done? * Transfer done? */ */ if (data->bytes_xfered == host->size) { if (data->bytes_xfered == host->size) wbsd_kunmap_sg(host); return; return; } /* /* * End of scatter list entry? * End of scatter list entry? */ */ if (host->remain == 0) { if (host->remain == 0) { wbsd_kunmap_sg(host); /* /* * Get next entry. Check if last. * Get next entry. Check if last. */ */ Loading @@ -640,13 +622,11 @@ static void wbsd_fill_fifo(struct wbsd_host *host) return; return; } } buffer = wbsd_kmap_sg(host); buffer = wbsd_sg_to_buffer(host); } } } } } } wbsd_kunmap_sg(host); /* /* * The controller stops sending interrupts for * The controller stops sending interrupts for * 'FIFO empty' under certain conditions. So we * 'FIFO empty' under certain conditions. So we Loading drivers/mmc/wbsd.h +0 −1 Original line number Original line Diff line number Diff line Loading @@ -154,7 +154,6 @@ struct wbsd_host struct scatterlist* cur_sg; /* Current SG entry */ struct scatterlist* cur_sg; /* Current SG entry */ unsigned int num_sg; /* Number of entries left */ unsigned int num_sg; /* Number of entries left */ void* mapped_sg; /* vaddr of mapped sg */ unsigned int offset; /* Offset into current entry */ unsigned int offset; /* Offset into current entry */ unsigned int remain; /* Data left in curren entry */ unsigned int remain; /* Data left in curren entry */ Loading Loading
drivers/mmc/wbsd.c +10 −30 Original line number Original line Diff line number Diff line Loading @@ -272,16 +272,9 @@ static inline int wbsd_next_sg(struct wbsd_host *host) return host->num_sg; return host->num_sg; } } static inline char *wbsd_kmap_sg(struct wbsd_host *host) static inline char *wbsd_sg_to_buffer(struct wbsd_host *host) { { host->mapped_sg = kmap_atomic(host->cur_sg->page, KM_BIO_SRC_IRQ) + return page_address(host->cur_sg->page) + host->cur_sg->offset; host->cur_sg->offset; return host->mapped_sg; } static inline void wbsd_kunmap_sg(struct wbsd_host *host) { kunmap_atomic(host->mapped_sg, KM_BIO_SRC_IRQ); } } static inline void wbsd_sg_to_dma(struct wbsd_host *host, struct mmc_data *data) static inline void wbsd_sg_to_dma(struct wbsd_host *host, struct mmc_data *data) Loading @@ -302,12 +295,11 @@ static inline void wbsd_sg_to_dma(struct wbsd_host *host, struct mmc_data *data) * we do not transfer too much. * we do not transfer too much. */ */ for (i = 0; i < len; i++) { for (i = 0; i < len; i++) { sgbuf = kmap_atomic(sg[i].page, KM_BIO_SRC_IRQ) + sg[i].offset; sgbuf = page_address(sg[i].page) + sg[i].offset; if (size < sg[i].length) if (size < sg[i].length) memcpy(dmabuf, sgbuf, size); memcpy(dmabuf, sgbuf, size); else else memcpy(dmabuf, sgbuf, sg[i].length); memcpy(dmabuf, sgbuf, sg[i].length); kunmap_atomic(sgbuf, KM_BIO_SRC_IRQ); dmabuf += sg[i].length; dmabuf += sg[i].length; if (size < sg[i].length) if (size < sg[i].length) Loading Loading @@ -347,7 +339,7 @@ static inline void wbsd_dma_to_sg(struct wbsd_host *host, struct mmc_data *data) * we do not transfer too much. * we do not transfer too much. */ */ for (i = 0; i < len; i++) { for (i = 0; i < len; i++) { sgbuf = kmap_atomic(sg[i].page, KM_BIO_SRC_IRQ) + sg[i].offset; sgbuf = page_address(sg[i].page) + sg[i].offset; if (size < sg[i].length) if (size < sg[i].length) memcpy(sgbuf, dmabuf, size); memcpy(sgbuf, dmabuf, size); else else Loading Loading @@ -497,7 +489,7 @@ static void wbsd_empty_fifo(struct wbsd_host *host) if (data->bytes_xfered == host->size) if (data->bytes_xfered == host->size) return; return; buffer = wbsd_kmap_sg(host) + host->offset; buffer = wbsd_sg_to_buffer(host) + host->offset; /* /* * Drain the fifo. This has a tendency to loop longer * Drain the fifo. This has a tendency to loop longer Loading Loading @@ -526,17 +518,13 @@ static void wbsd_empty_fifo(struct wbsd_host *host) /* /* * Transfer done? * Transfer done? */ */ if (data->bytes_xfered == host->size) { if (data->bytes_xfered == host->size) wbsd_kunmap_sg(host); return; return; } /* /* * End of scatter list entry? * End of scatter list entry? */ */ if (host->remain == 0) { if (host->remain == 0) { wbsd_kunmap_sg(host); /* /* * Get next entry. Check if last. * Get next entry. Check if last. */ */ Loading @@ -554,13 +542,11 @@ static void wbsd_empty_fifo(struct wbsd_host *host) return; return; } } buffer = wbsd_kmap_sg(host); buffer = wbsd_sg_to_buffer(host); } } } } } } wbsd_kunmap_sg(host); /* /* * This is a very dirty hack to solve a * This is a very dirty hack to solve a * hardware problem. The chip doesn't trigger * hardware problem. The chip doesn't trigger Loading @@ -583,7 +569,7 @@ static void wbsd_fill_fifo(struct wbsd_host *host) if (data->bytes_xfered == host->size) if (data->bytes_xfered == host->size) return; return; buffer = wbsd_kmap_sg(host) + host->offset; buffer = wbsd_sg_to_buffer(host) + host->offset; /* /* * Fill the fifo. This has a tendency to loop longer * Fill the fifo. This has a tendency to loop longer Loading Loading @@ -612,17 +598,13 @@ static void wbsd_fill_fifo(struct wbsd_host *host) /* /* * Transfer done? * Transfer done? */ */ if (data->bytes_xfered == host->size) { if (data->bytes_xfered == host->size) wbsd_kunmap_sg(host); return; return; } /* /* * End of scatter list entry? * End of scatter list entry? */ */ if (host->remain == 0) { if (host->remain == 0) { wbsd_kunmap_sg(host); /* /* * Get next entry. Check if last. * Get next entry. Check if last. */ */ Loading @@ -640,13 +622,11 @@ static void wbsd_fill_fifo(struct wbsd_host *host) return; return; } } buffer = wbsd_kmap_sg(host); buffer = wbsd_sg_to_buffer(host); } } } } } } wbsd_kunmap_sg(host); /* /* * The controller stops sending interrupts for * The controller stops sending interrupts for * 'FIFO empty' under certain conditions. So we * 'FIFO empty' under certain conditions. So we Loading
drivers/mmc/wbsd.h +0 −1 Original line number Original line Diff line number Diff line Loading @@ -154,7 +154,6 @@ struct wbsd_host struct scatterlist* cur_sg; /* Current SG entry */ struct scatterlist* cur_sg; /* Current SG entry */ unsigned int num_sg; /* Number of entries left */ unsigned int num_sg; /* Number of entries left */ void* mapped_sg; /* vaddr of mapped sg */ unsigned int offset; /* Offset into current entry */ unsigned int offset; /* Offset into current entry */ unsigned int remain; /* Data left in curren entry */ unsigned int remain; /* Data left in curren entry */ Loading