Re: [PATCH] sdhci: fix undue iomem warning

Daniel J Blueman
2011-05-30T13:27:12Z

Hi Wolfram,

On 30 May 2011 20:58, Wolfram Sang <w.sang@pengutronix.de> wrote:
> Hi Daniel,
>
>> diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
>> index 936bbca..ae948b0 100644
>> --- a/drivers/mmc/host/sdhci-pci.c
>> +++ b/drivers/mmc/host/sdhci-pci.c
>> @@ -918,8 +918,9 @@ static struct sdhci_pci_slot * __devinit sdhci_pci_probe_slot(
>>               return ERR_PTR(-ENODEV);
>>       }
>>
>> -     if (pci_resource_len(pdev, bar) != 0x100) {
>> -             dev_err(&pdev->dev, "Invalid iomem size. You may "
>> +     int len = pci_resource_len(pdev, bar);
>> +     if (len != 0x100 && len != 0x200) {
>
> Hmmm,
>
> a) SDHC Specs (even v3) only mention 0x100, so this _is_ the standard.
>   Do the new cards (which ones?) have anything located in the extra
>   area?

This controller is a dual-slot one, so has two register sets (though
one set of pins aren't wired to a socket).

> b) your approach won't scale very well

True - a more scalable test would be to check for non-zero length and
a multiple of 256 bytes, would you say?

This would be in-tune with page 2 of:
http://www.sdcard.org/developers/tech/host_controller/simple_spec/Simplified_SD_Host_Controller_Spec.pdf

> so, I'd say it is better to keep the old way.
>
>> +             dev_warn(&pdev->dev, "Invalid iomem size. You may "
>>                       "experience problems.\n");
>
> I second turning the message into a warning, though.

If the latter method is preferred, I'll adjust the patch and resend.

Thanks,
Daniel
--
Daniel J Blueman