aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394/eth1394.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2007-04-01 04:06:33 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2007-04-29 18:00:30 -0400
commit09d7a96f5ad1019386594e2795c1f0229dd43305 (patch)
treebc713f7ac6ac56bb4a40ec16b4467946775297a0 /drivers/ieee1394/eth1394.c
parent70093cfde8af52b0b9030d90f9004cbde38f2ff8 (diff)
ieee1394: eth1394: Move common recv_init code to helper function
There is some common code between ether1394_open and ether1394_add_host which can be moved to a separate helper function for a slightly smaller eth1394 driver (-160 bytes on i386.) Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/ieee1394/eth1394.c')
-rw-r--r--drivers/ieee1394/eth1394.c71
1 files changed, 31 insertions, 40 deletions
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c
index b4fa754bfd1a..f7b47b981fd1 100644
--- a/drivers/ieee1394/eth1394.c
+++ b/drivers/ieee1394/eth1394.c
@@ -208,38 +208,45 @@ static struct hpsb_highlevel eth1394_highlevel = {
208}; 208};
209 209
210 210
211static int ether1394_recv_init(struct net_device *dev)
212{
213 struct eth1394_priv *priv = netdev_priv(dev);
214
215 priv->iso = hpsb_iso_recv_init(priv->host,
216 ETHER1394_ISO_BUF_SIZE,
217 ETHER1394_GASP_BUFFERS,
218 priv->broadcast_channel,
219 HPSB_ISO_DMA_PACKET_PER_BUFFER,
220 1, ether1394_iso);
221 if (priv->iso == NULL) {
222 ETH1394_PRINT(KERN_ERR, dev->name,
223 "Could not allocate isochronous receive "
224 "context for the broadcast channel\n");
225 priv->bc_state = ETHER1394_BC_ERROR;
226 return -EAGAIN;
227 }
228
229 if (hpsb_iso_recv_start(priv->iso, -1, (1 << 3), -1) < 0)
230 priv->bc_state = ETHER1394_BC_STOPPED;
231 else
232 priv->bc_state = ETHER1394_BC_RUNNING;
233 return 0;
234}
235
211/* This is called after an "ifup" */ 236/* This is called after an "ifup" */
212static int ether1394_open (struct net_device *dev) 237static int ether1394_open(struct net_device *dev)
213{ 238{
214 struct eth1394_priv *priv = netdev_priv(dev); 239 struct eth1394_priv *priv = netdev_priv(dev);
215 int ret = 0; 240 int ret;
216 241
217 /* Something bad happened, don't even try */ 242 /* Something bad happened, don't even try */
218 if (priv->bc_state == ETHER1394_BC_ERROR) { 243 if (priv->bc_state == ETHER1394_BC_ERROR) {
219 /* we'll try again */ 244 /* we'll try again */
220 priv->iso = hpsb_iso_recv_init(priv->host, 245 ret = ether1394_recv_init(dev);
221 ETHER1394_ISO_BUF_SIZE, 246 if (ret)
222 ETHER1394_GASP_BUFFERS, 247 return ret;
223 priv->broadcast_channel,
224 HPSB_ISO_DMA_PACKET_PER_BUFFER,
225 1, ether1394_iso);
226 if (priv->iso == NULL) {
227 ETH1394_PRINT(KERN_ERR, dev->name,
228 "Could not allocate isochronous receive "
229 "context for the broadcast channel\n");
230 priv->bc_state = ETHER1394_BC_ERROR;
231 ret = -EAGAIN;
232 } else {
233 if (hpsb_iso_recv_start(priv->iso, -1, (1 << 3), -1) < 0)
234 priv->bc_state = ETHER1394_BC_STOPPED;
235 else
236 priv->bc_state = ETHER1394_BC_RUNNING;
237 }
238 } 248 }
239 249
240 if (ret)
241 return ret;
242
243 netif_start_queue (dev); 250 netif_start_queue (dev);
244 return 0; 251 return 0;
245} 252}
@@ -628,23 +635,7 @@ static void ether1394_add_host (struct hpsb_host *host)
628 * be checked when the eth device is opened. */ 635 * be checked when the eth device is opened. */
629 priv->broadcast_channel = host->csr.broadcast_channel & 0x3f; 636 priv->broadcast_channel = host->csr.broadcast_channel & 0x3f;
630 637
631 priv->iso = hpsb_iso_recv_init(host, 638 ether1394_recv_init(dev);
632 ETHER1394_ISO_BUF_SIZE,
633 ETHER1394_GASP_BUFFERS,
634 priv->broadcast_channel,
635 HPSB_ISO_DMA_PACKET_PER_BUFFER,
636 1, ether1394_iso);
637 if (priv->iso == NULL) {
638 ETH1394_PRINT(KERN_ERR, dev->name,
639 "Could not allocate isochronous receive context "
640 "for the broadcast channel\n");
641 priv->bc_state = ETHER1394_BC_ERROR;
642 } else {
643 if (hpsb_iso_recv_start(priv->iso, -1, (1 << 3), -1) < 0)
644 priv->bc_state = ETHER1394_BC_STOPPED;
645 else
646 priv->bc_state = ETHER1394_BC_RUNNING;
647 }
648 return; 639 return;
649out: 640out:
650 if (dev) 641 if (dev)