aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/mmci.h
diff options
context:
space:
mode:
authorRabin Vincent <rabin.vincent@stericsson.com>2010-07-21 07:44:58 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-07-27 05:48:44 -0400
commit4ce1d6cbf07271ab8f7cc47c3e27edeac08b58a7 (patch)
treeff2c3397828cda8d8455893f336e497bcdd6cb44 /drivers/mmc/host/mmci.h
parent2c39c9e149f45ec15a6985cb06ec8f6d904bb35e (diff)
ARM: 6237/1: mmci: use sg_miter API to fix multi-page sg handling
The mmci driver's SG list iteration logic assumes that each SG entry spans only one page, and only maps and flushes one page of the sg. This is not a valid assumption. Fix it by converting the driver to the sg_miter API, which correctly handles sgs which span multiple pages. Acked-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/mmc/host/mmci.h')
-rw-r--r--drivers/mmc/host/mmci.h35
1 files changed, 1 insertions, 34 deletions
diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h
index d77062e5e3af..7cb24ab1eecc 100644
--- a/drivers/mmc/host/mmci.h
+++ b/drivers/mmc/host/mmci.h
@@ -171,42 +171,9 @@ struct mmci_host {
171 struct timer_list timer; 171 struct timer_list timer;
172 unsigned int oldstat; 172 unsigned int oldstat;
173 173
174 unsigned int sg_len;
175
176 /* pio stuff */ 174 /* pio stuff */
177 struct scatterlist *sg_ptr; 175 struct sg_mapping_iter sg_miter;
178 unsigned int sg_off;
179 unsigned int size; 176 unsigned int size;
180 struct regulator *vcc; 177 struct regulator *vcc;
181}; 178};
182 179
183static inline void mmci_init_sg(struct mmci_host *host, struct mmc_data *data)
184{
185 /*
186 * Ideally, we want the higher levels to pass us a scatter list.
187 */
188 host->sg_len = data->sg_len;
189 host->sg_ptr = data->sg;
190 host->sg_off = 0;
191}
192
193static inline int mmci_next_sg(struct mmci_host *host)
194{
195 host->sg_ptr++;
196 host->sg_off = 0;
197 return --host->sg_len;
198}
199
200static inline char *mmci_kmap_atomic(struct mmci_host *host, unsigned long *flags)
201{
202 struct scatterlist *sg = host->sg_ptr;
203
204 local_irq_save(*flags);
205 return kmap_atomic(sg_page(sg), KM_BIO_SRC_IRQ) + sg->offset;
206}
207
208static inline void mmci_kunmap_atomic(struct mmci_host *host, void *buffer, unsigned long *flags)
209{
210 kunmap_atomic(buffer, KM_BIO_SRC_IRQ);
211 local_irq_restore(*flags);
212}