bcm53xx: add BCM5301X patches sent upstream (bus and R6250 LEDs)
[openwrt/svn-archive/archive.git] / target / linux / bcm53xx / patches-3.14 / 402-mtd-spi-nor-allow-NULL-as-spi_device_id-in-spi_nor_s.patch
1 --- a/drivers/mtd/spi-nor/spi-nor.c
2 +++ b/drivers/mtd/spi-nor/spi-nor.c
3 @@ -925,29 +925,23 @@ int spi_nor_scan(struct spi_nor *nor, co
4 if (ret)
5 return ret;
6
7 - info = (void *)id->driver_data;
8 -
9 - if (info->jedec_id) {
10 - const struct spi_device_id *jid;
11 -
12 - jid = nor->read_id(nor);
13 - if (IS_ERR(jid)) {
14 - return PTR_ERR(jid);
15 - } else if (jid != id) {
16 - /*
17 - * JEDEC knows better, so overwrite platform ID. We
18 - * can't trust partitions any longer, but we'll let
19 - * mtd apply them anyway, since some partitions may be
20 - * marked read-only, and we don't want to lose that
21 - * information, even if it's not 100% accurate.
22 - */
23 - dev_warn(dev, "found %s, expected %s\n",
24 - jid->name, id->name);
25 - id = jid;
26 - info = (void *)jid->driver_data;
27 + if (id) {
28 + info = (void *)id->driver_data;
29 + if (info->jedec_id) {
30 + dev_warn(dev,
31 + "passed SPI device ID (%s) contains JEDEC, ignoring it, driver should be fixed!\n",
32 + id->name);
33 + id = NULL;
34 }
35 }
36
37 + if (!id) {
38 + id = nor->read_id(nor);
39 + if (IS_ERR(id))
40 + return PTR_ERR(id);
41 + }
42 + info = (void *)id->driver_data;
43 +
44 mutex_init(&nor->lock);
45
46 /*