diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2014-09-29 22:14:55 -0400 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2014-10-21 16:46:03 -0400 |
commit | a5b7616c55e188fe3d6ef686bef402d4703ecb62 (patch) | |
tree | 914866866e05332cbbcfb9f70c75212a622ffb2a | |
parent | 70f3ce0510afdad7cbaf27ab7ab961377205c782 (diff) |
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: 03e296f613af ("mtd: m25p80: use the SPI nor framework")
Cc: <stable@vger.kernel.org> # 3.16.x: 32f1b7c8352f: mtd: move support for struct flash_platform_data into m25p80
Cc: <stable@vger.kernel.org> # 3.16.x: 90e55b3812a1: mtd: m25p80: get rid of spi_get_device_id
Cc: <stable@vger.kernel.org> # 3.16.x: 70f3ce0510af: mtd: spi-nor: make spi_nor_scan() take a chip type name, not spi_device_id
Cc: <stable@vger.kernel.org> # 3.16.x
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-rw-r--r-- | drivers/mtd/devices/m25p80.c | 52 | ||||
-rw-r--r-- | drivers/mtd/spi-nor/spi-nor.c | 3 | ||||
-rw-r--r-- | include/linux/mtd/spi-nor.h | 1 |
3 files changed, 52 insertions, 4 deletions
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index bd5e4c6edfd4..ed827cf894e4 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c | |||
@@ -261,12 +261,62 @@ static int m25p_remove(struct spi_device *spi) | |||
261 | } | 261 | } |
262 | 262 | ||
263 | 263 | ||
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 | |||
264 | static struct spi_driver m25p80_driver = { | 314 | static struct spi_driver m25p80_driver = { |
265 | .driver = { | 315 | .driver = { |
266 | .name = "m25p80", | 316 | .name = "m25p80", |
267 | .owner = THIS_MODULE, | 317 | .owner = THIS_MODULE, |
268 | }, | 318 | }, |
269 | .id_table = spi_nor_ids, | 319 | .id_table = m25p_ids, |
270 | .probe = m25p_probe, | 320 | .probe = m25p_probe, |
271 | .remove = m25p_remove, | 321 | .remove = m25p_remove, |
272 | 322 | ||
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index 5c8e39977bc5..c51ee52386a7 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c | |||
@@ -475,7 +475,7 @@ struct flash_info { | |||
475 | * more nor chips. This current list focusses on newer chips, which | 475 | * more nor chips. This current list focusses on newer chips, which |
476 | * have been converging on command sets which including JEDEC ID. | 476 | * have been converging on command sets which including JEDEC ID. |
477 | */ | 477 | */ |
478 | const struct spi_device_id spi_nor_ids[] = { | 478 | static const struct spi_device_id spi_nor_ids[] = { |
479 | /* Atmel -- some are (confusingly) marketed as "DataFlash" */ | 479 | /* Atmel -- some are (confusingly) marketed as "DataFlash" */ |
480 | { "at25fs010", INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K) }, | 480 | { "at25fs010", INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K) }, |
481 | { "at25fs040", INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K) }, | 481 | { "at25fs040", INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K) }, |
@@ -639,7 +639,6 @@ const struct spi_device_id spi_nor_ids[] = { | |||
639 | { "cat25128", CAT25_INFO(2048, 8, 64, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, | 639 | { "cat25128", CAT25_INFO(2048, 8, 64, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, |
640 | { }, | 640 | { }, |
641 | }; | 641 | }; |
642 | EXPORT_SYMBOL_GPL(spi_nor_ids); | ||
643 | 642 | ||
644 | static const struct spi_device_id *spi_nor_read_id(struct spi_nor *nor) | 643 | static const struct spi_device_id *spi_nor_read_id(struct spi_nor *nor) |
645 | { | 644 | { |
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h index a5a7a086748d..046a0a2e4c4e 100644 --- a/include/linux/mtd/spi-nor.h +++ b/include/linux/mtd/spi-nor.h | |||
@@ -199,6 +199,5 @@ struct spi_nor { | |||
199 | * Return: 0 for success, others for failure. | 199 | * Return: 0 for success, others for failure. |
200 | */ | 200 | */ |
201 | int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode); | 201 | 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[]; | ||
203 | 202 | ||
204 | #endif | 203 | #endif |