#define SPI_NOR_MAX_ID_LEN     6
 
 struct flash_info {
+       char            *name;
+
        /*
         * This array stores the ID bytes.
         * The first three bytes are the JEDIC ID.
 
 #define JEDEC_MFR(info)        ((info)->id[0])
 
-static const struct spi_device_id *spi_nor_match_id(const char *name);
+static const struct flash_info *spi_nor_match_id(const char *name);
 
 /*
  * Read the status register, returning its value in the location
 }
 
 /* Enable/disable 4-byte addressing mode. */
-static inline int set_4byte(struct spi_nor *nor, struct flash_info *info,
+static inline int set_4byte(struct spi_nor *nor, const struct flash_info *info,
                            int enable)
 {
        int status;
 
 /* Used when the "_ext_id" is two bytes at most */
 #define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags)     \
-       ((kernel_ulong_t)&(struct flash_info) {                         \
                .id = {                                                 \
                        ((_jedec_id) >> 16) & 0xff,                     \
                        ((_jedec_id) >> 8) & 0xff,                      \
                .sector_size = (_sector_size),                          \
                .n_sectors = (_n_sectors),                              \
                .page_size = 256,                                       \
-               .flags = (_flags),                                      \
-       })
+               .flags = (_flags),
 
 #define INFO6(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags)    \
-       ((kernel_ulong_t)&(struct flash_info) {                         \
                .id = {                                                 \
                        ((_jedec_id) >> 16) & 0xff,                     \
                        ((_jedec_id) >> 8) & 0xff,                      \
                .sector_size = (_sector_size),                          \
                .n_sectors = (_n_sectors),                              \
                .page_size = 256,                                       \
-               .flags = (_flags),                                      \
-       })
+               .flags = (_flags),
 
 #define CAT25_INFO(_sector_size, _n_sectors, _page_size, _addr_width, _flags)  \
-       ((kernel_ulong_t)&(struct flash_info) {                         \
                .sector_size = (_sector_size),                          \
                .n_sectors = (_n_sectors),                              \
                .page_size = (_page_size),                              \
                .addr_width = (_addr_width),                            \
-               .flags = (_flags),                                      \
-       })
+               .flags = (_flags),
 
 /* NOTE: double check command sets and memory organization when you add
  * more nor chips.  This current list focusses on newer chips, which
  * For historical (and compatibility) reasons (before we got above config) some
  * old entries may be missing 4K flag.
  */
-static const struct spi_device_id spi_nor_ids[] = {
+static const struct flash_info spi_nor_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) },
        { },
 };
 
-static const struct spi_device_id *spi_nor_read_id(struct spi_nor *nor)
+static const struct flash_info *spi_nor_read_id(struct spi_nor *nor)
 {
        int                     tmp;
        u8                      id[SPI_NOR_MAX_ID_LEN];
-       struct flash_info       *info;
+       const struct flash_info *info;
 
        tmp = nor->read_reg(nor, SPINOR_OP_RDID, id, SPI_NOR_MAX_ID_LEN);
        if (tmp < 0) {
        }
 
        for (tmp = 0; tmp < ARRAY_SIZE(spi_nor_ids) - 1; tmp++) {
-               info = (void *)spi_nor_ids[tmp].driver_data;
+               info = &spi_nor_ids[tmp];
                if (info->id_len) {
                        if (!memcmp(info->id, id, info->id_len))
                                return &spi_nor_ids[tmp];
        return 0;
 }
 
-static int set_quad_mode(struct spi_nor *nor, struct flash_info *info)
+static int set_quad_mode(struct spi_nor *nor, const struct flash_info *info)
 {
        int status;
 
 
 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;
+       const struct flash_info *info = NULL;
        struct device *dev = nor->dev;
        struct mtd_info *mtd = nor->mtd;
        struct device_node *np = dev->of_node;
                return ret;
 
        if (name)
-               id = spi_nor_match_id(name);
+               info = spi_nor_match_id(name);
        /* Try to auto-detect if chip name wasn't specified or not found */
-       if (!id)
-               id = spi_nor_read_id(nor);
-       if (IS_ERR_OR_NULL(id))
+       if (!info)
+               info = spi_nor_read_id(nor);
+       if (IS_ERR_OR_NULL(info))
                return -ENOENT;
 
-       info = (void *)id->driver_data;
-
        /*
         * If caller has specified name of flash model that can normally be
         * detected using JEDEC, let's verify it.
         */
        if (name && info->id_len) {
-               const struct spi_device_id *jid;
+               const struct flash_info *jinfo;
 
-               jid = spi_nor_read_id(nor);
-               if (IS_ERR(jid)) {
-                       return PTR_ERR(jid);
-               } else if (jid != id) {
+               jinfo = spi_nor_read_id(nor);
+               if (IS_ERR(jinfo)) {
+                       return PTR_ERR(jinfo);
+               } else if (jinfo != info) {
                        /*
                         * JEDEC knows better, so overwrite platform ID. We
                         * can't trust partitions any longer, but we'll let
                         * information, even if it's not 100% accurate.
                         */
                        dev_warn(dev, "found %s, expected %s\n",
-                                jid->name, id->name);
-                       id = jid;
-                       info = (void *)jid->driver_data;
+                                jinfo->name, info->name);
+                       info = jinfo;
                }
        }
 
 
        nor->read_dummy = spi_nor_read_dummy_cycles(nor);
 
-       dev_info(dev, "%s (%lld Kbytes)\n", id->name,
+       dev_info(dev, "%s (%lld Kbytes)\n", info->name,
                        (long long)mtd->size >> 10);
 
        dev_dbg(dev,
 }
 EXPORT_SYMBOL_GPL(spi_nor_scan);
 
-static const struct spi_device_id *spi_nor_match_id(const char *name)
+static const struct flash_info *spi_nor_match_id(const char *name)
 {
-       const struct spi_device_id *id = spi_nor_ids;
+       const struct flash_info *id = spi_nor_ids;
 
        while (id->name[0]) {
                if (!strcmp(name, id->name))