Skip to content

Commit a5b7616

Browse files
bwhackscomputersforpeace
authored andcommitted
mtd: m25p80,spi-nor: Fix module aliases for m25p80
m25p80's device ID table is now spi_nor_ids, defined in spi-nor. The MODULE_DEVICE_TABLE() macro doesn't work with extern definitions, but its use was also removed at the same time. Now if m25p80 is built as a module it doesn't get the necessary aliases to be loaded automatically. A clean solution to this will involve defining the list of device IDs in spi-nor.h and removing struct spi_device_id from the spi-nor API, but this is quite a large change. As a quick fix suitable for stable, copy the device IDs back into m25p80. Fixes: 03e296f ("mtd: m25p80: use the SPI nor framework") Cc: <[email protected]> # 3.16.x: 32f1b7c: mtd: move support for struct flash_platform_data into m25p80 Cc: <[email protected]> # 3.16.x: 90e55b3: mtd: m25p80: get rid of spi_get_device_id Cc: <[email protected]> # 3.16.x: 70f3ce0: mtd: spi-nor: make spi_nor_scan() take a chip type name, not spi_device_id Cc: <[email protected]> # 3.16.x Signed-off-by: Ben Hutchings <[email protected]> Signed-off-by: Brian Norris <[email protected]>
1 parent 70f3ce0 commit a5b7616

File tree

3 files changed

+52
-4
lines changed

3 files changed

+52
-4
lines changed

drivers/mtd/devices/m25p80.c

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,62 @@ static int m25p_remove(struct spi_device *spi)
261261
}
262262

263263

264+
/*
265+
* XXX This needs to be kept in sync with spi_nor_ids. We can't share
266+
* it with spi-nor, because if this is built as a module then modpost
267+
* won't be able to read it and add appropriate aliases.
268+
*/
269+
static const struct spi_device_id m25p_ids[] = {
270+
{"at25fs010"}, {"at25fs040"}, {"at25df041a"}, {"at25df321a"},
271+
{"at25df641"}, {"at26f004"}, {"at26df081a"}, {"at26df161a"},
272+
{"at26df321"}, {"at45db081d"},
273+
{"en25f32"}, {"en25p32"}, {"en25q32b"}, {"en25p64"},
274+
{"en25q64"}, {"en25qh128"}, {"en25qh256"},
275+
{"f25l32pa"},
276+
{"mr25h256"}, {"mr25h10"},
277+
{"gd25q32"}, {"gd25q64"},
278+
{"160s33b"}, {"320s33b"}, {"640s33b"},
279+
{"mx25l2005a"}, {"mx25l4005a"}, {"mx25l8005"}, {"mx25l1606e"},
280+
{"mx25l3205d"}, {"mx25l3255e"}, {"mx25l6405d"}, {"mx25l12805d"},
281+
{"mx25l12855e"},{"mx25l25635e"},{"mx25l25655e"},{"mx66l51235l"},
282+
{"mx66l1g55g"},
283+
{"n25q064"}, {"n25q128a11"}, {"n25q128a13"}, {"n25q256a"},
284+
{"n25q512a"}, {"n25q512ax3"}, {"n25q00"},
285+
{"pm25lv512"}, {"pm25lv010"}, {"pm25lq032"},
286+
{"s25sl032p"}, {"s25sl064p"}, {"s25fl256s0"}, {"s25fl256s1"},
287+
{"s25fl512s"}, {"s70fl01gs"}, {"s25sl12800"}, {"s25sl12801"},
288+
{"s25fl129p0"}, {"s25fl129p1"}, {"s25sl004a"}, {"s25sl008a"},
289+
{"s25sl016a"}, {"s25sl032a"}, {"s25sl064a"}, {"s25fl008k"},
290+
{"s25fl016k"}, {"s25fl064k"},
291+
{"sst25vf040b"},{"sst25vf080b"},{"sst25vf016b"},{"sst25vf032b"},
292+
{"sst25vf064c"},{"sst25wf512"}, {"sst25wf010"}, {"sst25wf020"},
293+
{"sst25wf040"},
294+
{"m25p05"}, {"m25p10"}, {"m25p20"}, {"m25p40"},
295+
{"m25p80"}, {"m25p16"}, {"m25p32"}, {"m25p64"},
296+
{"m25p128"}, {"n25q032"},
297+
{"m25p05-nonjedec"}, {"m25p10-nonjedec"}, {"m25p20-nonjedec"},
298+
{"m25p40-nonjedec"}, {"m25p80-nonjedec"}, {"m25p16-nonjedec"},
299+
{"m25p32-nonjedec"}, {"m25p64-nonjedec"}, {"m25p128-nonjedec"},
300+
{"m45pe10"}, {"m45pe80"}, {"m45pe16"},
301+
{"m25pe20"}, {"m25pe80"}, {"m25pe16"},
302+
{"m25px16"}, {"m25px32"}, {"m25px32-s0"}, {"m25px32-s1"},
303+
{"m25px64"},
304+
{"w25x10"}, {"w25x20"}, {"w25x40"}, {"w25x80"},
305+
{"w25x16"}, {"w25x32"}, {"w25q32"}, {"w25q32dw"},
306+
{"w25x64"}, {"w25q64"}, {"w25q128"}, {"w25q80"},
307+
{"w25q80bl"}, {"w25q128"}, {"w25q256"}, {"cat25c11"},
308+
{"cat25c03"}, {"cat25c09"}, {"cat25c17"}, {"cat25128"},
309+
{ },
310+
};
311+
MODULE_DEVICE_TABLE(spi, m25p_ids);
312+
313+
264314
static struct spi_driver m25p80_driver = {
265315
.driver = {
266316
.name = "m25p80",
267317
.owner = THIS_MODULE,
268318
},
269-
.id_table = spi_nor_ids,
319+
.id_table = m25p_ids,
270320
.probe = m25p_probe,
271321
.remove = m25p_remove,
272322

drivers/mtd/spi-nor/spi-nor.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ struct flash_info {
475475
* more nor chips. This current list focusses on newer chips, which
476476
* have been converging on command sets which including JEDEC ID.
477477
*/
478-
const struct spi_device_id spi_nor_ids[] = {
478+
static const struct spi_device_id spi_nor_ids[] = {
479479
/* Atmel -- some are (confusingly) marketed as "DataFlash" */
480480
{ "at25fs010", INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K) },
481481
{ "at25fs040", INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K) },
@@ -639,7 +639,6 @@ const struct spi_device_id spi_nor_ids[] = {
639639
{ "cat25128", CAT25_INFO(2048, 8, 64, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) },
640640
{ },
641641
};
642-
EXPORT_SYMBOL_GPL(spi_nor_ids);
643642

644643
static const struct spi_device_id *spi_nor_read_id(struct spi_nor *nor)
645644
{

include/linux/mtd/spi-nor.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,5 @@ struct spi_nor {
199199
* Return: 0 for success, others for failure.
200200
*/
201201
int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode);
202-
extern const struct spi_device_id spi_nor_ids[];
203202

204203
#endif

0 commit comments

Comments
 (0)