aboutsummaryrefslogtreecommitdiffstats
path: root/net/dsa
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-04-06 21:52:19 -0400
committerDavid S. Miller <davem@davemloft.net>2015-04-06 22:34:15 -0400
commitc85d6975ef923cffdd56de3e0e6aba0977282cff (patch)
treecb497deea01827951809c9c7c0f1c22780c146be /net/dsa
parent60302ff631f0f3eac0ec592e128b776f0676b397 (diff)
parentf22e6e847115abc3a0e2ad7bb18d243d42275af1 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: drivers/net/ethernet/mellanox/mlx4/cmd.c net/core/fib_rules.c net/ipv4/fib_frontend.c The fib_rules.c and fib_frontend.c conflicts were locking adjustments in 'net' overlapping addition and removal of code in 'net-next'. The mlx4 conflict was a bug fix in 'net' happening in the same place a constant was being replaced with a more suitable macro. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa')
-rw-r--r--net/dsa/dsa.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 899772108ee3..5eaadabe23a1 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -513,12 +513,10 @@ static struct net_device *dev_to_net_device(struct device *dev)
513#ifdef CONFIG_OF 513#ifdef CONFIG_OF
514static int dsa_of_setup_routing_table(struct dsa_platform_data *pd, 514static int dsa_of_setup_routing_table(struct dsa_platform_data *pd,
515 struct dsa_chip_data *cd, 515 struct dsa_chip_data *cd,
516 int chip_index, 516 int chip_index, int port_index,
517 struct device_node *link) 517 struct device_node *link)
518{ 518{
519 int ret;
520 const __be32 *reg; 519 const __be32 *reg;
521 int link_port_addr;
522 int link_sw_addr; 520 int link_sw_addr;
523 struct device_node *parent_sw; 521 struct device_node *parent_sw;
524 int len; 522 int len;
@@ -531,6 +529,10 @@ static int dsa_of_setup_routing_table(struct dsa_platform_data *pd,
531 if (!reg || (len != sizeof(*reg) * 2)) 529 if (!reg || (len != sizeof(*reg) * 2))
532 return -EINVAL; 530 return -EINVAL;
533 531
532 /*
533 * Get the destination switch number from the second field of its 'reg'
534 * property, i.e. for "reg = <0x19 1>" sw_addr is '1'.
535 */
534 link_sw_addr = be32_to_cpup(reg + 1); 536 link_sw_addr = be32_to_cpup(reg + 1);
535 537
536 if (link_sw_addr >= pd->nr_chips) 538 if (link_sw_addr >= pd->nr_chips)
@@ -547,20 +549,9 @@ static int dsa_of_setup_routing_table(struct dsa_platform_data *pd,
547 memset(cd->rtable, -1, pd->nr_chips * sizeof(s8)); 549 memset(cd->rtable, -1, pd->nr_chips * sizeof(s8));
548 } 550 }
549 551
550 reg = of_get_property(link, "reg", NULL); 552 cd->rtable[link_sw_addr] = port_index;
551 if (!reg) {
552 ret = -EINVAL;
553 goto out;
554 }
555
556 link_port_addr = be32_to_cpup(reg);
557
558 cd->rtable[link_sw_addr] = link_port_addr;
559 553
560 return 0; 554 return 0;
561out:
562 kfree(cd->rtable);
563 return ret;
564} 555}
565 556
566static void dsa_of_free_platform_data(struct dsa_platform_data *pd) 557static void dsa_of_free_platform_data(struct dsa_platform_data *pd)
@@ -670,7 +661,7 @@ static int dsa_of_probe(struct device *dev)
670 if (!strcmp(port_name, "dsa") && link && 661 if (!strcmp(port_name, "dsa") && link &&
671 pd->nr_chips > 1) { 662 pd->nr_chips > 1) {
672 ret = dsa_of_setup_routing_table(pd, cd, 663 ret = dsa_of_setup_routing_table(pd, cd,
673 chip_index, link); 664 chip_index, port_index, link);
674 if (ret) 665 if (ret)
675 goto out_free_chip; 666 goto out_free_chip;
676 } 667 }