public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: micky_ching@realsil.com.cn
Cc: sameo@linux.intel.com, lee.jones@linaro.org, chris@printf.net,
	ulf.hansson@linaro.org, gregkh@linuxfoundation.org,
	linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
	wei_wang@realsil.com.cn, rogerable@realtek.com,
	devel@linuxdriverproject.org
Subject: Re: [PATCH v2 2/2] mmc: rtsx: add support for sdio card
Date: Mon, 1 Dec 2014 15:37:04 +0300	[thread overview]
Message-ID: <20141201123704.GE4994@mwanda> (raw)
In-Reply-To: <544df18ef543c169c93e4c9bd64e94c4ed3c1f9b.1417141102.git.micky_ching@realsil.com.cn>

On Fri, Nov 28, 2014 at 02:31:56PM +0800, micky_ching@realsil.com.cn wrote:
>  #ifdef DEBUG
> -static void sd_print_debug_regs(struct realtek_pci_sdmmc *host)
> +static void dump_reg_range(struct realtek_pci_sdmmc *host, u16 start, u16 end)
>  {
> -	struct rtsx_pcr *pcr = host->pcr;
> -	u16 i;
> -	u8 *ptr;
> +	u16 len = end - start + 1;
> +	int i;
> +	u8 data[8];
>  
> -	/* Print SD host internal registers */
> -	rtsx_pci_init_cmd(pcr);
> -	for (i = 0xFDA0; i <= 0xFDAE; i++)
> -		rtsx_pci_add_cmd(pcr, READ_REG_CMD, i, 0, 0);
> -	for (i = 0xFD52; i <= 0xFD69; i++)
> -		rtsx_pci_add_cmd(pcr, READ_REG_CMD, i, 0, 0);
> -	rtsx_pci_send_cmd(pcr, 100);
> -
> -	ptr = rtsx_pci_get_cmd_data(pcr);
> -	for (i = 0xFDA0; i <= 0xFDAE; i++)
> -		dev_dbg(sdmmc_dev(host), "0x%04X: 0x%02x\n", i, *(ptr++));
> -	for (i = 0xFD52; i <= 0xFD69; i++)
> -		dev_dbg(sdmmc_dev(host), "0x%04X: 0x%02x\n", i, *(ptr++));
> +	if (!data)
> +		return;

Delete this check.  It will cause a static checker warning because
arrays never NULL.

> +
> +	for (i = 0; i < len; i += 8) {
> +		int j;
> +		int n = min(8, len - i);
> +
> +		memset(&data, 0, sizeof(data));
> +		for (j = 0; j < n; j++)
> +			rtsx_pci_read_register(host->pcr, start + i + j,
> +				data + j);
> +		dev_dbg(sdmmc_dev(host), "0x%04X(%d): %8ph\n", start, n, data);

This should be start + i, sorry for not spotting that earlier.

regards,
dan carpenter


  reply	other threads:[~2014-12-01 12:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-28  6:31 [PATCH v2 0/2] mmc: rtsx: add support for sdio card micky_ching
2014-11-28  6:31 ` [PATCH v2 1/2] mfd: rtsx: add func to split u32 into register micky_ching
2014-12-01 12:18   ` Lee Jones
2014-12-01 12:37     ` Dan Carpenter
2014-12-01 12:46   ` Lee Jones
2014-11-28  6:31 ` [PATCH v2 2/2] mmc: rtsx: add support for sdio card micky_ching
2014-12-01 12:37   ` Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-12-02  1:36 [PATCH v2 0/2] " micky_ching
2014-12-02  1:36 ` [PATCH v2 2/2] " micky_ching
2014-12-04 13:56   ` Ulf Hansson

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=20141201123704.GE4994@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=chris@printf.net \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=micky_ching@realsil.com.cn \
    --cc=rogerable@realtek.com \
    --cc=sameo@linux.intel.com \
    --cc=ulf.hansson@linaro.org \
    --cc=wei_wang@realsil.com.cn \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox