aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2007-02-02 12:27:42 -0500
committerPierre Ossman <drzeus@drzeus.cx>2007-02-04 14:54:12 -0500
commit2a22b14edfdf1dce303ec48bb934a6a2edb278b5 (patch)
treee0e3a9704358297ed1fa8394af83faded7718733 /drivers
parent4a0ddbd25ad4e03a0a1657f5cb2259c9a35fe9e6 (diff)
mmc: sdhci: replace kmap with page_address
Since we actively avoid highmem, calling kmap_atomic() instead of page_address() is effectively only obfuscation. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/sdhci.c24
-rw-r--r--drivers/mmc/sdhci.h1
2 files changed, 6 insertions, 19 deletions
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index b57393c7f9b5..24803538570a 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -206,15 +206,9 @@ static void sdhci_deactivate_led(struct sdhci_host *host)
206 * * 206 * *
207\*****************************************************************************/ 207\*****************************************************************************/
208 208
209static inline char* sdhci_kmap_sg(struct sdhci_host* host) 209static inline char* sdhci_sg_to_buffer(struct sdhci_host* host)
210{ 210{
211 host->mapped_sg = kmap_atomic(host->cur_sg->page, KM_BIO_SRC_IRQ); 211 return page_address(host->cur_sg->page) + host->cur_sg->offset;
212 return host->mapped_sg + host->cur_sg->offset;
213}
214
215static inline void sdhci_kunmap_sg(struct sdhci_host* host)
216{
217 kunmap_atomic(host->mapped_sg, KM_BIO_SRC_IRQ);
218} 212}
219 213
220static inline int sdhci_next_sg(struct sdhci_host* host) 214static inline int sdhci_next_sg(struct sdhci_host* host)
@@ -249,7 +243,7 @@ static void sdhci_read_block_pio(struct sdhci_host *host)
249 chunk_remain = 0; 243 chunk_remain = 0;
250 data = 0; 244 data = 0;
251 245
252 buffer = sdhci_kmap_sg(host) + host->offset; 246 buffer = sdhci_sg_to_buffer(host) + host->offset;
253 247
254 while (blksize) { 248 while (blksize) {
255 if (chunk_remain == 0) { 249 if (chunk_remain == 0) {
@@ -273,16 +267,13 @@ static void sdhci_read_block_pio(struct sdhci_host *host)
273 } 267 }
274 268
275 if (host->remain == 0) { 269 if (host->remain == 0) {
276 sdhci_kunmap_sg(host);
277 if (sdhci_next_sg(host) == 0) { 270 if (sdhci_next_sg(host) == 0) {
278 BUG_ON(blksize != 0); 271 BUG_ON(blksize != 0);
279 return; 272 return;
280 } 273 }
281 buffer = sdhci_kmap_sg(host); 274 buffer = sdhci_sg_to_buffer(host);
282 } 275 }
283 } 276 }
284
285 sdhci_kunmap_sg(host);
286} 277}
287 278
288static void sdhci_write_block_pio(struct sdhci_host *host) 279static void sdhci_write_block_pio(struct sdhci_host *host)
@@ -299,7 +290,7 @@ static void sdhci_write_block_pio(struct sdhci_host *host)
299 data = 0; 290 data = 0;
300 291
301 bytes = 0; 292 bytes = 0;
302 buffer = sdhci_kmap_sg(host) + host->offset; 293 buffer = sdhci_sg_to_buffer(host) + host->offset;
303 294
304 while (blksize) { 295 while (blksize) {
305 size = min(host->size, host->remain); 296 size = min(host->size, host->remain);
@@ -323,16 +314,13 @@ static void sdhci_write_block_pio(struct sdhci_host *host)
323 } 314 }
324 315
325 if (host->remain == 0) { 316 if (host->remain == 0) {
326 sdhci_kunmap_sg(host);
327 if (sdhci_next_sg(host) == 0) { 317 if (sdhci_next_sg(host) == 0) {
328 BUG_ON(blksize != 0); 318 BUG_ON(blksize != 0);
329 return; 319 return;
330 } 320 }
331 buffer = sdhci_kmap_sg(host); 321 buffer = sdhci_sg_to_buffer(host);
332 } 322 }
333 } 323 }
334
335 sdhci_kunmap_sg(host);
336} 324}
337 325
338static void sdhci_transfer_pio(struct sdhci_host *host) 326static void sdhci_transfer_pio(struct sdhci_host *host)
diff --git a/drivers/mmc/sdhci.h b/drivers/mmc/sdhci.h
index bc6bf7e7757d..e324f0a623dc 100644
--- a/drivers/mmc/sdhci.h
+++ b/drivers/mmc/sdhci.h
@@ -183,7 +183,6 @@ struct sdhci_host {
183 struct mmc_data *data; /* Current data request */ 183 struct mmc_data *data; /* Current data request */
184 184
185 struct scatterlist *cur_sg; /* We're working on this */ 185 struct scatterlist *cur_sg; /* We're working on this */
186 char *mapped_sg; /* This is where it's mapped */
187 int num_sg; /* Entries left */ 186 int num_sg; /* Entries left */
188 int offset; /* Offset into current sg */ 187 int offset; /* Offset into current sg */
189 int remain; /* Bytes left in current */ 188 int remain; /* Bytes left in current */