[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50D31EC8-BD9E-4920-8CEB-2AD10DF9C5C5@marvell.com>
Date: Thu, 16 Dec 2010 18:33:49 -0800
From: Philip Rakity <prakity@...vell.com>
To: Chris Ball <cjb@...top.org>
CC: Takashi Iwai <tiwai@...e.de>, Aries Lee <arieslee@...cron.com>,
zhangfei gao <zhangfei.gao@...il.com>,
Qiming Wu <wuqm@...vell.com>,
"linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mmc: Test bus-width for old MMC devices (v2)
Chris,
It is not possible for bus_width to be not initialized. This would imply ARRAY_SIZE(bus_widths) is 1. Certainly not true.
We could just initialize by changing
+ unsigned idx, bus_width;
to
+ unsigned idx, bus_width = 0;
I wonder what compiler are you using so we can avoid this issue in future.
Philip
+ static unsigned ext_csd_bits[][2] = {
+ { EXT_CSD_BUS_WIDTH_8, EXT_CSD_DDR_BUS_WIDTH_8 },
+ { EXT_CSD_BUS_WIDTH_4, EXT_CSD_DDR_BUS_WIDTH_4 },
+ { EXT_CSD_BUS_WIDTH_1, EXT_CSD_BUS_WIDTH_1 },
+ };
+ static unsigned bus_widths[] = {
+ MMC_BUS_WIDTH_8,
+ MMC_BUS_WIDTH_4,
+ MMC_BUS_WIDTH_1
+ };
+ unsigned idx, bus_width;
+
+ if (host->caps & MMC_CAP_8_BIT_DATA)
+ idx = 0;
+ else
+ idx = 1;
+ for (; idx < ARRAY_SIZE(bus_widths); idx++) {
+ bus_width = bus_widths[idx];
+ if (bus_width == MMC_BUS_WIDTH_1)
+ ddr = 0; /* no DDR for 1-bit width */
On Dec 16, 2010, at 3:40 PM, Chris Ball wrote:
> Hi Takashi,
>
> On Wed, Dec 15, 2010 at 08:14:24AM +0100, Takashi Iwai wrote:
>> From: Aries Lee <arieslee@...cron.com>
>>
>> Some old MMC devices fail with the 4/8 bits the driver tries to use
>> exclusively. This patch adds a test for the given bus setup and falls
>> back to the lower bit mode (until 1-bit mode) when the test fails.
>>
>> [Major rework and refactoring by tiwai]
>> [Quirk addition and many fixes by prakity]
>>
>> v1->v2:
>> - Rebased to the code with DDR support, set DDR bit properly
>> - Return always error when bus-switching fallback failed
>> - Define MMC_BUS_TEST_{R|W} in linux/mmc/mmc.h
>> - Add quirk MMC_CAP_BUS_WIDTH_TEST -- default not used for compatibility
>> - Ignore errors on BUS_TEST_W -- improves chances test will work
>>
>> Signed-off-by: Aries Lee <arieslee@...cron.com>
>> Signed-off-by: Takashi Iwai <tiwai@...e.de>
>> Signed-off-by: Philip Rakity <prakity@...vell.com>
>> Tested-by: Philip Rakity <prakity@...vell.com>
>
> This looks good, but adds a warning:
>
> drivers/mmc/core/mmc.c: In function ‘mmc_init_card’:
> drivers/mmc/core/mmc.c:547: warning: ‘bus_width’ may be used uninitialized in this function
>
> Thanks,
>
> --
> Chris Ball <cjb@...top.org> <http://printf.net/>
> One Laptop Per Child
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists