[PATCH 2/2] mtd: m25p80: set driver id_table

Sascha Hauer s.hauer at pengutronix.de
Fri Feb 7 03:33:20 EST 2014


This sets the id_table in the driver correctly so that the driver
can match to the various types of flashes, not only "m25p80".

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/mtd/devices/m25p80.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 9594011..c36d240 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -73,11 +73,6 @@
 
 #define SPI_NAME_SIZE   32
 
-struct spi_device_id {
-	char name[SPI_NAME_SIZE];
-	unsigned long driver_data;
-};
-
 struct m25p {
 	struct spi_device	*spi;
 	struct mtd_info		mtd;
@@ -618,7 +613,7 @@ struct flash_info {
  * more flash chips.  This current list focusses on newer chips, which
  * have been converging on command sets which including JEDEC ID.
  */
-static const struct spi_device_id m25p_ids[] = {
+static const struct platform_device_id m25p_ids[] = {
 	/* Atmel -- some are (confusingly) marketed as "DataFlash" */
 	{ "at25fs010",  INFO(0x1f6601, 0, 32 * 1024,   4, SECT_4K) },
 	{ "at25fs040",  INFO(0x1f6604, 0, 64 * 1024,   8, SECT_4K) },
@@ -755,7 +750,7 @@ static const struct spi_device_id m25p_ids[] = {
 	{ },
 };
 
-static const struct spi_device_id *jedec_probe(struct spi_device *spi)
+static const struct platform_device_id *jedec_probe(struct spi_device *spi)
 {
 	int			tmp;
 	u8			code = OPCODE_RDID;
@@ -803,7 +798,7 @@ static const struct spi_device_id *jedec_probe(struct spi_device *spi)
 static int m25p_probe(struct device_d *dev)
 {
 	struct spi_device *spi = (struct spi_device *)dev->type_data;
-	const struct spi_device_id	*id = NULL;
+	const struct platform_device_id	*id = NULL;
 	struct flash_platform_data	*data;
 	struct m25p			*flash;
 	struct flash_info		*info = NULL;
@@ -819,7 +814,7 @@ static int m25p_probe(struct device_d *dev)
 	 */
 	data = dev->platform_data;
 	if (data && data->type) {
-		const struct spi_device_id *plat_id;
+		const struct platform_device_id *plat_id;
 
 		for (i = 0; i < ARRAY_SIZE(m25p_ids) - 1; i++) {
 			plat_id = &m25p_ids[i];
@@ -840,7 +835,7 @@ static int m25p_probe(struct device_d *dev)
 	}
 
 	if (do_jdec_probe) {
-		const struct spi_device_id *jid;
+		const struct platform_device_id *jid;
 
 		jid = jedec_probe(spi);
 		if (IS_ERR(jid)) {
@@ -969,6 +964,7 @@ static struct driver_d m25p80_driver = {
 	.name	= "m25p80",
 	.probe	= m25p_probe,
 	.of_compatible = DRV_OF_COMPAT(m25p80_dt_ids),
+	.id_table = (struct platform_device_id *)m25p_ids,
 };
 device_spi_driver(m25p80_driver);
 
-- 
1.8.5.3




More information about the barebox mailing list