All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: JosephChan@via.com.tw
Cc: linux-kernel@vger.kernel.org, ben-linux@fluff.org
Subject: Re: [Patch 1/1 v2] via-sdmmc: VIA MSP card reader driver support
Date: Tue, 10 Feb 2009 13:18:08 +0100	[thread overview]
Message-ID: <200902101318.08517.arnd@arndb.de> (raw)
In-Reply-To: <C80EF34A3D2E494DBAF9AC29C7AE4EB8089A3E0C@exchtp03.taipei.via.com.tw>

On Tuesday 10 February 2009, JosephChan@via.com.tw wrote:
> The following patches provides VIA MSP SD/MMC card reader driver support.
> And these patches are based on kernel 2.6.29-rc4.
> Also, thanks for Arnd's previous suggestions.

Looks mostly good, just two more comments:

> --- a/drivers/mmc/host/via-sdmmc.h	1970-01-01 08:00:00.000000000 +0800
> +++ b/drivers/mmc/host/via-sdmmc.h	2009-02-10 21:34:18.000000000 +0800

The header file is used in only one place, which means that you could
move everything from there into via-sdmmc.c. This would make reading the
code easier later on.

> +
> +	if (data->flags & MMC_DATA_WRITE) {
> +		for (i = 0; i < len; i++) {
> +			tmpbuf = kmap_atomic(sg_page(&sg[i]), KM_BIO_SRC_IRQ);
> +			tmpbuf += sg[i].offset;
> +			memcpy(host->ddmabuf + offset, tmpbuf, sg[i].length);
> +			offset += sg[i].length;
> +			kunmap_atomic(tmpbuf, KM_BIO_SRC_IRQ);
> +		}
> +	}

This loop is broken for sg chaining. You should use for_each_sg() or
sg_next() instead of sg[i] indexing.

> +	if (data->flags & MMC_DATA_READ) {
> +		struct scatterlist *sg = data->sg;
> +		unsigned char *sgbuf;
> +		int i;
> +
> +		for (i = 0; i < data->sg_len; i++) {
> +			sgbuf = kmap_atomic(sg_page(&sg[i]), KM_BIO_SRC_IRQ);
> +			memcpy(sgbuf + sg[i].offset, host->ddmabuf + offset,
> +			       sg[i].length);
> +			offset += sg[i].length;
> +			kunmap_atomic(sgbuf, KM_BIO_SRC_IRQ);
> +		}
> +	}
> +

same here.

	Arnd <><

      reply	other threads:[~2009-02-10 12:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-10  6:33 [Patch 1/1 v2] via-sdmmc: VIA MSP card reader driver support JosephChan
2009-02-10 12:18 ` Arnd Bergmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200902101318.08517.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=JosephChan@via.com.tw \
    --cc=ben-linux@fluff.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.