Skip to content

Commit

Permalink
net: dsa: b53: Initialize ds->ops in b53_switch_alloc
Browse files Browse the repository at this point in the history
In order to allow drivers to override specific dsa_switch_driver
callbacks, initialize ds->ops to b53_switch_ops earlier, which avoids
having to expose this structure to glue drivers.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Florian Fainelli authored and David S. Miller committed Aug 26, 2016
1 parent ed35ca9 commit 485ebd6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/net/dsa/b53/b53_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,6 @@ static const struct b53_chip_data b53_switch_chips[] = {

static int b53_switch_init(struct b53_device *dev)
{
struct dsa_switch *ds = dev->ds;
unsigned int i;
int ret;

Expand All @@ -1618,7 +1617,6 @@ static int b53_switch_init(struct b53_device *dev)
dev->vta_regs[1] = chip->vta_regs[1];
dev->vta_regs[2] = chip->vta_regs[2];
dev->jumbo_pm_reg = chip->jumbo_pm_reg;
ds->ops = &b53_switch_ops;
dev->cpu_port = chip->cpu_port;
dev->num_vlans = chip->vlans;
dev->num_arl_entries = chip->arl_entries;
Expand Down Expand Up @@ -1706,6 +1704,7 @@ struct b53_device *b53_switch_alloc(struct device *base,
dev->ds = ds;
dev->priv = priv;
dev->ops = ops;
ds->ops = &b53_switch_ops;
mutex_init(&dev->reg_mutex);
mutex_init(&dev->stats_mutex);

Expand Down

0 comments on commit 485ebd6

Please sign in to comment.