netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/7] ethoc: calculate number of buffers in ethoc_probe
@ 2010-06-11 12:47 Jonas Bonn
  2010-06-11 12:47 ` [PATCH 2/7] ethoc: Write bus addresses to registers Jonas Bonn
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Jonas Bonn @ 2010-06-11 12:47 UTC (permalink / raw)
  To: netdev; +Cc: Jonas Bonn

This moves the calculation of the number of transmission buffers to
ethoc_probe where it more logically fits with the rest of the memory
allocation code.

Signed-off-by: Jonas Bonn <jonas@southpole.se>
---
 drivers/net/ethoc.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
index 6ed2df1..68093cf 100644
--- a/drivers/net/ethoc.c
+++ b/drivers/net/ethoc.c
@@ -658,8 +658,6 @@ static int ethoc_mdio_probe(struct net_device *dev)
 static int ethoc_open(struct net_device *dev)
 {
 	struct ethoc *priv = netdev_priv(dev);
-	unsigned int min_tx = 2;
-	unsigned int num_bd;
 	int ret;
 
 	ret = request_irq(dev->irq, ethoc_interrupt, IRQF_SHARED,
@@ -667,11 +665,6 @@ static int ethoc_open(struct net_device *dev)
 	if (ret)
 		return ret;
 
-	/* calculate the number of TX/RX buffers, maximum 128 supported */
-	num_bd = min_t(unsigned int,
-		128, (dev->mem_end - dev->mem_start + 1) / ETHOC_BUFSIZ);
-	priv->num_tx = max(min_tx, num_bd / 4);
-	priv->num_rx = num_bd - priv->num_tx;
 	ethoc_write(priv, TX_BD_NUM, priv->num_tx);
 
 	ethoc_init_ring(priv);
@@ -884,6 +877,7 @@ static int ethoc_probe(struct platform_device *pdev)
 	struct resource *mem = NULL;
 	struct ethoc *priv = NULL;
 	unsigned int phy;
+	int num_bd;
 	int ret = 0;
 
 	/* allocate networking device */
@@ -978,6 +972,12 @@ static int ethoc_probe(struct platform_device *pdev)
 		priv->dma_alloc = buffer_size;
 	}
 
+	/* calculate the number of TX/RX buffers, maximum 128 supported */
+	num_bd = min_t(unsigned int,
+		128, (netdev->mem_end - netdev->mem_start + 1) / ETHOC_BUFSIZ);
+	priv->num_tx = max(2, num_bd / 4);
+	priv->num_rx = num_bd - priv->num_tx;
+
 	/* Allow the platform setup code to pass in a MAC address. */
 	if (pdev->dev.platform_data) {
 		struct ethoc_platform_data *pdata =
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-06-11 20:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-11 12:47 [PATCH 1/7] ethoc: calculate number of buffers in ethoc_probe Jonas Bonn
2010-06-11 12:47 ` [PATCH 2/7] ethoc: Write bus addresses to registers Jonas Bonn
2010-06-11 12:47 ` [PATCH 3/7] ethoc: write number of TX buffers in init_ring Jonas Bonn
2010-06-11 12:47 ` [PATCH 4/7] ethoc: Clean up PHY probing Jonas Bonn
2010-06-11 12:47 ` [PATCH 5/7] Remove unused variable Jonas Bonn
2010-06-11 12:47 ` [PATCH 6/7] ethoc: Clear command buffer after write Jonas Bonn
2010-06-11 12:47 ` [PATCH 7/7] ethoc: use devres resource management Jonas Bonn
2010-06-11 20:29 ` [PATCH 1/7] ethoc: calculate number of buffers in ethoc_probe David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).