aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wimax/i2400m/driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wimax/i2400m/driver.c')
-rw-r--r--drivers/net/wimax/i2400m/driver.c54
1 files changed, 40 insertions, 14 deletions
diff --git a/drivers/net/wimax/i2400m/driver.c b/drivers/net/wimax/i2400m/driver.c
index 304f0443ca4b..20d574ca9183 100644
--- a/drivers/net/wimax/i2400m/driver.c
+++ b/drivers/net/wimax/i2400m/driver.c
@@ -619,6 +619,46 @@ EXPORT_SYMBOL_GPL(i2400m_dev_reset_handle);
619 619
620 620
621/** 621/**
622 * i2400m_bm_buf_alloc - Alloc the command and ack buffers for boot mode
623 *
624 * Get the buffers needed to deal with boot mode messages. These
625 * buffers need to be allocated before the sdio recieve irq is setup.
626 */
627int i2400m_bm_buf_alloc(struct i2400m *i2400m)
628{
629 int result;
630
631 result = -ENOMEM;
632 i2400m->bm_cmd_buf = kzalloc(I2400M_BM_CMD_BUF_SIZE, GFP_KERNEL);
633 if (i2400m->bm_cmd_buf == NULL)
634 goto error_bm_cmd_kzalloc;
635 i2400m->bm_ack_buf = kzalloc(I2400M_BM_ACK_BUF_SIZE, GFP_KERNEL);
636 if (i2400m->bm_ack_buf == NULL)
637 goto error_bm_ack_buf_kzalloc;
638 return 0;
639
640error_bm_ack_buf_kzalloc:
641 kfree(i2400m->bm_cmd_buf);
642error_bm_cmd_kzalloc:
643 return result;
644}
645EXPORT_SYMBOL_GPL(i2400m_bm_buf_alloc);
646
647/**
648 * i2400m_bm_buf_free - Free boot mode command and ack buffers.
649 *
650 * Free the command and ack buffers
651 *
652 */
653void i2400m_bm_buf_free(struct i2400m *i2400m)
654{
655 kfree(i2400m->bm_ack_buf);
656 kfree(i2400m->bm_cmd_buf);
657 return;
658}
659EXPORT_SYMBOL_GPL(i2400m_bm_buf_free
660);
661/**
622 * i2400m_setup - bus-generic setup function for the i2400m device 662 * i2400m_setup - bus-generic setup function for the i2400m device
623 * 663 *
624 * @i2400m: device descriptor (bus-specific parts have been initialized) 664 * @i2400m: device descriptor (bus-specific parts have been initialized)
@@ -645,16 +685,6 @@ int i2400m_setup(struct i2400m *i2400m, enum i2400m_bri bm_flags)
645 snprintf(wimax_dev->name, sizeof(wimax_dev->name), 685 snprintf(wimax_dev->name, sizeof(wimax_dev->name),
646 "i2400m-%s:%s", dev->bus->name, dev_name(dev)); 686 "i2400m-%s:%s", dev->bus->name, dev_name(dev));
647 687
648 i2400m->bm_cmd_buf = kzalloc(I2400M_BM_CMD_BUF_SIZE, GFP_KERNEL);
649 if (i2400m->bm_cmd_buf == NULL) {
650 dev_err(dev, "cannot allocate USB command buffer\n");
651 goto error_bm_cmd_kzalloc;
652 }
653 i2400m->bm_ack_buf = kzalloc(I2400M_BM_ACK_BUF_SIZE, GFP_KERNEL);
654 if (i2400m->bm_ack_buf == NULL) {
655 dev_err(dev, "cannot allocate USB ack buffer\n");
656 goto error_bm_ack_buf_kzalloc;
657 }
658 result = i2400m_bootrom_init(i2400m, bm_flags); 688 result = i2400m_bootrom_init(i2400m, bm_flags);
659 if (result < 0) { 689 if (result < 0) {
660 dev_err(dev, "read mac addr: bootrom init " 690 dev_err(dev, "read mac addr: bootrom init "
@@ -713,10 +743,6 @@ error_dev_start:
713error_register_netdev: 743error_register_netdev:
714error_read_mac_addr: 744error_read_mac_addr:
715error_bootrom_init: 745error_bootrom_init:
716 kfree(i2400m->bm_ack_buf);
717error_bm_ack_buf_kzalloc:
718 kfree(i2400m->bm_cmd_buf);
719error_bm_cmd_kzalloc:
720 d_fnend(3, dev, "(i2400m %p) = %d\n", i2400m, result); 746 d_fnend(3, dev, "(i2400m %p) = %d\n", i2400m, result);
721 return result; 747 return result;
722} 748}