* [PATCH 1/2] mtd: m25p80: get rid of spi_get_device_id
@ 2014-09-29 9:47 Rafał Miłecki
[not found] ` <1411984074-3850-1-git-send-email-zajec5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Rafał Miłecki @ 2014-09-29 9:47 UTC (permalink / raw)
To: David Woodhouse, Artem Bityutskiy, Brian Norris,
linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: Ben Hutchings, Hauke Mehrtens, Andrew Lunn, Jason Cooper,
linux-spi, Ian Campbell, Geert Uytterhoeven, Huang Shijie,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, debian-kernel,
Rafał Miłecki
This simplifies the way we use spi_nor framework and will allow us to
drop spi_nor_match_id.
Signed-off-by: Rafał Miłecki <zajec5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/mtd/devices/m25p80.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index dcda628..822209d 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -197,6 +197,7 @@ static int m25p_probe(struct spi_device *spi)
struct m25p *flash;
struct spi_nor *nor;
enum read_mode mode = SPI_NOR_NORMAL;
+ char *flash_name = NULL;
int ret;
data = dev_get_platdata(&spi->dev);
@@ -236,12 +237,11 @@ static int m25p_probe(struct spi_device *spi)
* If that's the case, respect "type" and ignore a "name".
*/
if (data && data->type)
- id = spi_nor_match_id(data->type);
-
- /* If we didn't get name from platform, simply use "modalias". */
- if (!id)
- id = spi_get_device_id(spi);
+ flash_name = data->type;
+ else
+ flash_name = spi->modalias;
+ id = spi_nor_match_id(flash_name);
ret = spi_nor_scan(nor, id, mode);
if (ret)
return ret;
--
1.8.4.5
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] mtd: spi-nor: make spi_nor_scan() take a chip type name, not spi_device_id
[not found] ` <1411984074-3850-1-git-send-email-zajec5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2014-09-29 9:47 ` Rafał Miłecki
[not found] ` <1411984074-3850-2-git-send-email-zajec5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-10-01 18:20 ` [PATCH 1/2] mtd: m25p80: get rid of spi_get_device_id Mark Brown
2014-10-17 16:30 ` Brian Norris
2 siblings, 1 reply; 7+ messages in thread
From: Rafał Miłecki @ 2014-09-29 9:47 UTC (permalink / raw)
To: David Woodhouse, Artem Bityutskiy, Brian Norris,
linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: Ben Hutchings, Hauke Mehrtens, Andrew Lunn, Jason Cooper,
linux-spi, Ian Campbell, Geert Uytterhoeven, Huang Shijie,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, debian-kernel,
Rafał Miłecki
From: Ben Hutchings <ben-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org>
Drivers currently call spi_nor_match_id() and then spi_nor_scan().
This adds a dependency on struct spi_device_id which we want to
avoid. Make spi_nor_scan() do it for them.
Signed-off-by: Ben Hutchings <ben-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org>
Signed-off-by: Rafał Miłecki <zajec5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/mtd/devices/m25p80.c | 4 +---
drivers/mtd/spi-nor/fsl-quadspi.c | 7 +------
drivers/mtd/spi-nor/spi-nor.c | 13 +++++++++----
include/linux/mtd/spi-nor.h | 20 +++-----------------
4 files changed, 14 insertions(+), 30 deletions(-)
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 822209d..bd5e4c6 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -193,7 +193,6 @@ static int m25p_probe(struct spi_device *spi)
{
struct mtd_part_parser_data ppdata;
struct flash_platform_data *data;
- const struct spi_device_id *id = NULL;
struct m25p *flash;
struct spi_nor *nor;
enum read_mode mode = SPI_NOR_NORMAL;
@@ -241,8 +240,7 @@ static int m25p_probe(struct spi_device *spi)
else
flash_name = spi->modalias;
- id = spi_nor_match_id(flash_name);
- ret = spi_nor_scan(nor, id, mode);
+ ret = spi_nor_scan(nor, flash_name, mode);
if (ret)
return ret;
diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index 8d659a2..d5269a2 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -881,7 +881,6 @@ static int fsl_qspi_probe(struct platform_device *pdev)
/* iterate the subnodes. */
for_each_available_child_of_node(dev->of_node, np) {
- const struct spi_device_id *id;
char modalias[40];
/* skip the holes */
@@ -909,10 +908,6 @@ static int fsl_qspi_probe(struct platform_device *pdev)
if (of_modalias_node(np, modalias, sizeof(modalias)) < 0)
goto map_failed;
- id = spi_nor_match_id(modalias);
- if (!id)
- goto map_failed;
-
ret = of_property_read_u32(np, "spi-max-frequency",
&q->clk_rate);
if (ret < 0)
@@ -921,7 +916,7 @@ static int fsl_qspi_probe(struct platform_device *pdev)
/* set the chip address for READID */
fsl_qspi_set_base_addr(q, nor);
- ret = spi_nor_scan(nor, id, SPI_NOR_QUAD);
+ ret = spi_nor_scan(nor, modalias, SPI_NOR_QUAD);
if (ret)
goto map_failed;
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index ae16aa2..5c8e399 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -28,6 +28,8 @@
#define JEDEC_MFR(_jedec_id) ((_jedec_id) >> 16)
+static const struct spi_device_id *spi_nor_match_id(const char *name);
+
/*
* Read the status register, returning its value in the location
* Return the status register value.
@@ -911,9 +913,9 @@ static int spi_nor_check(struct spi_nor *nor)
return 0;
}
-int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id,
- enum read_mode mode)
+int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
{
+ const struct spi_device_id *id = NULL;
struct flash_info *info;
struct device *dev = nor->dev;
struct mtd_info *mtd = nor->mtd;
@@ -925,6 +927,10 @@ int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id,
if (ret)
return ret;
+ id = spi_nor_match_id(name);
+ if (!id)
+ return -ENOENT;
+
info = (void *)id->driver_data;
if (info->jedec_id) {
@@ -1113,7 +1119,7 @@ int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id,
}
EXPORT_SYMBOL_GPL(spi_nor_scan);
-const struct spi_device_id *spi_nor_match_id(char *name)
+static const struct spi_device_id *spi_nor_match_id(const char *name)
{
const struct spi_device_id *id = spi_nor_ids;
@@ -1124,7 +1130,6 @@ const struct spi_device_id *spi_nor_match_id(char *name)
}
return NULL;
}
-EXPORT_SYMBOL_GPL(spi_nor_match_id);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Huang Shijie <shijie8-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>");
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 9e6294f..a5a7a08 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -187,32 +187,18 @@ struct spi_nor {
/**
* spi_nor_scan() - scan the SPI NOR
* @nor: the spi_nor structure
- * @id: the spi_device_id provided by the driver
+ * @name: the chip type name
* @mode: the read mode supported by the driver
*
* The drivers can use this fuction to scan the SPI NOR.
* In the scanning, it will try to get all the necessary information to
* fill the mtd_info{} and the spi_nor{}.
*
- * The board may assigns a spi_device_id with @id which be used to compared with
- * the spi_device_id detected by the scanning.
+ * The chip type name can be provided through the @name parameter.
*
* Return: 0 for success, others for failure.
*/
-int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id,
- enum read_mode mode);
+int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode);
extern const struct spi_device_id spi_nor_ids[];
-/**
- * spi_nor_match_id() - find the spi_device_id by the name
- * @name: the name of the spi_device_id
- *
- * The drivers use this function to find the spi_device_id
- * specified by the @name.
- *
- * Return: returns the right spi_device_id pointer on success,
- * and returns NULL on failure.
- */
-const struct spi_device_id *spi_nor_match_id(char *name);
-
#endif
--
1.8.4.5
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] mtd: m25p80: get rid of spi_get_device_id
[not found] ` <1411984074-3850-1-git-send-email-zajec5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-29 9:47 ` [PATCH 2/2] mtd: spi-nor: make spi_nor_scan() take a chip type name, not spi_device_id Rafał Miłecki
@ 2014-10-01 18:20 ` Mark Brown
2014-10-01 18:43 ` Brian Norris
2014-10-17 16:30 ` Brian Norris
2 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2014-10-01 18:20 UTC (permalink / raw)
To: Rafał Miłecki
Cc: David Woodhouse, Artem Bityutskiy, Brian Norris,
linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Ben Hutchings,
Hauke Mehrtens, Andrew Lunn, Jason Cooper, linux-spi,
Ian Campbell, Geert Uytterhoeven, Huang Shijie,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, debian-kernel
[-- Attachment #1: Type: text/plain, Size: 277 bytes --]
On Mon, Sep 29, 2014 at 11:47:53AM +0200, Rafał Miłecki wrote:
> This simplifies the way we use spi_nor framework and will allow us to
> drop spi_nor_match_id.
Please don't CC linux-spi on spi-nor patches that don't have SPI level
changes, it just clogs up patchwork.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] mtd: m25p80: get rid of spi_get_device_id
2014-10-01 18:20 ` [PATCH 1/2] mtd: m25p80: get rid of spi_get_device_id Mark Brown
@ 2014-10-01 18:43 ` Brian Norris
2014-10-01 19:24 ` Rafał Miłecki
0 siblings, 1 reply; 7+ messages in thread
From: Brian Norris @ 2014-10-01 18:43 UTC (permalink / raw)
To: Mark Brown
Cc: Andrew Lunn, David Woodhouse, Artem Bityutskiy, Hauke Mehrtens,
Rafał Miłecki, linux-spi, linux-mtd, Huang Shijie,
Ian Campbell, Geert Uytterhoeven, debian-kernel, Ben Hutchings,
linux-arm-kernel, Jason Cooper
On Wed, Oct 01, 2014 at 07:20:03PM +0100, Mark Brown wrote:
> On Mon, Sep 29, 2014 at 11:47:53AM +0200, Rafał Miłecki wrote:
> > This simplifies the way we use spi_nor framework and will allow us to
> > drop spi_nor_match_id.
>
> Please don't CC linux-spi on spi-nor patches that don't have SPI level
> changes, it just clogs up patchwork.
+1 from me. I appreciate the converse, as I don't need unrelated noise
on linux-mtd.
(I feel sorry for people over at linux-arm-kernel and devicetree, since
they get CC'd on a large variety of unrelated things, it seems. I'm sure
the firehose gets to be almost as bad as LKML sometimes.)
Brian
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] mtd: m25p80: get rid of spi_get_device_id
2014-10-01 18:43 ` Brian Norris
@ 2014-10-01 19:24 ` Rafał Miłecki
0 siblings, 0 replies; 7+ messages in thread
From: Rafał Miłecki @ 2014-10-01 19:24 UTC (permalink / raw)
To: Brian Norris
Cc: Mark Brown, David Woodhouse, Artem Bityutskiy,
linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Ben Hutchings,
Hauke Mehrtens, Andrew Lunn, Jason Cooper, linux-spi,
Ian Campbell, Geert Uytterhoeven, Huang Shijie,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, debian-kernel
On 1 October 2014 20:43, Brian Norris <computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> On Wed, Oct 01, 2014 at 07:20:03PM +0100, Mark Brown wrote:
>> On Mon, Sep 29, 2014 at 11:47:53AM +0200, Rafał Miłecki wrote:
>> > This simplifies the way we use spi_nor framework and will allow us to
>> > drop spi_nor_match_id.
>>
>> Please don't CC linux-spi on spi-nor patches that don't have SPI level
>> changes, it just clogs up patchwork.
>
> +1 from me. I appreciate the converse, as I don't need unrelated noise
> on linux-mtd.
>
> (I feel sorry for people over at linux-arm-kernel and devicetree, since
> they get CC'd on a large variety of unrelated things, it seems. I'm sure
> the firehose gets to be almost as bad as LKML sometimes.)
Sorry, I usually don't. AFAIR this time I copied receivers list from
the original Ben patch / discussion about auto loading.
--
Rafał
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] mtd: m25p80: get rid of spi_get_device_id
[not found] ` <1411984074-3850-1-git-send-email-zajec5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-29 9:47 ` [PATCH 2/2] mtd: spi-nor: make spi_nor_scan() take a chip type name, not spi_device_id Rafał Miłecki
2014-10-01 18:20 ` [PATCH 1/2] mtd: m25p80: get rid of spi_get_device_id Mark Brown
@ 2014-10-17 16:30 ` Brian Norris
2 siblings, 0 replies; 7+ messages in thread
From: Brian Norris @ 2014-10-17 16:30 UTC (permalink / raw)
To: Rafał Miłecki
Cc: David Woodhouse, Artem Bityutskiy,
linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Ben Hutchings,
Hauke Mehrtens, Andrew Lunn, Jason Cooper, linux-spi,
Ian Campbell, Geert Uytterhoeven, Huang Shijie,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, debian-kernel
On Mon, Sep 29, 2014 at 11:47:53AM +0200, Rafał Miłecki wrote:
> This simplifies the way we use spi_nor framework and will allow us to
> drop spi_nor_match_id.
>
> Signed-off-by: Rafał Miłecki <zajec5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Applied to l2-mtd.git/master.
Brian
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] mtd: spi-nor: make spi_nor_scan() take a chip type name, not spi_device_id
[not found] ` <1411984074-3850-2-git-send-email-zajec5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2014-10-17 16:31 ` Brian Norris
0 siblings, 0 replies; 7+ messages in thread
From: Brian Norris @ 2014-10-17 16:31 UTC (permalink / raw)
To: Rafał Miłecki
Cc: David Woodhouse, Artem Bityutskiy,
linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Ben Hutchings,
Hauke Mehrtens, Andrew Lunn, Jason Cooper, linux-spi,
Ian Campbell, Geert Uytterhoeven, Huang Shijie,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, debian-kernel
On Mon, Sep 29, 2014 at 11:47:54AM +0200, Rafał Miłecki wrote:
> From: Ben Hutchings <ben-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org>
>
> Drivers currently call spi_nor_match_id() and then spi_nor_scan().
> This adds a dependency on struct spi_device_id which we want to
> avoid. Make spi_nor_scan() do it for them.
>
> Signed-off-by: Ben Hutchings <ben-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org>
> Signed-off-by: Rafał Miłecki <zajec5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Pushed to l2-mtd.git/master.
Brian
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-10-17 16:31 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-29 9:47 [PATCH 1/2] mtd: m25p80: get rid of spi_get_device_id Rafał Miłecki
[not found] ` <1411984074-3850-1-git-send-email-zajec5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-29 9:47 ` [PATCH 2/2] mtd: spi-nor: make spi_nor_scan() take a chip type name, not spi_device_id Rafał Miłecki
[not found] ` <1411984074-3850-2-git-send-email-zajec5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-10-17 16:31 ` Brian Norris
2014-10-01 18:20 ` [PATCH 1/2] mtd: m25p80: get rid of spi_get_device_id Mark Brown
2014-10-01 18:43 ` Brian Norris
2014-10-01 19:24 ` Rafał Miłecki
2014-10-17 16:30 ` Brian Norris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).