aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/i2c/summary45
-rw-r--r--arch/sparc64/kernel/smp.c19
-rw-r--r--arch/um/drivers/net_kern.c2
-rw-r--r--arch/xtensa/platform-iss/network.c4
-rw-r--r--drivers/i2c/busses/i2c-davinci.c4
-rw-r--r--drivers/i2c/busses/i2c-gpio.c1
-rw-r--r--drivers/i2c/busses/i2c-omap.c6
-rw-r--r--drivers/i2c/chips/isp1301_omap.c2
-rw-r--r--drivers/media/common/saa7146_video.c11
-rw-r--r--drivers/media/dvb/dvb-usb/Makefile3
-rw-r--r--drivers/media/dvb/dvb-usb/dibusb-common.c4
-rw-r--r--drivers/media/dvb/frontends/tda10086.c14
-rw-r--r--drivers/media/dvb/frontends/zl10353.c4
-rw-r--r--drivers/media/dvb/frontends/zl10353.h2
-rw-r--r--drivers/media/video/bt8xx/bttv-cards.c2
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c9
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c5
-rw-r--r--drivers/media/video/cx88/cx88-video.c5
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c7
-rw-r--r--drivers/media/video/ivtv/ivtv-i2c.c2
-rw-r--r--drivers/media/video/ivtv/ivtv-i2c.h2
-rw-r--r--drivers/media/video/ivtv/ivtv-streams.c2
-rw-r--r--drivers/media/video/saa5246a.c10
-rw-r--r--drivers/media/video/saa5249.c8
-rw-r--r--drivers/media/video/saa7134/saa7134-alsa.c16
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c21
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c1
-rw-r--r--drivers/media/video/saa7134/saa7134-empress.c5
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c5
-rw-r--r--drivers/media/video/tvp5150.c11
-rw-r--r--drivers/media/video/videobuf-core.c259
-rw-r--r--drivers/media/video/videobuf-vmalloc.c6
-rw-r--r--drivers/media/video/vivi.c1
-rw-r--r--drivers/net/Kconfig1
-rw-r--r--drivers/net/bnx2.c35
-rw-r--r--drivers/net/bnx2.h1
-rw-r--r--drivers/net/e100.c5
-rw-r--r--drivers/net/hamachi.c70
-rw-r--r--drivers/net/ibm_newemac/debug.c2
-rw-r--r--drivers/net/ixgb/ixgb_main.c16
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c1
-rw-r--r--drivers/net/s2io.c4
-rw-r--r--drivers/net/sis190.c10
-rw-r--r--drivers/net/sky2.c9
-rw-r--r--drivers/net/smc911x.h2
-rw-r--r--drivers/net/starfire.c2
-rw-r--r--drivers/net/sundance.c34
-rw-r--r--drivers/net/ucc_geth.c2
-rw-r--r--drivers/net/ucc_geth_mii.h2
-rw-r--r--drivers/s390/net/ctcmain.c6
-rw-r--r--drivers/s390/net/netiucv.c4
-rw-r--r--drivers/serial/suncore.c33
-rw-r--r--drivers/serial/suncore.h3
-rw-r--r--drivers/serial/sunhv.c14
-rw-r--r--drivers/serial/sunsab.c16
-rw-r--r--drivers/serial/sunsu.c16
-rw-r--r--drivers/serial/sunzilog.c41
-rw-r--r--include/media/videobuf-core.h2
-rw-r--r--net/8021q/vlan.c2
-rw-r--r--net/core/dev.c6
-rw-r--r--net/ipv4/devinet.c3
-rw-r--r--net/ipv4/esp4.c5
-rw-r--r--net/ipv6/esp6.c6
-rw-r--r--net/ipv6/xfrm6_policy.c2
-rw-r--r--net/xfrm/xfrm_policy.c9
66 files changed, 481 insertions, 383 deletions
diff --git a/Documentation/i2c/summary b/Documentation/i2c/summary
index 003c7319b8c7..13ab076dcd92 100644
--- a/Documentation/i2c/summary
+++ b/Documentation/i2c/summary
@@ -1,5 +1,3 @@
1This is an explanation of what i2c is, and what is supported in this package.
2
3I2C and SMBus 1I2C and SMBus
4============= 2=============
5 3
@@ -33,52 +31,17 @@ When we talk about I2C, we use the following terms:
33 Client 31 Client
34 32
35An Algorithm driver contains general code that can be used for a whole class 33An Algorithm driver contains general code that can be used for a whole class
36of I2C adapters. Each specific adapter driver depends on one algorithm 34of I2C adapters. Each specific adapter driver either depends on one algorithm
37driver. 35driver, or includes its own implementation.
38 36
39A Driver driver (yes, this sounds ridiculous, sorry) contains the general 37A Driver driver (yes, this sounds ridiculous, sorry) contains the general
40code to access some type of device. Each detected device gets its own 38code to access some type of device. Each detected device gets its own
41data in the Client structure. Usually, Driver and Client are more closely 39data in the Client structure. Usually, Driver and Client are more closely
42integrated than Algorithm and Adapter. 40integrated than Algorithm and Adapter.
43 41
44For a given configuration, you will need a driver for your I2C bus (usually 42For a given configuration, you will need a driver for your I2C bus, and
45a separate Adapter and Algorithm driver), and drivers for your I2C devices 43drivers for your I2C devices (usually one driver for each device).
46(usually one driver for each device). There are no I2C device drivers
47in this package. See the lm_sensors project http://www.lm-sensors.nu
48for device drivers.
49 44
50At this time, Linux only operates I2C (or SMBus) in master mode; you can't 45At this time, Linux only operates I2C (or SMBus) in master mode; you can't
51use these APIs to make a Linux system behave as a slave/device, either to 46use these APIs to make a Linux system behave as a slave/device, either to
52speak a custom protocol or to emulate some other device. 47speak a custom protocol or to emulate some other device.
53
54
55Included Bus Drivers
56====================
57Note that only stable drivers are patched into the kernel by 'mkpatch'.
58
59
60Base modules
61------------
62
63i2c-core: The basic I2C code, including the /proc/bus/i2c* interface
64i2c-dev: The /dev/i2c-* interface
65i2c-proc: The /proc/sys/dev/sensors interface for device (client) drivers
66
67Algorithm drivers
68-----------------
69
70i2c-algo-bit: A bit-banging algorithm
71i2c-algo-pcf: A PCF 8584 style algorithm
72i2c-algo-ibm_ocp: An algorithm for the I2C device in IBM 4xx processors (NOT BUILT BY DEFAULT)
73
74Adapter drivers
75---------------
76
77i2c-elektor: Elektor ISA card (uses i2c-algo-pcf)
78i2c-elv: ELV parallel port adapter (uses i2c-algo-bit)
79i2c-pcf-epp: PCF8584 on a EPP parallel port (uses i2c-algo-pcf) (NOT mkpatched)
80i2c-philips-par: Philips style parallel port adapter (uses i2c-algo-bit)
81i2c-adap-ibm_ocp: IBM 4xx processor I2C device (uses i2c-algo-ibm_ocp) (NOT BUILT BY DEFAULT)
82i2c-pport: Primitive parallel port adapter (uses i2c-algo-bit)
83i2c-velleman: Velleman K8000 parallel port adapter (uses i2c-algo-bit)
84
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index 894b506f9636..c39944927f1a 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -476,7 +476,7 @@ static inline void spitfire_xcall_deliver(u64 data0, u64 data1, u64 data2, cpuma
476 */ 476 */
477static void cheetah_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mask) 477static void cheetah_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mask)
478{ 478{
479 u64 pstate, ver; 479 u64 pstate, ver, busy_mask;
480 int nack_busy_id, is_jbus, need_more; 480 int nack_busy_id, is_jbus, need_more;
481 481
482 if (cpus_empty(mask)) 482 if (cpus_empty(mask))
@@ -508,14 +508,20 @@ retry:
508 "i" (ASI_INTR_W)); 508 "i" (ASI_INTR_W));
509 509
510 nack_busy_id = 0; 510 nack_busy_id = 0;
511 busy_mask = 0;
511 { 512 {
512 int i; 513 int i;
513 514
514 for_each_cpu_mask(i, mask) { 515 for_each_cpu_mask(i, mask) {
515 u64 target = (i << 14) | 0x70; 516 u64 target = (i << 14) | 0x70;
516 517
517 if (!is_jbus) 518 if (is_jbus) {
519 busy_mask |= (0x1UL << (i * 2));
520 } else {
518 target |= (nack_busy_id << 24); 521 target |= (nack_busy_id << 24);
522 busy_mask |= (0x1UL <<
523 (nack_busy_id * 2));
524 }
519 __asm__ __volatile__( 525 __asm__ __volatile__(
520 "stxa %%g0, [%0] %1\n\t" 526 "stxa %%g0, [%0] %1\n\t"
521 "membar #Sync\n\t" 527 "membar #Sync\n\t"
@@ -531,15 +537,16 @@ retry:
531 537
532 /* Now, poll for completion. */ 538 /* Now, poll for completion. */
533 { 539 {
534 u64 dispatch_stat; 540 u64 dispatch_stat, nack_mask;
535 long stuck; 541 long stuck;
536 542
537 stuck = 100000 * nack_busy_id; 543 stuck = 100000 * nack_busy_id;
544 nack_mask = busy_mask << 1;
538 do { 545 do {
539 __asm__ __volatile__("ldxa [%%g0] %1, %0" 546 __asm__ __volatile__("ldxa [%%g0] %1, %0"
540 : "=r" (dispatch_stat) 547 : "=r" (dispatch_stat)
541 : "i" (ASI_INTR_DISPATCH_STAT)); 548 : "i" (ASI_INTR_DISPATCH_STAT));
542 if (dispatch_stat == 0UL) { 549 if (!(dispatch_stat & (busy_mask | nack_mask))) {
543 __asm__ __volatile__("wrpr %0, 0x0, %%pstate" 550 __asm__ __volatile__("wrpr %0, 0x0, %%pstate"
544 : : "r" (pstate)); 551 : : "r" (pstate));
545 if (unlikely(need_more)) { 552 if (unlikely(need_more)) {
@@ -556,12 +563,12 @@ retry:
556 } 563 }
557 if (!--stuck) 564 if (!--stuck)
558 break; 565 break;
559 } while (dispatch_stat & 0x5555555555555555UL); 566 } while (dispatch_stat & busy_mask);
560 567
561 __asm__ __volatile__("wrpr %0, 0x0, %%pstate" 568 __asm__ __volatile__("wrpr %0, 0x0, %%pstate"
562 : : "r" (pstate)); 569 : : "r" (pstate));
563 570
564 if ((dispatch_stat & ~(0x5555555555555555UL)) == 0) { 571 if (dispatch_stat & busy_mask) {
565 /* Busy bits will not clear, continue instead 572 /* Busy bits will not clear, continue instead
566 * of freezing up on this cpu. 573 * of freezing up on this cpu.
567 */ 574 */
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index 73681f14f9fc..3c6c44ca1ffa 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -98,10 +98,10 @@ static int uml_net_rx(struct net_device *dev)
98 if (pkt_len > 0) { 98 if (pkt_len > 0) {
99 skb_trim(skb, pkt_len); 99 skb_trim(skb, pkt_len);
100 skb->protocol = (*lp->protocol)(skb); 100 skb->protocol = (*lp->protocol)(skb);
101 netif_rx(skb);
102 101
103 lp->stats.rx_bytes += skb->len; 102 lp->stats.rx_bytes += skb->len;
104 lp->stats.rx_packets++; 103 lp->stats.rx_packets++;
104 netif_rx(skb);
105 return pkt_len; 105 return pkt_len;
106 } 106 }
107 107
diff --git a/arch/xtensa/platform-iss/network.c b/arch/xtensa/platform-iss/network.c
index b61fb36674e7..f21b9b0899a8 100644
--- a/arch/xtensa/platform-iss/network.c
+++ b/arch/xtensa/platform-iss/network.c
@@ -393,11 +393,11 @@ static int iss_net_rx(struct net_device *dev)
393 if (pkt_len > 0) { 393 if (pkt_len > 0) {
394 skb_trim(skb, pkt_len); 394 skb_trim(skb, pkt_len);
395 skb->protocol = lp->tp.protocol(skb); 395 skb->protocol = lp->tp.protocol(skb);
396 // netif_rx(skb);
397 netif_rx_ni(skb);
398 396
399 lp->stats.rx_bytes += skb->len; 397 lp->stats.rx_bytes += skb->len;
400 lp->stats.rx_packets++; 398 lp->stats.rx_packets++;
399 // netif_rx(skb);
400 netif_rx_ni(skb);
401 return pkt_len; 401 return pkt_len;
402 } 402 }
403 kfree_skb(skb); 403 kfree_skb(skb);
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index bd7aaff35240..67679882ebef 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -404,7 +404,7 @@ static irqreturn_t i2c_davinci_isr(int this_irq, void *dev_id)
404 DAVINCI_I2C_STR_REG, 404 DAVINCI_I2C_STR_REG,
405 w); 405 w);
406 } else 406 } else
407 dev_err(dev->dev, "RDR IRQ while no" 407 dev_err(dev->dev, "RDR IRQ while no "
408 "data requested\n"); 408 "data requested\n");
409 break; 409 break;
410 410
@@ -423,7 +423,7 @@ static irqreturn_t i2c_davinci_isr(int this_irq, void *dev_id)
423 DAVINCI_I2C_IMR_REG, 423 DAVINCI_I2C_IMR_REG,
424 w); 424 w);
425 } else 425 } else
426 dev_err(dev->dev, "TDR IRQ while no data to" 426 dev_err(dev->dev, "TDR IRQ while no data to "
427 "send\n"); 427 "send\n");
428 break; 428 break;
429 429
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index 44e1cd21bb01..3ca19fc234fb 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -140,6 +140,7 @@ static int __init i2c_gpio_probe(struct platform_device *pdev)
140 adap->owner = THIS_MODULE; 140 adap->owner = THIS_MODULE;
141 snprintf(adap->name, sizeof(adap->name), "i2c-gpio%d", pdev->id); 141 snprintf(adap->name, sizeof(adap->name), "i2c-gpio%d", pdev->id);
142 adap->algo_data = bit_data; 142 adap->algo_data = bit_data;
143 adap->class = I2C_CLASS_HWMON;
143 adap->dev.parent = &pdev->dev; 144 adap->dev.parent = &pdev->dev;
144 145
145 /* 146 /*
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 89a30028ddb6..cb55cf2ba1e9 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -203,7 +203,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
203 while (!(omap_i2c_read_reg(dev, OMAP_I2C_SYSS_REG) & 203 while (!(omap_i2c_read_reg(dev, OMAP_I2C_SYSS_REG) &
204 OMAP_I2C_SYSS_RDONE)) { 204 OMAP_I2C_SYSS_RDONE)) {
205 if (time_after(jiffies, timeout)) { 205 if (time_after(jiffies, timeout)) {
206 dev_warn(dev->dev, "timeout waiting" 206 dev_warn(dev->dev, "timeout waiting "
207 "for controller reset\n"); 207 "for controller reset\n");
208 return -ETIMEDOUT; 208 return -ETIMEDOUT;
209 } 209 }
@@ -483,7 +483,7 @@ omap_i2c_isr(int this_irq, void *dev_id)
483 dev->buf_len--; 483 dev->buf_len--;
484 } 484 }
485 } else 485 } else
486 dev_err(dev->dev, "RRDY IRQ while no data" 486 dev_err(dev->dev, "RRDY IRQ while no data "
487 "requested\n"); 487 "requested\n");
488 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_RRDY); 488 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_RRDY);
489 continue; 489 continue;
@@ -498,7 +498,7 @@ omap_i2c_isr(int this_irq, void *dev_id)
498 dev->buf_len--; 498 dev->buf_len--;
499 } 499 }
500 } else 500 } else
501 dev_err(dev->dev, "XRDY IRQ while no" 501 dev_err(dev->dev, "XRDY IRQ while no "
502 "data to send\n"); 502 "data to send\n");
503 omap_i2c_write_reg(dev, OMAP_I2C_DATA_REG, w); 503 omap_i2c_write_reg(dev, OMAP_I2C_DATA_REG, w);
504 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_XRDY); 504 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_XRDY);
diff --git a/drivers/i2c/chips/isp1301_omap.c b/drivers/i2c/chips/isp1301_omap.c
index fe04e46991aa..b767603a07ba 100644
--- a/drivers/i2c/chips/isp1301_omap.c
+++ b/drivers/i2c/chips/isp1301_omap.c
@@ -26,7 +26,7 @@
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/usb/ch9.h> 28#include <linux/usb/ch9.h>
29#include <linux/usb_gadget.h> 29#include <linux/usb/gadget.h>
30#include <linux/usb.h> 30#include <linux/usb.h>
31#include <linux/usb/otg.h> 31#include <linux/usb/otg.h>
32#include <linux/i2c.h> 32#include <linux/i2c.h>
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c
index f245a3b2ef47..ae36d101006b 100644
--- a/drivers/media/common/saa7146_video.c
+++ b/drivers/media/common/saa7146_video.c
@@ -1205,13 +1205,10 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
1205 DEB_D(("VIDIOCGMBUF \n")); 1205 DEB_D(("VIDIOCGMBUF \n"));
1206 1206
1207 q = &fh->video_q; 1207 q = &fh->video_q;
1208 mutex_lock(&q->lock);
1209 err = videobuf_mmap_setup(q,gbuffers,gbufsize, 1208 err = videobuf_mmap_setup(q,gbuffers,gbufsize,
1210 V4L2_MEMORY_MMAP); 1209 V4L2_MEMORY_MMAP);
1211 if (err < 0) { 1210 if (err < 0)
1212 mutex_unlock(&q->lock);
1213 return err; 1211 return err;
1214 }
1215 1212
1216 gbuffers = err; 1213 gbuffers = err;
1217 memset(mbuf,0,sizeof(*mbuf)); 1214 memset(mbuf,0,sizeof(*mbuf));
@@ -1219,7 +1216,6 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
1219 mbuf->size = gbuffers * gbufsize; 1216 mbuf->size = gbuffers * gbufsize;
1220 for (i = 0; i < gbuffers; i++) 1217 for (i = 0; i < gbuffers; i++)
1221 mbuf->offsets[i] = i * gbufsize; 1218 mbuf->offsets[i] = i * gbufsize;
1222 mutex_unlock(&q->lock);
1223 return 0; 1219 return 0;
1224 } 1220 }
1225#endif 1221#endif
@@ -1440,10 +1436,7 @@ static void video_close(struct saa7146_dev *dev, struct file *file)
1440 err = saa7146_stop_preview(fh); 1436 err = saa7146_stop_preview(fh);
1441 } 1437 }
1442 1438
1443 // release all capture buffers 1439 videobuf_stop(q);
1444 mutex_lock(&q->lock);
1445 videobuf_read_stop(q);
1446 mutex_unlock(&q->lock);
1447 1440
1448 /* hmm, why is this function declared void? */ 1441 /* hmm, why is this function declared void? */
1449 /* return err */ 1442 /* return err */
diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile
index 73ac0a93fdeb..60a910052c16 100644
--- a/drivers/media/dvb/dvb-usb/Makefile
+++ b/drivers/media/dvb/dvb-usb/Makefile
@@ -62,3 +62,6 @@ dvb-usb-af9005-remote-objs = af9005-remote.o
62obj-$(CONFIG_DVB_USB_AF9005_REMOTE) += dvb-usb-af9005-remote.o 62obj-$(CONFIG_DVB_USB_AF9005_REMOTE) += dvb-usb-af9005-remote.o
63 63
64EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ 64EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
65# due to tuner-xc3028
66EXTRA_CFLAGS += -Idrivers/media/video
67
diff --git a/drivers/media/dvb/dvb-usb/dibusb-common.c b/drivers/media/dvb/dvb-usb/dibusb-common.c
index 9a184da01c47..8ee6cd4da9e7 100644
--- a/drivers/media/dvb/dvb-usb/dibusb-common.c
+++ b/drivers/media/dvb/dvb-usb/dibusb-common.c
@@ -223,6 +223,9 @@ static struct dibx000_agc_config dib3000p_panasonic_agc_config = {
223 .agc2_slope2 = 0x1e, 223 .agc2_slope2 = 0x1e,
224}; 224};
225 225
226#if defined(CONFIG_DVB_DIB3000MC) || \
227 (defined(CONFIG_DVB_DIB3000MC_MODULE) && defined(MODULE))
228
226static struct dib3000mc_config mod3000p_dib3000p_config = { 229static struct dib3000mc_config mod3000p_dib3000p_config = {
227 &dib3000p_panasonic_agc_config, 230 &dib3000p_panasonic_agc_config,
228 231
@@ -305,6 +308,7 @@ int dibusb_dib3000mc_tuner_attach(struct dvb_usb_adapter *adap)
305 return 0; 308 return 0;
306} 309}
307EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach); 310EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach);
311#endif
308 312
309/* 313/*
310 * common remote control stuff 314 * common remote control stuff
diff --git a/drivers/media/dvb/frontends/tda10086.c b/drivers/media/dvb/frontends/tda10086.c
index 9a8ddc537f8f..9d26ace65151 100644
--- a/drivers/media/dvb/frontends/tda10086.c
+++ b/drivers/media/dvb/frontends/tda10086.c
@@ -158,7 +158,7 @@ static int tda10086_init(struct dvb_frontend* fe)
158 tda10086_write_byte(state, 0x3d, 0x80); 158 tda10086_write_byte(state, 0x3d, 0x80);
159 159
160 // setup SEC 160 // setup SEC
161 tda10086_write_byte(state, 0x36, 0x00); // all SEC off 161 tda10086_write_byte(state, 0x36, 0x80); // all SEC off, no 22k tone
162 tda10086_write_byte(state, 0x34, (((1<<19) * (22000/1000)) / (SACLK/1000))); // } tone frequency 162 tda10086_write_byte(state, 0x34, (((1<<19) * (22000/1000)) / (SACLK/1000))); // } tone frequency
163 tda10086_write_byte(state, 0x35, (((1<<19) * (22000/1000)) / (SACLK/1000)) >> 8); // } 163 tda10086_write_byte(state, 0x35, (((1<<19) * (22000/1000)) / (SACLK/1000)) >> 8); // }
164 164
@@ -183,13 +183,13 @@ static int tda10086_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone)
183 183
184 dprintk ("%s\n", __FUNCTION__); 184 dprintk ("%s\n", __FUNCTION__);
185 185
186 switch(tone) { 186 switch (tone) {
187 case SEC_TONE_OFF: 187 case SEC_TONE_OFF:
188 tda10086_write_byte(state, 0x36, 0x00); 188 tda10086_write_byte(state, 0x36, 0x80);
189 break; 189 break;
190 190
191 case SEC_TONE_ON: 191 case SEC_TONE_ON:
192 tda10086_write_byte(state, 0x36, 0x01); 192 tda10086_write_byte(state, 0x36, 0x81);
193 break; 193 break;
194 } 194 }
195 195
@@ -212,7 +212,7 @@ static int tda10086_send_master_cmd (struct dvb_frontend* fe,
212 for(i=0; i< cmd->msg_len; i++) { 212 for(i=0; i< cmd->msg_len; i++) {
213 tda10086_write_byte(state, 0x48+i, cmd->msg[i]); 213 tda10086_write_byte(state, 0x48+i, cmd->msg[i]);
214 } 214 }
215 tda10086_write_byte(state, 0x36, 0x08 | ((cmd->msg_len - 1) << 4)); 215 tda10086_write_byte(state, 0x36, 0x88 | ((cmd->msg_len - 1) << 4));
216 216
217 tda10086_diseqc_wait(state); 217 tda10086_diseqc_wait(state);
218 218
@@ -230,11 +230,11 @@ static int tda10086_send_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t minic
230 230
231 switch(minicmd) { 231 switch(minicmd) {
232 case SEC_MINI_A: 232 case SEC_MINI_A:
233 tda10086_write_byte(state, 0x36, 0x04); 233 tda10086_write_byte(state, 0x36, 0x84);
234 break; 234 break;
235 235
236 case SEC_MINI_B: 236 case SEC_MINI_B:
237 tda10086_write_byte(state, 0x36, 0x06); 237 tda10086_write_byte(state, 0x36, 0x86);
238 break; 238 break;
239 } 239 }
240 240
diff --git a/drivers/media/dvb/frontends/zl10353.c b/drivers/media/dvb/frontends/zl10353.c
index a97a7fd2c891..0106df4c55e8 100644
--- a/drivers/media/dvb/frontends/zl10353.c
+++ b/drivers/media/dvb/frontends/zl10353.c
@@ -122,7 +122,7 @@ static void zl10353_calc_nominal_rate(struct dvb_frontend *fe,
122 enum fe_bandwidth bandwidth, 122 enum fe_bandwidth bandwidth,
123 u16 *nominal_rate) 123 u16 *nominal_rate)
124{ 124{
125 u32 adc_clock = 22528; /* 20.480 MHz on the board(!?) */ 125 u32 adc_clock = 45056; /* 45.056 MHz */
126 u8 bw; 126 u8 bw;
127 struct zl10353_state *state = fe->demodulator_priv; 127 struct zl10353_state *state = fe->demodulator_priv;
128 128
@@ -142,7 +142,7 @@ static void zl10353_calc_nominal_rate(struct dvb_frontend *fe,
142 break; 142 break;
143 } 143 }
144 144
145 *nominal_rate = (64 * bw * (1<<16) / (7 * 8) * 4000 / adc_clock + 2) / 4; 145 *nominal_rate = (bw * (1 << 23) / 7 * 125 + adc_clock / 2) / adc_clock;
146 146
147 dprintk("%s: bw %d, adc_clock %d => 0x%x\n", 147 dprintk("%s: bw %d, adc_clock %d => 0x%x\n",
148 __FUNCTION__, bw, adc_clock, *nominal_rate); 148 __FUNCTION__, bw, adc_clock, *nominal_rate);
diff --git a/drivers/media/dvb/frontends/zl10353.h b/drivers/media/dvb/frontends/zl10353.h
index cb274dc12b82..1c3d494a6da9 100644
--- a/drivers/media/dvb/frontends/zl10353.h
+++ b/drivers/media/dvb/frontends/zl10353.h
@@ -30,7 +30,7 @@ struct zl10353_config
30 u8 demod_address; 30 u8 demod_address;
31 31
32 /* frequencies in kHz */ 32 /* frequencies in kHz */
33 int adc_clock; // default: 22528 33 int adc_clock; /* default: 45056 */
34 34
35 /* set if no pll is connected to the secondary i2c bus */ 35 /* set if no pll is connected to the secondary i2c bus */
36 int no_tuner; 36 int no_tuner;
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c
index 3abd9fa54d2c..585d1ef95afd 100644
--- a/drivers/media/video/bt8xx/bttv-cards.c
+++ b/drivers/media/video/bt8xx/bttv-cards.c
@@ -5080,7 +5080,7 @@ static void PXC200_muxsel(struct bttv *btv, unsigned int input)
5080/* ----------------------------------------------------------------------- */ 5080/* ----------------------------------------------------------------------- */
5081/* motherboard chipset specific stuff */ 5081/* motherboard chipset specific stuff */
5082 5082
5083void __devinit bttv_check_chipset(void) 5083void __init bttv_check_chipset(void)
5084{ 5084{
5085 int pcipci_fail = 0; 5085 int pcipci_fail = 0;
5086 struct pci_dev *dev = NULL; 5086 struct pci_dev *dev = NULL;
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index a88b56e6ca05..c02d92deacd2 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -3827,10 +3827,7 @@ static int bttv_release(struct inode *inode, struct file *file)
3827 3827
3828 /* stop vbi capture */ 3828 /* stop vbi capture */
3829 if (check_btres(fh, RESOURCE_VBI)) { 3829 if (check_btres(fh, RESOURCE_VBI)) {
3830 if (fh->vbi.streaming) 3830 videobuf_stop(&fh->vbi);
3831 videobuf_streamoff(&fh->vbi);
3832 if (fh->vbi.reading)
3833 videobuf_read_stop(&fh->vbi);
3834 free_btres(btv,fh,RESOURCE_VBI); 3831 free_btres(btv,fh,RESOURCE_VBI);
3835 } 3832 }
3836 3833
@@ -4988,7 +4985,7 @@ static struct pci_driver bttv_pci_driver = {
4988#endif 4985#endif
4989}; 4986};
4990 4987
4991static int bttv_init_module(void) 4988static int __init bttv_init_module(void)
4992{ 4989{
4993 int ret; 4990 int ret;
4994 4991
@@ -5021,7 +5018,7 @@ static int bttv_init_module(void)
5021 return pci_register_driver(&bttv_pci_driver); 5018 return pci_register_driver(&bttv_pci_driver);
5022} 5019}
5023 5020
5024static void bttv_cleanup_module(void) 5021static void __exit bttv_cleanup_module(void)
5025{ 5022{
5026 pci_unregister_driver(&bttv_pci_driver); 5023 pci_unregister_driver(&bttv_pci_driver);
5027 bus_unregister(&bttv_sub_bus_type); 5024 bus_unregister(&bttv_sub_bus_type);
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index f33f0b47142c..f802b5653569 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -1085,10 +1085,7 @@ static int mpeg_release(struct inode *inode, struct file *file)
1085 1085
1086 cx8802_cancel_buffers(fh->dev); 1086 cx8802_cancel_buffers(fh->dev);
1087 /* stop mpeg capture */ 1087 /* stop mpeg capture */
1088 if (fh->mpegq.streaming) 1088 videobuf_stop(&fh->mpegq);
1089 videobuf_streamoff(&fh->mpegq);
1090 if (fh->mpegq.reading)
1091 videobuf_read_stop(&fh->mpegq);
1092 1089
1093 videobuf_mmap_free(&fh->mpegq); 1090 videobuf_mmap_free(&fh->mpegq);
1094 file->private_data = NULL; 1091 file->private_data = NULL;
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 5ee05f8f3fad..c84dafbdb991 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -851,10 +851,7 @@ static int video_release(struct inode *inode, struct file *file)
851 851
852 /* stop vbi capture */ 852 /* stop vbi capture */
853 if (res_check(fh, RESOURCE_VBI)) { 853 if (res_check(fh, RESOURCE_VBI)) {
854 if (fh->vbiq.streaming) 854 videobuf_stop(&fh->vbiq);
855 videobuf_streamoff(&fh->vbiq);
856 if (fh->vbiq.reading)
857 videobuf_read_stop(&fh->vbiq);
858 res_free(dev,fh,RESOURCE_VBI); 855 res_free(dev,fh,RESOURCE_VBI);
859 } 856 }
860 857
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 2529c298b862..0906bc5766cc 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -144,7 +144,8 @@ static int em28xx_config(struct em28xx *dev)
144{ 144{
145 145
146 /* Sets I2C speed to 100 KHz */ 146 /* Sets I2C speed to 100 KHz */
147 em28xx_write_regs_req(dev, 0x00, 0x06, "\x40", 1); 147 if (!dev->is_em2800)
148 em28xx_write_regs_req(dev, 0x00, 0x06, "\x40", 1);
148 149
149 /* enable vbi capturing */ 150 /* enable vbi capturing */
150 151
@@ -570,7 +571,9 @@ static void em28xx_vm_close(struct vm_area_struct *vma)
570{ 571{
571 /* NOTE: buffers are not freed here */ 572 /* NOTE: buffers are not freed here */
572 struct em28xx_frame_t *f = vma->vm_private_data; 573 struct em28xx_frame_t *f = vma->vm_private_data;
573 f->vma_use_count--; 574
575 if (f->vma_use_count)
576 f->vma_use_count--;
574} 577}
575 578
576static struct vm_operations_struct em28xx_vm_ops = { 579static struct vm_operations_struct em28xx_vm_ops = {
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c
index 623eea2652ca..77b27dc750b1 100644
--- a/drivers/media/video/ivtv/ivtv-i2c.c
+++ b/drivers/media/video/ivtv/ivtv-i2c.c
@@ -706,7 +706,7 @@ void ivtv_call_i2c_clients(struct ivtv *itv, unsigned int cmd, void *arg)
706} 706}
707 707
708/* init + register i2c algo-bit adapter */ 708/* init + register i2c algo-bit adapter */
709int __devinit init_ivtv_i2c(struct ivtv *itv) 709int init_ivtv_i2c(struct ivtv *itv)
710{ 710{
711 IVTV_DEBUG_I2C("i2c init\n"); 711 IVTV_DEBUG_I2C("i2c init\n");
712 712
diff --git a/drivers/media/video/ivtv/ivtv-i2c.h b/drivers/media/video/ivtv/ivtv-i2c.h
index de6a07442298..987042c09b64 100644
--- a/drivers/media/video/ivtv/ivtv-i2c.h
+++ b/drivers/media/video/ivtv/ivtv-i2c.h
@@ -35,7 +35,7 @@ int ivtv_call_i2c_client(struct ivtv *itv, int addr, unsigned int cmd, void *arg
35void ivtv_call_i2c_clients(struct ivtv *itv, unsigned int cmd, void *arg); 35void ivtv_call_i2c_clients(struct ivtv *itv, unsigned int cmd, void *arg);
36 36
37/* init + register i2c algo-bit adapter */ 37/* init + register i2c algo-bit adapter */
38int __devinit init_ivtv_i2c(struct ivtv *itv); 38int init_ivtv_i2c(struct ivtv *itv);
39void exit_ivtv_i2c(struct ivtv *itv); 39void exit_ivtv_i2c(struct ivtv *itv);
40 40
41#endif 41#endif
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c
index aa03e61ef310..74fb0e021979 100644
--- a/drivers/media/video/ivtv/ivtv-streams.c
+++ b/drivers/media/video/ivtv/ivtv-streams.c
@@ -76,7 +76,7 @@ static struct {
76 int minor_offset; 76 int minor_offset;
77 int dma, pio; 77 int dma, pio;
78 enum v4l2_buf_type buf_type; 78 enum v4l2_buf_type buf_type;
79 struct file_operations *fops; 79 const struct file_operations *fops;
80} ivtv_stream_info[] = { 80} ivtv_stream_info[] = {
81 { /* IVTV_ENC_STREAM_TYPE_MPG */ 81 { /* IVTV_ENC_STREAM_TYPE_MPG */
82 "encoder MPG", 82 "encoder MPG",
diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c
index ad0232935df6..996b49491f5a 100644
--- a/drivers/media/video/saa5246a.c
+++ b/drivers/media/video/saa5246a.c
@@ -187,12 +187,14 @@ static int i2c_senddata(struct saa5246a_device *t, ...)
187{ 187{
188 unsigned char buf[64]; 188 unsigned char buf[64];
189 int v; 189 int v;
190 int ct=0; 190 int ct = 0;
191 va_list argp; 191 va_list argp;
192 va_start(argp,t); 192 va_start(argp, t);
193 193
194 while((v=va_arg(argp,int))!=-1) 194 while ((v = va_arg(argp, int)) != -1)
195 buf[ct++]=v; 195 buf[ct++] = v;
196
197 va_end(argp);
196 return i2c_sendbuf(t, buf[0], ct-1, buf+1); 198 return i2c_sendbuf(t, buf[0], ct-1, buf+1);
197} 199}
198 200
diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c
index 94bb59a32b17..f55d6e85f20f 100644
--- a/drivers/media/video/saa5249.c
+++ b/drivers/media/video/saa5249.c
@@ -282,12 +282,14 @@ static int i2c_senddata(struct saa5249_device *t, ...)
282{ 282{
283 unsigned char buf[64]; 283 unsigned char buf[64];
284 int v; 284 int v;
285 int ct=0; 285 int ct = 0;
286 va_list argp; 286 va_list argp;
287 va_start(argp,t); 287 va_start(argp,t);
288 288
289 while((v=va_arg(argp,int))!=-1) 289 while ((v = va_arg(argp, int)) != -1)
290 buf[ct++]=v; 290 buf[ct++] = v;
291
292 va_end(argp);
291 return i2c_sendbuf(t, buf[0], ct-1, buf+1); 293 return i2c_sendbuf(t, buf[0], ct-1, buf+1);
292} 294}
293 295
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c
index b9c5cf7dc849..4878f3067787 100644
--- a/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/drivers/media/video/saa7134/saa7134-alsa.c
@@ -222,7 +222,8 @@ static irqreturn_t saa7134_alsa_irq(int irq, void *dev_id)
222 222
223 if (report & SAA7134_IRQ_REPORT_DONE_RA3) { 223 if (report & SAA7134_IRQ_REPORT_DONE_RA3) {
224 handled = 1; 224 handled = 1;
225 saa_writel(SAA7134_IRQ_REPORT,report); 225 saa_writel(SAA7134_IRQ_REPORT,
226 SAA7134_IRQ_REPORT_DONE_RA3);
226 saa7134_irq_alsa_done(dev, status); 227 saa7134_irq_alsa_done(dev, status);
227 } else { 228 } else {
228 goto out; 229 goto out;
@@ -457,7 +458,7 @@ static struct snd_pcm_hardware snd_card_saa7134_capture =
457 .buffer_bytes_max = (256*1024), 458 .buffer_bytes_max = (256*1024),
458 .period_bytes_min = 64, 459 .period_bytes_min = 64,
459 .period_bytes_max = (256*1024), 460 .period_bytes_max = (256*1024),
460 .periods_min = 2, 461 .periods_min = 4,
461 .periods_max = 1024, 462 .periods_max = 1024,
462}; 463};
463 464
@@ -491,7 +492,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
491 492
492 snd_assert(period_size >= 0x100 && period_size <= 0x10000, 493 snd_assert(period_size >= 0x100 && period_size <= 0x10000,
493 return -EINVAL); 494 return -EINVAL);
494 snd_assert(periods >= 2, return -EINVAL); 495 snd_assert(periods >= 4, return -EINVAL);
495 snd_assert(period_size * periods <= 1024 * 1024, return -EINVAL); 496 snd_assert(period_size * periods <= 1024 * 1024, return -EINVAL);
496 497
497 dev = saa7134->dev; 498 dev = saa7134->dev;
@@ -647,7 +648,14 @@ static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream)
647 saa7134_tvaudio_setmute(dev); 648 saa7134_tvaudio_setmute(dev);
648 } 649 }
649 650
650 if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) 651 err = snd_pcm_hw_constraint_integer(runtime,
652 SNDRV_PCM_HW_PARAM_PERIODS);
653 if (err < 0)
654 return err;
655
656 err = snd_pcm_hw_constraint_step(runtime, 0,
657 SNDRV_PCM_HW_PARAM_PERIODS, 2);
658 if (err < 0)
651 return err; 659 return err;
652 660
653 return 0; 661 return 0;
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index 4f3dad9ae6d6..c6eb1e37a46e 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -334,7 +334,7 @@ struct saa7134_board saa7134_boards[] = {
334 .tv = 1, 334 .tv = 1,
335 },{ 335 },{
336 .name = name_comp1, 336 .name = name_comp1,
337 .vmux = 2, 337 .vmux = 0,
338 .amux = LINE1, 338 .amux = LINE1,
339 },{ 339 },{
340 .name = name_comp2, 340 .name = name_comp2,
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index a499eea379e6..4fd187ac9d70 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -569,21 +569,22 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id)
569 for (loop = 0; loop < 10; loop++) { 569 for (loop = 0; loop < 10; loop++) {
570 report = saa_readl(SAA7134_IRQ_REPORT); 570 report = saa_readl(SAA7134_IRQ_REPORT);
571 status = saa_readl(SAA7134_IRQ_STATUS); 571 status = saa_readl(SAA7134_IRQ_STATUS);
572 if (0 == report) {
573 if (irq_debug > 1)
574 printk(KERN_DEBUG "%s/irq: no (more) work\n",
575 dev->name);
576 goto out;
577 }
578
579 /* If dmasound support is active and we get a sound report, exit
580 and let the saa7134-alsa/oss module deal with it */
581 572
573 /* If dmasound support is active and we get a sound report,
574 * mask out the report and let the saa7134-alsa module deal
575 * with it */
582 if ((report & SAA7134_IRQ_REPORT_DONE_RA3) && 576 if ((report & SAA7134_IRQ_REPORT_DONE_RA3) &&
583 (dev->dmasound.priv_data != NULL) ) 577 (dev->dmasound.priv_data != NULL) )
584 { 578 {
585 if (irq_debug > 1) 579 if (irq_debug > 1)
586 printk(KERN_DEBUG "%s/irq: ignoring interrupt for DMA sound\n", 580 printk(KERN_DEBUG "%s/irq: preserving DMA sound interrupt\n",
581 dev->name);
582 report &= ~SAA7134_IRQ_REPORT_DONE_RA3;
583 }
584
585 if (0 == report) {
586 if (irq_debug > 1)
587 printk(KERN_DEBUG "%s/irq: no (more) work\n",
587 dev->name); 588 dev->name);
588 goto out; 589 goto out;
589 } 590 }
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index 38d87332cc5d..e1ab099ec4c6 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -662,6 +662,7 @@ static struct tda1004x_config hauppauge_hvr_1110_config = {
662 .if_freq = TDA10046_FREQ_045, 662 .if_freq = TDA10046_FREQ_045,
663 .i2c_gate = 0x4b, 663 .i2c_gate = 0x4b,
664 .tuner_address = 0x61, 664 .tuner_address = 0x61,
665 .tuner_config = 1,
665 .request_firmware = philips_tda1004x_request_firmware 666 .request_firmware = philips_tda1004x_request_firmware
666}; 667};
667 668
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c
index 75d0c5bf46d2..9322f44865b8 100644
--- a/drivers/media/video/saa7134/saa7134-empress.c
+++ b/drivers/media/video/saa7134/saa7134-empress.c
@@ -110,11 +110,8 @@ static int ts_release(struct inode *inode, struct file *file)
110{ 110{
111 struct saa7134_dev *dev = file->private_data; 111 struct saa7134_dev *dev = file->private_data;
112 112
113 if (dev->empress_tsq.streaming)
114 videobuf_streamoff(&dev->empress_tsq);
115 mutex_lock(&dev->empress_tsq.lock); 113 mutex_lock(&dev->empress_tsq.lock);
116 if (dev->empress_tsq.reading) 114 videobuf_stop(&dev->empress_tsq);
117 videobuf_read_stop(&dev->empress_tsq);
118 videobuf_mmap_free(&dev->empress_tsq); 115 videobuf_mmap_free(&dev->empress_tsq);
119 dev->empress_users--; 116 dev->empress_users--;
120 117
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index 3b9ffb4b648a..6396d9b5c063 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -1445,10 +1445,7 @@ static int video_release(struct inode *inode, struct file *file)
1445 1445
1446 /* stop vbi capture */ 1446 /* stop vbi capture */
1447 if (res_check(fh, RESOURCE_VBI)) { 1447 if (res_check(fh, RESOURCE_VBI)) {
1448 if (fh->vbi.streaming) 1448 videobuf_stop(&fh->vbi);
1449 videobuf_streamoff(&fh->vbi);
1450 if (fh->vbi.reading)
1451 videobuf_read_stop(&fh->vbi);
1452 res_free(dev,fh,RESOURCE_VBI); 1449 res_free(dev,fh,RESOURCE_VBI);
1453 } 1450 }
1454 1451
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index 25d0aef88ef5..445eba4174d7 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -290,6 +290,7 @@ static inline void tvp5150_selmux(struct i2c_client *c)
290 int opmode=0; 290 int opmode=0;
291 struct tvp5150 *decoder = i2c_get_clientdata(c); 291 struct tvp5150 *decoder = i2c_get_clientdata(c);
292 int input = 0; 292 int input = 0;
293 unsigned char val;
293 294
294 if ((decoder->route.output & TVP5150_BLACK_SCREEN) || !decoder->enable) 295 if ((decoder->route.output & TVP5150_BLACK_SCREEN) || !decoder->enable)
295 input = 8; 296 input = 8;
@@ -315,6 +316,16 @@ static inline void tvp5150_selmux(struct i2c_client *c)
315 316
316 tvp5150_write(c, TVP5150_OP_MODE_CTL, opmode); 317 tvp5150_write(c, TVP5150_OP_MODE_CTL, opmode);
317 tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, input); 318 tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, input);
319
320 /* Svideo should enable YCrCb output and disable GPCL output
321 * For Composite and TV, it should be the reverse
322 */
323 val = tvp5150_read(c, TVP5150_MISC_CTL);
324 if (decoder->route.input == TVP5150_SVIDEO)
325 val = (val & ~0x40) | 0x10;
326 else
327 val = (val & ~0x10) | 0x40;
328 tvp5150_write(c, TVP5150_MISC_CTL, val);
318}; 329};
319 330
320struct i2c_reg_value { 331struct i2c_reg_value {
diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c
index 89a44f16f0ba..81f77d2b4bd3 100644
--- a/drivers/media/video/videobuf-core.c
+++ b/drivers/media/video/videobuf-core.c
@@ -141,6 +141,7 @@ void videobuf_queue_core_init(struct videobuf_queue* q,
141 INIT_LIST_HEAD(&q->stream); 141 INIT_LIST_HEAD(&q->stream);
142} 142}
143 143
144/* Locking: Only usage in bttv unsafe find way to remove */
144int videobuf_queue_is_busy(struct videobuf_queue *q) 145int videobuf_queue_is_busy(struct videobuf_queue *q)
145{ 146{
146 int i; 147 int i;
@@ -178,6 +179,7 @@ int videobuf_queue_is_busy(struct videobuf_queue *q)
178 return 0; 179 return 0;
179} 180}
180 181
182/* Locking: Caller holds q->lock */
181void videobuf_queue_cancel(struct videobuf_queue *q) 183void videobuf_queue_cancel(struct videobuf_queue *q)
182{ 184{
183 unsigned long flags=0; 185 unsigned long flags=0;
@@ -208,6 +210,7 @@ void videobuf_queue_cancel(struct videobuf_queue *q)
208 210
209/* --------------------------------------------------------------------- */ 211/* --------------------------------------------------------------------- */
210 212
213/* Locking: Caller holds q->lock */
211enum v4l2_field videobuf_next_field(struct videobuf_queue *q) 214enum v4l2_field videobuf_next_field(struct videobuf_queue *q)
212{ 215{
213 enum v4l2_field field = q->field; 216 enum v4l2_field field = q->field;
@@ -226,6 +229,7 @@ enum v4l2_field videobuf_next_field(struct videobuf_queue *q)
226 return field; 229 return field;
227} 230}
228 231
232/* Locking: Caller holds q->lock */
229static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b, 233static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b,
230 struct videobuf_buffer *vb, enum v4l2_buf_type type) 234 struct videobuf_buffer *vb, enum v4l2_buf_type type)
231{ 235{
@@ -281,20 +285,108 @@ static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b,
281 b->sequence = vb->field_count >> 1; 285 b->sequence = vb->field_count >> 1;
282} 286}
283 287
288/* Locking: Caller holds q->lock */
289static int __videobuf_mmap_free(struct videobuf_queue *q)
290{
291 int i;
292 int rc;
293
294 if (!q)
295 return 0;
296
297 MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS);
298
299 rc = CALL(q,mmap_free,q);
300 if (rc<0)
301 return rc;
302
303 for (i = 0; i < VIDEO_MAX_FRAME; i++) {
304 if (NULL == q->bufs[i])
305 continue;
306 q->ops->buf_release(q,q->bufs[i]);
307 kfree(q->bufs[i]);
308 q->bufs[i] = NULL;
309 }
310
311 return rc;
312}
313
314int videobuf_mmap_free(struct videobuf_queue *q)
315{
316 int ret;
317 mutex_lock(&q->lock);
318 ret = __videobuf_mmap_free(q);
319 mutex_unlock(&q->lock);
320 return ret;
321}
322
323/* Locking: Caller holds q->lock */
324static int __videobuf_mmap_setup(struct videobuf_queue *q,
325 unsigned int bcount, unsigned int bsize,
326 enum v4l2_memory memory)
327{
328 unsigned int i;
329 int err;
330
331 MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS);
332
333 err = __videobuf_mmap_free(q);
334 if (0 != err)
335 return err;
336
337 /* Allocate and initialize buffers */
338 for (i = 0; i < bcount; i++) {
339 q->bufs[i] = videobuf_alloc(q);
340
341 if (q->bufs[i] == NULL)
342 break;
343
344 q->bufs[i]->i = i;
345 q->bufs[i]->input = UNSET;
346 q->bufs[i]->memory = memory;
347 q->bufs[i]->bsize = bsize;
348 switch (memory) {
349 case V4L2_MEMORY_MMAP:
350 q->bufs[i]->boff = bsize * i;
351 break;
352 case V4L2_MEMORY_USERPTR:
353 case V4L2_MEMORY_OVERLAY:
354 /* nothing */
355 break;
356 }
357 }
358
359 if (!i)
360 return -ENOMEM;
361
362 dprintk(1,"mmap setup: %d buffers, %d bytes each\n",
363 i, bsize);
364
365 return i;
366}
367
368int videobuf_mmap_setup(struct videobuf_queue *q,
369 unsigned int bcount, unsigned int bsize,
370 enum v4l2_memory memory)
371{
372 int ret;
373 mutex_lock(&q->lock);
374 ret = __videobuf_mmap_setup(q, bcount, bsize, memory);
375 mutex_unlock(&q->lock);
376 return ret;
377}
378
284int videobuf_reqbufs(struct videobuf_queue *q, 379int videobuf_reqbufs(struct videobuf_queue *q,
285 struct v4l2_requestbuffers *req) 380 struct v4l2_requestbuffers *req)
286{ 381{
287 unsigned int size,count; 382 unsigned int size,count;
288 int retval; 383 int retval;
289 384
290 if (req->type != q->type) {
291 dprintk(1,"reqbufs: queue type invalid\n");
292 return -EINVAL;
293 }
294 if (req->count < 1) { 385 if (req->count < 1) {
295 dprintk(1,"reqbufs: count invalid (%d)\n",req->count); 386 dprintk(1,"reqbufs: count invalid (%d)\n",req->count);
296 return -EINVAL; 387 return -EINVAL;
297 } 388 }
389
298 if (req->memory != V4L2_MEMORY_MMAP && 390 if (req->memory != V4L2_MEMORY_MMAP &&
299 req->memory != V4L2_MEMORY_USERPTR && 391 req->memory != V4L2_MEMORY_USERPTR &&
300 req->memory != V4L2_MEMORY_OVERLAY) { 392 req->memory != V4L2_MEMORY_OVERLAY) {
@@ -303,6 +395,12 @@ int videobuf_reqbufs(struct videobuf_queue *q,
303 } 395 }
304 396
305 mutex_lock(&q->lock); 397 mutex_lock(&q->lock);
398 if (req->type != q->type) {
399 dprintk(1,"reqbufs: queue type invalid\n");
400 retval = -EINVAL;
401 goto done;
402 }
403
306 if (q->streaming) { 404 if (q->streaming) {
307 dprintk(1,"reqbufs: streaming already exists\n"); 405 dprintk(1,"reqbufs: streaming already exists\n");
308 retval = -EBUSY; 406 retval = -EBUSY;
@@ -323,7 +421,7 @@ int videobuf_reqbufs(struct videobuf_queue *q,
323 dprintk(1,"reqbufs: bufs=%d, size=0x%x [%d pages total]\n", 421 dprintk(1,"reqbufs: bufs=%d, size=0x%x [%d pages total]\n",
324 count, size, (count*size)>>PAGE_SHIFT); 422 count, size, (count*size)>>PAGE_SHIFT);
325 423
326 retval = videobuf_mmap_setup(q,count,size,req->memory); 424 retval = __videobuf_mmap_setup(q,count,size,req->memory);
327 if (retval < 0) { 425 if (retval < 0) {
328 dprintk(1,"reqbufs: mmap setup returned %d\n",retval); 426 dprintk(1,"reqbufs: mmap setup returned %d\n",retval);
329 goto done; 427 goto done;
@@ -338,20 +436,28 @@ int videobuf_reqbufs(struct videobuf_queue *q,
338 436
339int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b) 437int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b)
340{ 438{
439 int ret = -EINVAL;
440
441 mutex_lock(&q->lock);
341 if (unlikely(b->type != q->type)) { 442 if (unlikely(b->type != q->type)) {
342 dprintk(1,"querybuf: Wrong type.\n"); 443 dprintk(1,"querybuf: Wrong type.\n");
343 return -EINVAL; 444 goto done;
344 } 445 }
345 if (unlikely(b->index < 0 || b->index >= VIDEO_MAX_FRAME)) { 446 if (unlikely(b->index < 0 || b->index >= VIDEO_MAX_FRAME)) {
346 dprintk(1,"querybuf: index out of range.\n"); 447 dprintk(1,"querybuf: index out of range.\n");
347 return -EINVAL; 448 goto done;
348 } 449 }
349 if (unlikely(NULL == q->bufs[b->index])) { 450 if (unlikely(NULL == q->bufs[b->index])) {
350 dprintk(1,"querybuf: buffer is null.\n"); 451 dprintk(1,"querybuf: buffer is null.\n");
351 return -EINVAL; 452 goto done;
352 } 453 }
454
353 videobuf_status(q,b,q->bufs[b->index],q->type); 455 videobuf_status(q,b,q->bufs[b->index],q->type);
354 return 0; 456
457 ret = 0;
458done:
459 mutex_unlock(&q->lock);
460 return ret;
355} 461}
356 462
357int videobuf_qbuf(struct videobuf_queue *q, 463int videobuf_qbuf(struct videobuf_queue *q,
@@ -541,22 +647,30 @@ int videobuf_streamon(struct videobuf_queue *q)
541 return retval; 647 return retval;
542} 648}
543 649
544int videobuf_streamoff(struct videobuf_queue *q) 650/* Locking: Caller holds q->lock */
651static int __videobuf_streamoff(struct videobuf_queue *q)
545{ 652{
546 int retval = -EINVAL;
547
548 mutex_lock(&q->lock);
549 if (!q->streaming) 653 if (!q->streaming)
550 goto done; 654 return -EINVAL;
655
551 videobuf_queue_cancel(q); 656 videobuf_queue_cancel(q);
552 q->streaming = 0; 657 q->streaming = 0;
553 retval = 0;
554 658
555 done: 659 return 0;
660}
661
662int videobuf_streamoff(struct videobuf_queue *q)
663{
664 int retval;
665
666 mutex_lock(&q->lock);
667 retval = __videobuf_streamoff(q);
556 mutex_unlock(&q->lock); 668 mutex_unlock(&q->lock);
669
557 return retval; 670 return retval;
558} 671}
559 672
673/* Locking: Caller holds q->lock */
560static ssize_t videobuf_read_zerocopy(struct videobuf_queue *q, 674static ssize_t videobuf_read_zerocopy(struct videobuf_queue *q,
561 char __user *data, 675 char __user *data,
562 size_t count, loff_t *ppos) 676 size_t count, loff_t *ppos)
@@ -691,7 +805,8 @@ ssize_t videobuf_read_one(struct videobuf_queue *q,
691 return retval; 805 return retval;
692} 806}
693 807
694int videobuf_read_start(struct videobuf_queue *q) 808/* Locking: Caller holds q->lock */
809int __videobuf_read_start(struct videobuf_queue *q)
695{ 810{
696 enum v4l2_field field; 811 enum v4l2_field field;
697 unsigned long flags=0; 812 unsigned long flags=0;
@@ -705,7 +820,7 @@ int videobuf_read_start(struct videobuf_queue *q)
705 count = VIDEO_MAX_FRAME; 820 count = VIDEO_MAX_FRAME;
706 size = PAGE_ALIGN(size); 821 size = PAGE_ALIGN(size);
707 822
708 err = videobuf_mmap_setup(q, count, size, V4L2_MEMORY_USERPTR); 823 err = __videobuf_mmap_setup(q, count, size, V4L2_MEMORY_USERPTR);
709 if (err < 0) 824 if (err < 0)
710 return err; 825 return err;
711 826
@@ -728,12 +843,13 @@ int videobuf_read_start(struct videobuf_queue *q)
728 return 0; 843 return 0;
729} 844}
730 845
731void videobuf_read_stop(struct videobuf_queue *q) 846static void __videobuf_read_stop(struct videobuf_queue *q)
732{ 847{
733 int i; 848 int i;
734 849
850
735 videobuf_queue_cancel(q); 851 videobuf_queue_cancel(q);
736 videobuf_mmap_free(q); 852 __videobuf_mmap_free(q);
737 INIT_LIST_HEAD(&q->stream); 853 INIT_LIST_HEAD(&q->stream);
738 for (i = 0; i < VIDEO_MAX_FRAME; i++) { 854 for (i = 0; i < VIDEO_MAX_FRAME; i++) {
739 if (NULL == q->bufs[i]) 855 if (NULL == q->bufs[i])
@@ -743,8 +859,41 @@ void videobuf_read_stop(struct videobuf_queue *q)
743 } 859 }
744 q->read_buf = NULL; 860 q->read_buf = NULL;
745 q->reading = 0; 861 q->reading = 0;
862
746} 863}
747 864
865int videobuf_read_start(struct videobuf_queue *q)
866{
867 int rc;
868
869 mutex_lock(&q->lock);
870 rc = __videobuf_read_start(q);
871 mutex_unlock(&q->lock);
872
873 return rc;
874}
875
876void videobuf_read_stop(struct videobuf_queue *q)
877{
878 mutex_lock(&q->lock);
879 __videobuf_read_stop(q);
880 mutex_unlock(&q->lock);
881}
882
883void videobuf_stop(struct videobuf_queue *q)
884{
885 mutex_lock(&q->lock);
886
887 if (q->streaming)
888 __videobuf_streamoff(q);
889
890 if (q->reading)
891 __videobuf_read_stop(q);
892
893 mutex_unlock(&q->lock);
894}
895
896
748ssize_t videobuf_read_stream(struct videobuf_queue *q, 897ssize_t videobuf_read_stream(struct videobuf_queue *q,
749 char __user *data, size_t count, loff_t *ppos, 898 char __user *data, size_t count, loff_t *ppos,
750 int vbihack, int nonblocking) 899 int vbihack, int nonblocking)
@@ -858,75 +1007,6 @@ unsigned int videobuf_poll_stream(struct file *file,
858 return rc; 1007 return rc;
859} 1008}
860 1009
861int videobuf_mmap_setup(struct videobuf_queue *q,
862 unsigned int bcount, unsigned int bsize,
863 enum v4l2_memory memory)
864{
865 unsigned int i;
866 int err;
867
868 MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS);
869
870 err = videobuf_mmap_free(q);
871 if (0 != err)
872 return err;
873
874 /* Allocate and initialize buffers */
875 for (i = 0; i < bcount; i++) {
876 q->bufs[i] = videobuf_alloc(q);
877
878 if (q->bufs[i] == NULL)
879 break;
880
881 q->bufs[i]->i = i;
882 q->bufs[i]->input = UNSET;
883 q->bufs[i]->memory = memory;
884 q->bufs[i]->bsize = bsize;
885 switch (memory) {
886 case V4L2_MEMORY_MMAP:
887 q->bufs[i]->boff = bsize * i;
888 break;
889 case V4L2_MEMORY_USERPTR:
890 case V4L2_MEMORY_OVERLAY:
891 /* nothing */
892 break;
893 }
894 }
895
896 if (!i)
897 return -ENOMEM;
898
899 dprintk(1,"mmap setup: %d buffers, %d bytes each\n",
900 i, bsize);
901
902 return i;
903}
904
905int videobuf_mmap_free(struct videobuf_queue *q)
906{
907 int i;
908 int rc;
909
910 if (!q)
911 return 0;
912
913 MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS);
914
915 rc = CALL(q,mmap_free,q);
916 if (rc<0)
917 return rc;
918
919 for (i = 0; i < VIDEO_MAX_FRAME; i++) {
920 if (NULL == q->bufs[i])
921 continue;
922 q->ops->buf_release(q,q->bufs[i]);
923 kfree(q->bufs[i]);
924 q->bufs[i] = NULL;
925 }
926
927 return rc;
928}
929
930int videobuf_mmap_mapper(struct videobuf_queue *q, 1010int videobuf_mmap_mapper(struct videobuf_queue *q,
931 struct vm_area_struct *vma) 1011 struct vm_area_struct *vma)
932{ 1012{
@@ -991,6 +1071,7 @@ EXPORT_SYMBOL_GPL(videobuf_streamoff);
991 1071
992EXPORT_SYMBOL_GPL(videobuf_read_start); 1072EXPORT_SYMBOL_GPL(videobuf_read_start);
993EXPORT_SYMBOL_GPL(videobuf_read_stop); 1073EXPORT_SYMBOL_GPL(videobuf_read_stop);
1074EXPORT_SYMBOL_GPL(videobuf_stop);
994EXPORT_SYMBOL_GPL(videobuf_read_stream); 1075EXPORT_SYMBOL_GPL(videobuf_read_stream);
995EXPORT_SYMBOL_GPL(videobuf_read_one); 1076EXPORT_SYMBOL_GPL(videobuf_read_one);
996EXPORT_SYMBOL_GPL(videobuf_poll_stream); 1077EXPORT_SYMBOL_GPL(videobuf_poll_stream);
diff --git a/drivers/media/video/videobuf-vmalloc.c b/drivers/media/video/videobuf-vmalloc.c
index cd74341c984f..e01259438bb2 100644
--- a/drivers/media/video/videobuf-vmalloc.c
+++ b/drivers/media/video/videobuf-vmalloc.c
@@ -51,7 +51,7 @@ videobuf_vm_open(struct vm_area_struct *vma)
51{ 51{
52 struct videobuf_mapping *map = vma->vm_private_data; 52 struct videobuf_mapping *map = vma->vm_private_data;
53 53
54 dprintk(2,"vm_open %p [count=%d,vma=%08lx-%08lx]\n",map, 54 dprintk(2,"vm_open %p [count=%u,vma=%08lx-%08lx]\n",map,
55 map->count,vma->vm_start,vma->vm_end); 55 map->count,vma->vm_start,vma->vm_end);
56 56
57 map->count++; 57 map->count++;
@@ -64,7 +64,7 @@ videobuf_vm_close(struct vm_area_struct *vma)
64 struct videobuf_queue *q = map->q; 64 struct videobuf_queue *q = map->q;
65 int i; 65 int i;
66 66
67 dprintk(2,"vm_close %p [count=%d,vma=%08lx-%08lx]\n",map, 67 dprintk(2,"vm_close %p [count=%u,vma=%08lx-%08lx]\n",map,
68 map->count,vma->vm_start,vma->vm_end); 68 map->count,vma->vm_start,vma->vm_end);
69 69
70 map->count--; 70 map->count--;
@@ -221,7 +221,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,
221 } 221 }
222 222
223 /* create mapping + update buffer list */ 223 /* create mapping + update buffer list */
224 map = q->bufs[first]->map = kmalloc(sizeof(struct videobuf_mapping),GFP_KERNEL); 224 map = q->bufs[first]->map = kzalloc(sizeof(struct videobuf_mapping),GFP_KERNEL);
225 if (NULL == map) 225 if (NULL == map)
226 return -ENOMEM; 226 return -ENOMEM;
227 227
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
index ee73dc75131c..9b54ff9d2e36 100644
--- a/drivers/media/video/vivi.c
+++ b/drivers/media/video/vivi.c
@@ -1076,6 +1076,7 @@ static int vivi_release(struct inode *inode, struct file *file)
1076 int minor = iminor(inode); 1076 int minor = iminor(inode);
1077 1077
1078 vivi_stop_thread(vidq); 1078 vivi_stop_thread(vidq);
1079 videobuf_stop(&fh->vb_vidq);
1079 videobuf_mmap_free(&fh->vb_vidq); 1080 videobuf_mmap_free(&fh->vb_vidq);
1080 1081
1081 kfree (fh); 1082 kfree (fh);
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 6cde4edc846b..d9107e542dfa 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2588,7 +2588,6 @@ config MLX4_DEBUG
2588config TEHUTI 2588config TEHUTI
2589 tristate "Tehuti Networks 10G Ethernet" 2589 tristate "Tehuti Networks 10G Ethernet"
2590 depends on PCI 2590 depends on PCI
2591 select ZLIB_INFLATE
2592 help 2591 help
2593 Tehuti Networks 10G Ethernet NIC 2592 Tehuti Networks 10G Ethernet NIC
2594 2593
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index da767d3d5af5..4e7b46e44874 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -56,8 +56,8 @@
56 56
57#define DRV_MODULE_NAME "bnx2" 57#define DRV_MODULE_NAME "bnx2"
58#define PFX DRV_MODULE_NAME ": " 58#define PFX DRV_MODULE_NAME ": "
59#define DRV_MODULE_VERSION "1.6.8" 59#define DRV_MODULE_VERSION "1.6.9"
60#define DRV_MODULE_RELDATE "October 17, 2007" 60#define DRV_MODULE_RELDATE "December 8, 2007"
61 61
62#define RUN_AT(x) (jiffies + (x)) 62#define RUN_AT(x) (jiffies + (x))
63 63
@@ -2387,18 +2387,24 @@ bnx2_reuse_rx_skb(struct bnx2 *bp, struct sk_buff *skb,
2387 prod_bd->rx_bd_haddr_lo = cons_bd->rx_bd_haddr_lo; 2387 prod_bd->rx_bd_haddr_lo = cons_bd->rx_bd_haddr_lo;
2388} 2388}
2389 2389
2390static inline u16
2391bnx2_get_hw_rx_cons(struct bnx2 *bp)
2392{
2393 u16 cons = bp->status_blk->status_rx_quick_consumer_index0;
2394
2395 if (unlikely((cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT))
2396 cons++;
2397 return cons;
2398}
2399
2390static int 2400static int
2391bnx2_rx_int(struct bnx2 *bp, int budget) 2401bnx2_rx_int(struct bnx2 *bp, int budget)
2392{ 2402{
2393 struct status_block *sblk = bp->status_blk;
2394 u16 hw_cons, sw_cons, sw_ring_cons, sw_prod, sw_ring_prod; 2403 u16 hw_cons, sw_cons, sw_ring_cons, sw_prod, sw_ring_prod;
2395 struct l2_fhdr *rx_hdr; 2404 struct l2_fhdr *rx_hdr;
2396 int rx_pkt = 0; 2405 int rx_pkt = 0;
2397 2406
2398 hw_cons = bp->hw_rx_cons = sblk->status_rx_quick_consumer_index0; 2407 hw_cons = bnx2_get_hw_rx_cons(bp);
2399 if ((hw_cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT) {
2400 hw_cons++;
2401 }
2402 sw_cons = bp->rx_cons; 2408 sw_cons = bp->rx_cons;
2403 sw_prod = bp->rx_prod; 2409 sw_prod = bp->rx_prod;
2404 2410
@@ -2515,10 +2521,7 @@ next_rx:
2515 2521
2516 /* Refresh hw_cons to see if there is new work */ 2522 /* Refresh hw_cons to see if there is new work */
2517 if (sw_cons == hw_cons) { 2523 if (sw_cons == hw_cons) {
2518 hw_cons = bp->hw_rx_cons = 2524 hw_cons = bnx2_get_hw_rx_cons(bp);
2519 sblk->status_rx_quick_consumer_index0;
2520 if ((hw_cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT)
2521 hw_cons++;
2522 rmb(); 2525 rmb();
2523 } 2526 }
2524 } 2527 }
@@ -2622,7 +2625,7 @@ bnx2_has_work(struct bnx2 *bp)
2622{ 2625{
2623 struct status_block *sblk = bp->status_blk; 2626 struct status_block *sblk = bp->status_blk;
2624 2627
2625 if ((sblk->status_rx_quick_consumer_index0 != bp->hw_rx_cons) || 2628 if ((bnx2_get_hw_rx_cons(bp) != bp->rx_cons) ||
2626 (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons)) 2629 (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons))
2627 return 1; 2630 return 1;
2628 2631
@@ -2655,7 +2658,7 @@ static int bnx2_poll_work(struct bnx2 *bp, int work_done, int budget)
2655 if (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons) 2658 if (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons)
2656 bnx2_tx_int(bp); 2659 bnx2_tx_int(bp);
2657 2660
2658 if (sblk->status_rx_quick_consumer_index0 != bp->hw_rx_cons) 2661 if (bnx2_get_hw_rx_cons(bp) != bp->rx_cons)
2659 work_done += bnx2_rx_int(bp, budget - work_done); 2662 work_done += bnx2_rx_int(bp, budget - work_done);
2660 2663
2661 return work_done; 2664 return work_done;
@@ -4177,7 +4180,6 @@ bnx2_init_rx_ring(struct bnx2 *bp)
4177 4180
4178 ring_prod = prod = bp->rx_prod = 0; 4181 ring_prod = prod = bp->rx_prod = 0;
4179 bp->rx_cons = 0; 4182 bp->rx_cons = 0;
4180 bp->hw_rx_cons = 0;
4181 bp->rx_prod_bseq = 0; 4183 bp->rx_prod_bseq = 0;
4182 4184
4183 for (i = 0; i < bp->rx_max_ring; i++) { 4185 for (i = 0; i < bp->rx_max_ring; i++) {
@@ -6685,8 +6687,9 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
6685 } else if (CHIP_NUM(bp) == CHIP_NUM_5706 || 6687 } else if (CHIP_NUM(bp) == CHIP_NUM_5706 ||
6686 CHIP_NUM(bp) == CHIP_NUM_5708) 6688 CHIP_NUM(bp) == CHIP_NUM_5708)
6687 bp->phy_flags |= PHY_CRC_FIX_FLAG; 6689 bp->phy_flags |= PHY_CRC_FIX_FLAG;
6688 else if (CHIP_ID(bp) == CHIP_ID_5709_A0 || 6690 else if (CHIP_NUM(bp) == CHIP_NUM_5709 &&
6689 CHIP_ID(bp) == CHIP_ID_5709_A1) 6691 (CHIP_REV(bp) == CHIP_REV_Ax ||
6692 CHIP_REV(bp) == CHIP_REV_Bx))
6690 bp->phy_flags |= PHY_DIS_EARLY_DAC_FLAG; 6693 bp->phy_flags |= PHY_DIS_EARLY_DAC_FLAG;
6691 6694
6692 if ((CHIP_ID(bp) == CHIP_ID_5708_A0) || 6695 if ((CHIP_ID(bp) == CHIP_ID_5708_A0) ||
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index 1dce0d1a2581..30ba366608b0 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -6513,7 +6513,6 @@ struct bnx2 {
6513 u32 rx_prod_bseq; 6513 u32 rx_prod_bseq;
6514 u16 rx_prod; 6514 u16 rx_prod;
6515 u16 rx_cons; 6515 u16 rx_cons;
6516 u16 hw_rx_cons;
6517 6516
6518 u32 rx_csum; 6517 u32 rx_csum;
6519 6518
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index e1c8a0d023ea..2b06e4b4dabc 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -2737,8 +2737,9 @@ static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
2737 pci_enable_wake(pdev, PCI_D3cold, 0); 2737 pci_enable_wake(pdev, PCI_D3cold, 0);
2738 } 2738 }
2739 2739
2740 pci_disable_device(pdev);
2741 free_irq(pdev->irq, netdev); 2740 free_irq(pdev->irq, netdev);
2741
2742 pci_disable_device(pdev);
2742 pci_set_power_state(pdev, PCI_D3hot); 2743 pci_set_power_state(pdev, PCI_D3hot);
2743 2744
2744 return 0; 2745 return 0;
@@ -2780,6 +2781,8 @@ static void e100_shutdown(struct pci_dev *pdev)
2780 pci_enable_wake(pdev, PCI_D3cold, 0); 2781 pci_enable_wake(pdev, PCI_D3cold, 0);
2781 } 2782 }
2782 2783
2784 free_irq(pdev->irq, netdev);
2785
2783 pci_disable_device(pdev); 2786 pci_disable_device(pdev);
2784 pci_set_power_state(pdev, PCI_D3hot); 2787 pci_set_power_state(pdev, PCI_D3hot);
2785} 2788}
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c
index ed407c85708f..b53f6b6491b3 100644
--- a/drivers/net/hamachi.c
+++ b/drivers/net/hamachi.c
@@ -204,8 +204,10 @@ KERN_INFO " Further modifications by Keith Underwood <keithu@parl.clemson.edu>
204/* Condensed bus+endian portability operations. */ 204/* Condensed bus+endian portability operations. */
205#if ADDRLEN == 64 205#if ADDRLEN == 64
206#define cpu_to_leXX(addr) cpu_to_le64(addr) 206#define cpu_to_leXX(addr) cpu_to_le64(addr)
207#define leXX_to_cpu(addr) le64_to_cpu(addr)
207#else 208#else
208#define cpu_to_leXX(addr) cpu_to_le32(addr) 209#define cpu_to_leXX(addr) cpu_to_le32(addr)
210#define leXX_to_cpu(addr) le32_to_cpu(addr)
209#endif 211#endif
210 212
211 213
@@ -465,12 +467,12 @@ enum intr_status_bits {
465 467
466/* The Hamachi Rx and Tx buffer descriptors. */ 468/* The Hamachi Rx and Tx buffer descriptors. */
467struct hamachi_desc { 469struct hamachi_desc {
468 u32 status_n_length; 470 __le32 status_n_length;
469#if ADDRLEN == 64 471#if ADDRLEN == 64
470 u32 pad; 472 u32 pad;
471 u64 addr; 473 __le64 addr;
472#else 474#else
473 u32 addr; 475 __le32 addr;
474#endif 476#endif
475}; 477};
476 478
@@ -874,13 +876,13 @@ static int hamachi_open(struct net_device *dev)
874 876
875#if ADDRLEN == 64 877#if ADDRLEN == 64
876 /* writellll anyone ? */ 878 /* writellll anyone ? */
877 writel(cpu_to_le64(hmp->rx_ring_dma), ioaddr + RxPtr); 879 writel(hmp->rx_ring_dma, ioaddr + RxPtr);
878 writel(cpu_to_le64(hmp->rx_ring_dma) >> 32, ioaddr + RxPtr + 4); 880 writel(hmp->rx_ring_dma >> 32, ioaddr + RxPtr + 4);
879 writel(cpu_to_le64(hmp->tx_ring_dma), ioaddr + TxPtr); 881 writel(hmp->tx_ring_dma, ioaddr + TxPtr);
880 writel(cpu_to_le64(hmp->tx_ring_dma) >> 32, ioaddr + TxPtr + 4); 882 writel(hmp->tx_ring_dma >> 32, ioaddr + TxPtr + 4);
881#else 883#else
882 writel(cpu_to_le32(hmp->rx_ring_dma), ioaddr + RxPtr); 884 writel(hmp->rx_ring_dma, ioaddr + RxPtr);
883 writel(cpu_to_le32(hmp->tx_ring_dma), ioaddr + TxPtr); 885 writel(hmp->tx_ring_dma, ioaddr + TxPtr);
884#endif 886#endif
885 887
886 /* TODO: It would make sense to organize this as words since the card 888 /* TODO: It would make sense to organize this as words since the card
@@ -1019,8 +1021,8 @@ static inline int hamachi_tx(struct net_device *dev)
1019 skb = hmp->tx_skbuff[entry]; 1021 skb = hmp->tx_skbuff[entry];
1020 if (skb) { 1022 if (skb) {
1021 pci_unmap_single(hmp->pci_dev, 1023 pci_unmap_single(hmp->pci_dev,
1022 hmp->tx_ring[entry].addr, skb->len, 1024 leXX_to_cpu(hmp->tx_ring[entry].addr),
1023 PCI_DMA_TODEVICE); 1025 skb->len, PCI_DMA_TODEVICE);
1024 dev_kfree_skb(skb); 1026 dev_kfree_skb(skb);
1025 hmp->tx_skbuff[entry] = NULL; 1027 hmp->tx_skbuff[entry] = NULL;
1026 } 1028 }
@@ -1071,10 +1073,10 @@ static void hamachi_tx_timeout(struct net_device *dev)
1071 { 1073 {
1072 printk(KERN_DEBUG " Rx ring %p: ", hmp->rx_ring); 1074 printk(KERN_DEBUG " Rx ring %p: ", hmp->rx_ring);
1073 for (i = 0; i < RX_RING_SIZE; i++) 1075 for (i = 0; i < RX_RING_SIZE; i++)
1074 printk(" %8.8x", (unsigned int)hmp->rx_ring[i].status_n_length); 1076 printk(" %8.8x", le32_to_cpu(hmp->rx_ring[i].status_n_length));
1075 printk("\n"KERN_DEBUG" Tx ring %p: ", hmp->tx_ring); 1077 printk("\n"KERN_DEBUG" Tx ring %p: ", hmp->tx_ring);
1076 for (i = 0; i < TX_RING_SIZE; i++) 1078 for (i = 0; i < TX_RING_SIZE; i++)
1077 printk(" %4.4x", hmp->tx_ring[i].status_n_length); 1079 printk(" %4.4x", le32_to_cpu(hmp->tx_ring[i].status_n_length));
1078 printk("\n"); 1080 printk("\n");
1079 } 1081 }
1080 1082
@@ -1099,14 +1101,15 @@ static void hamachi_tx_timeout(struct net_device *dev)
1099 struct sk_buff *skb; 1101 struct sk_buff *skb;
1100 1102
1101 if (i >= TX_RING_SIZE - 1) 1103 if (i >= TX_RING_SIZE - 1)
1102 hmp->tx_ring[i].status_n_length = cpu_to_le32( 1104 hmp->tx_ring[i].status_n_length =
1103 DescEndRing | 1105 cpu_to_le32(DescEndRing) |
1104 (hmp->tx_ring[i].status_n_length & 0x0000FFFF)); 1106 (hmp->tx_ring[i].status_n_length &
1107 cpu_to_le32(0x0000ffff));
1105 else 1108 else
1106 hmp->tx_ring[i].status_n_length &= 0x0000ffff; 1109 hmp->tx_ring[i].status_n_length &= cpu_to_le32(0x0000ffff);
1107 skb = hmp->tx_skbuff[i]; 1110 skb = hmp->tx_skbuff[i];
1108 if (skb){ 1111 if (skb){
1109 pci_unmap_single(hmp->pci_dev, hmp->tx_ring[i].addr, 1112 pci_unmap_single(hmp->pci_dev, leXX_to_cpu(hmp->tx_ring[i].addr),
1110 skb->len, PCI_DMA_TODEVICE); 1113 skb->len, PCI_DMA_TODEVICE);
1111 dev_kfree_skb(skb); 1114 dev_kfree_skb(skb);
1112 hmp->tx_skbuff[i] = NULL; 1115 hmp->tx_skbuff[i] = NULL;
@@ -1128,7 +1131,8 @@ static void hamachi_tx_timeout(struct net_device *dev)
1128 struct sk_buff *skb = hmp->rx_skbuff[i]; 1131 struct sk_buff *skb = hmp->rx_skbuff[i];
1129 1132
1130 if (skb){ 1133 if (skb){
1131 pci_unmap_single(hmp->pci_dev, hmp->rx_ring[i].addr, 1134 pci_unmap_single(hmp->pci_dev,
1135 leXX_to_cpu(hmp->rx_ring[i].addr),
1132 hmp->rx_buf_sz, PCI_DMA_FROMDEVICE); 1136 hmp->rx_buf_sz, PCI_DMA_FROMDEVICE);
1133 dev_kfree_skb(skb); 1137 dev_kfree_skb(skb);
1134 hmp->rx_skbuff[i] = NULL; 1138 hmp->rx_skbuff[i] = NULL;
@@ -1420,7 +1424,7 @@ static irqreturn_t hamachi_interrupt(int irq, void *dev_instance)
1420 /* Free the original skb. */ 1424 /* Free the original skb. */
1421 if (skb){ 1425 if (skb){
1422 pci_unmap_single(hmp->pci_dev, 1426 pci_unmap_single(hmp->pci_dev,
1423 hmp->tx_ring[entry].addr, 1427 leXX_to_cpu(hmp->tx_ring[entry].addr),
1424 skb->len, 1428 skb->len,
1425 PCI_DMA_TODEVICE); 1429 PCI_DMA_TODEVICE);
1426 dev_kfree_skb_irq(skb); 1430 dev_kfree_skb_irq(skb);
@@ -1500,11 +1504,11 @@ static int hamachi_rx(struct net_device *dev)
1500 if (desc_status & DescOwn) 1504 if (desc_status & DescOwn)
1501 break; 1505 break;
1502 pci_dma_sync_single_for_cpu(hmp->pci_dev, 1506 pci_dma_sync_single_for_cpu(hmp->pci_dev,
1503 desc->addr, 1507 leXX_to_cpu(desc->addr),
1504 hmp->rx_buf_sz, 1508 hmp->rx_buf_sz,
1505 PCI_DMA_FROMDEVICE); 1509 PCI_DMA_FROMDEVICE);
1506 buf_addr = (u8 *) hmp->rx_skbuff[entry]->data; 1510 buf_addr = (u8 *) hmp->rx_skbuff[entry]->data;
1507 frame_status = le32_to_cpu(get_unaligned((s32*)&(buf_addr[data_size - 12]))); 1511 frame_status = le32_to_cpu(get_unaligned((__le32*)&(buf_addr[data_size - 12])));
1508 if (hamachi_debug > 4) 1512 if (hamachi_debug > 4)
1509 printk(KERN_DEBUG " hamachi_rx() status was %8.8x.\n", 1513 printk(KERN_DEBUG " hamachi_rx() status was %8.8x.\n",
1510 frame_status); 1514 frame_status);
@@ -1518,9 +1522,9 @@ static int hamachi_rx(struct net_device *dev)
1518 dev->name, desc, &hmp->rx_ring[hmp->cur_rx % RX_RING_SIZE]); 1522 dev->name, desc, &hmp->rx_ring[hmp->cur_rx % RX_RING_SIZE]);
1519 printk(KERN_WARNING "%s: Oversized Ethernet frame -- next status %x/%x last status %x.\n", 1523 printk(KERN_WARNING "%s: Oversized Ethernet frame -- next status %x/%x last status %x.\n",
1520 dev->name, 1524 dev->name,
1521 hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length & 0xffff0000, 1525 le32_to_cpu(hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length) & 0xffff0000,
1522 hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length & 0x0000ffff, 1526 le32_to_cpu(hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length) & 0x0000ffff,
1523 hmp->rx_ring[(hmp->cur_rx-1) % RX_RING_SIZE].status_n_length); 1527 le32_to_cpu(hmp->rx_ring[(hmp->cur_rx-1) % RX_RING_SIZE].status_n_length));
1524 hmp->stats.rx_length_errors++; 1528 hmp->stats.rx_length_errors++;
1525 } /* else Omit for prototype errata??? */ 1529 } /* else Omit for prototype errata??? */
1526 if (frame_status & 0x00380000) { 1530 if (frame_status & 0x00380000) {
@@ -1566,7 +1570,7 @@ static int hamachi_rx(struct net_device *dev)
1566#endif 1570#endif
1567 skb_reserve(skb, 2); /* 16 byte align the IP header */ 1571 skb_reserve(skb, 2); /* 16 byte align the IP header */
1568 pci_dma_sync_single_for_cpu(hmp->pci_dev, 1572 pci_dma_sync_single_for_cpu(hmp->pci_dev,
1569 hmp->rx_ring[entry].addr, 1573 leXX_to_cpu(hmp->rx_ring[entry].addr),
1570 hmp->rx_buf_sz, 1574 hmp->rx_buf_sz,
1571 PCI_DMA_FROMDEVICE); 1575 PCI_DMA_FROMDEVICE);
1572 /* Call copy + cksum if available. */ 1576 /* Call copy + cksum if available. */
@@ -1579,12 +1583,12 @@ static int hamachi_rx(struct net_device *dev)
1579 + entry*sizeof(*desc), pkt_len); 1583 + entry*sizeof(*desc), pkt_len);
1580#endif 1584#endif
1581 pci_dma_sync_single_for_device(hmp->pci_dev, 1585 pci_dma_sync_single_for_device(hmp->pci_dev,
1582 hmp->rx_ring[entry].addr, 1586 leXX_to_cpu(hmp->rx_ring[entry].addr),
1583 hmp->rx_buf_sz, 1587 hmp->rx_buf_sz,
1584 PCI_DMA_FROMDEVICE); 1588 PCI_DMA_FROMDEVICE);
1585 } else { 1589 } else {
1586 pci_unmap_single(hmp->pci_dev, 1590 pci_unmap_single(hmp->pci_dev,
1587 hmp->rx_ring[entry].addr, 1591 leXX_to_cpu(hmp->rx_ring[entry].addr),
1588 hmp->rx_buf_sz, PCI_DMA_FROMDEVICE); 1592 hmp->rx_buf_sz, PCI_DMA_FROMDEVICE);
1589 skb_put(skb = hmp->rx_skbuff[entry], pkt_len); 1593 skb_put(skb = hmp->rx_skbuff[entry], pkt_len);
1590 hmp->rx_skbuff[entry] = NULL; 1594 hmp->rx_skbuff[entry] = NULL;
@@ -1787,21 +1791,21 @@ static int hamachi_close(struct net_device *dev)
1787 for (i = 0; i < RX_RING_SIZE; i++) { 1791 for (i = 0; i < RX_RING_SIZE; i++) {
1788 skb = hmp->rx_skbuff[i]; 1792 skb = hmp->rx_skbuff[i];
1789 hmp->rx_ring[i].status_n_length = 0; 1793 hmp->rx_ring[i].status_n_length = 0;
1790 hmp->rx_ring[i].addr = 0xBADF00D0; /* An invalid address. */
1791 if (skb) { 1794 if (skb) {
1792 pci_unmap_single(hmp->pci_dev, 1795 pci_unmap_single(hmp->pci_dev,
1793 hmp->rx_ring[i].addr, hmp->rx_buf_sz, 1796 leXX_to_cpu(hmp->rx_ring[i].addr),
1794 PCI_DMA_FROMDEVICE); 1797 hmp->rx_buf_sz, PCI_DMA_FROMDEVICE);
1795 dev_kfree_skb(skb); 1798 dev_kfree_skb(skb);
1796 hmp->rx_skbuff[i] = NULL; 1799 hmp->rx_skbuff[i] = NULL;
1797 } 1800 }
1801 hmp->rx_ring[i].addr = cpu_to_leXX(0xBADF00D0); /* An invalid address. */
1798 } 1802 }
1799 for (i = 0; i < TX_RING_SIZE; i++) { 1803 for (i = 0; i < TX_RING_SIZE; i++) {
1800 skb = hmp->tx_skbuff[i]; 1804 skb = hmp->tx_skbuff[i];
1801 if (skb) { 1805 if (skb) {
1802 pci_unmap_single(hmp->pci_dev, 1806 pci_unmap_single(hmp->pci_dev,
1803 hmp->tx_ring[i].addr, skb->len, 1807 leXX_to_cpu(hmp->tx_ring[i].addr),
1804 PCI_DMA_TODEVICE); 1808 skb->len, PCI_DMA_TODEVICE);
1805 dev_kfree_skb(skb); 1809 dev_kfree_skb(skb);
1806 hmp->tx_skbuff[i] = NULL; 1810 hmp->tx_skbuff[i] = NULL;
1807 } 1811 }
diff --git a/drivers/net/ibm_newemac/debug.c b/drivers/net/ibm_newemac/debug.c
index a2fc660ca5d4..86b756a30784 100644
--- a/drivers/net/ibm_newemac/debug.c
+++ b/drivers/net/ibm_newemac/debug.c
@@ -26,7 +26,7 @@
26 26
27#include "core.h" 27#include "core.h"
28 28
29static spinlock_t emac_dbg_lock = SPIN_LOCK_UNLOCKED; 29static DEFINE_SPINLOCK(emac_dbg_lock);
30 30
31static void emac_desc_dump(struct emac_instance *p) 31static void emac_desc_dump(struct emac_instance *p)
32{ 32{
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index 3021234b1e17..bf9085fe035a 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -320,10 +320,22 @@ ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog)
320void 320void
321ixgb_reset(struct ixgb_adapter *adapter) 321ixgb_reset(struct ixgb_adapter *adapter)
322{ 322{
323 struct ixgb_hw *hw = &adapter->hw;
323 324
324 ixgb_adapter_stop(&adapter->hw); 325 ixgb_adapter_stop(hw);
325 if(!ixgb_init_hw(&adapter->hw)) 326 if (!ixgb_init_hw(hw))
326 DPRINTK(PROBE, ERR, "ixgb_init_hw failed.\n"); 327 DPRINTK(PROBE, ERR, "ixgb_init_hw failed.\n");
328
329 /* restore frame size information */
330 IXGB_WRITE_REG(hw, MFS, hw->max_frame_size << IXGB_MFS_SHIFT);
331 if (hw->max_frame_size >
332 IXGB_MAX_ENET_FRAME_SIZE_WITHOUT_FCS + ENET_FCS_LENGTH) {
333 u32 ctrl0 = IXGB_READ_REG(hw, CTRL0);
334 if (!(ctrl0 & IXGB_CTRL0_JFE)) {
335 ctrl0 |= IXGB_CTRL0_JFE;
336 IXGB_WRITE_REG(hw, CTRL0, ctrl0);
337 }
338 }
327} 339}
328 340
329/** 341/**
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index db6a97d1d7b1..51bbd582f16c 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -1746,6 +1746,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
1746 PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "NE2K.cis"), 1746 PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "NE2K.cis"),
1747 PCMCIA_DEVICE_CIS_PROD_ID12("PMX ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "PE-200.cis"), 1747 PCMCIA_DEVICE_CIS_PROD_ID12("PMX ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "PE-200.cis"),
1748 PCMCIA_DEVICE_CIS_PROD_ID12("TAMARACK", "Ethernet", 0xcf434fba, 0x00b2e941, "tamarack.cis"), 1748 PCMCIA_DEVICE_CIS_PROD_ID12("TAMARACK", "Ethernet", 0xcf434fba, 0x00b2e941, "tamarack.cis"),
1749 PCMCIA_DEVICE_PROD_ID12("Ethernet", "CF Size PC Card", 0x00b2e941, 0x43ac239b),
1749 PCMCIA_DEVICE_PROD_ID123("Fast Ethernet", "CF Size PC Card", "1.0", 1750 PCMCIA_DEVICE_PROD_ID123("Fast Ethernet", "CF Size PC Card", "1.0",
1750 0xb4be14e3, 0x43ac239b, 0x0877b627), 1751 0xb4be14e3, 0x43ac239b, 0x0877b627),
1751 PCMCIA_DEVICE_NULL 1752 PCMCIA_DEVICE_NULL
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 121cb100f93a..9d80f1cf73ac 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -3737,7 +3737,7 @@ static int s2io_enable_msi_x(struct s2io_nic *nic)
3737} 3737}
3738 3738
3739/* Handle software interrupt used during MSI(X) test */ 3739/* Handle software interrupt used during MSI(X) test */
3740static irqreturn_t __devinit s2io_test_intr(int irq, void *dev_id) 3740static irqreturn_t s2io_test_intr(int irq, void *dev_id)
3741{ 3741{
3742 struct s2io_nic *sp = dev_id; 3742 struct s2io_nic *sp = dev_id;
3743 3743
@@ -3748,7 +3748,7 @@ static irqreturn_t __devinit s2io_test_intr(int irq, void *dev_id)
3748} 3748}
3749 3749
3750/* Test interrupt path by forcing a a software IRQ */ 3750/* Test interrupt path by forcing a a software IRQ */
3751static int __devinit s2io_test_msi(struct s2io_nic *sp) 3751static int s2io_test_msi(struct s2io_nic *sp)
3752{ 3752{
3753 struct pci_dev *pdev = sp->pdev; 3753 struct pci_dev *pdev = sp->pdev;
3754 struct XENA_dev_config __iomem *bar0 = sp->bar0; 3754 struct XENA_dev_config __iomem *bar0 = sp->bar0;
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index 720088396bb9..7eab072ae792 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -474,7 +474,7 @@ static inline void sis190_map_to_asic(struct RxDesc *desc, dma_addr_t mapping,
474static inline void sis190_make_unusable_by_asic(struct RxDesc *desc) 474static inline void sis190_make_unusable_by_asic(struct RxDesc *desc)
475{ 475{
476 desc->PSize = 0x0; 476 desc->PSize = 0x0;
477 desc->addr = 0xdeadbeef; 477 desc->addr = cpu_to_le32(0xdeadbeef);
478 desc->size &= cpu_to_le32(RingEnd); 478 desc->size &= cpu_to_le32(RingEnd);
479 wmb(); 479 wmb();
480 desc->status = 0x0; 480 desc->status = 0x0;
@@ -580,7 +580,7 @@ static int sis190_rx_interrupt(struct net_device *dev,
580 struct RxDesc *desc = tp->RxDescRing + entry; 580 struct RxDesc *desc = tp->RxDescRing + entry;
581 u32 status; 581 u32 status;
582 582
583 if (desc->status & OWNbit) 583 if (le32_to_cpu(desc->status) & OWNbit)
584 break; 584 break;
585 585
586 status = le32_to_cpu(desc->PSize); 586 status = le32_to_cpu(desc->PSize);
@@ -1381,7 +1381,7 @@ out:
1381 return rc; 1381 return rc;
1382} 1382}
1383 1383
1384static void __devexit sis190_mii_remove(struct net_device *dev) 1384static void sis190_mii_remove(struct net_device *dev)
1385{ 1385{
1386 struct sis190_private *tp = netdev_priv(dev); 1386 struct sis190_private *tp = netdev_priv(dev);
1387 1387
@@ -1538,9 +1538,9 @@ static int __devinit sis190_get_mac_addr_from_eeprom(struct pci_dev *pdev,
1538 1538
1539 /* Get MAC address from EEPROM */ 1539 /* Get MAC address from EEPROM */
1540 for (i = 0; i < MAC_ADDR_LEN / 2; i++) { 1540 for (i = 0; i < MAC_ADDR_LEN / 2; i++) {
1541 __le16 w = sis190_read_eeprom(ioaddr, EEPROMMACAddr + i); 1541 u16 w = sis190_read_eeprom(ioaddr, EEPROMMACAddr + i);
1542 1542
1543 ((u16 *)dev->dev_addr)[i] = le16_to_cpu(w); 1543 ((__le16 *)dev->dev_addr)[i] = cpu_to_le16(w);
1544 } 1544 }
1545 1545
1546 sis190_set_rgmii(tp, sis190_read_eeprom(ioaddr, EEPROMInfo)); 1546 sis190_set_rgmii(tp, sis190_read_eeprom(ioaddr, EEPROMInfo));
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 6197afb3ed83..a74fc11a6482 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -822,8 +822,13 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
822 822
823 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), rx_reg); 823 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), rx_reg);
824 824
825 /* Flush Rx MAC FIFO on any flow control or error */ 825 if (hw->chip_id == CHIP_ID_YUKON_XL) {
826 sky2_write16(hw, SK_REG(port, RX_GMF_FL_MSK), GMR_FS_ANY_ERR); 826 /* Hardware errata - clear flush mask */
827 sky2_write16(hw, SK_REG(port, RX_GMF_FL_MSK), 0);
828 } else {
829 /* Flush Rx MAC FIFO on any flow control or error */
830 sky2_write16(hw, SK_REG(port, RX_GMF_FL_MSK), GMR_FS_ANY_ERR);
831 }
827 832
828 /* Set threshold to 0xa (64 bytes) + 1 to workaround pause bug */ 833 /* Set threshold to 0xa (64 bytes) + 1 to workaround pause bug */
829 reg = RX_GMF_FL_THR_DEF + 1; 834 reg = RX_GMF_FL_THR_DEF + 1;
diff --git a/drivers/net/smc911x.h b/drivers/net/smc911x.h
index d04e4fa35206..7defa63b9c74 100644
--- a/drivers/net/smc911x.h
+++ b/drivers/net/smc911x.h
@@ -76,7 +76,7 @@
76 76
77 77
78 78
79#if SMC_USE_PXA_DMA 79#ifdef SMC_USE_PXA_DMA
80#define SMC_USE_DMA 80#define SMC_USE_DMA
81 81
82/* 82/*
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index bcc430bd9e49..6e00dc857afa 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -1742,7 +1742,7 @@ static void set_rx_mode(struct net_device *dev)
1742 if (vlan_group_get_device(np->vlgrp, i)) { 1742 if (vlan_group_get_device(np->vlgrp, i)) {
1743 if (vlan_count >= 32) 1743 if (vlan_count >= 32)
1744 break; 1744 break;
1745 writew(cpu_to_be16(i), filter_addr); 1745 writew(i, filter_addr);
1746 filter_addr += 16; 1746 filter_addr += 16;
1747 vlan_count++; 1747 vlan_count++;
1748 } 1748 }
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
index ff98f5d597f1..0a6186d4a48e 100644
--- a/drivers/net/sundance.c
+++ b/drivers/net/sundance.c
@@ -340,9 +340,9 @@ enum mac_ctrl1_bits {
340/* Note that using only 32 bit fields simplifies conversion to big-endian 340/* Note that using only 32 bit fields simplifies conversion to big-endian
341 architectures. */ 341 architectures. */
342struct netdev_desc { 342struct netdev_desc {
343 u32 next_desc; 343 __le32 next_desc;
344 u32 status; 344 __le32 status;
345 struct desc_frag { u32 addr, length; } frag[1]; 345 struct desc_frag { __le32 addr, length; } frag[1];
346}; 346};
347 347
348/* Bits in netdev_desc.status */ 348/* Bits in netdev_desc.status */
@@ -495,8 +495,8 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
495 goto err_out_res; 495 goto err_out_res;
496 496
497 for (i = 0; i < 3; i++) 497 for (i = 0; i < 3; i++)
498 ((u16 *)dev->dev_addr)[i] = 498 ((__le16 *)dev->dev_addr)[i] =
499 le16_to_cpu(eeprom_read(ioaddr, i + EEPROM_SA_OFFSET)); 499 cpu_to_le16(eeprom_read(ioaddr, i + EEPROM_SA_OFFSET));
500 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); 500 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
501 501
502 dev->base_addr = (unsigned long)ioaddr; 502 dev->base_addr = (unsigned long)ioaddr;
@@ -1090,8 +1090,8 @@ reset_tx (struct net_device *dev)
1090 skb = np->tx_skbuff[i]; 1090 skb = np->tx_skbuff[i];
1091 if (skb) { 1091 if (skb) {
1092 pci_unmap_single(np->pci_dev, 1092 pci_unmap_single(np->pci_dev,
1093 np->tx_ring[i].frag[0].addr, skb->len, 1093 le32_to_cpu(np->tx_ring[i].frag[0].addr),
1094 PCI_DMA_TODEVICE); 1094 skb->len, PCI_DMA_TODEVICE);
1095 if (irq) 1095 if (irq)
1096 dev_kfree_skb_irq (skb); 1096 dev_kfree_skb_irq (skb);
1097 else 1097 else
@@ -1214,7 +1214,7 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
1214 skb = np->tx_skbuff[entry]; 1214 skb = np->tx_skbuff[entry];
1215 /* Free the original skb. */ 1215 /* Free the original skb. */
1216 pci_unmap_single(np->pci_dev, 1216 pci_unmap_single(np->pci_dev,
1217 np->tx_ring[entry].frag[0].addr, 1217 le32_to_cpu(np->tx_ring[entry].frag[0].addr),
1218 skb->len, PCI_DMA_TODEVICE); 1218 skb->len, PCI_DMA_TODEVICE);
1219 dev_kfree_skb_irq (np->tx_skbuff[entry]); 1219 dev_kfree_skb_irq (np->tx_skbuff[entry]);
1220 np->tx_skbuff[entry] = NULL; 1220 np->tx_skbuff[entry] = NULL;
@@ -1233,7 +1233,7 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
1233 skb = np->tx_skbuff[entry]; 1233 skb = np->tx_skbuff[entry];
1234 /* Free the original skb. */ 1234 /* Free the original skb. */
1235 pci_unmap_single(np->pci_dev, 1235 pci_unmap_single(np->pci_dev,
1236 np->tx_ring[entry].frag[0].addr, 1236 le32_to_cpu(np->tx_ring[entry].frag[0].addr),
1237 skb->len, PCI_DMA_TODEVICE); 1237 skb->len, PCI_DMA_TODEVICE);
1238 dev_kfree_skb_irq (np->tx_skbuff[entry]); 1238 dev_kfree_skb_irq (np->tx_skbuff[entry]);
1239 np->tx_skbuff[entry] = NULL; 1239 np->tx_skbuff[entry] = NULL;
@@ -1311,19 +1311,19 @@ static void rx_poll(unsigned long data)
1311 && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { 1311 && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) {
1312 skb_reserve(skb, 2); /* 16 byte align the IP header */ 1312 skb_reserve(skb, 2); /* 16 byte align the IP header */
1313 pci_dma_sync_single_for_cpu(np->pci_dev, 1313 pci_dma_sync_single_for_cpu(np->pci_dev,
1314 desc->frag[0].addr, 1314 le32_to_cpu(desc->frag[0].addr),
1315 np->rx_buf_sz, 1315 np->rx_buf_sz,
1316 PCI_DMA_FROMDEVICE); 1316 PCI_DMA_FROMDEVICE);
1317 1317
1318 skb_copy_to_linear_data(skb, np->rx_skbuff[entry]->data, pkt_len); 1318 skb_copy_to_linear_data(skb, np->rx_skbuff[entry]->data, pkt_len);
1319 pci_dma_sync_single_for_device(np->pci_dev, 1319 pci_dma_sync_single_for_device(np->pci_dev,
1320 desc->frag[0].addr, 1320 le32_to_cpu(desc->frag[0].addr),
1321 np->rx_buf_sz, 1321 np->rx_buf_sz,
1322 PCI_DMA_FROMDEVICE); 1322 PCI_DMA_FROMDEVICE);
1323 skb_put(skb, pkt_len); 1323 skb_put(skb, pkt_len);
1324 } else { 1324 } else {
1325 pci_unmap_single(np->pci_dev, 1325 pci_unmap_single(np->pci_dev,
1326 desc->frag[0].addr, 1326 le32_to_cpu(desc->frag[0].addr),
1327 np->rx_buf_sz, 1327 np->rx_buf_sz,
1328 PCI_DMA_FROMDEVICE); 1328 PCI_DMA_FROMDEVICE);
1329 skb_put(skb = np->rx_skbuff[entry], pkt_len); 1329 skb_put(skb = np->rx_skbuff[entry], pkt_len);
@@ -1709,23 +1709,23 @@ static int netdev_close(struct net_device *dev)
1709 /* Free all the skbuffs in the Rx queue. */ 1709 /* Free all the skbuffs in the Rx queue. */
1710 for (i = 0; i < RX_RING_SIZE; i++) { 1710 for (i = 0; i < RX_RING_SIZE; i++) {
1711 np->rx_ring[i].status = 0; 1711 np->rx_ring[i].status = 0;
1712 np->rx_ring[i].frag[0].addr = 0xBADF00D0; /* An invalid address. */
1713 skb = np->rx_skbuff[i]; 1712 skb = np->rx_skbuff[i];
1714 if (skb) { 1713 if (skb) {
1715 pci_unmap_single(np->pci_dev, 1714 pci_unmap_single(np->pci_dev,
1716 np->rx_ring[i].frag[0].addr, np->rx_buf_sz, 1715 le32_to_cpu(np->rx_ring[i].frag[0].addr),
1717 PCI_DMA_FROMDEVICE); 1716 np->rx_buf_sz, PCI_DMA_FROMDEVICE);
1718 dev_kfree_skb(skb); 1717 dev_kfree_skb(skb);
1719 np->rx_skbuff[i] = NULL; 1718 np->rx_skbuff[i] = NULL;
1720 } 1719 }
1720 np->rx_ring[i].frag[0].addr = cpu_to_le32(0xBADF00D0); /* poison */
1721 } 1721 }
1722 for (i = 0; i < TX_RING_SIZE; i++) { 1722 for (i = 0; i < TX_RING_SIZE; i++) {
1723 np->tx_ring[i].next_desc = 0; 1723 np->tx_ring[i].next_desc = 0;
1724 skb = np->tx_skbuff[i]; 1724 skb = np->tx_skbuff[i];
1725 if (skb) { 1725 if (skb) {
1726 pci_unmap_single(np->pci_dev, 1726 pci_unmap_single(np->pci_dev,
1727 np->tx_ring[i].frag[0].addr, skb->len, 1727 le32_to_cpu(np->tx_ring[i].frag[0].addr),
1728 PCI_DMA_TODEVICE); 1728 skb->len, PCI_DMA_TODEVICE);
1729 dev_kfree_skb(skb); 1729 dev_kfree_skb(skb);
1730 np->tx_skbuff[i] = NULL; 1730 np->tx_skbuff[i] = NULL;
1731 } 1731 }
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 7f689907ac28..abac7db3819e 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3447,7 +3447,7 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
3447 u16 length, howmany = 0; 3447 u16 length, howmany = 0;
3448 u32 bd_status; 3448 u32 bd_status;
3449 u8 *bdBuffer; 3449 u8 *bdBuffer;
3450 struct net_device * dev; 3450 struct net_device *dev;
3451 3451
3452 ugeth_vdbg("%s: IN", __FUNCTION__); 3452 ugeth_vdbg("%s: IN", __FUNCTION__);
3453 3453
diff --git a/drivers/net/ucc_geth_mii.h b/drivers/net/ucc_geth_mii.h
index d83437039919..1e45b2028a50 100644
--- a/drivers/net/ucc_geth_mii.h
+++ b/drivers/net/ucc_geth_mii.h
@@ -96,5 +96,5 @@ enum enet_tbi_mii_reg {
96int uec_mdio_read(struct mii_bus *bus, int mii_id, int regnum); 96int uec_mdio_read(struct mii_bus *bus, int mii_id, int regnum);
97int uec_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value); 97int uec_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value);
98int __init uec_mdio_init(void); 98int __init uec_mdio_init(void);
99void __exit uec_mdio_exit(void); 99void uec_mdio_exit(void);
100#endif /* __UEC_MII_H */ 100#endif /* __UEC_MII_H */
diff --git a/drivers/s390/net/ctcmain.c b/drivers/s390/net/ctcmain.c
index 97adc701a819..77a503139e32 100644
--- a/drivers/s390/net/ctcmain.c
+++ b/drivers/s390/net/ctcmain.c
@@ -478,14 +478,14 @@ ctc_unpack_skb(struct channel *ch, struct sk_buff *pskb)
478 skb->dev = pskb->dev; 478 skb->dev = pskb->dev;
479 skb->protocol = pskb->protocol; 479 skb->protocol = pskb->protocol;
480 pskb->ip_summed = CHECKSUM_UNNECESSARY; 480 pskb->ip_summed = CHECKSUM_UNNECESSARY;
481 netif_rx_ni(skb);
482 /** 481 /**
483 * Successful rx; reset logflags 482 * reset logflags
484 */ 483 */
485 ch->logflags = 0; 484 ch->logflags = 0;
486 dev->last_rx = jiffies;
487 privptr->stats.rx_packets++; 485 privptr->stats.rx_packets++;
488 privptr->stats.rx_bytes += skb->len; 486 privptr->stats.rx_bytes += skb->len;
487 netif_rx_ni(skb);
488 dev->last_rx = jiffies;
489 if (len > 0) { 489 if (len > 0) {
490 skb_pull(pskb, header->length); 490 skb_pull(pskb, header->length);
491 if (skb_tailroom(pskb) < LL_HEADER_LENGTH) { 491 if (skb_tailroom(pskb) < LL_HEADER_LENGTH) {
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c
index 4d18d6419ddc..c7ea9381db9f 100644
--- a/drivers/s390/net/netiucv.c
+++ b/drivers/s390/net/netiucv.c
@@ -639,14 +639,14 @@ static void netiucv_unpack_skb(struct iucv_connection *conn,
639 skb->dev = pskb->dev; 639 skb->dev = pskb->dev;
640 skb->protocol = pskb->protocol; 640 skb->protocol = pskb->protocol;
641 pskb->ip_summed = CHECKSUM_UNNECESSARY; 641 pskb->ip_summed = CHECKSUM_UNNECESSARY;
642 privptr->stats.rx_packets++;
643 privptr->stats.rx_bytes += skb->len;
642 /* 644 /*
643 * Since receiving is always initiated from a tasklet (in iucv.c), 645 * Since receiving is always initiated from a tasklet (in iucv.c),
644 * we must use netif_rx_ni() instead of netif_rx() 646 * we must use netif_rx_ni() instead of netif_rx()
645 */ 647 */
646 netif_rx_ni(skb); 648 netif_rx_ni(skb);
647 dev->last_rx = jiffies; 649 dev->last_rx = jiffies;
648 privptr->stats.rx_packets++;
649 privptr->stats.rx_bytes += skb->len;
650 skb_pull(pskb, header->next); 650 skb_pull(pskb, header->next);
651 skb_put(pskb, NETIUCV_HDRLEN); 651 skb_put(pskb, NETIUCV_HDRLEN);
652 } 652 }
diff --git a/drivers/serial/suncore.c b/drivers/serial/suncore.c
index 70a09a3d5af0..707c5b03bce9 100644
--- a/drivers/serial/suncore.c
+++ b/drivers/serial/suncore.c
@@ -23,11 +23,36 @@
23 23
24#include "suncore.h" 24#include "suncore.h"
25 25
26int sunserial_current_minor = 64; 26static int sunserial_current_minor = 64;
27 27
28EXPORT_SYMBOL(sunserial_current_minor); 28int sunserial_register_minors(struct uart_driver *drv, int count)
29{
30 int err = 0;
31
32 drv->minor = sunserial_current_minor;
33 drv->nr += count;
34 /* Register the driver on the first call */
35 if (drv->nr == count)
36 err = uart_register_driver(drv);
37 if (err == 0) {
38 sunserial_current_minor += count;
39 drv->tty_driver->name_base = drv->minor - 64;
40 }
41 return err;
42}
43EXPORT_SYMBOL(sunserial_register_minors);
44
45void sunserial_unregister_minors(struct uart_driver *drv, int count)
46{
47 drv->nr -= count;
48 sunserial_current_minor -= count;
49
50 if (drv->nr == 0)
51 uart_unregister_driver(drv);
52}
53EXPORT_SYMBOL(sunserial_unregister_minors);
29 54
30int sunserial_console_match(struct console *con, struct device_node *dp, 55int __init sunserial_console_match(struct console *con, struct device_node *dp,
31 struct uart_driver *drv, int line) 56 struct uart_driver *drv, int line)
32{ 57{
33 int off; 58 int off;
@@ -133,8 +158,6 @@ sunserial_console_termios(struct console *con)
133 con->cflag = cflag; 158 con->cflag = cflag;
134} 159}
135 160
136EXPORT_SYMBOL(sunserial_console_termios);
137
138/* Sun serial MOUSE auto baud rate detection. */ 161/* Sun serial MOUSE auto baud rate detection. */
139static struct mouse_baud_cflag { 162static struct mouse_baud_cflag {
140 int baud; 163 int baud;
diff --git a/drivers/serial/suncore.h b/drivers/serial/suncore.h
index 829d7d65d6db..042668aa602e 100644
--- a/drivers/serial/suncore.h
+++ b/drivers/serial/suncore.h
@@ -22,7 +22,8 @@
22extern unsigned int suncore_mouse_baud_cflag_next(unsigned int, int *); 22extern unsigned int suncore_mouse_baud_cflag_next(unsigned int, int *);
23extern int suncore_mouse_baud_detection(unsigned char, int); 23extern int suncore_mouse_baud_detection(unsigned char, int);
24 24
25extern int sunserial_current_minor; 25extern int sunserial_register_minors(struct uart_driver *, int);
26extern void sunserial_unregister_minors(struct uart_driver *, int);
26 27
27extern int sunserial_console_match(struct console *, struct device_node *, 28extern int sunserial_console_match(struct console *, struct device_node *,
28 struct uart_driver *, int); 29 struct uart_driver *, int);
diff --git a/drivers/serial/sunhv.c b/drivers/serial/sunhv.c
index 8ff900b09811..be0fe152891b 100644
--- a/drivers/serial/sunhv.c
+++ b/drivers/serial/sunhv.c
@@ -562,16 +562,10 @@ static int __devinit hv_probe(struct of_device *op, const struct of_device_id *m
562 562
563 port->dev = &op->dev; 563 port->dev = &op->dev;
564 564
565 sunhv_reg.minor = sunserial_current_minor; 565 err = sunserial_register_minors(&sunhv_reg, 1);
566 sunhv_reg.nr = 1;
567
568 err = uart_register_driver(&sunhv_reg);
569 if (err) 566 if (err)
570 goto out_free_con_read_page; 567 goto out_free_con_read_page;
571 568
572 sunhv_reg.tty_driver->name_base = sunhv_reg.minor - 64;
573 sunserial_current_minor += 1;
574
575 sunserial_console_match(&sunhv_console, op->node, 569 sunserial_console_match(&sunhv_console, op->node,
576 &sunhv_reg, port->line); 570 &sunhv_reg, port->line);
577 571
@@ -591,8 +585,7 @@ out_remove_port:
591 uart_remove_one_port(&sunhv_reg, port); 585 uart_remove_one_port(&sunhv_reg, port);
592 586
593out_unregister_driver: 587out_unregister_driver:
594 sunserial_current_minor -= 1; 588 sunserial_unregister_minors(&sunhv_reg, 1);
595 uart_unregister_driver(&sunhv_reg);
596 589
597out_free_con_read_page: 590out_free_con_read_page:
598 kfree(con_read_page); 591 kfree(con_read_page);
@@ -614,8 +607,7 @@ static int __devexit hv_remove(struct of_device *dev)
614 607
615 uart_remove_one_port(&sunhv_reg, port); 608 uart_remove_one_port(&sunhv_reg, port);
616 609
617 sunserial_current_minor -= 1; 610 sunserial_unregister_minors(&sunhv_reg, 1);
618 uart_unregister_driver(&sunhv_reg);
619 611
620 kfree(port); 612 kfree(port);
621 sunhv_port = NULL; 613 sunhv_port = NULL;
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c
index ff610c23314b..543f93741e6f 100644
--- a/drivers/serial/sunsab.c
+++ b/drivers/serial/sunsab.c
@@ -832,7 +832,6 @@ static struct uart_driver sunsab_reg = {
832}; 832};
833 833
834static struct uart_sunsab_port *sunsab_ports; 834static struct uart_sunsab_port *sunsab_ports;
835static int num_channels;
836 835
837#ifdef CONFIG_SERIAL_SUNSAB_CONSOLE 836#ifdef CONFIG_SERIAL_SUNSAB_CONSOLE
838 837
@@ -1102,8 +1101,8 @@ static int __init sunsab_init(void)
1102{ 1101{
1103 struct device_node *dp; 1102 struct device_node *dp;
1104 int err; 1103 int err;
1104 int num_channels = 0;
1105 1105
1106 num_channels = 0;
1107 for_each_node_by_name(dp, "se") 1106 for_each_node_by_name(dp, "se")
1108 num_channels += 2; 1107 num_channels += 2;
1109 for_each_node_by_name(dp, "serial") { 1108 for_each_node_by_name(dp, "serial") {
@@ -1117,20 +1116,14 @@ static int __init sunsab_init(void)
1117 if (!sunsab_ports) 1116 if (!sunsab_ports)
1118 return -ENOMEM; 1117 return -ENOMEM;
1119 1118
1120 sunsab_reg.minor = sunserial_current_minor;
1121 sunsab_reg.nr = num_channels;
1122 sunsab_reg.cons = SUNSAB_CONSOLE(); 1119 sunsab_reg.cons = SUNSAB_CONSOLE();
1123 1120 err = sunserial_register_minors(&sunsab_reg, num_channels);
1124 err = uart_register_driver(&sunsab_reg);
1125 if (err) { 1121 if (err) {
1126 kfree(sunsab_ports); 1122 kfree(sunsab_ports);
1127 sunsab_ports = NULL; 1123 sunsab_ports = NULL;
1128 1124
1129 return err; 1125 return err;
1130 } 1126 }
1131
1132 sunsab_reg.tty_driver->name_base = sunsab_reg.minor - 64;
1133 sunserial_current_minor += num_channels;
1134 } 1127 }
1135 1128
1136 return of_register_driver(&sab_driver, &of_bus_type); 1129 return of_register_driver(&sab_driver, &of_bus_type);
@@ -1139,9 +1132,8 @@ static int __init sunsab_init(void)
1139static void __exit sunsab_exit(void) 1132static void __exit sunsab_exit(void)
1140{ 1133{
1141 of_unregister_driver(&sab_driver); 1134 of_unregister_driver(&sab_driver);
1142 if (num_channels) { 1135 if (sunsab_reg.nr) {
1143 sunserial_current_minor -= num_channels; 1136 sunserial_unregister_minors(&sunsab_reg, sunsab_reg.nr);
1144 uart_unregister_driver(&sunsab_reg);
1145 } 1137 }
1146 1138
1147 kfree(sunsab_ports); 1139 kfree(sunsab_ports);
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index e074943feff5..4e2302d43ab1 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -1528,14 +1528,12 @@ static struct of_platform_driver su_driver = {
1528 .remove = __devexit_p(su_remove), 1528 .remove = __devexit_p(su_remove),
1529}; 1529};
1530 1530
1531static int num_uart;
1532
1533static int __init sunsu_init(void) 1531static int __init sunsu_init(void)
1534{ 1532{
1535 struct device_node *dp; 1533 struct device_node *dp;
1536 int err; 1534 int err;
1535 int num_uart = 0;
1537 1536
1538 num_uart = 0;
1539 for_each_node_by_name(dp, "su") { 1537 for_each_node_by_name(dp, "su") {
1540 if (su_get_type(dp) == SU_PORT_PORT) 1538 if (su_get_type(dp) == SU_PORT_PORT)
1541 num_uart++; 1539 num_uart++;
@@ -1552,26 +1550,22 @@ static int __init sunsu_init(void)
1552 } 1550 }
1553 1551
1554 if (num_uart) { 1552 if (num_uart) {
1555 sunsu_reg.minor = sunserial_current_minor; 1553 err = sunserial_register_minors(&sunsu_reg, num_uart);
1556 sunsu_reg.nr = num_uart;
1557 err = uart_register_driver(&sunsu_reg);
1558 if (err) 1554 if (err)
1559 return err; 1555 return err;
1560 sunsu_reg.tty_driver->name_base = sunsu_reg.minor - 64;
1561 sunserial_current_minor += num_uart;
1562 } 1556 }
1563 1557
1564 err = of_register_driver(&su_driver, &of_bus_type); 1558 err = of_register_driver(&su_driver, &of_bus_type);
1565 if (err && num_uart) 1559 if (err && num_uart)
1566 uart_unregister_driver(&sunsu_reg); 1560 sunserial_unregister_minors(&sunsu_reg, num_uart);
1567 1561
1568 return err; 1562 return err;
1569} 1563}
1570 1564
1571static void __exit sunsu_exit(void) 1565static void __exit sunsu_exit(void)
1572{ 1566{
1573 if (num_uart) 1567 if (sunsu_reg.nr)
1574 uart_unregister_driver(&sunsu_reg); 1568 sunserial_unregister_minors(&sunsu_reg, sunsu_reg.nr);
1575} 1569}
1576 1570
1577module_init(sunsu_init); 1571module_init(sunsu_init);
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
index 283bef0d24cb..cb2e40506379 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/serial/sunzilog.c
@@ -63,10 +63,6 @@
63 readb(&((__channel)->control)) 63 readb(&((__channel)->control))
64#endif 64#endif
65 65
66static int num_sunzilog;
67#define NUM_SUNZILOG num_sunzilog
68#define NUM_CHANNELS (NUM_SUNZILOG * 2)
69
70#define ZS_CLOCK 4915200 /* Zilog input clock rate. */ 66#define ZS_CLOCK 4915200 /* Zilog input clock rate. */
71#define ZS_CLOCK_DIVISOR 16 /* Divisor this driver uses. */ 67#define ZS_CLOCK_DIVISOR 16 /* Divisor this driver uses. */
72 68
@@ -1031,18 +1027,19 @@ static struct uart_driver sunzilog_reg = {
1031 .major = TTY_MAJOR, 1027 .major = TTY_MAJOR,
1032}; 1028};
1033 1029
1034static int __init sunzilog_alloc_tables(void) 1030static int __init sunzilog_alloc_tables(int num_sunzilog)
1035{ 1031{
1036 struct uart_sunzilog_port *up; 1032 struct uart_sunzilog_port *up;
1037 unsigned long size; 1033 unsigned long size;
1034 int num_channels = num_sunzilog * 2;
1038 int i; 1035 int i;
1039 1036
1040 size = NUM_CHANNELS * sizeof(struct uart_sunzilog_port); 1037 size = num_channels * sizeof(struct uart_sunzilog_port);
1041 sunzilog_port_table = kzalloc(size, GFP_KERNEL); 1038 sunzilog_port_table = kzalloc(size, GFP_KERNEL);
1042 if (!sunzilog_port_table) 1039 if (!sunzilog_port_table)
1043 return -ENOMEM; 1040 return -ENOMEM;
1044 1041
1045 for (i = 0; i < NUM_CHANNELS; i++) { 1042 for (i = 0; i < num_channels; i++) {
1046 up = &sunzilog_port_table[i]; 1043 up = &sunzilog_port_table[i];
1047 1044
1048 spin_lock_init(&up->port.lock); 1045 spin_lock_init(&up->port.lock);
@@ -1050,13 +1047,13 @@ static int __init sunzilog_alloc_tables(void)
1050 if (i == 0) 1047 if (i == 0)
1051 sunzilog_irq_chain = up; 1048 sunzilog_irq_chain = up;
1052 1049
1053 if (i < NUM_CHANNELS - 1) 1050 if (i < num_channels - 1)
1054 up->next = up + 1; 1051 up->next = up + 1;
1055 else 1052 else
1056 up->next = NULL; 1053 up->next = NULL;
1057 } 1054 }
1058 1055
1059 size = NUM_SUNZILOG * sizeof(struct zilog_layout __iomem *); 1056 size = num_sunzilog * sizeof(struct zilog_layout __iomem *);
1060 sunzilog_chip_regs = kzalloc(size, GFP_KERNEL); 1057 sunzilog_chip_regs = kzalloc(size, GFP_KERNEL);
1061 if (!sunzilog_chip_regs) { 1058 if (!sunzilog_chip_regs) {
1062 kfree(sunzilog_port_table); 1059 kfree(sunzilog_port_table);
@@ -1496,34 +1493,28 @@ static int __init sunzilog_init(void)
1496 struct device_node *dp; 1493 struct device_node *dp;
1497 int err, uart_count; 1494 int err, uart_count;
1498 int num_keybms; 1495 int num_keybms;
1496 int num_sunzilog = 0;
1499 1497
1500 NUM_SUNZILOG = 0;
1501 num_keybms = 0; 1498 num_keybms = 0;
1502 for_each_node_by_name(dp, "zs") { 1499 for_each_node_by_name(dp, "zs") {
1503 NUM_SUNZILOG++; 1500 num_sunzilog++;
1504 if (of_find_property(dp, "keyboard", NULL)) 1501 if (of_find_property(dp, "keyboard", NULL))
1505 num_keybms++; 1502 num_keybms++;
1506 } 1503 }
1507 1504
1508 uart_count = 0; 1505 uart_count = 0;
1509 if (NUM_SUNZILOG) { 1506 if (num_sunzilog) {
1510 int uart_count; 1507 int uart_count;
1511 1508
1512 err = sunzilog_alloc_tables(); 1509 err = sunzilog_alloc_tables(num_sunzilog);
1513 if (err) 1510 if (err)
1514 goto out; 1511 goto out;
1515 1512
1516 uart_count = (NUM_SUNZILOG * 2) - (2 * num_keybms); 1513 uart_count = (num_sunzilog * 2) - (2 * num_keybms);
1517 1514
1518 sunzilog_reg.nr = uart_count; 1515 err = sunserial_register_minors(&sunzilog_reg, uart_count);
1519 sunzilog_reg.minor = sunserial_current_minor;
1520 err = uart_register_driver(&sunzilog_reg);
1521 if (err) 1516 if (err)
1522 goto out_free_tables; 1517 goto out_free_tables;
1523
1524 sunzilog_reg.tty_driver->name_base = sunzilog_reg.minor - 64;
1525
1526 sunserial_current_minor += uart_count;
1527 } 1518 }
1528 1519
1529 err = of_register_driver(&zs_driver, &of_bus_type); 1520 err = of_register_driver(&zs_driver, &of_bus_type);
@@ -1557,8 +1548,8 @@ out_unregister_driver:
1557 of_unregister_driver(&zs_driver); 1548 of_unregister_driver(&zs_driver);
1558 1549
1559out_unregister_uart: 1550out_unregister_uart:
1560 if (NUM_SUNZILOG) { 1551 if (num_sunzilog) {
1561 uart_unregister_driver(&sunzilog_reg); 1552 sunserial_unregister_minors(&sunzilog_reg, num_sunzilog);
1562 sunzilog_reg.cons = NULL; 1553 sunzilog_reg.cons = NULL;
1563 } 1554 }
1564 1555
@@ -1590,8 +1581,8 @@ static void __exit sunzilog_exit(void)
1590 zilog_irq = -1; 1581 zilog_irq = -1;
1591 } 1582 }
1592 1583
1593 if (NUM_SUNZILOG) { 1584 if (sunzilog_reg.nr) {
1594 uart_unregister_driver(&sunzilog_reg); 1585 sunserial_unregister_minors(&sunzilog_reg, sunzilog_reg.nr);
1595 sunzilog_free_tables(); 1586 sunzilog_free_tables();
1596 } 1587 }
1597} 1588}
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h
index 0fa5d5912555..4fd5d0eaa935 100644
--- a/include/media/videobuf-core.h
+++ b/include/media/videobuf-core.h
@@ -208,6 +208,8 @@ int videobuf_cgmbuf(struct videobuf_queue *q,
208int videobuf_streamon(struct videobuf_queue *q); 208int videobuf_streamon(struct videobuf_queue *q);
209int videobuf_streamoff(struct videobuf_queue *q); 209int videobuf_streamoff(struct videobuf_queue *q);
210 210
211void videobuf_stop(struct videobuf_queue *q);
212
211int videobuf_read_start(struct videobuf_queue *q); 213int videobuf_read_start(struct videobuf_queue *q);
212void videobuf_read_stop(struct videobuf_queue *q); 214void videobuf_read_stop(struct videobuf_queue *q);
213ssize_t videobuf_read_stream(struct videobuf_queue *q, 215ssize_t videobuf_read_stream(struct videobuf_queue *q,
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 5b183156307a..4add9bd4bc8d 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -124,8 +124,8 @@ static void __exit vlan_cleanup_module(void)
124{ 124{
125 int i; 125 int i;
126 126
127 vlan_netlink_fini();
128 vlan_ioctl_set(NULL); 127 vlan_ioctl_set(NULL);
128 vlan_netlink_fini();
129 129
130 /* Un-register us from receiving netdevice events */ 130 /* Un-register us from receiving netdevice events */
131 unregister_netdevice_notifier(&vlan_notifier_block); 131 unregister_netdevice_notifier(&vlan_notifier_block);
diff --git a/net/core/dev.c b/net/core/dev.c
index 86d62611f2fc..26a3a3a15be0 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3972,8 +3972,7 @@ void synchronize_net(void)
3972 * @dev: device 3972 * @dev: device
3973 * 3973 *
3974 * This function shuts down a device interface and removes it 3974 * This function shuts down a device interface and removes it
3975 * from the kernel tables. On success 0 is returned, on a failure 3975 * from the kernel tables.
3976 * a negative errno code is returned.
3977 * 3976 *
3978 * Callers must hold the rtnl semaphore. You may want 3977 * Callers must hold the rtnl semaphore. You may want
3979 * unregister_netdev() instead of this. 3978 * unregister_netdev() instead of this.
@@ -3991,8 +3990,7 @@ void unregister_netdevice(struct net_device *dev)
3991 * @dev: device 3990 * @dev: device
3992 * 3991 *
3993 * This function shuts down a device interface and removes it 3992 * This function shuts down a device interface and removes it
3994 * from the kernel tables. On success 0 is returned, on a failure 3993 * from the kernel tables.
3995 * a negative errno code is returned.
3996 * 3994 *
3997 * This is just a wrapper for unregister_netdevice that takes 3995 * This is just a wrapper for unregister_netdevice that takes
3998 * the rtnl semaphore. In general you want to use this and not 3996 * the rtnl semaphore. In general you want to use this and not
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 55d199e4ae21..3168c3de4919 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -516,8 +516,6 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh)
516 goto errout; 516 goto errout;
517 } 517 }
518 518
519 ipv4_devconf_setall(in_dev);
520
521 ifa = inet_alloc_ifa(); 519 ifa = inet_alloc_ifa();
522 if (ifa == NULL) { 520 if (ifa == NULL) {
523 /* 521 /*
@@ -528,6 +526,7 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh)
528 goto errout; 526 goto errout;
529 } 527 }
530 528
529 ipv4_devconf_setall(in_dev);
531 in_dev_hold(in_dev); 530 in_dev_hold(in_dev);
532 531
533 if (tb[IFA_ADDRESS] == NULL) 532 if (tb[IFA_ADDRESS] == NULL)
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index c31bccb9b526..1738113268bc 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -9,6 +9,7 @@
9#include <linux/pfkeyv2.h> 9#include <linux/pfkeyv2.h>
10#include <linux/random.h> 10#include <linux/random.h>
11#include <linux/spinlock.h> 11#include <linux/spinlock.h>
12#include <linux/in6.h>
12#include <net/icmp.h> 13#include <net/icmp.h>
13#include <net/protocol.h> 14#include <net/protocol.h>
14#include <net/udp.h> 15#include <net/udp.h>
@@ -224,6 +225,10 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
224 225
225 /* ... check padding bits here. Silly. :-) */ 226 /* ... check padding bits here. Silly. :-) */
226 227
228 /* RFC4303: Drop dummy packets without any error */
229 if (nexthdr[1] == IPPROTO_NONE)
230 goto out;
231
227 iph = ip_hdr(skb); 232 iph = ip_hdr(skb);
228 ihl = iph->ihl * 4; 233 ihl = iph->ihl * 4;
229 234
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 7db66f10e00d..444053254676 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -230,6 +230,12 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
230 } 230 }
231 /* ... check padding bits here. Silly. :-) */ 231 /* ... check padding bits here. Silly. :-) */
232 232
233 /* RFC4303: Drop dummy packets without any error */
234 if (nexthdr[1] == IPPROTO_NONE) {
235 ret = -EINVAL;
236 goto out;
237 }
238
233 pskb_trim(skb, skb->len - alen - padlen - 2); 239 pskb_trim(skb, skb->len - alen - padlen - 2);
234 ret = nexthdr[1]; 240 ret = nexthdr[1];
235 } 241 }
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 82e27b80d07d..b8e9eb445d74 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -233,7 +233,7 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int
233 dst_prev->output = dst_prev->xfrm->outer_mode->afinfo->output; 233 dst_prev->output = dst_prev->xfrm->outer_mode->afinfo->output;
234 /* Sheit... I remember I did this right. Apparently, 234 /* Sheit... I remember I did this right. Apparently,
235 * it was magically lost, so this code needs audit */ 235 * it was magically lost, so this code needs audit */
236 x->u.rt6.rt6i_flags = rt0->rt6i_flags&(RTCF_BROADCAST|RTCF_MULTICAST|RTCF_LOCAL); 236 x->u.rt6.rt6i_flags = rt0->rt6i_flags&(RTF_ANYCAST|RTF_LOCAL);
237 x->u.rt6.rt6i_metric = rt0->rt6i_metric; 237 x->u.rt6.rt6i_metric = rt0->rt6i_metric;
238 x->u.rt6.rt6i_node = rt0->rt6i_node; 238 x->u.rt6.rt6i_node = rt0->rt6i_node;
239 x->u.rt6.rt6i_gateway = rt0->rt6i_gateway; 239 x->u.rt6.rt6i_gateway = rt0->rt6i_gateway;
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 9a4cf2e45a15..b91b16671c1e 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1318,8 +1318,9 @@ restart:
1318 1318
1319 if (sk && sk->sk_policy[XFRM_POLICY_OUT]) { 1319 if (sk && sk->sk_policy[XFRM_POLICY_OUT]) {
1320 policy = xfrm_sk_policy_lookup(sk, XFRM_POLICY_OUT, fl); 1320 policy = xfrm_sk_policy_lookup(sk, XFRM_POLICY_OUT, fl);
1321 err = PTR_ERR(policy);
1321 if (IS_ERR(policy)) 1322 if (IS_ERR(policy))
1322 return PTR_ERR(policy); 1323 goto dropdst;
1323 } 1324 }
1324 1325
1325 if (!policy) { 1326 if (!policy) {
@@ -1330,8 +1331,9 @@ restart:
1330 1331
1331 policy = flow_cache_lookup(fl, dst_orig->ops->family, 1332 policy = flow_cache_lookup(fl, dst_orig->ops->family,
1332 dir, xfrm_policy_lookup); 1333 dir, xfrm_policy_lookup);
1334 err = PTR_ERR(policy);
1333 if (IS_ERR(policy)) 1335 if (IS_ERR(policy))
1334 return PTR_ERR(policy); 1336 goto dropdst;
1335 } 1337 }
1336 1338
1337 if (!policy) 1339 if (!policy)
@@ -1501,8 +1503,9 @@ restart:
1501 return 0; 1503 return 0;
1502 1504
1503error: 1505error:
1504 dst_release(dst_orig);
1505 xfrm_pols_put(pols, npols); 1506 xfrm_pols_put(pols, npols);
1507dropdst:
1508 dst_release(dst_orig);
1506 *dst_p = NULL; 1509 *dst_p = NULL;
1507 return err; 1510 return err;
1508} 1511}