All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, andrew@lunn.ch, jon.mason@broadcom.com,
	Florian Fainelli <f.fainelli@gmail.com>
Subject: [PATCH net-next 1/6] net: dsa: b53: Initialize ds->drv in b53_switch_alloc
Date: Wed, 24 Aug 2016 18:33:40 -0700	[thread overview]
Message-ID: <1472088825-20181-2-git-send-email-f.fainelli@gmail.com> (raw)
In-Reply-To: <1472088825-20181-1-git-send-email-f.fainelli@gmail.com>

In order to alloc drivers to override specific dsa_switch_driver
callbacks, initialize ds->drv to b53_switch_ops earlier, which avoids
having to expose this structure to glue drivers.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/dsa/b53/b53_common.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 65ecb51f99e5..30377ceb1928 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -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;
 
@@ -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->drv = &b53_switch_ops;
 			dev->cpu_port = chip->cpu_port;
 			dev->num_vlans = chip->vlans;
 			dev->num_arl_entries = chip->arl_entries;
@@ -1706,6 +1704,7 @@ struct b53_device *b53_switch_alloc(struct device *base,
 	dev->ds = ds;
 	dev->priv = priv;
 	dev->ops = ops;
+	ds->drv = &b53_switch_ops;
 	mutex_init(&dev->reg_mutex);
 	mutex_init(&dev->stats_mutex);
 
-- 
2.7.4

  reply	other threads:[~2016-08-25  5:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-25  1:33 [PATCH net-next 0/6] net: dsa: Make bcm_sf2 utilize b53_common Florian Fainelli
2016-08-25  1:33 ` Florian Fainelli [this message]
2016-08-25  3:14   ` [PATCH net-next 1/6] net: dsa: b53: Initialize ds->drv in b53_switch_alloc Florian Fainelli
2016-08-25  1:33 ` [PATCH net-next 2/6] net: dsa: b53: Prepare to support 7445 switch Florian Fainelli
2016-08-25  1:33 ` [PATCH net-next 3/6] net: dsa: b53: Define SF2 MIB layout Florian Fainelli
2016-08-25  1:33 ` [PATCH net-next 4/6] net: dsa: b53: Add JOIN_ALL_VLAN support Florian Fainelli
2016-08-25  1:33 ` [PATCH net-next 5/6] net: dsa: bcm_sf2: Utilize core B53 driver when possible Florian Fainelli
2016-08-25  1:33 ` [PATCH net-next 6/6] net: dsa: bcm_sf2: Remove duplicate code Florian Fainelli
2016-08-25 16:24 [PATCH net-next-v2 0/6] net: dsa: Make bcm_sf2 utilize b53_common Florian Fainelli
2016-08-25 16:24 ` [PATCH net-next 1/6] net: dsa: b53: Initialize ds->drv in b53_switch_alloc Florian Fainelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1472088825-20181-2-git-send-email-f.fainelli@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=jon.mason@broadcom.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.