diff options
Diffstat (limited to '')
-rw-r--r-- | drivers/net/dsa/mv88e6xxx.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c index 49f085a8453d..5fb21e059f35 100644 --- a/drivers/net/dsa/mv88e6xxx.c +++ b/drivers/net/dsa/mv88e6xxx.c @@ -3169,24 +3169,25 @@ int mv88e6xxx_get_temp_alarm(struct dsa_switch *ds, bool *alarm) } #endif /* CONFIG_NET_DSA_HWMON */ -static const char * -mv88e6xxx_lookup_name(unsigned int id, const struct mv88e6xxx_switch_id *table, +static const struct mv88e6xxx_info * +mv88e6xxx_lookup_info(unsigned int prod_num, const struct mv88e6xxx_info *table, unsigned int num) { int i; for (i = 0; i < num; ++i) - if (table[i].id == (id & 0xfff0)) - return table[i].name; + if (table[i].prod_num == prod_num) + return &table[i]; return NULL; } const char *mv88e6xxx_drv_probe(struct device *dsa_dev, struct device *host_dev, int sw_addr, void **priv, - const struct mv88e6xxx_switch_id *table, + const struct mv88e6xxx_info *table, unsigned int num) { + const struct mv88e6xxx_info *info; struct mv88e6xxx_priv_state *ps; struct mii_bus *bus; const char *name; @@ -3203,16 +3204,19 @@ const char *mv88e6xxx_drv_probe(struct device *dsa_dev, struct device *host_dev, prod_num = (id & 0xfff0) >> 4; rev = id & 0x000f; - name = mv88e6xxx_lookup_name(id, table, num); - if (!name) + info = mv88e6xxx_lookup_info(prod_num, table, num); + if (!info) return NULL; + name = info->name; + ps = devm_kzalloc(dsa_dev, sizeof(*ps), GFP_KERNEL); if (!ps) return NULL; ps->bus = bus; ps->sw_addr = sw_addr; + ps->info = info; ps->id = id & 0xfff0; *priv = ps; |