LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [RFC] [PATCH] Fix up needless kmap:s
@ 2007-02-03 13:55 Pierre Ossman
2007-02-04 2:03 ` Alex Dubov
0 siblings, 1 reply; 3+ messages in thread
From: Pierre Ossman @ 2007-02-03 13:55 UTC (permalink / raw)
To: Alex Dubov, LKML
[-- Attachment #1: Type: text/plain, Size: 280 bytes --]
Hi Alex,
I'd like you to test and comment on the following patch.
Rgds
--
-- Pierre Ossman
Linux kernel, MMC maintainer http://www.kernel.org
PulseAudio, core developer http://pulseaudio.org
rdesktop, core developer http://www.rdesktop.org
[-- Attachment #2: 0001-mmc-tifm-replace-kmap-with-page_address.txt --]
[-- Type: text/plain, Size: 2246 bytes --]
>From c8467c6b0ea0443f948c0ece281e1ca8e92f6ea7 Mon Sep 17 00:00:00 2001
From: Pierre Ossman <drzeus@drzeus.cx>
Date: Sat, 3 Feb 2007 13:36:41 +0100
Subject: [PATCH] mmc: tifm: 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>
---
drivers/mmc/tifm_sd.c | 15 ++++-----------
1 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/drivers/mmc/tifm_sd.c b/drivers/mmc/tifm_sd.c
index 7e607b7..e65f8a0 100644
--- a/drivers/mmc/tifm_sd.c
+++ b/drivers/mmc/tifm_sd.c
@@ -107,14 +107,9 @@ struct tifm_sd {
};
-static char* tifm_sd_kmap_atomic(struct mmc_data *data)
+static char* tifm_sd_data_buffer(struct mmc_data *data)
{
- return kmap_atomic(data->sg->page, KM_BIO_SRC_IRQ) + data->sg->offset;
-}
-
-static void tifm_sd_kunmap_atomic(char *buffer, struct mmc_data *data)
-{
- kunmap_atomic(buffer - data->sg->offset, KM_BIO_SRC_IRQ);
+ return page_address(data->sg->page) + data->sg->offset;
}
static int tifm_sd_transfer_data(struct tifm_dev *sock, struct tifm_sd *host,
@@ -127,18 +122,17 @@ static int tifm_sd_transfer_data(struct tifm_dev *sock, struct tifm_sd *host,
if (host_status & TIFM_MMCSD_BRS) {
/* in non-dma rx mode BRS fires when fifo is still not empty */
if (no_dma && (cmd->data->flags & MMC_DATA_READ)) {
- buffer = tifm_sd_kmap_atomic(host->req->data);
+ buffer = tifm_sd_data_buffer(host->req->data);
while (host->buffer_size > host->buffer_pos) {
t_val = readl(sock->addr + SOCK_MMCSD_DATA);
buffer[host->buffer_pos++] = t_val & 0xff;
buffer[host->buffer_pos++] =
(t_val >> 8) & 0xff;
}
- tifm_sd_kunmap_atomic(buffer, host->req->data);
}
return 1;
} else if (no_dma) {
- buffer = tifm_sd_kmap_atomic(host->req->data);
+ buffer = tifm_sd_data_buffer(host->req->data);
if ((cmd->data->flags & MMC_DATA_READ) &&
(host_status & TIFM_MMCSD_AF)) {
for (cnt = 0; cnt < TIFM_MMCSD_FIFO_SIZE; cnt++) {
@@ -163,7 +157,6 @@ static int tifm_sd_transfer_data(struct tifm_dev *sock, struct tifm_sd *host,
}
}
}
- tifm_sd_kunmap_atomic(buffer, host->req->data);
}
return 0;
}
--
1.4.4.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC] [PATCH] Fix up needless kmap:s
2007-02-03 13:55 [RFC] [PATCH] Fix up needless kmap:s Pierre Ossman
@ 2007-02-04 2:03 ` Alex Dubov
2007-02-04 16:49 ` Pierre Ossman
0 siblings, 1 reply; 3+ messages in thread
From: Alex Dubov @ 2007-02-04 2:03 UTC (permalink / raw)
To: Pierre Ossman, LKML
The patch looks ok.
However, due to certain peculiarities with memorystick and xd I have to emulate a scatter-gather
in software. Considering that this particular aspect of implementation is the same for all card
types on this TI chip, it can be shared by tifm_sd driver as well. In this case highmem won't be
needed to be avoided and kmap_atomic will come back (may be).
And, by the way, to what extent pagefault_enable/pagefault_disable calls are needed? They are
present in k(u)map_atomic even for non-highmem pages/architectures.
____________________________________________________________________________________
Expecting? Get great news right away with email Auto-Check.
Try the Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC] [PATCH] Fix up needless kmap:s
2007-02-04 2:03 ` Alex Dubov
@ 2007-02-04 16:49 ` Pierre Ossman
0 siblings, 0 replies; 3+ messages in thread
From: Pierre Ossman @ 2007-02-04 16:49 UTC (permalink / raw)
To: Alex Dubov; +Cc: LKML
Alex Dubov wrote:
> The patch looks ok.
>
> However, due to certain peculiarities with memorystick and xd I have to emulate a scatter-gather
> in software. Considering that this particular aspect of implementation is the same for all card
> types on this TI chip, it can be shared by tifm_sd driver as well. In this case highmem won't be
> needed to be avoided and kmap_atomic will come back (may be).
>
>
Fair enough. Just make sure you handle the big problem case (kmap only
maps a single page, not the entire sg entry).
> And, by the way, to what extent pagefault_enable/pagefault_disable calls are needed? They are
> present in k(u)map_atomic even for non-highmem pages/architectures.
>
>
They tell the page fault handler that it may not sleep on a page fault.
Currently it only has the behaviour of disabling preemption though. I'd
guess it is present for non-highmem so that things behave somewhat
similar for both the highmem and non-highmem cases.
Rgds
--
-- Pierre Ossman
Linux kernel, MMC maintainer http://www.kernel.org
PulseAudio, core developer http://pulseaudio.org
rdesktop, core developer http://www.rdesktop.org
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-02-04 16:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-03 13:55 [RFC] [PATCH] Fix up needless kmap:s Pierre Ossman
2007-02-04 2:03 ` Alex Dubov
2007-02-04 16:49 ` Pierre Ossman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).