[PATCH] ARM: don't set unused name in struct flash_platform_data
Rafał Miłecki
zajec5 at gmail.com
Tue Oct 21 23:11:38 PDT 2014
On 22 October 2014 08:03, Rafał Miłecki <zajec5 at gmail.com> wrote:
> On 22 October 2014 07:53, Brian Norris <computersforpeace at gmail.com> wrote:
>> On Mon, Sep 29, 2014 at 02:30:53PM +0200, Rafał Miłecki wrote:
>>> Loading correct SPI driver (m25p80) is handled using modalias from the
>>> struct spi_board_info. There is no point of setting name in the
>>> platform_data, m25p80 ignores it anyway.
>>
>> Wait, is 'name' actually ignored? It looks to me like it sets the MTD
>> name. See the comments in include/linux/spi/flash.h and
>> arch/arm/include/asm/mach/flash.h (BTW, why do we have two definitions
>> for this??):
>>
>> @name: optional flash device name (eg, as used with mtdparts=)
>>
>> And I think it's used for exactly that in m25p80.c:
>>
>> if (data && data->name)
>> flash->mtd.name = data->name;
>
> And very few lines later in the m25p80.c you have this:
> if (data && data->type)
> id = spi_nor_match_id(data->type);
>
> Code I touched in my patch was using both: name and type. So what you
> got it "type" took a precedence and "name" value was ignored. It seems
> like ppl used to use "name" to trigger "m25p80" probe, which isn't
> needed (it's done by SPI layer).
>
> Also see my comment about data->type usage I added in:
> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=32f1b7c8352fd33d41bcec3cfb054ccdcfd40a42
Oh, wait. I just noticed you pointed to the code setting mtd's name,
not finding a chip name. Sorry, I got a bit confused by so many recent
changes to the m25p80 and spi-nor.
So you are right, m25p80 uses this "name" to set the mtd_info's name.
Will look at this again.
--
Rafał
More information about the linux-arm-kernel
mailing list