diff mbox

mtd: m25p80: Get mtd_info->name from spi_device as the second choice

Message ID 1436515808-45639-1-git-send-email-haikun.wang@freescale.com
State Superseded
Headers show

Commit Message

Haikun.Wang@freescale.com July 10, 2015, 8:10 a.m. UTC
If we can't get "mtd_info->name" form struct flash_platform_data,
get it from "spi_device".

Signed-off-by: Haikun Wang <haikun.wang@freescale.com>
---
 drivers/mtd/devices/m25p80.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Rafał Miłecki July 11, 2015, 5:14 p.m. UTC | #1
On 10 July 2015 at 10:10, Haikun Wang <haikun.wang@freescale.com> wrote:
> If we can't get "mtd_info->name" form struct flash_platform_data,
> get it from "spi_device".
>
> Signed-off-by: Haikun Wang <haikun.wang@freescale.com>
> ---
>  drivers/mtd/devices/m25p80.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
> index d313f948b..ebac9e5 100644
> --- a/drivers/mtd/devices/m25p80.c
> +++ b/drivers/mtd/devices/m25p80.c
> @@ -215,6 +215,8 @@ static int m25p_probe(struct spi_device *spi)
>
>         if (data && data->name)
>                 flash->mtd.name = data->name;
> +       else
> +               flash->mtd.name = dev_name(&spi->dev);

I'm curious. Is this for changing kernel messages to include some nice
name? Can you give us an example of before vs. after?
Haikun.Wang@freescale.com July 13, 2015, 11:01 a.m. UTC | #2
On 7/12/2015 1:14 AM, Rafał Miłecki wrote:
> On 10 July 2015 at 10:10, Haikun Wang <haikun.wang@freescale.com> wrote:
>> If we can't get "mtd_info->name" form struct flash_platform_data,
>> get it from "spi_device".
>>
>> Signed-off-by: Haikun Wang <haikun.wang@freescale.com>
>> ---
>>   drivers/mtd/devices/m25p80.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
>> index d313f948b..ebac9e5 100644
>> --- a/drivers/mtd/devices/m25p80.c
>> +++ b/drivers/mtd/devices/m25p80.c
>> @@ -215,6 +215,8 @@ static int m25p_probe(struct spi_device *spi)
>>
>>          if (data && data->name)
>>                  flash->mtd.name = data->name;
>> +       else
>> +               flash->mtd.name = dev_name(&spi->dev);
>
> I'm curious. Is this for changing kernel messages to include some nice
> name? Can you give us an example of before vs. after?
>
Function "spi_nor_scan" already has this checking:
if (!mtd->name)
	mtd->name = dev_name(dev);
commit id: 32f1b7c8352fd33d41bcec3cfb054ccdcfd40a42
This patch is duplicate.
diff mbox

Patch

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index d313f948b..ebac9e5 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -215,6 +215,8 @@  static int m25p_probe(struct spi_device *spi)
 
 	if (data && data->name)
 		flash->mtd.name = data->name;
+	else
+		flash->mtd.name = dev_name(&spi->dev);
 
 	/* For some (historical?) reason many platforms provide two different
 	 * names in flash_platform_data: "name" and "type". Quite often name is