Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2003-10-17 04:44:07 +1000
committerPaul Mackerras <paulus@samba.org>2003-10-17 04:44:07 +1000
commitd411a89128b993602c7eb7196b8d6d0226335621 (patch)
treef384e607be7fca44bd48817461a5883298b33c52
parent3da9e7112eaa71c10c03bedb348370b2909226f7 (diff)
parentecdbf2f52f4b9552064d8136871d19c6846c95ff (diff)
Merge samba.org:/stuff/paulus/kernel/linux-2.5
into samba.org:/stuff/paulus/kernel/for-linus-ppc64
-rw-r--r--arch/i386/kernel/microcode.c537
-rw-r--r--drivers/char/agp/ali-agp.c4
-rw-r--r--drivers/char/agp/amd-k7-agp.c6
-rw-r--r--drivers/char/agp/amd64-agp.c10
-rw-r--r--drivers/char/agp/ati-agp.c6
-rw-r--r--drivers/char/agp/i460-agp.c4
-rw-r--r--drivers/char/agp/intel-agp.c4
-rw-r--r--drivers/char/agp/nvidia-agp.c4
-rw-r--r--drivers/char/agp/sis-agp.c6
-rw-r--r--drivers/char/agp/sworks-agp.c4
-rw-r--r--drivers/char/agp/uninorth-agp.c6
-rw-r--r--drivers/char/agp/via-agp.c6
-rw-r--r--drivers/char/ite_gpio.c9
-rw-r--r--drivers/char/synclink.c4
-rw-r--r--drivers/char/synclinkmp.c4
-rw-r--r--drivers/i2c/algos/i2c-algo-ite.c7
-rw-r--r--drivers/i2c/chips/w83781d.c24
-rw-r--r--drivers/media/dvb/dvb-core/dvb_net.c36
-rw-r--r--drivers/media/dvb/dvb-core/dvb_net.h2
-rw-r--r--drivers/media/dvb/ttpci/av7110.c4
-rw-r--r--drivers/net/8139too.c2
-rw-r--r--drivers/net/Kconfig4
-rwxr-xr-xdrivers/net/amd8111e.c6
-rwxr-xr-xdrivers/net/amd8111e.h2
-rw-r--r--drivers/net/b44.c15
-rw-r--r--drivers/net/defxx.c4
-rw-r--r--drivers/net/e1000/e1000_main.c35
-rw-r--r--drivers/net/hamradio/bpqether.c6
-rw-r--r--drivers/net/hamradio/scc.c4
-rw-r--r--drivers/net/hp100.c10
-rw-r--r--drivers/net/natsemi.c2
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c23
-rw-r--r--drivers/net/tulip/tulip_core.c1
-rw-r--r--drivers/net/tulip/xircom_cb.c35
-rw-r--r--drivers/net/wireless/atmel.c1
-rw-r--r--drivers/net/wireless/atmel_cs.c11
-rw-r--r--drivers/usb/host/ehci-dbg.c10
-rw-r--r--drivers/usb/host/ehci-q.c30
-rw-r--r--drivers/usb/host/ehci.h16
-rw-r--r--drivers/usb/host/ohci-hcd.c54
-rw-r--r--drivers/usb/host/ohci-hub.c2
-rw-r--r--drivers/usb/host/ohci-pci.c44
-rw-r--r--drivers/usb/host/ohci-q.c23
-rw-r--r--drivers/usb/host/ohci.h5
-rw-r--r--drivers/usb/input/Kconfig1
-rw-r--r--drivers/usb/serial/keyspan_usa90msg.h16
-rw-r--r--drivers/usb/serial/visor.c3
-rw-r--r--fs/proc/array.c10
-rw-r--r--include/asm-i386/div64.h9
-rw-r--r--include/asm-i386/processor.h28
-rw-r--r--include/linux/ethtool.h11
-rw-r--r--net/core/ethtool.c49
-rw-r--r--sound/oss/ad1889.c6
-rw-r--r--sound/oss/ali5455.c8
-rw-r--r--sound/oss/cs4281/cs4281m.c11
-rw-r--r--sound/oss/cs46xx.c6
-rw-r--r--sound/oss/i810_audio.c6
-rw-r--r--sound/oss/maestro3.c4
-rw-r--r--sound/oss/swarm_cs4297a.c8
-rw-r--r--sound/oss/trident.c4
-rw-r--r--sound/oss/via82cxxx_audio.c10
61 files changed, 689 insertions, 533 deletions
diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c
index a58ad2a9f4d2..cb82c3d398aa 100644
--- a/arch/i386/kernel/microcode.c
+++ b/arch/i386/kernel/microcode.c
@@ -55,10 +55,18 @@
* Tigran Aivazian <tigran@veritas.com>,
* Serialize updates as required on HT processors due to speculative
* nature of implementation.
- * 1.11 22 Mar 2001 Tigran Aivazian <tigran@veritas.com>
+ * 1.11 22 Mar 2002 Tigran Aivazian <tigran@veritas.com>
* Fix the panic when writing zero-length microcode chunk.
+ * 1.12 29 Sep 2003 Nitin Kamble <nitin.a.kamble@intel.com>,
+ * Jun Nakajima <jun.nakajima@intel.com>
+ * Support for the microcode updates in the new format.
+ * 1.13 10 Oct 2003 Tigran Aivazian <tigran@veritas.com>
+ * Removed ->read() method and obsoleted MICROCODE_IOCFREE ioctl
+ * because we no longer hold a copy of applied microcode
+ * in kernel memory.
*/
+
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/module.h>
@@ -72,264 +80,387 @@
#include <asm/uaccess.h>
#include <asm/processor.h>
-
-static spinlock_t microcode_update_lock = SPIN_LOCK_UNLOCKED;
-
-#define MICROCODE_VERSION "1.11"
-
MODULE_DESCRIPTION("Intel CPU (IA-32) microcode update driver");
MODULE_AUTHOR("Tigran Aivazian <tigran@veritas.com>");
MODULE_LICENSE("GPL");
-#define MICRO_DEBUG 0
-
+#define MICROCODE_VERSION "1.13"
+#define MICRO_DEBUG 0
#if MICRO_DEBUG
-#define printf(x...) printk(##x)
+#define dprintk(x...) printk(KERN_INFO x)
#else
-#define printf(x...)
+#define dprintk(x...)
#endif
-/* read()/write()/ioctl() are serialized on this */
-static DECLARE_RWSEM(microcode_rwsem);
-
-static struct microcode *microcode; /* array of 2048byte microcode blocks */
-static unsigned int microcode_num; /* number of chunks in microcode */
-static char *mc_applied; /* array of applied microcode blocks */
-static unsigned int mc_fsize; /* file size of /dev/cpu/microcode */
+#define DEFAULT_UCODE_DATASIZE (2000) /* 2000 bytes */
+#define MC_HEADER_SIZE (sizeof (microcode_header_t)) /* 48 bytes */
+#define DEFAULT_UCODE_TOTALSIZE (DEFAULT_UCODE_DATASIZE + MC_HEADER_SIZE) /* 2048 bytes */
+#define EXT_HEADER_SIZE (sizeof (struct extended_sigtable)) /* 20 bytes */
+#define EXT_SIGNATURE_SIZE (sizeof (struct extended_signature)) /* 12 bytes */
+#define DWSIZE (sizeof (u32))
+#define get_totalsize(mc) \
+ (((microcode_t *)mc)->hdr.totalsize ? \
+ ((microcode_t *)mc)->hdr.totalsize : DEFAULT_UCODE_TOTALSIZE)
+#define get_datasize(mc) \
+ (((microcode_t *)mc)->hdr.datasize ? \
+ ((microcode_t *)mc)->hdr.datasize : DEFAULT_UCODE_DATASIZE)
+#define sigmatch(s1, s2, p1, p2) (((s1) == (s2)) && ((p1) & (p2)))
+#define exttable_size(et) ((et)->count * EXT_SIGNATURE_SIZE + EXT_HEADER_SIZE)
+
+/* serialize access to the physical write to MSR 0x79 */
+static spinlock_t microcode_update_lock = SPIN_LOCK_UNLOCKED;
-static int microcode_open(struct inode *unused1, struct file *unused2)
+/* no concurrent ->write()s are allowed on /dev/cpu/microcode */
+static DECLARE_MUTEX(microcode_sem);
+
+static void *user_buffer; /* user area microcode data buffer */
+static unsigned int user_buffer_size; /* it's size */
+
+typedef enum mc_error_code {
+ MC_SUCCESS = 0,
+ MC_NOTFOUND = 1,
+ MC_MARKED = 2,
+ MC_ALLOCATED = 3,
+} mc_error_code_t;
+
+static struct ucode_cpu_info {
+ unsigned int sig;
+ unsigned int pf;
+ unsigned int rev;
+ unsigned int cksum;
+ mc_error_code_t err;
+ microcode_t *mc;
+} ucode_cpu_info[NR_CPUS];
+
+static int microcode_open (struct inode *unused1, struct file *unused2)
{
return capable(CAP_SYS_RAWIO) ? 0 : -EPERM;
}
-/*
- * update_req[cpu].err is set to 1 if update failed on 'cpu', 0 otherwise
- * if err==0, microcode[update_req[cpu].slot] points to applied block of microcode
- */
-struct update_req {
- int err;
- int slot;
-} update_req[NR_CPUS];
-
-static void do_update_one(void *unused)
+static void collect_cpu_info (void *unused)
{
int cpu_num = smp_processor_id();
struct cpuinfo_x86 *c = cpu_data + cpu_num;
- struct update_req *req = update_req + cpu_num;
- unsigned int pf = 0, val[2], rev, sig;
- unsigned long flags;
- int i;
+ struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
+ unsigned int val[2];
- req->err = 1; /* assume update will fail on this cpu */
+ uci->sig = uci->pf = uci->rev = uci->cksum = 0;
+ uci->err = MC_NOTFOUND;
+ uci->mc = NULL;
if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 ||
cpu_has(c, X86_FEATURE_IA64)) {
printk(KERN_ERR "microcode: CPU%d not a capable Intel processor\n", cpu_num);
return;
+ } else {
+ uci->sig = cpuid_eax(0x00000001);
+
+ if ((c->x86_model >= 5) || (c->x86 > 6)) {
+ /* get processor flags from MSR 0x17 */
+ rdmsr(MSR_IA32_PLATFORM_ID, val[0], val[1]);
+ uci->pf = 1 << ((val[1] >> 18) & 7);
+ }
}
- sig = c->x86_mask + (c->x86_model<<4) + (c->x86<<8);
+ wrmsr(MSR_IA32_UCODE_REV, 0, 0);
+ __asm__ __volatile__ ("cpuid" : : : "ax", "bx", "cx", "dx");
+ /* get the current revision from MSR 0x8B */
+ rdmsr(MSR_IA32_UCODE_REV, val[0], uci->rev);
+ dprintk("microcode: collect_cpu_info : sig=0x%x, pf=0x%x, rev=0x%x\n",
+ uci->sig, uci->pf, uci->rev);
+}
- if ((c->x86_model >= 5) || (c->x86 > 6)) {
- /* get processor flags from MSR 0x17 */
- rdmsr(MSR_IA32_PLATFORM_ID, val[0], val[1]);
- pf = 1 << ((val[1] >> 18) & 7);
+static inline void mark_microcode_update (int cpu_num, microcode_header_t *mc_header, int sig, int pf, int cksum)
+{
+ struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
+
+ dprintk("Microcode Found.\n");
+ dprintk(" Header Revision 0x%x\n", mc_header->hdrver);
+ dprintk(" Loader Revision 0x%x\n", mc_header->ldrver);
+ dprintk(" Revision 0x%x \n", mc_header->rev);
+ dprintk(" Date %x/%x/%x\n",
+ ((mc_header->date >> 24 ) & 0xff),
+ ((mc_header->date >> 16 ) & 0xff),
+ (mc_header->date & 0xFFFF));
+ dprintk(" Signature 0x%x\n", sig);
+ dprintk(" Type 0x%x Family 0x%x Model 0x%x Stepping 0x%x\n",
+ ((sig >> 12) & 0x3),
+ ((sig >> 8) & 0xf),
+ ((sig >> 4) & 0xf),
+ ((sig & 0xf)));
+ dprintk(" Processor Flags 0x%x\n", pf);
+ dprintk(" Checksum 0x%x\n", cksum);
+
+ if (mc_header->rev < uci->rev) {
+ printk(KERN_ERR "microcode: CPU%d not 'upgrading' to earlier revision"
+ " 0x%x (current=0x%x)\n", cpu_num, mc_header->rev, uci->rev);
+ goto out;
+ } else if (mc_header->rev == uci->rev) {
+ /* notify the caller of success on this cpu */
+ uci->err = MC_SUCCESS;
+ printk(KERN_ERR "microcode: CPU%d already at revision"
+ " 0x%x (current=0x%x)\n", cpu_num, mc_header->rev, uci->rev);
+ goto out;
}
- for (i=0; i<microcode_num; i++)
- if (microcode[i].sig == sig && microcode[i].pf == pf &&
- microcode[i].ldrver == 1 && microcode[i].hdrver == 1) {
- int sum = 0;
- struct microcode *m = &microcode[i];
- unsigned int *sump = (unsigned int *)(m+1);
-
- printf("Microcode\n");
- printf(" Header Revision %d\n",microcode[i].hdrver);
- printf(" Date %x/%x/%x\n",
- ((microcode[i].date >> 24 ) & 0xff),
- ((microcode[i].date >> 16 ) & 0xff),
- (microcode[i].date & 0xFFFF));
- printf(" Type %x Family %x Model %x Stepping %x\n",
- ((microcode[i].sig >> 12) & 0x3),
- ((microcode[i].sig >> 8) & 0xf),
- ((microcode[i].sig >> 4) & 0xf),
- ((microcode[i].sig & 0xf)));
- printf(" Checksum %x\n",microcode[i].cksum);
- printf(" Loader Revision %x\n",microcode[i].ldrver);
- printf(" Processor Flags %x\n\n",microcode[i].pf);
-
- req->slot = i;
-
- /* serialize access to update decision */
- spin_lock_irqsave(&microcode_update_lock, flags);
-
- /* trick, to work even if there was no prior update by the BIOS */
- wrmsr(MSR_IA32_UCODE_REV, 0, 0);
- __asm__ __volatile__ ("cpuid" : : : "ax", "bx", "cx", "dx");
-
- /* get current (on-cpu) revision into rev (ignore val[0]) */
- rdmsr(MSR_IA32_UCODE_REV, val[0], rev);
-
- if (microcode[i].rev < rev) {
- spin_unlock_irqrestore(&microcode_update_lock, flags);
- printk(KERN_INFO
- "microcode: CPU%d not 'upgrading' to earlier revision"
- " %d (current=%d)\n", cpu_num, microcode[i].rev, rev);
- return;
- } else if (microcode[i].rev == rev) {
- /* notify the caller of success on this cpu */
- req->err = 0;
- spin_unlock_irqrestore(&microcode_update_lock, flags);
- printk(KERN_INFO
- "microcode: CPU%d already at revision"
- " %d (current=%d)\n", cpu_num, microcode[i].rev, rev);
- return;
- }
+ dprintk("microcode: CPU%d found a matching microcode update with "
+ " revision 0x%x (current=0x%x)\n", cpu_num, mc_header->rev, uci->rev);
+ uci->cksum = cksum;
+ uci->pf = pf; /* keep the original mc pf for cksum calculation */
+ uci->err = MC_MARKED; /* found the match */
+out:
+ return;
+}
+
+static int find_matching_ucodes (void)
+{
+ int cursor = 0;
+ int error = 0;
+
+ while (cursor + MC_HEADER_SIZE < user_buffer_size) {
+ microcode_header_t mc_header;
+ void *newmc = NULL;
+ int i, sum, cpu_num, allocated_flag, total_size, data_size, ext_table_size;
+
+ if (copy_from_user(&mc_header, user_buffer + cursor, MC_HEADER_SIZE)) {
+ printk(KERN_ERR "microcode: error! Can not read user data\n");
+ error = -EFAULT;
+ goto out;
+ }
+
+ total_size = get_totalsize(&mc_header);
+ if ((cursor + total_size > user_buffer_size) || (total_size < DEFAULT_UCODE_TOTALSIZE)) {
+ printk(KERN_ERR "microcode: error! Bad data in microcode data file\n");
+ error = -EINVAL;
+ goto out;
+ }
+
+ data_size = get_datasize(&mc_header);
+ if ((data_size + MC_HEADER_SIZE > total_size) || (data_size < DEFAULT_UCODE_DATASIZE)) {
+ printk(KERN_ERR "microcode: error! Bad data in microcode data file\n");
+ error = -EINVAL;
+ goto out;
+ }
- /* Verify the checksum */
- while (--sump >= (unsigned int *)m)
- sum += *sump;
- if (sum != 0) {
- req->err = 1;
- spin_unlock_irqrestore(&microcode_update_lock, flags);
- printk(KERN_ERR "microcode: CPU%d aborting, "
- "bad checksum\n", cpu_num);
- return;
+ if (mc_header.ldrver != 1 || mc_header.hdrver != 1) {
+ printk(KERN_ERR "microcode: error! Unknown microcode update format\n");
+ error = -EINVAL;
+ goto out;
+ }
+
+ for (cpu_num = 0; cpu_num < num_online_cpus(); cpu_num++) {
+ struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
+ if (uci->err != MC_NOTFOUND) /* already found a match or not an online cpu*/
+ continue;
+
+ if (sigmatch(mc_header.sig, uci->sig, mc_header.pf, uci->pf))
+ mark_microcode_update(cpu_num, &mc_header, mc_header.sig, mc_header.pf, mc_header.cksum);
+ }
+
+ ext_table_size = total_size - (MC_HEADER_SIZE + data_size);
+ if (ext_table_size) {
+ struct extended_sigtable ext_header;
+ struct extended_signature ext_sig;
+ int ext_sigcount;
+
+ if ((ext_table_size < EXT_HEADER_SIZE)
+ || ((ext_table_size - EXT_HEADER_SIZE) % EXT_SIGNATURE_SIZE)) {
+ printk(KERN_ERR "microcode: error! Bad data in microcode data file\n");
+ error = -EINVAL;
+ goto out;
+ }
+ if (copy_from_user(&ext_header, user_buffer + cursor
+ + MC_HEADER_SIZE + data_size, EXT_HEADER_SIZE)) {
+ printk(KERN_ERR "microcode: error! Can not read user data\n");
+ error = -EFAULT;
+ goto out;
+ }
+ if (ext_table_size != exttable_size(&ext_header)) {
+ printk(KERN_ERR "microcode: error! Bad data in microcode data file\n");
+ error = -EFAULT;
+ goto out;
}
+
+ ext_sigcount = ext_header.count;
- /* write microcode via MSR 0x79 */
- wrmsr(MSR_IA32_UCODE_WRITE, (unsigned int)(m->bits), 0);
-
- /* serialize */
- __asm__ __volatile__ ("cpuid" : : : "ax", "bx", "cx", "dx");
-
- /* get the current revision from MSR 0x8B */
- rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]);
-
- /* notify the caller of success on this cpu */
- req->err = 0;
- spin_unlock_irqrestore(&microcode_update_lock, flags);
- printk(KERN_INFO "microcode: CPU%d updated from revision "
- "%d to %d, date=%08x\n",
- cpu_num, rev, val[1], microcode[i].date);
- return;
+ for (i = 0; i < ext_sigcount; i++) {
+ if (copy_from_user(&ext_sig, user_buffer + cursor + MC_HEADER_SIZE + data_size + EXT_HEADER_SIZE
+ + EXT_SIGNATURE_SIZE * i, EXT_SIGNATURE_SIZE)) {
+ printk(KERN_ERR "microcode: error! Can not read user data\n");
+ error = -EFAULT;
+ goto out;
+ }
+ for (cpu_num = 0; cpu_num < num_online_cpus(); cpu_num++) {
+ struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
+ if (uci->err != MC_NOTFOUND) /* already found a match or not an online cpu*/
+ continue;
+ if (sigmatch(ext_sig.sig, uci->sig, ext_sig.pf, uci->pf)) {
+ mark_microcode_update(cpu_num, &mc_header, ext_sig.sig, ext_sig.pf, ext_sig.cksum);
+ }
+ }
+ }
}
-
- printk(KERN_ERR
- "microcode: CPU%d no microcode found! (sig=%x, pflags=%d)\n",
- cpu_num, sig, pf);
+ /* now check if any cpu has matched */
+ for (cpu_num = 0, allocated_flag = 0, sum = 0; cpu_num < num_online_cpus(); cpu_num++) {
+ if (ucode_cpu_info[cpu_num].err == MC_MARKED) {
+ struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
+ if (!allocated_flag) {
+ allocated_flag = 1;
+ newmc = vmalloc(total_size);
+ if (!newmc) {
+ printk(KERN_ERR "microcode: error! Can not allocate memory\n");
+ error = -ENOMEM;
+ goto out;
+ }
+ if (copy_from_user(newmc + MC_HEADER_SIZE,
+ user_buffer + cursor + MC_HEADER_SIZE,
+ total_size - MC_HEADER_SIZE)) {
+ printk(KERN_ERR "microcode: error! Can not read user data\n");
+ vfree(newmc);
+ error = -EFAULT;
+ goto out;
+ }
+ memcpy(newmc, &mc_header, MC_HEADER_SIZE);
+ /* check extended table checksum */
+ if (ext_table_size) {
+ int ext_table_sum = 0;
+ i = ext_table_size / DWSIZE;
+ int * ext_tablep = (((void *) newmc) + MC_HEADER_SIZE + data_size);
+ while (i--) ext_table_sum += ext_tablep[i];
+ if (ext_table_sum) {
+ printk(KERN_WARNING "microcode: aborting, bad extended signature table checksum\n");
+ vfree(newmc);
+ error = -EINVAL;
+ goto out;
+ }
+ }
+
+ /* calculate the checksum */
+ i = (MC_HEADER_SIZE + data_size) / DWSIZE;
+ while (i--) sum += ((int *)newmc)[i];
+ sum -= (mc_header.sig + mc_header.pf + mc_header.cksum);
+ }
+ ucode_cpu_info[cpu_num].mc = newmc;
+ ucode_cpu_info[cpu_num].err = MC_ALLOCATED; /* mc updated */
+ if (sum + uci->sig + uci->pf + uci->cksum != 0) {
+ printk(KERN_ERR "microcode: CPU%d aborting, bad checksum\n", cpu_num);
+ error = -EINVAL;
+ goto out;
+ }
+ }
+ }
+ cursor += total_size; /* goto the next update patch */
+ } /* end of while */
+out:
+ return error;
}
-
-static int do_microcode_update(void)
+static void do_update_one (void * unused)
{
- int i, error = 0, err;
- struct microcode *m;
+ unsigned long flags;
+ unsigned int val[2];
+ int cpu_num = smp_processor_id();
+ struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
- if (on_each_cpu(do_update_one, NULL, 1, 1) != 0) {
- printk(KERN_ERR "microcode: IPI timeout, giving up\n");
- return -EIO;
+ if (uci->mc == NULL) {
+ printk(KERN_INFO "microcode: No suitable data for cpu %d\n", cpu_num);
+ return;
}
- for (i=0; i<NR_CPUS; i++) {
- err = update_req[i].err;
- error += err;
- if (!err) {
- m = (struct microcode *)mc_applied + i;
- memcpy(m, &microcode[update_req[i].slot], sizeof(struct microcode));
- }
- }
- return error;
+ /* serialize access to the physical write to MSR 0x79 */
+ spin_lock_irqsave(&microcode_update_lock, flags);
+
+ /* write microcode via MSR 0x79 */
+ wrmsr(MSR_IA32_UCODE_WRITE, (unsigned int)(uci->mc->bits), 0);
+ wrmsr(MSR_IA32_UCODE_REV, 0, 0);
+
+ __asm__ __volatile__ ("cpuid" : : : "ax", "bx", "cx", "dx");
+ /* get the current revision from MSR 0x8B */
+ rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]);
+
+ /* notify the caller of success on this cpu */
+ uci->err = MC_SUCCESS;
+ spin_unlock_irqrestore(&microcode_update_lock, flags);
+ printk(KERN_INFO "microcode: CPU%d updated from revision "
+ "0x%x to 0x%x, date = %08x \n",
+ cpu_num, uci->rev, val[1], uci->mc->hdr.date);
+ return;
}
-static ssize_t microcode_read(struct file *file, char __user *buf, size_t len, loff_t *ppos)
+static int do_microcode_update (void)
{
- ssize_t ret = 0;
+ int i, error;
- down_read(&microcode_rwsem);
- if (*ppos >= mc_fsize)
- goto out;
- if (*ppos + len > mc_fsize)
- len = mc_fsize - *ppos;
- ret = -EFAULT;
- if (copy_to_user(buf, mc_applied + *ppos, len))
+ if (on_each_cpu(collect_cpu_info, NULL, 1, 1) != 0) {
+ printk(KERN_ERR "microcode: Error! Could not run on all processors\n");
+ error = -EIO;
goto out;
- *ppos += len;
- ret = len;
+ }
+
+ if ((error = find_matching_ucodes())) {
+ printk(KERN_ERR "microcode: Error in the microcode data\n");
+ goto out_free;
+ }
+
+ if (on_each_cpu(do_update_one, NULL, 1, 1) != 0) {
+ printk(KERN_ERR "microcode: Error! Could not run on all processors\n");
+ error = -EIO;
+ }
+
+out_free:
+ for (i = 0; i < num_online_cpus(); i++) {
+ if (ucode_cpu_info[i].mc) {
+ int j;
+ void *tmp = ucode_cpu_info[i].mc;
+ vfree(tmp);
+ for (j = i; j < num_online_cpus(); j++) {
+ if (ucode_cpu_info[j].mc == tmp)
+ ucode_cpu_info[j].mc = NULL;
+ }
+ }
+ }
out:
- up_read(&microcode_rwsem);
- return ret;
+ return error;
}
-static ssize_t microcode_write(struct file *file, const char __user *buf, size_t len, loff_t *ppos)
+static ssize_t microcode_write (struct file *file, const char *buf, size_t len, loff_t *ppos)
{
ssize_t ret;
- if (!len || len % sizeof(struct microcode) != 0) {
- printk(KERN_ERR "microcode: can only write in N*%d bytes units\n",
- sizeof(struct microcode));
+ if (len < DEFAULT_UCODE_TOTALSIZE) {
+ printk(KERN_ERR "microcode: not enough data\n");
return -EINVAL;
}
+
if ((len >> PAGE_SHIFT) > num_physpages) {
printk(KERN_ERR "microcode: too much data (max %ld pages)\n", num_physpages);
return -EINVAL;
}
- down_write(&microcode_rwsem);
- if (!mc_applied) {
- mc_applied = kmalloc(NR_CPUS*sizeof(struct microcode),
- GFP_KERNEL);
- if (!mc_applied) {
- up_write(&microcode_rwsem);
- printk(KERN_ERR "microcode: out of memory for saved microcode\n");
- return -ENOMEM;
- }
- }
-
- microcode_num = len/sizeof(struct microcode);
- microcode = vmalloc(len);
- if (!microcode) {
- ret = -ENOMEM;
- goto out_unlock;
- }
- if (copy_from_user(microcode, buf, len)) {
- ret = -EFAULT;
- goto out_fsize;
- }
+ down(&microcode_sem);
- if(do_microcode_update()) {
- ret = -EIO;
- goto out_fsize;
- } else {
- mc_fsize = NR_CPUS * sizeof(struct microcode);
+ user_buffer = (void *) buf;
+ user_buffer_size = (int) len;
+
+ ret = do_microcode_update();
+ if (!ret)
ret = (ssize_t)len;
- }
-out_fsize:
- vfree(microcode);
-out_unlock:
- up_write(&microcode_rwsem);
+
+ up(&microcode_sem);
+
return ret;
}
-static int microcode_ioctl(struct inode *inode, struct file *file,
+static int microcode_ioctl (struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
- switch(cmd) {
+ switch (cmd) {
+ /*
+ * XXX: will be removed after microcode_ctl
+ * is updated to ignore failure of this ioctl()
+ */
case MICROCODE_IOCFREE:
- down_write(&microcode_rwsem);
- if (mc_applied) {
- int bytes = NR_CPUS * sizeof(struct microcode);
-
- kfree(mc_applied);
- mc_applied = NULL;
- printk(KERN_INFO "microcode: freed %d bytes\n", bytes);
- mc_fsize = 0;
- up_write(&microcode_rwsem);
- return 0;
- }
- up_write(&microcode_rwsem);
- return -ENODATA;
-
+ return 0;
default:
return -EINVAL;
}
@@ -338,7 +469,6 @@ static int microcode_ioctl(struct inode *inode, struct file *file,
static struct file_operations microcode_fops = {
.owner = THIS_MODULE,
- .read = microcode_read,
.write = microcode_write,
.ioctl = microcode_ioctl,
.open = microcode_open,
@@ -347,17 +477,20 @@ static struct file_operations microcode_fops = {
static struct miscdevice microcode_dev = {
.minor = MICROCODE_MINOR,
.name = "microcode",
- .devfs_name = "cpu/microcode",
.fops = &microcode_fops,
};
-static int __init microcode_init(void)
+static int __init microcode_init (void)
{
int error;
error = misc_register(&microcode_dev);
- if (error)
+ if (error) {
+ printk(KERN_ERR
+ "microcode: can't misc_register on minor=%d\n",
+ MICROCODE_MINOR);
return error;
+ }
printk(KERN_INFO
"IA-32 Microcode Update Driver: v%s <tigran@veritas.com>\n",
@@ -365,14 +498,12 @@ static int __init microcode_init(void)
return 0;
}
-static void __exit microcode_exit(void)
+static void __exit microcode_exit (void)
{
misc_deregister(&microcode_dev);
- kfree(mc_applied);
printk(KERN_INFO "IA-32 Microcode Update Driver v%s unregistered\n",
MICROCODE_VERSION);
}
module_init(microcode_init)
module_exit(microcode_exit)
-
diff --git a/drivers/char/agp/ali-agp.c b/drivers/char/agp/ali-agp.c
index 5f9a0b9447c2..e907eea9d2b2 100644
--- a/drivers/char/agp/ali-agp.c
+++ b/drivers/char/agp/ali-agp.c
@@ -231,7 +231,7 @@ struct agp_bridge_driver ali_m1541_bridge = {
};
-static struct agp_device_ids ali_agp_device_ids[] __initdata =
+static struct agp_device_ids ali_agp_device_ids[] __devinitdata =
{
{
.device_id = PCI_DEVICE_ID_AL_M1541,
@@ -272,7 +272,7 @@ static struct agp_device_ids ali_agp_device_ids[] __initdata =
{ }, /* dummy final entry, always present */
};
-static int __init agp_ali_probe(struct pci_dev *pdev,
+static int __devinit agp_ali_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
struct agp_device_ids *devs = ali_agp_device_ids;
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
index 28442f7dad51..ee40f2c1844a 100644
--- a/drivers/char/agp/amd-k7-agp.c
+++ b/drivers/char/agp/amd-k7-agp.c
@@ -365,7 +365,7 @@ struct agp_bridge_driver amd_irongate_driver = {
.agp_destroy_page = agp_generic_destroy_page,
};
-static struct agp_device_ids amd_agp_device_ids[] __initdata =
+static struct agp_device_ids amd_agp_device_ids[] __devinitdata =
{
{
.device_id = PCI_DEVICE_ID_AMD_FE_GATE_7006,
@@ -382,8 +382,8 @@ static struct agp_device_ids amd_agp_device_ids[] __initdata =
{ }, /* dummy final entry, always present */
};
-static int __init agp_amdk7_probe(struct pci_dev *pdev,
- const struct pci_device_id *ent)
+static int __devinit agp_amdk7_probe(struct pci_dev *pdev,
+ const struct pci_device_id *ent)
{
struct agp_device_ids *devs = amd_agp_device_ids;
struct agp_bridge_data *bridge;
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index 1d4fca34e32f..fda92bd3c865 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -248,7 +248,7 @@ struct agp_bridge_driver amd_8151_driver = {
};
/* Some basic sanity checks for the aperture. */
-static int __init aperture_valid(u64 aper, u32 size)
+static int __devinit aperture_valid(u64 aper, u32 size)
{
static int not_first_call;
u32 pfn, c;
@@ -297,7 +297,7 @@ static int __init aperture_valid(u64 aper, u32 size)
* to allocate that much memory. But at least error out cleanly instead of
* crashing.
*/
-static __init int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp,
+static __devinit int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp,
u16 cap)
{
u32 aper_low, aper_hi;
@@ -339,7 +339,7 @@ static __init int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp,
return 0;
}
-static __init int cache_nbs (struct pci_dev *pdev, u32 cap_ptr)
+static __devinit int cache_nbs (struct pci_dev *pdev, u32 cap_ptr)
{
struct pci_dev *loop_dev = NULL;
int i = 0;
@@ -365,8 +365,8 @@ static __init int cache_nbs (struct pci_dev *pdev, u32 cap_ptr)
return i == 0 ? -1 : 0;
}
-static int __init agp_amd64_probe(struct pci_dev *pdev,
- const struct pci_device_id *ent)
+static int __devinit agp_amd64_probe(struct pci_dev *pdev,
+ const struct pci_device_id *ent)
{
struct agp_bridge_data *bridge;
u8 rev_id;
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
index ecb2b0349d3e..92685b4a31cf 100644
--- a/drivers/char/agp/ati-agp.c
+++ b/drivers/char/agp/ati-agp.c
@@ -403,7 +403,7 @@ struct agp_bridge_driver ati_generic_bridge = {
};
-static struct agp_device_ids ati_agp_device_ids[] __initdata =
+static struct agp_device_ids ati_agp_device_ids[] __devinitdata =
{
{
.device_id = PCI_DEVICE_ID_ATI_RS100,
@@ -436,8 +436,8 @@ static struct agp_device_ids ati_agp_device_ids[] __initdata =
{ }, /* dummy final entry, always present */
};
-static int __init agp_ati_probe(struct pci_dev *pdev,
- const struct pci_device_id *ent)
+static int __devinit agp_ati_probe(struct pci_dev *pdev,
+ const struct pci_device_id *ent)
{
struct agp_device_ids *devs = ati_agp_device_ids;
struct agp_bridge_data *bridge;
diff --git a/drivers/char/agp/i460-agp.c b/drivers/char/agp/i460-agp.c
index 2f70f417f221..1751111edd31 100644
--- a/drivers/char/agp/i460-agp.c
+++ b/drivers/char/agp/i460-agp.c
@@ -560,8 +560,8 @@ struct agp_bridge_driver intel_i460_driver = {
.cant_use_aperture = 1,
};
-static int __init agp_intel_i460_probe(struct pci_dev *pdev,
- const struct pci_device_id *ent)
+static int __devinit agp_intel_i460_probe(struct pci_dev *pdev,
+ const struct pci_device_id *ent)
{
struct agp_bridge_data *bridge;
u8 cap_ptr;
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index e65679a20e24..ba8ff10153bc 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -1232,8 +1232,8 @@ static int find_i830(u16 device)
return 1;
}
-static int __init agp_intel_probe(struct pci_dev *pdev,
- const struct pci_device_id *ent)
+static int __devinit agp_intel_probe(struct pci_dev *pdev,
+ const struct pci_device_id *ent)
{
struct agp_bridge_data *bridge;
char *name = "(unknown)";
diff --git a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c
index 48b5f21f4447..c934e62b3cd5 100644
--- a/drivers/char/agp/nvidia-agp.c
+++ b/drivers/char/agp/nvidia-agp.c
@@ -250,8 +250,8 @@ struct agp_bridge_driver nvidia_driver = {
.agp_destroy_page = agp_generic_destroy_page,
};
-static int __init agp_nvidia_probe(struct pci_dev *pdev,
- const struct pci_device_id *ent)
+static int __devinit agp_nvidia_probe(struct pci_dev *pdev,
+ const struct pci_device_id *ent)
{
struct agp_bridge_data *bridge;
u8 cap_ptr;
diff --git a/drivers/char/agp/sis-agp.c b/drivers/char/agp/sis-agp.c
index 0d7e66316624..e370f9ac5344 100644
--- a/drivers/char/agp/sis-agp.c
+++ b/drivers/char/agp/sis-agp.c
@@ -95,7 +95,7 @@ struct agp_bridge_driver sis_driver = {
.agp_destroy_page = agp_generic_destroy_page,
};
-static struct agp_device_ids sis_agp_device_ids[] __initdata =
+static struct agp_device_ids sis_agp_device_ids[] __devinitdata =
{
{
.device_id = PCI_DEVICE_ID_SI_530,
@@ -164,8 +164,8 @@ static struct agp_device_ids sis_agp_device_ids[] __initdata =
{ }, /* dummy final entry, always present */
};
-static int __init agp_sis_probe(struct pci_dev *pdev,
- const struct pci_device_id *ent)
+static int __devinit agp_sis_probe(struct pci_dev *pdev,
+ const struct pci_device_id *ent)
{
struct agp_device_ids *devs = sis_agp_device_ids;
struct agp_bridge_data *bridge;
diff --git a/drivers/char/agp/sworks-agp.c b/drivers/char/agp/sworks-agp.c
index 38de057e9e37..249c4e07d901 100644
--- a/drivers/char/agp/sworks-agp.c
+++ b/drivers/char/agp/sworks-agp.c
@@ -437,8 +437,8 @@ struct agp_bridge_driver sworks_driver = {
.agp_destroy_page = agp_generic_destroy_page,
};
-static int __init agp_serverworks_probe(struct pci_dev *pdev,
- const struct pci_device_id *ent)
+static int __devinit agp_serverworks_probe(struct pci_dev *pdev,
+ const struct pci_device_id *ent)
{
struct agp_bridge_data *bridge;
struct pci_dev *bridge_dev;
diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
index 1fa77885c111..14dfb59ffa66 100644
--- a/drivers/char/agp/uninorth-agp.c
+++ b/drivers/char/agp/uninorth-agp.c
@@ -282,7 +282,7 @@ struct agp_bridge_driver uninorth_agp_driver = {
.cant_use_aperture = 1,
};
-static struct agp_device_ids uninorth_agp_device_ids[] __initdata = {
+static struct agp_device_ids uninorth_agp_device_ids[] __devinitdata = {
{
.device_id = PCI_DEVICE_ID_APPLE_UNI_N_AGP,
.chipset_name = "UniNorth",
@@ -301,8 +301,8 @@ static struct agp_device_ids uninorth_agp_device_ids[] __initdata = {
},
};
-static int __init agp_uninorth_probe(struct pci_dev *pdev,
- const struct pci_device_id *ent)
+static int __devinit agp_uninorth_probe(struct pci_dev *pdev,
+ const struct pci_device_id *ent)
{
struct agp_device_ids *devs = uninorth_agp_device_ids;
struct agp_bridge_data *bridge;
diff --git a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c
index e4cee0a8a578..24b80c78a426 100644
--- a/drivers/char/agp/via-agp.c
+++ b/drivers/char/agp/via-agp.c
@@ -211,7 +211,7 @@ struct agp_bridge_driver via_driver = {
.agp_destroy_page = agp_generic_destroy_page,
};
-static struct agp_device_ids via_agp_device_ids[] __initdata =
+static struct agp_device_ids via_agp_device_ids[] __devinitdata =
{
{
.device_id = PCI_DEVICE_ID_VIA_82C597_0,
@@ -371,8 +371,8 @@ static void check_via_agp3 (struct agp_bridge_data *bridge)
}
-static int __init agp_via_probe(struct pci_dev *pdev,
- const struct pci_device_id *ent)
+static int __devinit agp_via_probe(struct pci_dev *pdev,
+ const struct pci_device_id *ent)
{
struct agp_device_ids *devs = via_agp_device_ids;
struct agp_bridge_data *bridge;
diff --git a/drivers/char/ite_gpio.c b/drivers/char/ite_gpio.c
index f3a6c78bd322..1a4dfef7e46d 100644
--- a/drivers/char/ite_gpio.c
+++ b/drivers/char/ite_gpio.c
@@ -242,21 +242,12 @@ static int ite_gpio_open(struct inode *inode, struct file *file)
if (minor != GPIO_MINOR)
return -ENODEV;
-#ifdef MODULE
- MOD_INC_USE_COUNT;
-#endif
-
return 0;
}
static int ite_gpio_release(struct inode *inode, struct file *file)
{
-
-#ifdef MODULE
- MOD_DEC_USE_COUNT;
-#endif
-
return 0;
}
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index aeaa4d9f2b4d..585196d778f9 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -8020,8 +8020,8 @@ int mgsl_sppp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
#endif /* ifdef CONFIG_SYNCLINK_SYNCPPP */
-static int __init synclink_init_one (struct pci_dev *dev,
- const struct pci_device_id *ent)
+static int __devinit synclink_init_one (struct pci_dev *dev,
+ const struct pci_device_id *ent)
{
struct mgsl_struct *info;
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
index ec4d3393f9e7..82c7afe29f92 100644
--- a/drivers/char/synclinkmp.c
+++ b/drivers/char/synclinkmp.c
@@ -5451,8 +5451,8 @@ void write_control_reg(SLMP_INFO * info)
}
-static int __init synclinkmp_init_one (struct pci_dev *dev,
- const struct pci_device_id *ent)
+static int __devinit synclinkmp_init_one (struct pci_dev *dev,
+ const struct pci_device_id *ent)
{
if (pci_enable_device(dev)) {
printk("error enabling pci device %p\n", dev);
diff --git a/drivers/i2c/algos/i2c-algo-ite.c b/drivers/i2c/algos/i2c-algo-ite.c
index d8f601a31672..a1cafa3a66bb 100644
--- a/drivers/i2c/algos/i2c-algo-ite.c
+++ b/drivers/i2c/algos/i2c-algo-ite.c
@@ -779,10 +779,6 @@ int i2c_iic_add_bus(struct i2c_adapter *adap)
adap->retries = 3; /* be replaced by defines */
adap->flags = 0;
-#ifdef MODULE
- MOD_INC_USE_COUNT;
-#endif
-
i2c_add_adapter(adap);
iic_init(iic_adap);
@@ -815,9 +811,6 @@ int i2c_iic_del_bus(struct i2c_adapter *adap)
return res;
DEB2(printk("i2c-algo-ite: adapter unregistered: %s\n",adap->name));
-#ifdef MODULE
- MOD_DEC_USE_COUNT;
-#endif
return 0;
}
diff --git a/drivers/i2c/chips/w83781d.c b/drivers/i2c/chips/w83781d.c
index 40f183f4f217..8be736ccfe2d 100644
--- a/drivers/i2c/chips/w83781d.c
+++ b/drivers/i2c/chips/w83781d.c
@@ -422,9 +422,11 @@ sysfs_in_offsets(7);
sysfs_in_offsets(8);
#define device_create_file_in(client, offset) \
+do { \
device_create_file(&client->dev, &dev_attr_in_input##offset); \
device_create_file(&client->dev, &dev_attr_in_min##offset); \
-device_create_file(&client->dev, &dev_attr_in_max##offset);
+device_create_file(&client->dev, &dev_attr_in_max##offset); \
+} while (0)
#define show_fan_reg(reg) \
static ssize_t show_##reg (struct device *dev, char *buf, int nr) \
@@ -482,8 +484,10 @@ sysfs_fan_offset(3);
sysfs_fan_min_offset(3);
#define device_create_file_fan(client, offset) \
+do { \
device_create_file(&client->dev, &dev_attr_fan_input##offset); \
device_create_file(&client->dev, &dev_attr_fan_min##offset); \
+} while (0)
#define show_temp_reg(reg) \
static ssize_t show_##reg (struct device *dev, char *buf, int nr) \
@@ -566,9 +570,11 @@ sysfs_temp_offsets(2);
sysfs_temp_offsets(3);
#define device_create_file_temp(client, offset) \
+do { \
device_create_file(&client->dev, &dev_attr_temp_input##offset); \
device_create_file(&client->dev, &dev_attr_temp_max##offset); \
-device_create_file(&client->dev, &dev_attr_temp_min##offset);
+device_create_file(&client->dev, &dev_attr_temp_min##offset); \
+} while (0)
static ssize_t
show_vid_reg(struct device *dev, char *buf)
@@ -691,8 +697,10 @@ sysfs_beep(ENABLE, enable);
sysfs_beep(MASK, mask);
#define device_create_file_beep(client) \
+do { \
device_create_file(&client->dev, &dev_attr_beep_enable); \
-device_create_file(&client->dev, &dev_attr_beep_mask);
+device_create_file(&client->dev, &dev_attr_beep_mask); \
+} while (0)
/* w83697hf only has two fans */
static ssize_t
@@ -769,7 +777,9 @@ sysfs_fan_div(2);
sysfs_fan_div(3);
#define device_create_file_fan_div(client, offset) \
+do { \
device_create_file(&client->dev, &dev_attr_fan_div##offset); \
+} while (0)
/* w83697hf only has two fans */
static ssize_t
@@ -881,10 +891,14 @@ sysfs_pwm(3);
sysfs_pwm(4);
#define device_create_file_pwm(client, offset) \
+do { \
device_create_file(&client->dev, &dev_attr_pwm##offset); \
+} while (0)
#define device_create_file_pwmenable(client, offset) \
+do { \
device_create_file(&client->dev, &dev_attr_pwm_enable##offset); \
+} while (0)
static ssize_t
show_sensor_reg(struct device *dev, char *buf, int nr)
@@ -957,7 +971,9 @@ sysfs_sensor(2);
sysfs_sensor(3);
#define device_create_file_sensor(client, offset) \
+do { \
device_create_file(&client->dev, &dev_attr_sensor##offset); \
+} while (0)
#ifdef W83781D_RT
static ssize_t
@@ -1016,7 +1032,9 @@ sysfs_rt(2);
sysfs_rt(3);
#define device_create_file_rt(client, offset) \
+do { \
device_create_file(&client->dev, &dev_attr_rt##offset); \
+} while (0)
#endif /* ifdef W83781D_RT */
diff --git a/drivers/media/dvb/dvb-core/dvb_net.c b/drivers/media/dvb/dvb-core/dvb_net.c
index 73725594bb5b..013cd4de02e5 100644
--- a/drivers/media/dvb/dvb-core/dvb_net.c
+++ b/drivers/media/dvb/dvb-core/dvb_net.c
@@ -456,7 +456,7 @@ static struct net_device_stats * dvb_net_get_stats(struct net_device *dev)
}
-static int dvb_net_init_dev (struct net_device *dev)
+static void dvb_net_setup(struct net_device *dev)
{
ether_setup(dev);
@@ -472,11 +472,8 @@ static int dvb_net_init_dev (struct net_device *dev)
dev->hard_header_cache = NULL;
dev->flags |= IFF_NOARP;
-
- return 0;
}
-
static int get_if(struct dvb_net *dvbnet)
{
int i;
@@ -496,7 +493,6 @@ static int get_if(struct dvb_net *dvbnet)
static int dvb_net_add_if(struct dvb_net *dvbnet, u16 pid)
{
struct net_device *net;
- struct dmx_demux *demux;
struct dvb_net_priv *priv;
int result;
int if_num;
@@ -504,25 +500,20 @@ static int dvb_net_add_if(struct dvb_net *dvbnet, u16 pid)
if ((if_num = get_if(dvbnet)) < 0)
return -EINVAL;
- net = &dvbnet->device[if_num];
- demux = dvbnet->demux;
+ net = alloc_netdev(sizeof(struct dvb_net_priv), "dvb",
+ dvb_net_setup);
+ if (!net)
+ return -ENOMEM;
- memset(net, 0, sizeof(struct net_device));
+ sprintf(net->name, "dvb%d_%d", dvbnet->dvbdev->adapter->num, if_num);
- memcpy(net->name, "dvb0_0", 7);
- net->name[3] = dvbnet->dvbdev->adapter->num + '0';
- net->name[5] = if_num + '0';
net->addr_len = 6;
memcpy(net->dev_addr, dvbnet->dvbdev->adapter->proposed_mac, 6);
- net->next = NULL;
- net->init = dvb_net_init_dev;
- if (!(net->priv = kmalloc(sizeof(struct dvb_net_priv), GFP_KERNEL)))
- return -ENOMEM;
+ dvbnet->device[if_num] = net;
priv = net->priv;
- memset(priv, 0, sizeof(struct dvb_net_priv));
- priv->demux = demux;
+ priv->demux = dvbnet->demux;
priv->pid = pid;
priv->rx_mode = RX_MODE_UNI;
@@ -532,6 +523,7 @@ static int dvb_net_add_if(struct dvb_net *dvbnet, u16 pid)
net->base_addr = pid;
if ((result = register_netdev(net)) < 0) {
+ kfree(net);
return result;
}
@@ -541,18 +533,20 @@ static int dvb_net_add_if(struct dvb_net *dvbnet, u16 pid)
static int dvb_net_remove_if(struct dvb_net *dvbnet, int num)
{
- struct dvb_net_priv *priv = dvbnet->device[num].priv;
+ struct net_device *net = dvbnet->device[num];
+ struct dvb_net_priv *priv = net->priv;
if (!dvbnet->state[num])
return -EINVAL;
if (priv->in_use)
return -EBUSY;
- dvb_net_stop(&dvbnet->device[num]);
+ dvb_net_stop(net);
flush_scheduled_work();
- kfree(priv);
- unregister_netdev(&dvbnet->device[num]);
+ unregister_netdev(net);
dvbnet->state[num]=0;
+ free_netdev(net);
+
return 0;
}
diff --git a/drivers/media/dvb/dvb-core/dvb_net.h b/drivers/media/dvb/dvb-core/dvb_net.h
index 93648d4d0de6..5b701efe8e4d 100644
--- a/drivers/media/dvb/dvb-core/dvb_net.h
+++ b/drivers/media/dvb/dvb-core/dvb_net.h
@@ -34,7 +34,7 @@
struct dvb_net {
struct dvb_device *dvbdev;
- struct net_device device[DVB_NET_DEVICES_MAX];
+ struct net_device *device[DVB_NET_DEVICES_MAX];
int state[DVB_NET_DEVICES_MAX];
struct dmx_demux *demux;
};
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
index d9b1352e6c24..63211afd820b 100644
--- a/drivers/media/dvb/ttpci/av7110.c
+++ b/drivers/media/dvb/ttpci/av7110.c
@@ -2706,9 +2706,9 @@ static int tuner_set_tv_freq (struct saa7146_dev *dev, u32 freq)
buf[1] = div & 0xff;
buf[2] = 0x8e;
- if (freq < 16*168.25 )
+ if (freq < (u32) (16*168.25) )
config = 0xa0;
- else if (freq < 16*447.25)
+ else if (freq < (u32) (16*447.25))
config = 0x90;
else
config = 0x30;
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index 6f2676d839bd..c805d4f727b3 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -248,6 +248,8 @@ static struct pci_device_id rtl8139_pci_tbl[] = {
{0x14ea, 0xab06, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
{0x14ea, 0xab07, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
{0x11db, 0x1234, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
+ {0x1432, 0x9130, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
+ {0x02ac, 0x1012, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
#ifdef CONFIG_SH_SECUREEDGE5410
/* Bogus 8139 silicon reports 8129 without external PROM :-( */
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 6c6ce2a743f0..0a10a0556771 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1616,7 +1616,7 @@ config SUNDANCE_MMIO
config TLAN
tristate "TI ThunderLAN support"
- depends on NET_PCI && (PCI || EISA)
+ depends on NET_PCI && (PCI || EISA) && !64BIT
---help---
If you have a PCI Ethernet network card based on the ThunderLAN chip
which is supported by this driver, say Y and read the
@@ -2412,7 +2412,7 @@ config IPHASE5526
config RCPCI
tristate "Red Creek Hardware VPN (EXPERIMENTAL)"
- depends on NETDEVICES && EXPERIMENTAL && PCI
+ depends on NETDEVICES && EXPERIMENTAL && PCI && !64BIT
help
This is a driver for hardware which provides a Virtual Private
Network (VPN). Say Y if you have it.
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index bc9e1bfc7220..33314f110535 100755
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -1698,7 +1698,7 @@ static int amd8111e_resume(struct pci_dev *pci_dev)
/* Restart ipg timer */
if(lp->options & OPTION_DYN_IPG_ENABLE)
mod_timer(&lp->ipg_data.ipg_timer,
- jiffies + (IPG_CONVERGE_TIME * HZ));
+ jiffies + IPG_CONVERGE_JIFFIES);
spin_unlock_irq(&lp->lock);
return 0;
@@ -1772,7 +1772,7 @@ static void amd8111e_config_ipg(struct net_device* dev)
writew((u32)tmp_ipg, mmio + IPG);
writew((u32)(tmp_ipg - IFS1_DELTA), mmio + IFS1);
}
- mod_timer(&lp->ipg_data.ipg_timer, jiffies + (IPG_CONVERGE_TIME * HZ));
+ mod_timer(&lp->ipg_data.ipg_timer, jiffies + IPG_CONVERGE_JIFFIES);
return;
}
@@ -1909,7 +1909,7 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
lp->ipg_data.ipg_timer.data = (unsigned long) dev;
lp->ipg_data.ipg_timer.function = (void *)&amd8111e_config_ipg;
lp->ipg_data.ipg_timer.expires = jiffies +
- IPG_CONVERGE_TIME * HZ;
+ IPG_CONVERGE_JIFFIES;
lp->ipg_data.ipg = DEFAULT_IPG;
lp->ipg_data.ipg_state = CSTATE;
};
diff --git a/drivers/net/amd8111e.h b/drivers/net/amd8111e.h
index d751dc8dd53d..836277399b8a 100755
--- a/drivers/net/amd8111e.h
+++ b/drivers/net/amd8111e.h
@@ -606,7 +606,7 @@ typedef enum {
/* ipg parameters */
#define DEFAULT_IPG 0x60
#define IFS1_DELTA 36
-#define IPG_CONVERGE_TIME 0.5
+#define IPG_CONVERGE_JIFFIES (HZ / 2)
#define IPG_STABLE_TIME 5
#define MIN_IPG 96
#define MAX_IPG 255
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index ef10d16fd679..e87bb3ebb7db 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -25,8 +25,8 @@
#define DRV_MODULE_NAME "b44"
#define PFX DRV_MODULE_NAME ": "
-#define DRV_MODULE_VERSION "0.9"
-#define DRV_MODULE_RELDATE "Jul 14, 2003"
+#define DRV_MODULE_VERSION "0.91"
+#define DRV_MODULE_RELDATE "Oct 3, 2003"
#define B44_DEF_MSG_ENABLE \
(NETIF_MSG_DRV | \
@@ -80,15 +80,6 @@ MODULE_PARM_DESC(b44_debug, "B44 bitmapped debugging message enable value");
static int b44_debug = -1; /* -1 == use B44_DEF_MSG_ENABLE as value */
-#ifndef PCI_DEVICE_ID_BCM4401
-#define PCI_DEVICE_ID_BCM4401 0x4401
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#define IRQ_RETVAL(x)
-#define irqreturn_t void
-#endif
-
static struct pci_device_id b44_pci_tbl[] = {
{ PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BCM4401,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
@@ -870,6 +861,8 @@ static void b44_tx_timeout(struct net_device *dev)
spin_unlock_irq(&bp->lock);
+ b44_enable_ints(bp);
+
netif_wake_queue(dev);
}
diff --git a/drivers/net/defxx.c b/drivers/net/defxx.c
index 52948d2cbad6..014df260b075 100644
--- a/drivers/net/defxx.c
+++ b/drivers/net/defxx.c
@@ -2664,8 +2664,8 @@ static int dfx_hw_dma_uninit(DFX_board_t *bp, PI_UINT32 type)
static void my_skb_align(struct sk_buff *skb, int n)
{
- u32 x=(u32)skb->data; /* We only want the low bits .. */
- u32 v;
+ unsigned long x=(unsigned long)skb->data;
+ unsigned long v;
v=(x+n-1)&~(n-1); /* Where we want to be */
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index b11e2efc8306..f39fa66cb684 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -30,7 +30,7 @@
/* Change Log
*
- * 5.2.18 9/13/03
+ * 5.2.20 9/30/03
* o Bug fix: SERDES devices might be connected to a back-plane
* switch that doesn't support auto-neg, so add the capability
* to force 1000/Full.
@@ -39,6 +39,9 @@
* Jumbo Frames or with the reduced FIFO in 82547.
* o Better propagation of error codes. [Janice Girouard
* (janiceg@us.ibm.com)].
+ * o Bug fix: hang under heavy Tx stress when running out of Tx
+ * descriptors; wasn't clearing context descriptor when backing
+ * out of send because of no-resource condition.
*
* 5.2.16 8/8/03
* o Added support for new controllers: 82545GM, 82546GB, 82541/7_B1
@@ -61,7 +64,7 @@
char e1000_driver_name[] = "e1000";
char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
-char e1000_driver_version[] = "5.2.19-k1";
+char e1000_driver_version[] = "5.2.20-k1";
char e1000_copyright[] = "Copyright (c) 1999-2003 Intel Corporation.";
/* e1000_pci_tbl - PCI Device ID Table
@@ -1545,6 +1548,7 @@ e1000_tx_map(struct e1000_adapter *adapter, struct sk_buff *skb,
unsigned int first)
{
struct e1000_desc_ring *tx_ring = &adapter->tx_ring;
+ struct e1000_tx_desc *tx_desc;
struct e1000_buffer *buffer_info;
unsigned int len = skb->len, max_per_txd = E1000_MAX_DATA_PER_TXD;
unsigned int offset = 0, size, count = 0, i;
@@ -1640,17 +1644,29 @@ e1000_tx_map(struct e1000_adapter *adapter, struct sk_buff *skb,
}
}
- if(E1000_DESC_UNUSED(&adapter->tx_ring) < count) {
+ if(E1000_DESC_UNUSED(&adapter->tx_ring) < count + 2) {
/* There aren't enough descriptors available to queue up
- * this send, so undo the mapping and abort the send.
- * We could have done the check before we mapped the skb,
- * but because of all the workarounds (above), it's too
- * difficult to predict how many we're going to need.*/
- i = first;
+ * this send (need: count + 1 context desc + 1 desc gap
+ * to keep tail from touching head), so undo the mapping
+ * and abort the send. We could have done the check before
+ * we mapped the skb, but because of all the workarounds
+ * (above), it's too difficult to predict how many we're
+ * going to need.*/
+ i = adapter->tx_ring.next_to_use;
+
+ if(i == first) {
+ /* Cleanup after e1000_tx_[csum|tso] scribbling
+ * on descriptors. */
+ tx_desc = E1000_TX_DESC(*tx_ring, first);
+ tx_desc->buffer_addr = 0;
+ tx_desc->lower.data = 0;
+ tx_desc->upper.data = 0;
+ }
while(count--) {
buffer_info = &tx_ring->buffer_info[i];
+
if(buffer_info->dma) {
pci_unmap_page(adapter->pdev,
buffer_info->dma,
@@ -1658,9 +1674,12 @@ e1000_tx_map(struct e1000_adapter *adapter, struct sk_buff *skb,
PCI_DMA_TODEVICE);
buffer_info->dma = 0;
}
+
if(++i == tx_ring->count) i = 0;
}
+ adapter->tx_ring.next_to_use = first;
+
return 0;
}
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index 39cd1e6e487a..93865624e621 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -196,12 +196,8 @@ static int bpq_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty
eth = (struct ethhdr *)skb->mac.raw;
if (!(bpq->acpt_addr[0] & 0x01) &&
- memcmp(eth->h_source, bpq->acpt_addr, ETH_ALEN)) {
- if (net_ratelimit())
- printk(KERN_DEBUG "bpqether: wrong dest %s\n",
- bpq_print_ethaddr(eth->h_source));
+ memcmp(eth->h_source, bpq->acpt_addr, ETH_ALEN))
goto drop_unlock;
- }
if (skb_cow(skb, sizeof(struct ethhdr)))
goto drop_unlock;
diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c
index cee45d0cebbf..0eec5d3e8d8b 100644
--- a/drivers/net/hamradio/scc.c
+++ b/drivers/net/hamradio/scc.c
@@ -1762,7 +1762,7 @@ static int scc_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
#ifndef SCC_DONT_CHECK
- if(request_region(scc->ctrl, 1, "scc-probe"))
+ if(request_region(hwcfg.ctrl_a, 1, "scc-probe"))
{
disable_irq(hwcfg.irq);
Outb(hwcfg.ctrl_a, 0);
@@ -1774,7 +1774,7 @@ static int scc_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
if (InReg(hwcfg.ctrl_a,R13) != 0x55)
found = 0;
enable_irq(hwcfg.irq);
- release_region(scc->ctrl, 1);
+ release_region(hwcfg.ctrl_a, 1);
}
else
found = 0;
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index 3e7facd034d0..f92d5c9b5780 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -1265,9 +1265,9 @@ static int hp100_init_rxpdl(struct net_device *dev,
{
/* pdlptr is starting address for this pdl */
- if (0 != (((unsigned) pdlptr) & 0xf))
- printk("hp100: %s: Init rxpdl: Unaligned pdlptr 0x%x.\n",
- dev->name, (unsigned) pdlptr);
+ if (0 != (((unsigned long) pdlptr) & 0xf))
+ printk("hp100: %s: Init rxpdl: Unaligned pdlptr 0x%lx.\n",
+ dev->name, (unsigned long) pdlptr);
ringptr->pdl = pdlptr + 1;
ringptr->pdl_paddr = virt_to_whatever(dev, pdlptr + 1);
@@ -1292,8 +1292,8 @@ static int hp100_init_txpdl(struct net_device *dev,
register hp100_ring_t * ringptr,
register u32 * pdlptr)
{
- if (0 != (((unsigned) pdlptr) & 0xf))
- printk("hp100: %s: Init txpdl: Unaligned pdlptr 0x%x.\n", dev->name, (unsigned) pdlptr);
+ if (0 != (((unsigned long) pdlptr) & 0xf))
+ printk("hp100: %s: Init txpdl: Unaligned pdlptr 0x%lx.\n", dev->name, (unsigned long) pdlptr);
ringptr->pdl = pdlptr; /* +1; */
ringptr->pdl_paddr = virt_to_whatever(dev, pdlptr); /* +1 */
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 14fbbef63fb6..47fa6b2b1690 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -1530,7 +1530,7 @@ static void drain_tx(struct net_device *dev)
for (i = 0; i < TX_RING_SIZE; i++) {
if (np->tx_skbuff[i]) {
pci_unmap_single(np->pci_dev,
- np->rx_dma[i], np->rx_skbuff[i]->len,
+ np->tx_dma[i], np->tx_skbuff[i]->len,
PCI_DMA_TODEVICE);
dev_kfree_skb(np->tx_skbuff[i]);
np->stats.tx_dropped++;
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index d6bcac3b173e..c52f1c162710 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -681,10 +681,6 @@ static void pcnet_config(dev_link_t *link)
} else {
dev->if_port = 0;
}
- if (register_netdev(dev) != 0) {
- printk(KERN_NOTICE "pcnet_cs: register_netdev() failed\n");
- goto failed;
- }
hw_info = get_hwinfo(link);
if (hw_info == NULL)
@@ -699,7 +695,6 @@ static void pcnet_config(dev_link_t *link)
if (hw_info == NULL) {
printk(KERN_NOTICE "pcnet_cs: unable to read hardware net"
" address for io base %#3lx\n", dev->base_addr);
- unregister_netdev(dev);
goto failed;
}
@@ -733,8 +728,6 @@ static void pcnet_config(dev_link_t *link)
ei_status.word16 = 1;
ei_status.reset_8390 = &pcnet_reset_8390;
- strcpy(info->node.dev_name, dev->name);
- link->dev = &info->node;
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
if (info->flags & (IS_DL10019|IS_DL10022)) {
@@ -743,6 +736,21 @@ static void pcnet_config(dev_link_t *link)
mii_phy_probe(dev);
if ((id == 0x30) && !info->pna_phy && (info->eth_phy == 4))
info->eth_phy = 0;
+ }
+
+ link->dev = &info->node;
+ link->state &= ~DEV_CONFIG_PENDING;
+
+ if (register_netdev(dev) != 0) {
+ printk(KERN_NOTICE "pcnet_cs: register_netdev() failed\n");
+ link->dev = NULL;
+ goto failed;
+ }
+
+ strcpy(info->node.dev_name, dev->name);
+
+ if (info->flags & (IS_DL10019|IS_DL10022)) {
+ u_char id = inb(dev->base_addr + 0x1a);
printk(KERN_INFO "%s: NE2000 (DL100%d rev %02x): ",
dev->name, ((info->flags & IS_DL10022) ? 22 : 19), id);
if (info->pna_phy)
@@ -758,7 +766,6 @@ static void pcnet_config(dev_link_t *link)
printk(" hw_addr ");
for (i = 0; i < 6; i++)
printk("%02X%s", dev->dev_addr[i], ((i<5) ? ":" : "\n"));
- link->state &= ~DEV_CONFIG_PENDING;
return;
cs_failed:
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index daf5cea7612f..2aae8c5a0908 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -224,6 +224,7 @@ static struct pci_device_id tulip_pci_tbl[] = {
{ 0x1186, 0x1561, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
{ 0x1626, 0x8410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
{ 0x1737, 0xAB09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
+ { 0x1737, 0xAB08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
{ 0x17B3, 0xAB08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
{ 0x10b9, 0x5261, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DM910X }, /* ALi 1563 integrated ethernet */
{ 0x10b7, 0x9300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* 3Com 3CSOHO100B-TX */
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c
index 2d835d645fe8..e30f3c157f08 100644
--- a/drivers/net/tulip/xircom_cb.c
+++ b/drivers/net/tulip/xircom_cb.c
@@ -230,7 +230,8 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
This way, we can fail gracefully if not enough memory
is available.
*/
- if ((dev = init_etherdev(NULL, sizeof(struct xircom_private))) == NULL) {
+ dev = alloc_etherdev(sizeof(struct xircom_private));
+ if (!dev) {
printk(KERN_ERR "xircom_probe: failed to allocate etherdev\n");
goto device_fail;
}
@@ -250,7 +251,7 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
SET_MODULE_OWNER(dev);
SET_NETDEV_DEV(dev, &pdev->dev);
- printk(KERN_INFO "%s: Xircom cardbus revision %i at irq %i \n", dev->name, chip_rev, pdev->irq);
+
private->dev = dev;
private->pdev = pdev;
@@ -259,7 +260,6 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
dev->irq = pdev->irq;
dev->base_addr = private->io_port;
-
initialize_card(private);
read_mac_address(private);
setup_descriptors(private);
@@ -272,7 +272,12 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
pci_set_drvdata(pdev, dev);
-
+ if (register_netdev(dev)) {
+ printk(KERN_ERR "xircom_probe: netdevice registration failed.\n");
+ goto reg_fail;
+ }
+
+ printk(KERN_INFO "%s: Xircom cardbus revision %i at irq %i \n", dev->name, chip_rev, pdev->irq);
/* start the transmitter to get a heartbeat */
/* TODO: send 2 dummy packets here */
transceiver_voodoo(private);
@@ -287,10 +292,12 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
leave("xircom_probe");
return 0;
+reg_fail:
+ kfree(private->tx_buffer);
tx_buf_fail:
kfree(private->rx_buffer);
rx_buf_fail:
- kfree(dev);
+ free_netdev(dev);
device_fail:
return -ENODEV;
}
@@ -305,22 +312,16 @@ device_fail:
static void __devexit xircom_remove(struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata(pdev);
- struct xircom_private *card;
+ struct xircom_private *card = dev->priv;
+
enter("xircom_remove");
- if (dev!=NULL) {
- card=dev->priv;
- if (card!=NULL) {
- if (card->rx_buffer!=NULL)
- pci_free_consistent(pdev,8192,card->rx_buffer,card->rx_dma_handle);
- card->rx_buffer = NULL;
- if (card->tx_buffer!=NULL)
- pci_free_consistent(pdev,8192,card->tx_buffer,card->tx_dma_handle);
- card->tx_buffer = NULL;
- }
- }
+ pci_free_consistent(pdev,8192,card->rx_buffer,card->rx_dma_handle);
+ pci_free_consistent(pdev,8192,card->tx_buffer,card->tx_dma_handle);
+
release_region(dev->base_addr, 128);
unregister_netdev(dev);
free_netdev(dev);
+ pci_set_drvdata(pdev, NULL);
leave("xircom_remove");
}
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index c592df7c6a4f..87e8e8040a39 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -37,7 +37,6 @@
******************************************************************************/
#include <linux/config.h>
-#include <linux/version.h>
#include <linux/init.h>
#include <linux/kernel.h>
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index 2e014c19e7b8..9d286ac66662 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -84,7 +84,7 @@ static u_int irq_mask = 0xdeb8;
static int irq_list[4] = { -1 };
MODULE_AUTHOR("Simon Kelley");
-MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethnet cards.");
+MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards.");
MODULE_LICENSE("GPL");
MODULE_SUPPORTED_DEVICE("Atmel at76c50x PCMCIA cards");
MODULE_PARM(irq_mask, "i");
@@ -404,9 +404,12 @@ static void atmel_config(dev_link_t *link)
goto mismatch;
for (k = 0; k < j; k++) {
while ((*p != '\0') && (*p != '/')) p++;
- if (*p == '\0')
- goto mismatch;
- p++;
+ if (*p == '\0') {
+ if (*q != '\0')
+ goto mismatch;
+ } else {
+ p++;
+ }
}
while((*q != '\0') && (*p != '\0') &&
(*p != '/') && (*p == *q)) p++, q++;
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index ab7b4a53568a..ea90ffc0f16d 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -465,7 +465,7 @@ show_periodic (struct class_device *class_dev, char *buf)
spin_lock_irqsave (&ehci->lock, flags);
for (i = 0; i < ehci->periodic_size; i++) {
p = ehci->pshadow [i];
- if (!p.ptr)
+ if (likely (!p.ptr))
continue;
tag = Q_NEXT_TYPE (ehci->periodic [i]);
@@ -495,7 +495,7 @@ show_periodic (struct class_device *class_dev, char *buf)
break;
}
/* show more info the first time around */
- if (temp == seen_count) {
+ if (temp == seen_count && p.ptr) {
u32 scratch = cpu_to_le32p (
&p.qh->hw_info1);
struct ehci_qtd *qtd;
@@ -528,8 +528,10 @@ show_periodic (struct class_device *class_dev, char *buf)
seen [seen_count++].qh = p.qh;
} else
temp = 0;
- tag = Q_NEXT_TYPE (p.qh->hw_next);
- p = p.qh->qh_next;
+ if (p.qh) {
+ tag = Q_NEXT_TYPE (p.qh->hw_next);
+ p = p.qh->qh_next;
+ }
break;
case Q_TYPE_FSTN:
temp = snprintf (next, size,
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index 93fedc024028..bafc981be5eb 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -184,7 +184,7 @@ ehci_urb_done (struct ehci_hcd *ehci, struct urb *urb, struct pt_regs *regs)
struct ehci_qh *qh = (struct ehci_qh *) urb->hcpriv;
/* S-mask in a QH means it's an interrupt urb */
- if ((qh->hw_info2 & cpu_to_le32 (0x00ff)) != 0) {
+ if ((qh->hw_info2 & __constant_cpu_to_le32 (0x00ff)) != 0) {
/* ... update hc-wide periodic stats (for usbfs) */
hcd_to_bus (&ehci->hcd)->bandwidth_int_reqs--;
@@ -224,7 +224,7 @@ ehci_urb_done (struct ehci_hcd *ehci, struct urb *urb, struct pt_regs *regs)
* Chases up to qh->hw_current. Returns number of completions called,
* indicating how much "real" work we did.
*/
-#define HALT_BIT cpu_to_le32(QTD_STS_HALT)
+#define HALT_BIT __constant_cpu_to_le32(QTD_STS_HALT)
static unsigned
qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh, struct pt_regs *regs)
{
@@ -377,10 +377,14 @@ halt:
return count;
}
-#undef HALT_BIT
/*-------------------------------------------------------------------------*/
+// high bandwidth multiplier, as encoded in highspeed endpoint descriptors
+#define hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03))
+// ... and packet size, for any kind of endpoint descriptor
+#define max_packet(wMaxPacketSize) ((wMaxPacketSize) & 0x07ff)
+
/*
* reverse of qh_urb_transaction: free a list of TDs.
* used for cleanup after errors, before HC sees an URB's TDs.
@@ -461,7 +465,7 @@ qh_urb_transaction (
token |= (1 /* "in" */ << 8);
/* else it's already initted to "out" pid (0 << 8) */
- maxpacket = usb_maxpacket (urb->dev, urb->pipe, !is_input) & 0x03ff;
+ maxpacket = max_packet(usb_maxpacket(urb->dev, urb->pipe, !is_input));
/*
* buffer gets wrapped in one or more qtds;
@@ -564,11 +568,6 @@ clear_toggle (struct usb_device *udev, int ep, int is_out, struct ehci_qh *qh)
// That'd mean updating how usbcore talks to HCDs. (2.5?)
-// high bandwidth multiplier, as encoded in highspeed endpoint descriptors
-#define hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03))
-// ... and packet size, for any kind of endpoint descriptor
-#define max_packet(wMaxPacketSize) ((wMaxPacketSize) & 0x03ff)
-
/*
* Each QH holds a qtd list; a QH is used for everything except iso.
*
@@ -728,7 +727,7 @@ static void qh_link_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
}
}
- qh->hw_token &= ~__constant_cpu_to_le32 (QTD_STS_HALT);
+ qh->hw_token &= ~HALT_BIT;
/* splice right after start */
qh->qh_next = head->qh_next;
@@ -744,6 +743,8 @@ static void qh_link_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
/*-------------------------------------------------------------------------*/
+#define QH_ADDR_MASK __constant_le32_to_cpu(0x7f)
+
/*
* For control/bulk/interrupt, return QH with these TDs appended.
* Allocates and initializes the QH if necessary.
@@ -778,12 +779,13 @@ static struct ehci_qh *qh_append_tds (
/* control qh may need patching after enumeration */
if (unlikely (epnum == 0)) {
/* set_address changes the address */
- if (le32_to_cpu (qh->hw_info1 & 0x7f) == 0)
+ if ((qh->hw_info1 & QH_ADDR_MASK) == 0)
qh->hw_info1 |= cpu_to_le32 (
usb_pipedevice (urb->pipe));
/* for full speed, ep0 maxpacket can grow */
- else if (!(qh->hw_info1 & cpu_to_le32 (0x3 << 12))) {
+ else if (!(qh->hw_info1
+ & __constant_cpu_to_le32 (0x3 << 12))) {
u32 info, max;
info = le32_to_cpu (qh->hw_info1);
@@ -797,7 +799,7 @@ static struct ehci_qh *qh_append_tds (
/* usb_reset_device() briefly reverts to address 0 */
if (usb_pipedevice (urb->pipe) == 0)
- qh->hw_info1 &= cpu_to_le32(~0x7f);
+ qh->hw_info1 &= ~QH_ADDR_MASK;
}
/* usb_clear_halt() means qh data toggle gets reset */
@@ -833,7 +835,7 @@ static struct ehci_qh *qh_append_tds (
* HC is allowed to fetch the old dummy (4.10.2).
*/
token = qtd->hw_token;
- qtd->hw_token = cpu_to_le32 (QTD_STS_HALT);
+ qtd->hw_token = HALT_BIT;
wmb ();
dummy = qh->dummy;
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index ed23010d21a2..43415d2b054c 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -325,6 +325,7 @@ union ehci_shadow {
struct ehci_itd *itd; /* Q_TYPE_ITD */
struct ehci_sitd *sitd; /* Q_TYPE_SITD */
struct ehci_fstn *fstn; /* Q_TYPE_FSTN */
+ u32 *hw_next; /* (all types) */
void *ptr;
};
@@ -469,27 +470,12 @@ struct ehci_fstn {
/*-------------------------------------------------------------------------*/
-#include <linux/version.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,32)
-
-#define SUBMIT_URB(urb,mem_flags) usb_submit_urb(urb)
-#define STUB_DEBUG_FILES
-
-static inline int hcd_register_root (struct usb_hcd *hcd)
-{
- return usb_new_device (hcd_to_bus (hcd)->root_hub);
-}
-
-#else /* LINUX_VERSION_CODE */
-
#define SUBMIT_URB(urb,mem_flags) usb_submit_urb(urb,mem_flags)
#ifndef DEBUG
#define STUB_DEBUG_FILES
#endif /* DEBUG */
-#endif /* LINUX_VERSION_CODE */
-
/*-------------------------------------------------------------------------*/
#endif /* __LINUX_EHCI_HCD_H */
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index f978d143e090..4372ea78d09b 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -102,14 +102,8 @@
#include <asm/unaligned.h>
#include <asm/byteorder.h>
-/*
- * TO DO:
- *
- * - "disabled" and "sleeping" should be in hcd->state
- * - lots more testing!!
- */
-#define DRIVER_VERSION "2003 Feb 24"
+#define DRIVER_VERSION "2003 Oct 13"
#define DRIVER_AUTHOR "Roman Weissgaerber, David Brownell"
#define DRIVER_DESC "USB 1.1 'Open' Host Controller (OHCI) Driver"
@@ -131,7 +125,6 @@ static const char hcd_name [] = "ohci_hcd";
static inline void disable (struct ohci_hcd *ohci)
{
- ohci->disabled = 1;
ohci->hcd.state = USB_STATE_HALT;
}
@@ -222,7 +215,7 @@ static int ohci_urb_enqueue (
spin_lock_irqsave (&ohci->lock, flags);
/* don't submit to a dead HC */
- if (ohci->disabled || ohci->sleeping) {
+ if (!HCD_IS_RUNNING(ohci->hcd.state)) {
retval = -ENODEV;
goto fail;
}
@@ -278,7 +271,7 @@ static int ohci_urb_dequeue (struct usb_hcd *hcd, struct urb *urb)
#endif
spin_lock_irqsave (&ohci->lock, flags);
- if (!ohci->disabled) {
+ if (HCD_IS_RUNNING(ohci->hcd.state)) {
urb_priv_t *urb_priv;
/* Unless an IRQ completed the unlink while it was being
@@ -287,7 +280,6 @@ static int ohci_urb_dequeue (struct usb_hcd *hcd, struct urb *urb)
*/
urb_priv = urb->hcpriv;
if (urb_priv) {
- urb_priv->state = URB_DEL;
if (urb_priv->ed->state == ED_OPER)
start_urb_unlink (ohci, urb_priv->ed);
}
@@ -334,7 +326,7 @@ rescan:
if (!ed)
goto done;
- if (!HCD_IS_RUNNING (ohci->hcd.state) || ohci->disabled)
+ if (!HCD_IS_RUNNING (ohci->hcd.state))
ed->state = ED_IDLE;
switch (ed->state) {
case ED_UNLINK: /* wait for hw to finish? */
@@ -355,9 +347,9 @@ rescan:
/* caller was supposed to have unlinked any requests;
* that's not our job. can't recover; must leak ed.
*/
- ohci_err (ohci, "ed %p (#%d) state %d%s\n",
+ ohci_err (ohci, "leak ed %p (#%d) state %d%s\n",
ed, epnum, ed->state,
- list_empty (&ed->td_list) ? "" : "(has tds)");
+ list_empty (&ed->td_list) ? "" : " (has tds)");
td_free (ohci, ed->dummy);
break;
}
@@ -466,8 +458,7 @@ static int hc_start (struct ohci_hcd *ohci)
struct usb_bus *bus;
spin_lock_init (&ohci->lock);
- ohci->disabled = 1;
- ohci->sleeping = 0;
+ disable (ohci);
/* Tell the controller where the control and bulk lists are
* The lists are empty now. */
@@ -496,8 +487,8 @@ static int hc_start (struct ohci_hcd *ohci)
/* start controller operations */
ohci->hc_control &= OHCI_CTRL_RWC;
ohci->hc_control |= OHCI_CONTROL_INIT | OHCI_USB_OPER;
- ohci->disabled = 0;
writel (ohci->hc_control, &ohci->regs->control);
+ ohci->hcd.state = USB_STATE_RUNNING;
/* Choose the interrupts we care about now, others later on demand */
mask = OHCI_INTR_MIE | OHCI_INTR_UE | OHCI_INTR_WDH;
@@ -586,9 +577,11 @@ static void ohci_irq (struct usb_hcd *hcd, struct pt_regs *ptregs)
}
if (ints & OHCI_INTR_WDH) {
- writel (OHCI_INTR_WDH, &regs->intrdisable);
+ if (HCD_IS_RUNNING(hcd->state))
+ writel (OHCI_INTR_WDH, &regs->intrdisable);
dl_done_list (ohci, dl_reverse_done_list (ohci), ptregs);
- writel (OHCI_INTR_WDH, &regs->intrenable);
+ if (HCD_IS_RUNNING(hcd->state))
+ writel (OHCI_INTR_WDH, &regs->intrenable);
}
/* could track INTR_SO to reduce available PCI/... bandwidth */
@@ -600,14 +593,17 @@ static void ohci_irq (struct usb_hcd *hcd, struct pt_regs *ptregs)
if (ohci->ed_rm_list)
finish_unlinks (ohci, le16_to_cpu (ohci->hcca->frame_no),
ptregs);
- if ((ints & OHCI_INTR_SF) != 0 && !ohci->ed_rm_list)
+ if ((ints & OHCI_INTR_SF) != 0 && !ohci->ed_rm_list
+ && HCD_IS_RUNNING(ohci->hcd.state))
writel (OHCI_INTR_SF, &regs->intrdisable);
spin_unlock (&ohci->lock);
- writel (ints, &regs->intrstatus);
- writel (OHCI_INTR_MIE, &regs->intrenable);
- // flush those pci writes
- (void) readl (&ohci->regs->control);
+ if (HCD_IS_RUNNING(ohci->hcd.state)) {
+ writel (ints, &regs->intrstatus);
+ writel (OHCI_INTR_MIE, &regs->intrenable);
+ // flush those pci writes
+ (void) readl (&ohci->regs->control);
+ }
}
/*-------------------------------------------------------------------------*/
@@ -616,13 +612,12 @@ static void ohci_stop (struct usb_hcd *hcd)
{
struct ohci_hcd *ohci = hcd_to_ohci (hcd);
- ohci_dbg (ohci, "stop %s controller%s\n",
+ ohci_dbg (ohci, "stop %s controller (state 0x%02x)\n",
hcfs2string (ohci->hc_control & OHCI_CTRL_HCFS),
- ohci->disabled ? " (disabled)" : ""
- );
+ ohci->hcd.state);
ohci_dump (ohci, 1);
- if (!ohci->disabled)
+ if (HCD_IS_RUNNING(ohci->hcd.state))
hc_reset (ohci);
remove_debug_files (ohci);
@@ -649,8 +644,7 @@ static int hc_restart (struct ohci_hcd *ohci)
int temp;
int i;
- ohci->disabled = 1;
- ohci->sleeping = 0;
+ disable (ohci);
if (hcd_to_bus (&ohci->hcd)->root_hub)
usb_disconnect (&hcd_to_bus (&ohci->hcd)->root_hub);
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
index a7584a499af0..4f8260c91ba4 100644
--- a/drivers/usb/host/ohci-hub.c
+++ b/drivers/usb/host/ohci-hub.c
@@ -73,7 +73,7 @@ ohci_hub_status_data (struct usb_hcd *hcd, char *buf)
ports = roothub_a (ohci) & RH_A_NDP;
if (ports > MAX_ROOT_PORTS) {
- if (ohci->disabled)
+ if (!HCD_IS_RUNNING(ohci->hcd.state))
return -ESHUTDOWN;
ohci_err (ohci, "bogus NDP=%d, rereads as NDP=%d\n",
ports, readl (&ohci->regs->roothub.a) & RH_A_NDP);
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
index a0820ee9f178..431795328c26 100644
--- a/drivers/usb/host/ohci-pci.c
+++ b/drivers/usb/host/ohci-pci.c
@@ -117,7 +117,6 @@ ohci_pci_start (struct usb_hcd *hcd)
static int ohci_pci_suspend (struct usb_hcd *hcd, u32 state)
{
struct ohci_hcd *ohci = hcd_to_ohci (hcd);
- unsigned long flags;
u16 cmd;
u32 tmp;
@@ -129,16 +128,15 @@ static int ohci_pci_suspend (struct usb_hcd *hcd, u32 state)
/* act as if usb suspend can always be used */
ohci_dbg (ohci, "suspend to %d\n", state);
- ohci->sleeping = 1;
-
+
/* First stop processing */
- spin_lock_irqsave (&ohci->lock, flags);
+ spin_lock_irq (&ohci->lock);
ohci->hc_control &=
~(OHCI_CTRL_PLE|OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_IE);
writel (ohci->hc_control, &ohci->regs->control);
writel (OHCI_INTR_SF, &ohci->regs->intrstatus);
(void) readl (&ohci->regs->intrstatus);
- spin_unlock_irqrestore (&ohci->lock, flags);
+ spin_unlock_irq (&ohci->lock);
/* Wait a frame or two */
mdelay (1);
@@ -156,10 +154,14 @@ static int ohci_pci_suspend (struct usb_hcd *hcd, u32 state)
&ohci->regs->intrenable);
/* Suspend chip and let things settle down a bit */
+ spin_lock_irq (&ohci->lock);
ohci->hc_control = OHCI_USB_SUSPEND;
writel (ohci->hc_control, &ohci->regs->control);
(void) readl (&ohci->regs->control);
- mdelay (500); /* No schedule here ! */
+ spin_unlock_irq (&ohci->lock);
+
+ set_current_state (TASK_UNINTERRUPTIBLE);
+ schedule_timeout (HZ/2);
tmp = readl (&ohci->regs->control) | OHCI_CTRL_HCFS;
switch (tmp) {
@@ -199,7 +201,6 @@ static int ohci_pci_resume (struct usb_hcd *hcd)
struct ohci_hcd *ohci = hcd_to_ohci (hcd);
int temp;
int retval = 0;
- unsigned long flags;
#ifdef CONFIG_PMAC_PBOOK
{
@@ -226,6 +227,7 @@ static int ohci_pci_resume (struct usb_hcd *hcd)
switch (temp) {
case OHCI_USB_RESET: // lost power
+restart:
ohci_info (ohci, "USB restart\n");
retval = hc_restart (ohci);
break;
@@ -235,31 +237,28 @@ static int ohci_pci_resume (struct usb_hcd *hcd)
ohci_info (ohci, "USB continue from %s wakeup\n",
(temp == OHCI_USB_SUSPEND)
? "host" : "remote");
+
+ /* we "should" only need RESUME if we're SUSPENDed ... */
ohci->hc_control = OHCI_USB_RESUME;
writel (ohci->hc_control, &ohci->regs->control);
(void) readl (&ohci->regs->control);
- mdelay (20); /* no schedule here ! */
- /* Some controllers (lucent) need a longer delay here */
- mdelay (15);
+ /* Some controllers (lucent) need extra-long delays */
+ mdelay (35); /* no schedule here ! */
temp = readl (&ohci->regs->control);
temp = ohci->hc_control & OHCI_CTRL_HCFS;
if (temp != OHCI_USB_RESUME) {
ohci_err (ohci, "controller won't resume\n");
- ohci->disabled = 1;
- retval = -EIO;
- break;
+ /* maybe we can reset */
+ goto restart;
}
- /* Some chips likes being resumed first */
+ /* Then re-enable operations */
writel (OHCI_USB_OPER, &ohci->regs->control);
(void) readl (&ohci->regs->control);
mdelay (3);
- /* Then re-enable operations */
- spin_lock_irqsave (&ohci->lock, flags);
- ohci->disabled = 0;
- ohci->sleeping = 0;
+ spin_lock_irq (&ohci->lock);
ohci->hc_control = OHCI_CONTROL_INIT | OHCI_USB_OPER;
if (!ohci->ed_rm_list) {
if (ohci->ed_controltail)
@@ -274,25 +273,22 @@ static int ohci_pci_resume (struct usb_hcd *hcd)
writel (OHCI_INTR_SF, &ohci->regs->intrstatus);
writel (OHCI_INTR_SF, &ohci->regs->intrenable);
- /* Check for a pending done list */
writel (OHCI_INTR_WDH, &ohci->regs->intrdisable);
(void) readl (&ohci->regs->intrdisable);
- spin_unlock_irqrestore (&ohci->lock, flags);
+ spin_unlock_irq (&ohci->lock);
#ifdef CONFIG_PMAC_PBOOK
if (_machine == _MACH_Pmac)
enable_irq (hcd->pdev->irq);
#endif
+
+ /* Check for a pending done list */
if (ohci->hcca->done_head)
dl_done_list (ohci, dl_reverse_done_list (ohci), NULL);
writel (OHCI_INTR_WDH, &ohci->regs->intrenable);
/* assume there are TDs on the bulk and control lists */
writel (OHCI_BLF | OHCI_CLF, &ohci->regs->cmdstatus);
-
-// ohci_dump_status (ohci);
-ohci_dbg (ohci, "sleeping = %d, disabled = %d\n",
- ohci->sleeping, ohci->disabled);
break;
default:
diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c
index 0d1e63469030..7a6a1d4ec5c5 100644
--- a/drivers/usb/host/ohci-q.c
+++ b/drivers/usb/host/ohci-q.c
@@ -449,7 +449,7 @@ static void start_urb_unlink (struct ohci_hcd *ohci, struct ed *ed)
ohci->ed_rm_list = ed;
/* enable SOF interrupt */
- if (!ohci->sleeping) {
+ if (HCD_IS_RUNNING (ohci->hcd.state)) {
writel (OHCI_INTR_SF, &ohci->regs->intrstatus);
writel (OHCI_INTR_SF, &ohci->regs->intrenable);
// flush those pci writes
@@ -794,7 +794,16 @@ ed_halted (struct ohci_hcd *ohci, struct td *td, int cc, struct td *rev)
* looks odd ... that doesn't include protocol stalls
* (or maybe some other things)
*/
- if (cc != TD_CC_STALL || !usb_pipecontrol (urb->pipe))
+ switch (cc) {
+ case TD_DATAUNDERRUN:
+ if ((urb->transfer_flags & URB_SHORT_NOT_OK) == 0)
+ break;
+ /* fallthrough */
+ case TD_CC_STALL:
+ if (usb_pipecontrol (urb->pipe))
+ break;
+ /* fallthrough */
+ default:
ohci_dbg (ohci,
"urb %p path %s ep%d%s %08x cc %d --> status %d\n",
urb, urb->dev->devpath,
@@ -802,6 +811,7 @@ ed_halted (struct ohci_hcd *ohci, struct td *td, int cc, struct td *rev)
usb_pipein (urb->pipe) ? "in" : "out",
le32_to_cpu (td->hwINFO),
cc, cc_to_error [cc]);
+ }
return rev;
}
@@ -871,7 +881,8 @@ rescan_all:
/* only take off EDs that the HC isn't using, accounting for
* frame counter wraps.
*/
- if (tick_before (tick, ed->tick) && !ohci->disabled) {
+ if (tick_before (tick, ed->tick)
+ && HCD_IS_RUNNING(ohci->hcd.state)) {
last = &ed->ed_next;
continue;
}
@@ -901,7 +912,7 @@ rescan_this:
urb = td->urb;
urb_priv = td->urb->hcpriv;
- if (urb_priv->state != URB_DEL) {
+ if (urb->status == -EINPROGRESS) {
prev = &td->hwNextTD;
continue;
}
@@ -938,7 +949,7 @@ rescan_this:
/* but if there's work queued, reschedule */
if (!list_empty (&ed->td_list)) {
- if (!ohci->disabled && !ohci->sleeping)
+ if (HCD_IS_RUNNING(ohci->hcd.state))
ed_schedule (ohci, ed);
}
@@ -947,7 +958,7 @@ rescan_this:
}
/* maybe reenable control and bulk lists */
- if (!ohci->disabled && !ohci->ed_rm_list) {
+ if (HCD_IS_RUNNING(ohci->hcd.state) && !ohci->ed_rm_list) {
u32 command = 0, control = 0;
if (ohci->ed_controltail) {
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
index a9c564b98897..7419f7f10741 100644
--- a/drivers/usb/host/ohci.h
+++ b/drivers/usb/host/ohci.h
@@ -314,13 +314,10 @@ typedef struct urb_priv {
struct ed *ed;
__u16 length; // # tds in this request
__u16 td_cnt; // tds already serviced
- int state;
struct td *td [0]; // all TDs in this request
} urb_priv_t;
-#define URB_DEL 1
-
#define TD_HASH_SIZE 64 /* power'o'two */
// sizeof (struct td) ~= 64 == 2^6 ...
#define TD_HASH_FUNC(td_dma) ((td_dma ^ (td_dma >> 6)) % TD_HASH_SIZE)
@@ -365,8 +362,6 @@ struct ohci_hcd {
/*
* driver state
*/
- int disabled; /* e.g. got a UE, we're hung */
- int sleeping;
int load [NUM_INTS];
u32 hc_control; /* copy of hc control reg */
diff --git a/drivers/usb/input/Kconfig b/drivers/usb/input/Kconfig
index 2e64c26c9266..fb9a0a30457e 100644
--- a/drivers/usb/input/Kconfig
+++ b/drivers/usb/input/Kconfig
@@ -28,6 +28,7 @@ comment "Input core support is needed for USB HID input layer or HIDBP support"
config USB_HIDINPUT
bool "HID input layer support"
+ default y
depends on INPUT && USB_HID
help
Say Y here if you want to use a USB keyboard, mouse or joystick,
diff --git a/drivers/usb/serial/keyspan_usa90msg.h b/drivers/usb/serial/keyspan_usa90msg.h
index 5af43d42c33a..dd935b62c1a8 100644
--- a/drivers/usb/serial/keyspan_usa90msg.h
+++ b/drivers/usb/serial/keyspan_usa90msg.h
@@ -182,14 +182,14 @@ struct keyspan_usa90_portStatusMessage
// MSR bits
-#define MSR_dCTS 0x01 // CTS has changed since last report
-#define MSR_dDSR 0x02
-#define MSR_dRI 0x04
-#define MSR_dDCD 0x08
-
-#define MSR_CTS 0x10 // current state of CTS
-#define MSR_DSR 0x20
-#define MSR_RI 0x40
+#define USA_MSR_dCTS 0x01 // CTS has changed since last report
+#define USA_MSR_dDSR 0x02
+#define USA_MSR_dRI 0x04
+#define USA_MSR_dDCD 0x08
+
+#define USA_MSR_CTS 0x10 // current state of CTS
+#define USA_MSR_DSR 0x20
+#define USA_USA_MSR_RI 0x40
#define MSR_DCD 0x80
// ie: the maximum length of an endpoint buffer
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index 6eb51b58bc87..6e13bbeb6aa8 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -778,9 +778,6 @@ static int visor_probe (struct usb_serial *serial, const struct usb_device_id *i
serial->dev->actconfig->desc.bConfigurationValue);
return -ENODEV;
}
- dbg("%s - reset config", __FUNCTION__);
- retval = usb_reset_configuration (serial->dev);
-
if (id->driver_info) {
startup = (void *)id->driver_info;
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 1eba76a6f603..d26f6590bd05 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -226,6 +226,7 @@ static void collect_sigign_sigcatch(struct task_struct *p, sigset_t *ign,
static inline char * task_sig(struct task_struct *p, char *buffer)
{
sigset_t pending, shpending, blocked, ignored, caught;
+ int num_threads = 0;
sigemptyset(&pending);
sigemptyset(&shpending);
@@ -241,10 +242,13 @@ static inline char * task_sig(struct task_struct *p, char *buffer)
shpending = p->signal->shared_pending.signal;
blocked = p->blocked;
collect_sigign_sigcatch(p, &ignored, &caught);
+ num_threads = atomic_read(&p->signal->count);
spin_unlock_irq(&p->sighand->siglock);
}
read_unlock(&tasklist_lock);
+ buffer += sprintf(buffer, "Threads:\t%d\n", num_threads);
+
/* render them all */
buffer = render_sigset_t("SigPnd:\t", &pending, buffer);
buffer = render_sigset_t("ShdPnd:\t", &shpending, buffer);
@@ -296,6 +300,7 @@ int proc_pid_stat(struct task_struct *task, char * buffer)
char state;
int res;
pid_t ppid;
+ int num_threads = 0;
struct mm_struct *mm;
state = *get_task_state(task);
@@ -324,6 +329,7 @@ int proc_pid_stat(struct task_struct *task, char * buffer)
read_lock(&tasklist_lock);
if (task->sighand) {
spin_lock_irq(&task->sighand->siglock);
+ num_threads = atomic_read(&task->signal->count);
collect_sigign_sigcatch(task, &sigign, &sigcatch);
spin_unlock_irq(&task->sighand->siglock);
}
@@ -338,7 +344,7 @@ int proc_pid_stat(struct task_struct *task, char * buffer)
ppid = task->pid ? task->real_parent->pid : 0;
read_unlock(&tasklist_lock);
res = sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \
-%lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld %llu %lu %ld %lu %lu %lu %lu %lu \
+%lu %lu %lu %lu %lu %ld %ld %ld %ld %d %ld %llu %lu %ld %lu %lu %lu %lu %lu \
%lu %lu %lu %lu %lu %lu %lu %lu %d %d %lu %lu\n",
task->pid,
task->comm,
@@ -359,7 +365,7 @@ int proc_pid_stat(struct task_struct *task, char * buffer)
jiffies_to_clock_t(task->cstime),
priority,
nice,
- 0UL /* removed */,
+ num_threads,
jiffies_to_clock_t(task->it_real_value),
(unsigned long long)
jiffies_64_to_clock_t(task->start_time - INITIAL_JIFFIES),
diff --git a/include/asm-i386/div64.h b/include/asm-i386/div64.h
index e99f044af73b..28ed8b296afc 100644
--- a/include/asm-i386/div64.h
+++ b/include/asm-i386/div64.h
@@ -14,14 +14,15 @@
* convention" on x86.
*/
#define do_div(n,base) ({ \
- unsigned long __upper, __low, __high, __mod; \
+ unsigned long __upper, __low, __high, __mod, __base; \
+ __base = (base); \
asm("":"=a" (__low), "=d" (__high):"A" (n)); \
__upper = __high; \
if (__high) { \
- __upper = __high % (base); \
- __high = __high / (base); \
+ __upper = __high % (__base); \
+ __high = __high / (__base); \
} \
- asm("divl %2":"=a" (__low), "=d" (__mod):"rm" (base), "0" (__low), "1" (__upper)); \
+ asm("divl %2":"=a" (__low), "=d" (__mod):"rm" (__base), "0" (__low), "1" (__upper)); \
asm("":"=A" (n):"a" (__low),"d" (__high)); \
__mod; \
})
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
index bca7f54ccf43..b9998ad13267 100644
--- a/include/asm-i386/processor.h
+++ b/include/asm-i386/processor.h
@@ -498,7 +498,7 @@ unsigned long get_wchan(struct task_struct *p);
#define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)->thread_info))[1019])
#define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)->thread_info))[1022])
-struct microcode {
+struct microcode_header {
unsigned int hdrver;
unsigned int rev;
unsigned int date;
@@ -506,10 +506,32 @@ struct microcode {
unsigned int cksum;
unsigned int ldrver;
unsigned int pf;
- unsigned int reserved[5];
- unsigned int bits[500];
+ unsigned int datasize;
+ unsigned int totalsize;
+ unsigned int reserved[3];
+};
+
+struct microcode {
+ struct microcode_header hdr;
+ unsigned int bits[0];
+};
+
+typedef struct microcode microcode_t;
+typedef struct microcode_header microcode_header_t;
+
+/* microcode format is extended from prescott processors */
+struct extended_signature {
+ unsigned int sig;
+ unsigned int pf;
+ unsigned int cksum;
};
+struct extended_sigtable {
+ unsigned int count;
+ unsigned int cksum;
+ unsigned int reserved[3];
+ struct extended_signature sigs[0];
+};
/* '6' because it used to be for P6 only (but now covers Pentium 4 as well) */
#define MICROCODE_IOCFREE _IO('6',0)
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index cc942f675ae9..8d4d0e397ed5 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -307,14 +307,14 @@ int ethtool_op_set_tso(struct net_device *dev, u32 data);
*
* get_eeprom:
* Should fill in the magic field. Don't need to check len for zero
- * or wraparound but must check offset + len < size. Fill in the data
- * argument with the eeprom values from offset to offset + len. Update
- * len to the amount read. Returns an error or zero.
+ * or wraparound. Fill in the data argument with the eeprom values
+ * from offset to offset + len. Update len to the amount read.
+ * Returns an error or zero.
*
* set_eeprom:
* Should validate the magic field. Don't need to check len for zero
- * or wraparound but must check offset + len < size. Update len to
- * the amount written. Returns an error or zero.
+ * or wraparound. Update len to the amount written. Returns an error
+ * or zero.
*/
struct ethtool_ops {
int (*get_settings)(struct net_device *, struct ethtool_cmd *);
@@ -328,6 +328,7 @@ struct ethtool_ops {
void (*set_msglevel)(struct net_device *, u32);
int (*nway_reset)(struct net_device *);
u32 (*get_link)(struct net_device *);
+ int (*get_eeprom_len)(struct net_device *);
int (*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *);
int (*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *);
int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *);
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 35f27196b154..46e3cf090b3c 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -122,7 +122,8 @@ static int ethtool_get_drvinfo(struct net_device *dev, void *useraddr)
info.n_stats = ops->get_stats_count(dev);
if (ops->get_regs_len)
info.regdump_len = ops->get_regs_len(dev);
- /* XXX: eeprom? */
+ if (ops->get_eeprom_len)
+ info.eedump_len = ops->get_eeprom_len(dev);
if (copy_to_user(useraddr, &info, sizeof(info)))
return -EFAULT;
@@ -245,29 +246,34 @@ static int ethtool_get_link(struct net_device *dev, void *useraddr)
static int ethtool_get_eeprom(struct net_device *dev, void *useraddr)
{
struct ethtool_eeprom eeprom;
+ struct ethtool_ops *ops = dev->ethtool_ops;
u8 *data;
- int len, ret;
+ int ret;
- if (!dev->ethtool_ops->get_eeprom)
+ if (!ops->get_eeprom || !ops->get_eeprom_len)
return -EOPNOTSUPP;
if (copy_from_user(&eeprom, useraddr, sizeof(eeprom)))
return -EFAULT;
- len = eeprom.len;
/* Check for wrap and zero */
- if (eeprom.offset + len <= eeprom.offset)
+ if (eeprom.offset + eeprom.len <= eeprom.offset)
+ return -EINVAL;
+
+ /* Check for exceeding total eeprom len */
+ if (eeprom.offset + eeprom.len > ops->get_eeprom_len(dev))
return -EINVAL;
- data = kmalloc(len, GFP_USER);
+ data = kmalloc(eeprom.len, GFP_USER);
if (!data)
return -ENOMEM;
- if (copy_from_user(data, useraddr + sizeof(eeprom), len))
- return -EFAULT;
+ ret = -EFAULT;
+ if (copy_from_user(data, useraddr + sizeof(eeprom), eeprom.len))
+ goto out;
- ret = dev->ethtool_ops->get_eeprom(dev, &eeprom, data);
- if (!ret)
+ ret = ops->get_eeprom(dev, &eeprom, data);
+ if (ret)
goto out;
ret = -EFAULT;
@@ -285,32 +291,37 @@ static int ethtool_get_eeprom(struct net_device *dev, void *useraddr)
static int ethtool_set_eeprom(struct net_device *dev, void *useraddr)
{
struct ethtool_eeprom eeprom;
+ struct ethtool_ops *ops = dev->ethtool_ops;
u8 *data;
- int len, ret;
+ int ret;
- if (!dev->ethtool_ops->set_eeprom)
+ if (!ops->set_eeprom || !ops->get_eeprom_len)
return -EOPNOTSUPP;
if (copy_from_user(&eeprom, useraddr, sizeof(eeprom)))
return -EFAULT;
- len = eeprom.len;
/* Check for wrap and zero */
- if (eeprom.offset + len <= eeprom.offset)
+ if (eeprom.offset + eeprom.len <= eeprom.offset)
+ return -EINVAL;
+
+ /* Check for exceeding total eeprom len */
+ if (eeprom.offset + eeprom.len > ops->get_eeprom_len(dev))
return -EINVAL;
- data = kmalloc(len, GFP_USER);
+ data = kmalloc(eeprom.len, GFP_USER);
if (!data)
return -ENOMEM;
- if (copy_from_user(data, useraddr + sizeof(eeprom), len))
- return -EFAULT;
+ ret = -EFAULT;
+ if (copy_from_user(data, useraddr + sizeof(eeprom), eeprom.len))
+ goto out;
- ret = dev->ethtool_ops->set_eeprom(dev, &eeprom, data);
+ ret = ops->set_eeprom(dev, &eeprom, data);
if (ret)
goto out;
- if (copy_to_user(useraddr + sizeof(eeprom), data, len))
+ if (copy_to_user(useraddr + sizeof(eeprom), data, eeprom.len))
ret = -EFAULT;
out:
diff --git a/sound/oss/ad1889.c b/sound/oss/ad1889.c
index 6b4ab48945d7..f37ee7a44555 100644
--- a/sound/oss/ad1889.c
+++ b/sound/oss/ad1889.c
@@ -763,18 +763,17 @@ static int ad1889_open(struct inode *inode, struct file *file)
ad1889_set_wav_rate(ad1889_dev, 44100);
ad1889_set_wav_fmt(ad1889_dev, AFMT_S16_LE);
AD1889_WRITEW(ad1889_dev, AD_DSWADA, 0x0404); /* attenuation */
- MOD_INC_USE_COUNT;
return 0;
}
static int ad1889_release(struct inode *inode, struct file *file)
{
/* if we have state free it here */
- MOD_DEC_USE_COUNT;
return 0;
}
static struct file_operations ad1889_fops = {
+ .owner = THIS_MODULE,
.llseek = no_llseek,
.read = ad1889_read,
.write = ad1889_write,
@@ -792,13 +791,11 @@ static int ad1889_mixer_open(struct inode *inode, struct file *file)
return -ENODEV;
file->private_data = ad1889_dev->ac97_codec;
- MOD_INC_USE_COUNT;
return 0;
}
static int ad1889_mixer_release(struct inode *inode, struct file *file)
{
- MOD_DEC_USE_COUNT;
return 0;
}
@@ -810,6 +807,7 @@ static int ad1889_mixer_ioctl(struct inode *inode, struct file *file,
}
static struct file_operations ad1889_mixer_fops = {
+ .owner = THIS_MODULE,
.llseek = no_llseek,
.ioctl = ad1889_mixer_ioctl,
.open = ad1889_mixer_open,
diff --git a/sound/oss/ali5455.c b/sound/oss/ali5455.c
index c1db1668205e..804c1c35770e 100644
--- a/sound/oss/ali5455.c
+++ b/sound/oss/ali5455.c
@@ -3228,7 +3228,7 @@ static int ali_ac97_random_init_stuff(struct ali_card
/* AC97 codec initialisation. */
-static int __init ali_ac97_init(struct ali_card *card)
+static int __devinit ali_ac97_init(struct ali_card *card)
{
int num_ac97 = 0;
int total_channels = 0;
@@ -3333,7 +3333,7 @@ static int __init ali_ac97_init(struct ali_card *card)
return num_ac97;
}
-static void __init ali_configure_clocking(void)
+static void __devinit ali_configure_clocking(void)
{
struct ali_card *card;
struct ali_state *state;
@@ -3403,8 +3403,8 @@ config_out_nodmabuf:
/* install the driver, we do not allocate hardware channel nor DMA buffer now, they are defered
until "ACCESS" time (in prog_dmabuf called by open/read/write/ioctl/mmap) */
-static int __init ali_probe(struct pci_dev *pci_dev, const struct pci_device_id
- *pci_id)
+static int __devinit ali_probe(struct pci_dev *pci_dev,
+ const struct pci_device_id *pci_id)
{
struct ali_card *card;
if (pci_enable_device(pci_dev))
diff --git a/sound/oss/cs4281/cs4281m.c b/sound/oss/cs4281/cs4281m.c
index 64a1d696a277..f0f175897df6 100644
--- a/sound/oss/cs4281/cs4281m.c
+++ b/sound/oss/cs4281/cs4281m.c
@@ -2588,7 +2588,6 @@ static int cs4281_open_mixdev(struct inode *inode, struct file *file)
}
VALIDATE_STATE(s);
file->private_data = s;
- MOD_INC_USE_COUNT;
CS_DBGOUT(CS_FUNCTION | CS_OPEN, 4,
printk(KERN_INFO "cs4281: cs4281_open_mixdev()- 0\n"));
@@ -2603,7 +2602,6 @@ static int cs4281_release_mixdev(struct inode *inode, struct file *file)
(struct cs4281_state *) file->private_data;
VALIDATE_STATE(s);
- MOD_DEC_USE_COUNT;
return 0;
}
@@ -2620,6 +2618,7 @@ static int cs4281_ioctl_mixdev(struct inode *inode, struct file *file,
// Mixer file operations struct.
// ******************************************************************************************
static /*const */ struct file_operations cs4281_mixer_fops = {
+ .owner = THIS_MODULE,
.llseek = no_llseek,
.ioctl = cs4281_ioctl_mixdev,
.open = cs4281_open_mixdev,
@@ -3607,7 +3606,6 @@ static int cs4281_release(struct inode *inode, struct file *file)
s->open_mode &= ~FMODE_WRITE;
up(&s->open_sem_dac);
wake_up(&s->open_wait_dac);
- MOD_DEC_USE_COUNT;
}
if (file->f_mode & FMODE_READ) {
drain_adc(s, file->f_flags & O_NONBLOCK);
@@ -3617,7 +3615,6 @@ static int cs4281_release(struct inode *inode, struct file *file)
s->open_mode &= ~FMODE_READ;
up(&s->open_sem_adc);
wake_up(&s->open_wait_adc);
- MOD_DEC_USE_COUNT;
}
return 0;
}
@@ -3697,7 +3694,6 @@ static int cs4281_open(struct inode *inode, struct file *file)
s->dma_adc.ossfragshift = s->dma_adc.ossmaxfrags =
s->dma_adc.subdivision = 0;
up(&s->open_sem_adc);
- MOD_INC_USE_COUNT;
if (prog_dmabuf_adc(s)) {
CS_DBGOUT(CS_OPEN | CS_ERROR, 2, printk(KERN_ERR
@@ -3718,7 +3714,6 @@ static int cs4281_open(struct inode *inode, struct file *file)
s->dma_dac.ossfragshift = s->dma_dac.ossmaxfrags =
s->dma_dac.subdivision = 0;
up(&s->open_sem_dac);
- MOD_INC_USE_COUNT;
if (prog_dmabuf_dac(s)) {
CS_DBGOUT(CS_OPEN | CS_ERROR, 2, printk(KERN_ERR
@@ -3738,6 +3733,7 @@ static int cs4281_open(struct inode *inode, struct file *file)
// Wave (audio) file operations struct.
// ******************************************************************************************
static /*const */ struct file_operations cs4281_audio_fops = {
+ .owner = THIS_MODULE,
.llseek = no_llseek,
.read = cs4281_read,
.write = cs4281_write,
@@ -4029,7 +4025,6 @@ static int cs4281_midi_open(struct inode *inode, struct file *file)
f_mode << FMODE_MIDI_SHIFT) & (FMODE_MIDI_READ |
FMODE_MIDI_WRITE);
up(&s->open_sem);
- MOD_INC_USE_COUNT;
return 0;
}
@@ -4080,7 +4075,6 @@ static int cs4281_midi_release(struct inode *inode, struct file *file)
spin_unlock_irqrestore(&s->lock, flags);
up(&s->open_sem);
wake_up(&s->open_wait);
- MOD_DEC_USE_COUNT;
return 0;
}
@@ -4088,6 +4082,7 @@ static int cs4281_midi_release(struct inode *inode, struct file *file)
// Midi file operations struct.
// ******************************************************************************************
static /*const */ struct file_operations cs4281_midi_fops = {
+ .owner = THIS_MODULE,
.llseek = no_llseek,
.read = cs4281_midi_read,
.write = cs4281_midi_write,
diff --git a/sound/oss/cs46xx.c b/sound/oss/cs46xx.c
index da4a6daa14ef..4b40e667c6f3 100644
--- a/sound/oss/cs46xx.c
+++ b/sound/oss/cs46xx.c
@@ -1890,7 +1890,6 @@ static int cs_midi_open(struct inode *inode, struct file *file)
spin_unlock_irqrestore(&card->midi.lock, flags);
card->midi.open_mode |= (file->f_mode & (FMODE_READ | FMODE_WRITE));
up(&card->midi.open_sem);
- MOD_INC_USE_COUNT; /* for 2.2 */
return 0;
}
@@ -1926,7 +1925,6 @@ static int cs_midi_release(struct inode *inode, struct file *file)
card->midi.open_mode &= (~(file->f_mode & (FMODE_READ | FMODE_WRITE)));
up(&card->midi.open_sem);
wake_up(&card->midi.open_wait);
- MOD_DEC_USE_COUNT; /* for 2.2 */
return 0;
}
@@ -3370,7 +3368,6 @@ static int cs_open(struct inode *inode, struct file *file)
if((ret = prog_dmabuf(state)))
return ret;
}
- MOD_INC_USE_COUNT; /* for 2.2 */
CS_DBGOUT(CS_OPEN | CS_FUNCTION, 2, printk("cs46xx: cs_open()- 0\n") );
return 0;
}
@@ -3457,7 +3454,6 @@ static int cs_release(struct inode *inode, struct file *file)
}
CS_DBGOUT(CS_FUNCTION | CS_RELEASE, 2, printk("cs46xx: cs_release()- 0\n") );
- MOD_DEC_USE_COUNT; /* For 2.2 */
return 0;
}
@@ -4105,7 +4101,6 @@ static int cs_open_mixdev(struct inode *inode, struct file *file)
}
card->amplifier_ctrl(card, 1);
CS_INC_USE_COUNT(&card->mixer_use_cnt);
- MOD_INC_USE_COUNT; /* for 2.2 */
CS_DBGOUT(CS_FUNCTION | CS_OPEN, 4,
printk(KERN_INFO "cs46xx: cs_open_mixdev()- 0\n"));
return 0;
@@ -4136,7 +4131,6 @@ static int cs_release_mixdev(struct inode *inode, struct file *file)
return -ENODEV;
}
match:
- MOD_DEC_USE_COUNT; /* for 2.2 */
if(!CS_DEC_AND_TEST(&card->mixer_use_cnt))
{
CS_DBGOUT(CS_FUNCTION | CS_RELEASE, 4,
diff --git a/sound/oss/i810_audio.c b/sound/oss/i810_audio.c
index 40af7a1c4633..ed4101e26e58 100644
--- a/sound/oss/i810_audio.c
+++ b/sound/oss/i810_audio.c
@@ -2807,7 +2807,7 @@ static int i810_ac97_power_up_bus(struct i810_card *card)
return 1;
}
-static int __init i810_ac97_init(struct i810_card *card)
+static int __devinit i810_ac97_init(struct i810_card *card)
{
int num_ac97 = 0;
int ac97_id;
@@ -3011,7 +3011,7 @@ static int __init i810_ac97_init(struct i810_card *card)
return num_ac97;
}
-static void __init i810_configure_clocking (void)
+static void __devinit i810_configure_clocking (void)
{
struct i810_card *card;
struct i810_state *state;
@@ -3083,7 +3083,7 @@ config_out_nodmabuf:
/* install the driver, we do not allocate hardware channel nor DMA buffer now, they are defered
until "ACCESS" time (in prog_dmabuf called by open/read/write/ioctl/mmap) */
-static int __init i810_probe(struct pci_dev *pci_dev, const struct pci_device_id *pci_id)
+static int __devinit i810_probe(struct pci_dev *pci_dev, const struct pci_device_id *pci_id)
{
struct i810_card *card;
diff --git a/sound/oss/maestro3.c b/sound/oss/maestro3.c
index 87fe033b9302..137cb116677b 100644
--- a/sound/oss/maestro3.c
+++ b/sound/oss/maestro3.c
@@ -2297,7 +2297,7 @@ static void m3_codec_reset(struct m3_card *card, int busywait)
#endif
}
-static int __init m3_codec_install(struct m3_card *card)
+static int __devinit m3_codec_install(struct m3_card *card)
{
struct ac97_codec *codec;
@@ -2594,7 +2594,7 @@ void free_dsp_suspendmem(struct m3_card *card)
/*
* great day! this function is ugly as hell.
*/
-static int __init m3_probe(struct pci_dev *pci_dev, const struct pci_device_id *pci_id)
+static int __devinit m3_probe(struct pci_dev *pci_dev, const struct pci_device_id *pci_id)
{
u32 n;
int i;
diff --git a/sound/oss/swarm_cs4297a.c b/sound/oss/swarm_cs4297a.c
index eb5f324cd8fb..0f58fa4944c0 100644
--- a/sound/oss/swarm_cs4297a.c
+++ b/sound/oss/swarm_cs4297a.c
@@ -1557,7 +1557,6 @@ static int cs4297a_open_mixdev(struct inode *inode, struct file *file)
}
VALIDATE_STATE(s);
file->private_data = s;
- MOD_INC_USE_COUNT;
CS_DBGOUT(CS_FUNCTION | CS_OPEN, 4,
printk(KERN_INFO "cs4297a: cs4297a_open_mixdev()- 0\n"));
@@ -1572,7 +1571,6 @@ static int cs4297a_release_mixdev(struct inode *inode, struct file *file)
(struct cs4297a_state *) file->private_data;
VALIDATE_STATE(s);
- MOD_DEC_USE_COUNT;
return 0;
}
@@ -1589,6 +1587,7 @@ static int cs4297a_ioctl_mixdev(struct inode *inode, struct file *file,
// Mixer file operations struct.
// ******************************************************************************************
static /*const */ struct file_operations cs4297a_mixer_fops = {
+ .owner = THIS_MODULE,
.llseek = cs4297a_llseek,
.ioctl = cs4297a_ioctl_mixdev,
.open = cs4297a_open_mixdev,
@@ -2368,7 +2367,6 @@ static int cs4297a_release(struct inode *inode, struct file *file)
s->open_mode &= ~FMODE_WRITE;
up(&s->open_sem_dac);
wake_up(&s->open_wait_dac);
- MOD_DEC_USE_COUNT;
}
if (file->f_mode & FMODE_READ) {
drain_adc(s, file->f_flags & O_NONBLOCK);
@@ -2378,7 +2376,6 @@ static int cs4297a_release(struct inode *inode, struct file *file)
s->open_mode &= ~FMODE_READ;
up(&s->open_sem_adc);
wake_up(&s->open_wait_adc);
- MOD_DEC_USE_COUNT;
}
return 0;
}
@@ -2469,7 +2466,6 @@ static int cs4297a_open(struct inode *inode, struct file *file)
s->dma_adc.ossfragshift = s->dma_adc.ossmaxfrags =
s->dma_adc.subdivision = 0;
up(&s->open_sem_adc);
- MOD_INC_USE_COUNT;
if (prog_dmabuf_adc(s)) {
CS_DBGOUT(CS_OPEN | CS_ERROR, 2, printk(KERN_ERR
@@ -2488,7 +2484,6 @@ static int cs4297a_open(struct inode *inode, struct file *file)
s->dma_dac.ossfragshift = s->dma_dac.ossmaxfrags =
s->dma_dac.subdivision = 0;
up(&s->open_sem_dac);
- MOD_INC_USE_COUNT;
if (prog_dmabuf_dac(s)) {
CS_DBGOUT(CS_OPEN | CS_ERROR, 2, printk(KERN_ERR
@@ -2507,6 +2502,7 @@ static int cs4297a_open(struct inode *inode, struct file *file)
// Wave (audio) file operations struct.
// ******************************************************************************************
static /*const */ struct file_operations cs4297a_audio_fops = {
+ .owner = THIS_MODULE,
.llseek = cs4297a_llseek,
.read = cs4297a_read,
.write = cs4297a_write,
diff --git a/sound/oss/trident.c b/sound/oss/trident.c
index 415ab1595ac0..c06dbee6e49e 100644
--- a/sound/oss/trident.c
+++ b/sound/oss/trident.c
@@ -3957,7 +3957,7 @@ static int ali_reset_5451(struct trident_card *card)
}
/* AC97 codec initialisation. */
-static int __init trident_ac97_init(struct trident_card *card)
+static int __devinit trident_ac97_init(struct trident_card *card)
{
int num_ac97 = 0;
unsigned long ready_2nd = 0;
@@ -4120,7 +4120,7 @@ static int trident_game_open(struct gameport *gameport, int mode)
/* install the driver, we do not allocate hardware channel nor DMA buffer now, they are defered
until "ACCESS" time (in prog_dmabuf called by open/read/write/ioctl/mmap) */
-static int __init trident_probe(struct pci_dev *pci_dev, const struct pci_device_id *pci_id)
+static int __devinit trident_probe(struct pci_dev *pci_dev, const struct pci_device_id *pci_id)
{
unsigned long iobase;
struct trident_card *card;
diff --git a/sound/oss/via82cxxx_audio.c b/sound/oss/via82cxxx_audio.c
index 360306ecae43..68b8e396bc03 100644
--- a/sound/oss/via82cxxx_audio.c
+++ b/sound/oss/via82cxxx_audio.c
@@ -1642,7 +1642,7 @@ static struct file_operations via_mixer_fops = {
};
-static int __init via_ac97_reset (struct via_info *card)
+static int __devinit via_ac97_reset (struct via_info *card)
{
struct pci_dev *pdev = card->pdev;
u8 tmp8;
@@ -1752,7 +1752,7 @@ static void via_ac97_codec_wait (struct ac97_codec *codec)
}
-static int __init via_ac97_init (struct via_info *card)
+static int __devinit via_ac97_init (struct via_info *card)
{
int rc;
u16 tmp16;
@@ -2070,7 +2070,7 @@ static struct file_operations via_dsp_fops = {
};
-static int __init via_dsp_init (struct via_info *card)
+static int __devinit via_dsp_init (struct via_info *card)
{
u8 tmp8;
@@ -3394,7 +3394,7 @@ static int via_dsp_release(struct inode *inode, struct file *file)
*
*/
-static int __init via_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
+static int __devinit via_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
{
#ifdef CONFIG_MIDI_VIA82CXXX
u8 r42;
@@ -3772,7 +3772,7 @@ static void via_cleanup_proc (void)
}
-static int __init via_card_init_proc (struct via_info *card)
+static int __devinit via_card_init_proc (struct via_info *card)
{
char s[32];
int rc;