Skip to content

Commit a0b6848

Browse files
Jon Masondavem330
authored andcommitted
net: ethernet: bgmac: add dma_dev pointer
The dma buffer allocation, etc references a dma_dev device pointer from the bcma core. In anticipation of removing the bcma requirement for this driver, these must be changed to not reference that struct. Add a dma_dev device pointer to the bgmac stuct and reference that instead. Signed-off-by: Jon Mason <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Tested-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d00a828 commit a0b6848

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

drivers/net/ethernet/broadcom/bgmac.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac,
152152
struct bgmac_dma_ring *ring,
153153
struct sk_buff *skb)
154154
{
155-
struct device *dma_dev = bgmac->core->dma_dev;
155+
struct device *dma_dev = bgmac->dma_dev;
156156
struct net_device *net_dev = bgmac->net_dev;
157157
int index = ring->end % BGMAC_TX_RING_SLOTS;
158158
struct bgmac_slot_info *slot = &ring->slots[index];
@@ -254,7 +254,7 @@ static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac,
254254
/* Free transmitted packets */
255255
static void bgmac_dma_tx_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring)
256256
{
257-
struct device *dma_dev = bgmac->core->dma_dev;
257+
struct device *dma_dev = bgmac->dma_dev;
258258
int empty_slot;
259259
bool freed = false;
260260
unsigned bytes_compl = 0, pkts_compl = 0;
@@ -352,7 +352,7 @@ static void bgmac_dma_rx_enable(struct bgmac *bgmac,
352352
static int bgmac_dma_rx_skb_for_slot(struct bgmac *bgmac,
353353
struct bgmac_slot_info *slot)
354354
{
355-
struct device *dma_dev = bgmac->core->dma_dev;
355+
struct device *dma_dev = bgmac->dma_dev;
356356
dma_addr_t dma_addr;
357357
struct bgmac_rx_header *rx;
358358
void *buf;
@@ -441,7 +441,7 @@ static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring,
441441
end_slot /= sizeof(struct bgmac_dma_desc);
442442

443443
while (ring->start != end_slot) {
444-
struct device *dma_dev = bgmac->core->dma_dev;
444+
struct device *dma_dev = bgmac->dma_dev;
445445
struct bgmac_slot_info *slot = &ring->slots[ring->start];
446446
struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET;
447447
struct sk_buff *skb;
@@ -544,7 +544,7 @@ static bool bgmac_dma_unaligned(struct bgmac *bgmac,
544544
static void bgmac_dma_tx_ring_free(struct bgmac *bgmac,
545545
struct bgmac_dma_ring *ring)
546546
{
547-
struct device *dma_dev = bgmac->core->dma_dev;
547+
struct device *dma_dev = bgmac->dma_dev;
548548
struct bgmac_dma_desc *dma_desc = ring->cpu_base;
549549
struct bgmac_slot_info *slot;
550550
int i;
@@ -570,7 +570,7 @@ static void bgmac_dma_tx_ring_free(struct bgmac *bgmac,
570570
static void bgmac_dma_rx_ring_free(struct bgmac *bgmac,
571571
struct bgmac_dma_ring *ring)
572572
{
573-
struct device *dma_dev = bgmac->core->dma_dev;
573+
struct device *dma_dev = bgmac->dma_dev;
574574
struct bgmac_slot_info *slot;
575575
int i;
576576

@@ -591,7 +591,7 @@ static void bgmac_dma_ring_desc_free(struct bgmac *bgmac,
591591
struct bgmac_dma_ring *ring,
592592
int num_slots)
593593
{
594-
struct device *dma_dev = bgmac->core->dma_dev;
594+
struct device *dma_dev = bgmac->dma_dev;
595595
int size;
596596

597597
if (!ring->cpu_base)
@@ -629,7 +629,7 @@ static void bgmac_dma_free(struct bgmac *bgmac)
629629

630630
static int bgmac_dma_alloc(struct bgmac *bgmac)
631631
{
632-
struct device *dma_dev = bgmac->core->dma_dev;
632+
struct device *dma_dev = bgmac->dma_dev;
633633
struct bgmac_dma_ring *ring;
634634
static const u16 ring_base[] = { BGMAC_DMA_BASE0, BGMAC_DMA_BASE1,
635635
BGMAC_DMA_BASE2, BGMAC_DMA_BASE3, };
@@ -1703,6 +1703,7 @@ static int bgmac_probe(struct bcma_device *core)
17031703
net_dev->ethtool_ops = &bgmac_ethtool_ops;
17041704
bgmac = netdev_priv(net_dev);
17051705
bgmac->dev = &core->dev;
1706+
bgmac->dma_dev = core->dma_dev;
17061707
bgmac->net_dev = net_dev;
17071708
bgmac->core = core;
17081709
bcma_set_drvdata(core, bgmac);

drivers/net/ethernet/broadcom/bgmac.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ struct bgmac {
429429
struct bcma_device *cmn; /* Reference to CMN core for BCM4706 */
430430

431431
struct device *dev;
432+
struct device *dma_dev;
432433
struct net_device *net_dev;
433434
struct napi_struct napi;
434435
struct mii_bus *mii_bus;

0 commit comments

Comments
 (0)