diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-04 11:47:58 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-04 11:47:58 -0700 |
commit | 6ba74014c1ab0e37af7de6f64b4eccbbae3cb9e7 (patch) | |
tree | 8f3892fc44f1e403675a6d7e88fda5c70e56ee4c /drivers/net/wan | |
parent | 5abd9ccced7a726c817dd6b5b96bc933859138d1 (diff) | |
parent | 3ff1c25927e3af61c6bf0e4ed959504058ae4565 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1443 commits)
phy/marvell: add 88ec048 support
igb: Program MDICNFG register prior to PHY init
e1000e: correct MAC-PHY interconnect register offset for 82579
hso: Add new product ID
can: Add driver for esd CAN-USB/2 device
l2tp: fix export of header file for userspace
can-raw: Fix skb_orphan_try handling
Revert "net: remove zap_completion_queue"
net: cleanup inclusion
phy/marvell: add 88e1121 interface mode support
u32: negative offset fix
net: Fix a typo from "dev" to "ndev"
igb: Use irq_synchronize per vector when using MSI-X
ixgbevf: fix null pointer dereference due to filter being set for VLAN 0
e1000e: Fix irq_synchronize in MSI-X case
e1000e: register pm_qos request on hardware activation
ip_fragment: fix subtracting PPPOE_SES_HLEN from mtu twice
net: Add getsockopt support for TCP thin-streams
cxgb4: update driver version
cxgb4: add new PCI IDs
...
Manually fix up conflicts in:
- drivers/net/e1000e/netdev.c: due to pm_qos registration
infrastructure changes
- drivers/net/phy/marvell.c: conflict between adding 88ec048 support
and cleaning up the IDs
- drivers/net/wireless/ipw2x00/ipw2100.c: trivial ipw2100_pm_qos_req
conflict (registration change vs marking it static)
Diffstat (limited to 'drivers/net/wan')
-rw-r--r-- | drivers/net/wan/cosa.c | 10 | ||||
-rw-r--r-- | drivers/net/wan/farsync.c | 125 | ||||
-rw-r--r-- | drivers/net/wan/hd64570.h | 2 | ||||
-rw-r--r-- | drivers/net/wan/hdlc_cisco.c | 4 | ||||
-rw-r--r-- | drivers/net/wan/hdlc_fr.c | 2 | ||||
-rw-r--r-- | drivers/net/wan/sdla.c | 13 |
6 files changed, 70 insertions, 86 deletions
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index f0bd70fb650c..04c6cd4333f1 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c @@ -89,7 +89,6 @@ #include <linux/spinlock.h> #include <linux/mutex.h> #include <linux/device.h> -#include <linux/smp_lock.h> #include <asm/io.h> #include <asm/dma.h> #include <asm/byteorder.h> @@ -174,6 +173,7 @@ struct cosa_data { * Character device major number. 117 was allocated for us. * The value of 0 means to allocate a first free one. */ +static DEFINE_MUTEX(cosa_chardev_mutex); static int cosa_major = 117; /* @@ -944,7 +944,7 @@ static int cosa_open(struct inode *inode, struct file *file) int n; int ret = 0; - lock_kernel(); + mutex_lock(&cosa_chardev_mutex); if ((n=iminor(file->f_path.dentry->d_inode)>>CARD_MINOR_BITS) >= nr_cards) { ret = -ENODEV; @@ -976,7 +976,7 @@ static int cosa_open(struct inode *inode, struct file *file) chan->rx_done = chrdev_rx_done; spin_unlock_irqrestore(&cosa->lock, flags); out: - unlock_kernel(); + mutex_unlock(&cosa_chardev_mutex); return ret; } @@ -1212,10 +1212,10 @@ static long cosa_chardev_ioctl(struct file *file, unsigned int cmd, struct cosa_data *cosa; long ret; - lock_kernel(); + mutex_lock(&cosa_chardev_mutex); cosa = channel->cosa; ret = cosa_ioctl_common(cosa, channel, cmd, arg); - unlock_kernel(); + mutex_unlock(&cosa_chardev_mutex); return ret; } diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index e087b9a6daaa..ad7719fe6d0a 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c @@ -15,6 +15,8 @@ * Maintainer: Kevin Curtis <kevin.curtis@farsite.co.uk> */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/module.h> #include <linux/kernel.h> #include <linux/version.h> @@ -511,21 +513,19 @@ static int fst_debug_mask = { FST_DEBUG }; * support variable numbers of macro parameters. The inverted if prevents us * eating someone else's else clause. */ -#define dbg(F,fmt,A...) if ( ! ( fst_debug_mask & (F))) \ - ; \ - else \ - printk ( KERN_DEBUG FST_NAME ": " fmt, ## A ) - +#define dbg(F, fmt, args...) \ +do { \ + if (fst_debug_mask & (F)) \ + printk(KERN_DEBUG pr_fmt(fmt), ##args); \ +} while (0) #else -#define dbg(X...) /* NOP */ +#define dbg(F, fmt, args...) \ +do { \ + if (0) \ + printk(KERN_DEBUG pr_fmt(fmt), ##args); \ +} while (0) #endif -/* Printing short cuts - */ -#define printk_err(fmt,A...) printk ( KERN_ERR FST_NAME ": " fmt, ## A ) -#define printk_warn(fmt,A...) printk ( KERN_WARNING FST_NAME ": " fmt, ## A ) -#define printk_info(fmt,A...) printk ( KERN_INFO FST_NAME ": " fmt, ## A ) - /* * PCI ID lookup table */ @@ -961,7 +961,7 @@ fst_issue_cmd(struct fst_port_info *port, unsigned short cmd) spin_lock_irqsave(&card->card_lock, flags); if (++safety > 2000) { - printk_err("Mailbox safety timeout\n"); + pr_err("Mailbox safety timeout\n"); break; } @@ -1241,8 +1241,8 @@ fst_intr_rx(struct fst_card_info *card, struct fst_port_info *port) * This seems to happen on the TE1 interface sometimes * so throw the frame away and log the event. */ - printk_err("Frame received with 0 length. Card %d Port %d\n", - card->card_no, port->index); + pr_err("Frame received with 0 length. Card %d Port %d\n", + card->card_no, port->index); /* Return descriptor to card */ FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN); @@ -1486,9 +1486,8 @@ fst_intr(int dummy, void *dev_id) */ dbg(DBG_INTR, "intr: %d %p\n", card->irq, card); if (card->state != FST_RUNNING) { - printk_err - ("Interrupt received for card %d in a non running state (%d)\n", - card->card_no, card->state); + pr_err("Interrupt received for card %d in a non running state (%d)\n", + card->card_no, card->state); /* * It is possible to really be running, i.e. we have re-loaded @@ -1614,8 +1613,7 @@ fst_intr(int dummy, void *dev_id) break; default: - printk_err("intr: unknown card event %d. ignored\n", - event); + pr_err("intr: unknown card event %d. ignored\n", event); break; } @@ -1637,13 +1635,13 @@ check_started_ok(struct fst_card_info *card) /* Check structure version and end marker */ if (FST_RDW(card, smcVersion) != SMC_VERSION) { - printk_err("Bad shared memory version %d expected %d\n", - FST_RDW(card, smcVersion), SMC_VERSION); + pr_err("Bad shared memory version %d expected %d\n", + FST_RDW(card, smcVersion), SMC_VERSION); card->state = FST_BADVERSION; return; } if (FST_RDL(card, endOfSmcSignature) != END_SIG) { - printk_err("Missing shared memory signature\n"); + pr_err("Missing shared memory signature\n"); card->state = FST_BADVERSION; return; } @@ -1651,11 +1649,11 @@ check_started_ok(struct fst_card_info *card) if ((i = FST_RDB(card, taskStatus)) == 0x01) { card->state = FST_RUNNING; } else if (i == 0xFF) { - printk_err("Firmware initialisation failed. Card halted\n"); + pr_err("Firmware initialisation failed. Card halted\n"); card->state = FST_HALTED; return; } else if (i != 0x00) { - printk_err("Unknown firmware status 0x%x\n", i); + pr_err("Unknown firmware status 0x%x\n", i); card->state = FST_HALTED; return; } @@ -1665,9 +1663,10 @@ check_started_ok(struct fst_card_info *card) * existing firmware etc so we just report it for the moment. */ if (FST_RDL(card, numberOfPorts) != card->nports) { - printk_warn("Port count mismatch on card %d." - " Firmware thinks %d we say %d\n", card->card_no, - FST_RDL(card, numberOfPorts), card->nports); + pr_warning("Port count mismatch on card %d. " + "Firmware thinks %d we say %d\n", + card->card_no, + FST_RDL(card, numberOfPorts), card->nports); } } @@ -2038,16 +2037,10 @@ fst_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) /* Now copy the data to the card. */ - buf = kmalloc(wrthdr.size, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - if (copy_from_user(buf, - ifr->ifr_data + sizeof (struct fstioc_write), - wrthdr.size)) { - kfree(buf); - return -EFAULT; - } + buf = memdup_user(ifr->ifr_data + sizeof(struct fstioc_write), + wrthdr.size); + if (IS_ERR(buf)) + return PTR_ERR(buf); memcpy_toio(card->mem + wrthdr.offset, buf, wrthdr.size); kfree(buf); @@ -2096,9 +2089,8 @@ fst_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) */ if (card->state != FST_RUNNING) { - printk_err - ("Attempt to configure card %d in non-running state (%d)\n", - card->card_no, card->state); + pr_err("Attempt to configure card %d in non-running state (%d)\n", + card->card_no, card->state); return -EIO; } if (copy_from_user(&info, ifr->ifr_data, sizeof (info))) { @@ -2390,8 +2382,8 @@ fst_init_card(struct fst_card_info *card) err = register_hdlc_device(card->ports[i].dev); if (err < 0) { int j; - printk_err ("Cannot register HDLC device for port %d" - " (errno %d)\n", i, -err ); + pr_err("Cannot register HDLC device for port %d (errno %d)\n", + i, -err); for (j = i; j < card->nports; j++) { free_netdev(card->ports[j].dev); card->ports[j].dev = NULL; @@ -2401,10 +2393,10 @@ fst_init_card(struct fst_card_info *card) } } - printk_info("%s-%s: %s IRQ%d, %d ports\n", - port_to_dev(&card->ports[0])->name, - port_to_dev(&card->ports[card->nports - 1])->name, - type_strings[card->type], card->irq, card->nports); + pr_info("%s-%s: %s IRQ%d, %d ports\n", + port_to_dev(&card->ports[0])->name, + port_to_dev(&card->ports[card->nports - 1])->name, + type_strings[card->type], card->irq, card->nports); } static const struct net_device_ops fst_ops = { @@ -2423,19 +2415,17 @@ static const struct net_device_ops fst_ops = { static int __devinit fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) { - static int firsttime_done = 0; static int no_of_cards_added = 0; struct fst_card_info *card; int err = 0; int i; - if (!firsttime_done) { - printk_info("FarSync WAN driver " FST_USER_VERSION - " (c) 2001-2004 FarSite Communications Ltd.\n"); - firsttime_done = 1; - dbg(DBG_ASS, "The value of debug mask is %x\n", fst_debug_mask); - } - + printk_once(KERN_INFO + pr_fmt("FarSync WAN driver " FST_USER_VERSION + " (c) 2001-2004 FarSite Communications Ltd.\n")); +#if FST_DEBUG + dbg(DBG_ASS, "The value of debug mask is %x\n", fst_debug_mask); +#endif /* * We are going to be clever and allow certain cards not to be * configured. An exclude list can be provided in /etc/modules.conf @@ -2447,8 +2437,8 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) */ for (i = 0; i < fst_excluded_cards; i++) { if ((pdev->devfn) >> 3 == fst_excluded_list[i]) { - printk_info("FarSync PCI device %d not assigned\n", - (pdev->devfn) >> 3); + pr_info("FarSync PCI device %d not assigned\n", + (pdev->devfn) >> 3); return -EBUSY; } } @@ -2457,20 +2447,19 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) /* Allocate driver private data */ card = kzalloc(sizeof (struct fst_card_info), GFP_KERNEL); if (card == NULL) { - printk_err("FarSync card found but insufficient memory for" - " driver storage\n"); + pr_err("FarSync card found but insufficient memory for driver storage\n"); return -ENOMEM; } /* Try to enable the device */ if ((err = pci_enable_device(pdev)) != 0) { - printk_err("Failed to enable card. Err %d\n", -err); + pr_err("Failed to enable card. Err %d\n", -err); kfree(card); return err; } if ((err = pci_request_regions(pdev, "FarSync")) !=0) { - printk_err("Failed to allocate regions. Err %d\n", -err); + pr_err("Failed to allocate regions. Err %d\n", -err); pci_disable_device(pdev); kfree(card); return err; @@ -2481,14 +2470,14 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) card->phys_mem = pci_resource_start(pdev, 2); card->phys_ctlmem = pci_resource_start(pdev, 3); if ((card->mem = ioremap(card->phys_mem, FST_MEMSIZE)) == NULL) { - printk_err("Physical memory remap failed\n"); + pr_err("Physical memory remap failed\n"); pci_release_regions(pdev); pci_disable_device(pdev); kfree(card); return -ENODEV; } if ((card->ctlmem = ioremap(card->phys_ctlmem, 0x10)) == NULL) { - printk_err("Control memory remap failed\n"); + pr_err("Control memory remap failed\n"); pci_release_regions(pdev); pci_disable_device(pdev); kfree(card); @@ -2498,7 +2487,7 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) /* Register the interrupt handler */ if (request_irq(pdev->irq, fst_intr, IRQF_SHARED, FST_DEV_NAME, card)) { - printk_err("Unable to register interrupt %d\n", card->irq); + pr_err("Unable to register interrupt %d\n", card->irq); pci_release_regions(pdev); pci_disable_device(pdev); iounmap(card->ctlmem); @@ -2529,7 +2518,7 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) if (!dev) { while (i--) free_netdev(card->ports[i].dev); - printk_err ("FarSync: out of memory\n"); + pr_err("FarSync: out of memory\n"); free_irq(card->irq, card); pci_release_regions(pdev); pci_disable_device(pdev); @@ -2593,7 +2582,7 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) pci_alloc_consistent(card->device, FST_MAX_MTU, &card->rx_dma_handle_card); if (card->rx_dma_handle_host == NULL) { - printk_err("Could not allocate rx dma buffer\n"); + pr_err("Could not allocate rx dma buffer\n"); fst_disable_intr(card); pci_release_regions(pdev); pci_disable_device(pdev); @@ -2606,7 +2595,7 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) pci_alloc_consistent(card->device, FST_MAX_MTU, &card->tx_dma_handle_card); if (card->tx_dma_handle_host == NULL) { - printk_err("Could not allocate tx dma buffer\n"); + pr_err("Could not allocate tx dma buffer\n"); fst_disable_intr(card); pci_release_regions(pdev); pci_disable_device(pdev); @@ -2678,7 +2667,7 @@ fst_init(void) static void __exit fst_cleanup_module(void) { - printk_info("FarSync WAN driver unloading\n"); + pr_info("FarSync WAN driver unloading\n"); pci_unregister_driver(&fst_driver); } diff --git a/drivers/net/wan/hd64570.h b/drivers/net/wan/hd64570.h index 3839662ff201..e4f539ad071b 100644 --- a/drivers/net/wan/hd64570.h +++ b/drivers/net/wan/hd64570.h @@ -153,7 +153,7 @@ typedef struct { u16 len; /* Data Length */ u8 stat; /* Status */ u8 unused; /* pads to 2-byte boundary */ -}__attribute__ ((packed)) pkt_desc; +}__packed pkt_desc; /* Packet Descriptor Status bits */ diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c index ee7083fbea50..b38ffa149aba 100644 --- a/drivers/net/wan/hdlc_cisco.c +++ b/drivers/net/wan/hdlc_cisco.c @@ -36,7 +36,7 @@ struct hdlc_header { u8 address; u8 control; __be16 protocol; -}__attribute__ ((packed)); +}__packed; struct cisco_packet { @@ -45,7 +45,7 @@ struct cisco_packet { __be32 par2; __be16 rel; /* reliability */ __be32 time; -}__attribute__ ((packed)); +}__packed; #define CISCO_PACKET_LEN 18 #define CISCO_BIG_PACKET_LEN 20 diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c index 0e52993e2079..0edb535bb2b5 100644 --- a/drivers/net/wan/hdlc_fr.c +++ b/drivers/net/wan/hdlc_fr.c @@ -112,7 +112,7 @@ typedef struct { unsigned de: 1; unsigned ea2: 1; #endif -}__attribute__ ((packed)) fr_hdr; +}__packed fr_hdr; typedef struct pvc_device_struct { diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c index 43ae6f440bfb..f4125da2762f 100644 --- a/drivers/net/wan/sdla.c +++ b/drivers/net/wan/sdla.c @@ -330,7 +330,7 @@ struct _dlci_stat { short dlci; char flags; -} __attribute__((packed)); +} __packed; struct _frad_stat { @@ -1211,14 +1211,9 @@ static int sdla_xfer(struct net_device *dev, struct sdla_mem __user *info, int r } else { - temp = kmalloc(mem.len, GFP_KERNEL); - if (!temp) - return(-ENOMEM); - if(copy_from_user(temp, mem.data, mem.len)) - { - kfree(temp); - return -EFAULT; - } + temp = memdup_user(mem.data, mem.len); + if (IS_ERR(temp)) + return PTR_ERR(temp); sdla_write(dev, mem.addr, temp, mem.len); kfree(temp); } |