diff options
author | Sebastian Andrzej Siewior <sebastian@breakpoint.cc> | 2009-06-22 03:18:05 -0400 |
---|---|---|
committer | Pierre Ossman <pierre@ossman.eu> | 2009-07-31 06:28:46 -0400 |
commit | 4b2a108cd0d34880fe9d932258ca5b2ccebcd05e (patch) | |
tree | ce41850f6b9a738804cc8d811f74f3a09bc954f4 | |
parent | da60a91d012bcb10bc5bcd86d585c4281742832c (diff) |
cb710: use SG_MITER_TO_SG/SG_MITER_FROM_SG
the code allready uses flush_kernel_dcache_page(). This patch updates the
driver to the recent sg API changes which require that either SG_MITER_TO_SG
or SG_MITER_FROM_SG is set. SG_MITER_TO_SG calls flush_kernel_dcache_page()
in sg_mitter_stop()
Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Acked-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Pierre Ossman <pierre@ossman.eu>
-rw-r--r-- | drivers/misc/cb710/sgbuf2.c | 4 | ||||
-rw-r--r-- | drivers/mmc/host/cb710-mmc.c | 6 | ||||
-rw-r--r-- | include/linux/cb710.h | 29 |
3 files changed, 6 insertions, 33 deletions
diff --git a/drivers/misc/cb710/sgbuf2.c b/drivers/misc/cb710/sgbuf2.c index d38a7acdb6ec..d019746551f3 100644 --- a/drivers/misc/cb710/sgbuf2.c +++ b/drivers/misc/cb710/sgbuf2.c | |||
@@ -114,7 +114,6 @@ static void sg_dwiter_write_slow(struct sg_mapping_iter *miter, uint32_t data) | |||
114 | if (!left) | 114 | if (!left) |
115 | return; | 115 | return; |
116 | addr += len; | 116 | addr += len; |
117 | flush_kernel_dcache_page(miter->page); | ||
118 | } while (sg_dwiter_next(miter)); | 117 | } while (sg_dwiter_next(miter)); |
119 | } | 118 | } |
120 | 119 | ||
@@ -142,9 +141,6 @@ void cb710_sg_dwiter_write_next_block(struct sg_mapping_iter *miter, uint32_t da | |||
142 | return; | 141 | return; |
143 | } else | 142 | } else |
144 | sg_dwiter_write_slow(miter, data); | 143 | sg_dwiter_write_slow(miter, data); |
145 | |||
146 | if (miter->length == miter->consumed) | ||
147 | flush_kernel_dcache_page(miter->page); | ||
148 | } | 144 | } |
149 | EXPORT_SYMBOL_GPL(cb710_sg_dwiter_write_next_block); | 145 | EXPORT_SYMBOL_GPL(cb710_sg_dwiter_write_next_block); |
150 | 146 | ||
diff --git a/drivers/mmc/host/cb710-mmc.c b/drivers/mmc/host/cb710-mmc.c index 11efefb1af51..4e72964a7b43 100644 --- a/drivers/mmc/host/cb710-mmc.c +++ b/drivers/mmc/host/cb710-mmc.c | |||
@@ -278,7 +278,7 @@ static int cb710_mmc_receive(struct cb710_slot *slot, struct mmc_data *data) | |||
278 | if (unlikely(data->blksz & 15 && (data->blocks != 1 || data->blksz != 8))) | 278 | if (unlikely(data->blksz & 15 && (data->blocks != 1 || data->blksz != 8))) |
279 | return -EINVAL; | 279 | return -EINVAL; |
280 | 280 | ||
281 | sg_miter_start(&miter, data->sg, data->sg_len, 0); | 281 | sg_miter_start(&miter, data->sg, data->sg_len, SG_MITER_TO_SG); |
282 | 282 | ||
283 | cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT, | 283 | cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT, |
284 | 15, CB710_MMC_C2_READ_PIO_SIZE_MASK); | 284 | 15, CB710_MMC_C2_READ_PIO_SIZE_MASK); |
@@ -307,7 +307,7 @@ static int cb710_mmc_receive(struct cb710_slot *slot, struct mmc_data *data) | |||
307 | goto out; | 307 | goto out; |
308 | } | 308 | } |
309 | out: | 309 | out: |
310 | cb710_sg_miter_stop_writing(&miter); | 310 | sg_miter_stop(&miter); |
311 | return err; | 311 | return err; |
312 | } | 312 | } |
313 | 313 | ||
@@ -322,7 +322,7 @@ static int cb710_mmc_send(struct cb710_slot *slot, struct mmc_data *data) | |||
322 | if (unlikely(data->blocks > 1 && data->blksz & 15)) | 322 | if (unlikely(data->blocks > 1 && data->blksz & 15)) |
323 | return -EINVAL; | 323 | return -EINVAL; |
324 | 324 | ||
325 | sg_miter_start(&miter, data->sg, data->sg_len, 0); | 325 | sg_miter_start(&miter, data->sg, data->sg_len, SG_MITER_FROM_SG); |
326 | 326 | ||
327 | cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT, | 327 | cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT, |
328 | 0, CB710_MMC_C2_READ_PIO_SIZE_MASK); | 328 | 0, CB710_MMC_C2_READ_PIO_SIZE_MASK); |
diff --git a/include/linux/cb710.h b/include/linux/cb710.h index 63bc9a4d2926..8cc10411bab2 100644 --- a/include/linux/cb710.h +++ b/include/linux/cb710.h | |||
@@ -140,29 +140,6 @@ void cb710_dump_regs(struct cb710_chip *chip, unsigned dump); | |||
140 | #include <linux/highmem.h> | 140 | #include <linux/highmem.h> |
141 | #include <linux/scatterlist.h> | 141 | #include <linux/scatterlist.h> |
142 | 142 | ||
143 | /** | ||
144 | * cb710_sg_miter_stop_writing - stop mapping iteration after writing | ||
145 | * @miter: sg mapping iter to be stopped | ||
146 | * | ||
147 | * Description: | ||
148 | * Stops mapping iterator @miter. @miter should have been started | ||
149 | * started using sg_miter_start(). A stopped iteration can be | ||
150 | * resumed by calling sg_miter_next() on it. This is useful when | ||
151 | * resources (kmap) need to be released during iteration. | ||
152 | * | ||
153 | * This is a convenience wrapper that will be optimized out for arches | ||
154 | * that don't need flush_kernel_dcache_page(). | ||
155 | * | ||
156 | * Context: | ||
157 | * IRQ disabled if the SG_MITER_ATOMIC is set. Don't care otherwise. | ||
158 | */ | ||
159 | static inline void cb710_sg_miter_stop_writing(struct sg_mapping_iter *miter) | ||
160 | { | ||
161 | if (miter->page) | ||
162 | flush_kernel_dcache_page(miter->page); | ||
163 | sg_miter_stop(miter); | ||
164 | } | ||
165 | |||
166 | /* | 143 | /* |
167 | * 32-bit PIO mapping sg iterator | 144 | * 32-bit PIO mapping sg iterator |
168 | * | 145 | * |
@@ -171,12 +148,12 @@ static inline void cb710_sg_miter_stop_writing(struct sg_mapping_iter *miter) | |||
171 | * without DMA support). | 148 | * without DMA support). |
172 | * | 149 | * |
173 | * Best-case reading (transfer from device): | 150 | * Best-case reading (transfer from device): |
174 | * sg_miter_start(); | 151 | * sg_miter_start(, SG_MITER_TO_SG); |
175 | * cb710_sg_dwiter_write_from_io(); | 152 | * cb710_sg_dwiter_write_from_io(); |
176 | * cb710_sg_miter_stop_writing(); | 153 | * sg_miter_stop(); |
177 | * | 154 | * |
178 | * Best-case writing (transfer to device): | 155 | * Best-case writing (transfer to device): |
179 | * sg_miter_start(); | 156 | * sg_miter_start(, SG_MITER_FROM_SG); |
180 | * cb710_sg_dwiter_read_to_io(); | 157 | * cb710_sg_dwiter_read_to_io(); |
181 | * sg_miter_stop(); | 158 | * sg_miter_stop(); |
182 | */ | 159 | */ |