Skip to content

Commit

Permalink
net/macb: only probe queues once and use stored values
Browse files Browse the repository at this point in the history
When merging at91_ether and macb driver during 421d9df (net/macb: merge
at91_ether driver into macb driver) the probe function has been split. The code
dealing with initialization of queues is now moved in macb_init() which needs
information computed in the parent macb_probe() function.
So, add the queue_mask information to the private structure and use it when
needed in macb_init().

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Nicolas Ferre authored and David S. Miller committed Mar 31, 2015
1 parent 34d21e3 commit bfa0914
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/net/ethernet/cadence/macb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2180,7 +2180,7 @@ static void macb_probe_queues(void __iomem *mem,
static int macb_init(struct platform_device *pdev)
{
struct net_device *dev = platform_get_drvdata(pdev);
unsigned int hw_q, queue_mask, q, num_queues;
unsigned int hw_q, q;
struct macb *bp = netdev_priv(dev);
struct macb_queue *queue;
int err;
Expand Down Expand Up @@ -2226,10 +2226,8 @@ static int macb_init(struct platform_device *pdev)
* register mapping but we don't want to test the queue index then
* compute the corresponding register offset at run time.
*/
macb_probe_queues(bp->regs, &queue_mask, &num_queues);

for (hw_q = 0, q = 0; hw_q < MACB_MAX_QUEUES; ++hw_q) {
if (!(queue_mask & (1 << hw_q)))
if (!(bp->queue_mask & (1 << hw_q)))
continue;

queue = &bp->queues[q];
Expand Down Expand Up @@ -2715,6 +2713,7 @@ static int macb_probe(struct platform_device *pdev)
bp->dev = dev;
bp->regs = mem;
bp->num_queues = num_queues;
bp->queue_mask = queue_mask;
spin_lock_init(&bp->lock);

platform_set_drvdata(pdev, dev);
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/cadence/macb.h
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,7 @@ struct macb {
size_t rx_buffer_size;

unsigned int num_queues;
unsigned int queue_mask;
struct macb_queue queues[MACB_MAX_QUEUES];

spinlock_t lock;
Expand Down

0 comments on commit bfa0914

Please sign in to comment.