~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to drivers/net/usb/kaweth.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno, Martin Michlmayr
  • Date: 2011-04-06 13:53:30 UTC
  • mfrom: (43.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20110406135330-wjufxhd0tvn3zx4z
Tags: 2.6.38-3
[ Ben Hutchings ]
* [ppc64] Add to linux-tools package architectures (Closes: #620124)
* [amd64] Save cr4 to mmu_cr4_features at boot time (Closes: #620284)
* appletalk: Fix bugs introduced when removing use of BKL
* ALSA: Fix yet another race in disconnection
* cciss: Fix lost command issue
* ath9k: Fix kernel panic in AR2427
* ses: Avoid kernel panic when lun 0 is not mapped
* PCI/ACPI: Report ASPM support to BIOS if not disabled from command line

[ Aurelien Jarno ]
* rtlwifi: fix build when PCI is not enabled.

[ Martin Michlmayr ]
* rtlwifi: Eliminate udelay calls with too large values (Closes: #620204)

Show diffs side-by-side

added added

removed removed

Lines of Context:
145
145
        { USB_DEVICE(0x0707, 0x0100) }, /* SMC 2202USB */
146
146
        { USB_DEVICE(0x07aa, 0x0001) }, /* Correga K.K. */
147
147
        { USB_DEVICE(0x07b8, 0x4000) }, /* D-Link DU-E10 */
 
148
        { USB_DEVICE(0x07c9, 0xb010) }, /* Allied Telesyn AT-USB10 USB Ethernet Adapter */
148
149
        { USB_DEVICE(0x0846, 0x1001) }, /* NetGear EA-101 */
149
150
        { USB_DEVICE(0x0846, 0x1002) }, /* NetGear EA-101 */
150
151
        { USB_DEVICE(0x085a, 0x0008) }, /* PortGear Ethernet Adapter */
206
207
        __le16 segment_size;
207
208
        __u16 max_multicast_filters;
208
209
        __u8 reserved3;
209
 
} __attribute__ ((packed));
 
210
} __packed;
210
211
 
211
212
/****************************************************************
212
213
 *     kaweth_device
405
406
 
406
407
        if (fw->size > KAWETH_FIRMWARE_BUF_SIZE) {
407
408
                err("Firmware too big: %zu", fw->size);
 
409
                release_firmware(fw);
408
410
                return -ENOSPC;
409
411
        }
410
412
        data_len = fw->size;
471
473
        int result;
472
474
 
473
475
        dbg("kaweth_reset(%p)", kaweth);
474
 
        result = kaweth_control(kaweth,
475
 
                                usb_sndctrlpipe(kaweth->dev, 0),
476
 
                                USB_REQ_SET_CONFIGURATION,
477
 
                                0,
478
 
                                kaweth->dev->config[0].desc.bConfigurationValue,
479
 
                                0,
480
 
                                NULL,
481
 
                                0,
482
 
                                KAWETH_CONTROL_TIMEOUT);
483
 
 
 
476
        result = usb_reset_configuration(kaweth->dev);
484
477
        mdelay(10);
485
478
 
486
479
        dbg("kaweth_reset() returns %d.",result);
725
718
        return 0;
726
719
 
727
720
err_out:
728
 
        usb_autopm_enable(kaweth->intf);
 
721
        usb_autopm_put_interface(kaweth->intf);
729
722
        return -EIO;
730
723
}
731
724
 
762
755
 
763
756
        kaweth->status &= ~KAWETH_STATUS_CLOSING;
764
757
 
765
 
        usb_autopm_enable(kaweth->intf);
 
758
        usb_autopm_put_interface(kaweth->intf);
766
759
 
767
760
        return 0;
768
761
}
769
762
 
770
 
static void kaweth_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
771
 
{
772
 
        struct kaweth_device *kaweth = netdev_priv(dev);
773
 
 
774
 
        strlcpy(info->driver, driver_name, sizeof(info->driver));
775
 
        usb_make_path(kaweth->dev, info->bus_info, sizeof (info->bus_info));
776
 
}
777
 
 
778
763
static u32 kaweth_get_link(struct net_device *dev)
779
764
{
780
765
        struct kaweth_device *kaweth = netdev_priv(dev);
783
768
}
784
769
 
785
770
static const struct ethtool_ops ops = {
786
 
        .get_drvinfo    = kaweth_get_drvinfo,
787
771
        .get_link       = kaweth_get_link
788
772
};
789
773
 
864
848
        {
865
849
                kaweth->stats.tx_packets++;
866
850
                kaweth->stats.tx_bytes += skb->len;
867
 
                net->trans_start = jiffies;
868
851
        }
869
852
 
870
853
        spin_unlock_irq(&kaweth->device_lock);
890
873
        if (net->flags & IFF_PROMISC) {
891
874
                packet_filter_bitmap |= KAWETH_PACKET_FILTER_PROMISCUOUS;
892
875
        }
893
 
        else if ((net->mc_count) || (net->flags & IFF_ALLMULTI)) {
 
876
        else if (!netdev_mc_empty(net) || (net->flags & IFF_ALLMULTI)) {
894
877
                packet_filter_bitmap |= KAWETH_PACKET_FILTER_ALL_MULTICAST;
895
878
        }
896
879
 
1164
1147
        if (!kaweth->irq_urb)
1165
1148
                goto err_tx_and_rx;
1166
1149
 
1167
 
        kaweth->intbuffer = usb_buffer_alloc(   kaweth->dev,
 
1150
        kaweth->intbuffer = usb_alloc_coherent( kaweth->dev,
1168
1151
                                                INTBUFFERSIZE,
1169
1152
                                                GFP_KERNEL,
1170
1153
                                                &kaweth->intbufferhandle);
1171
1154
        if (!kaweth->intbuffer)
1172
1155
                goto err_tx_and_rx_and_irq;
1173
 
        kaweth->rx_buf = usb_buffer_alloc(      kaweth->dev,
 
1156
        kaweth->rx_buf = usb_alloc_coherent(    kaweth->dev,
1174
1157
                                                KAWETH_BUF_SIZE,
1175
1158
                                                GFP_KERNEL,
1176
1159
                                                &kaweth->rxbufferhandle);
1211
1194
 
1212
1195
err_intfdata:
1213
1196
        usb_set_intfdata(intf, NULL);
1214
 
        usb_buffer_free(kaweth->dev, KAWETH_BUF_SIZE, (void *)kaweth->rx_buf, kaweth->rxbufferhandle);
 
1197
        usb_free_coherent(kaweth->dev, KAWETH_BUF_SIZE, (void *)kaweth->rx_buf, kaweth->rxbufferhandle);
1215
1198
err_all_but_rxbuf:
1216
 
        usb_buffer_free(kaweth->dev, INTBUFFERSIZE, (void *)kaweth->intbuffer, kaweth->intbufferhandle);
 
1199
        usb_free_coherent(kaweth->dev, INTBUFFERSIZE, (void *)kaweth->intbuffer, kaweth->intbufferhandle);
1217
1200
err_tx_and_rx_and_irq:
1218
1201
        usb_free_urb(kaweth->irq_urb);
1219
1202
err_tx_and_rx:
1250
1233
        usb_free_urb(kaweth->tx_urb);
1251
1234
        usb_free_urb(kaweth->irq_urb);
1252
1235
 
1253
 
        usb_buffer_free(kaweth->dev, KAWETH_BUF_SIZE, (void *)kaweth->rx_buf, kaweth->rxbufferhandle);
1254
 
        usb_buffer_free(kaweth->dev, INTBUFFERSIZE, (void *)kaweth->intbuffer, kaweth->intbufferhandle);
 
1236
        usb_free_coherent(kaweth->dev, KAWETH_BUF_SIZE, (void *)kaweth->rx_buf, kaweth->rxbufferhandle);
 
1237
        usb_free_coherent(kaweth->dev, INTBUFFERSIZE, (void *)kaweth->intbuffer, kaweth->intbufferhandle);
1255
1238
 
1256
1239
        free_netdev(netdev);
1257
1240
}