]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branch 'fixes-jgarzik' of git://git.kernel.org/pub/scm/linux/kernel/git/linvill...
authorJeff Garzik <jeff@garzik.org>
Mon, 17 Dec 2007 23:05:43 +0000 (18:05 -0500)
committerJeff Garzik <jeff@garzik.org>
Mon, 17 Dec 2007 23:05:43 +0000 (18:05 -0500)
66 files changed:
Documentation/i2c/summary
arch/sparc64/kernel/smp.c
arch/um/drivers/net_kern.c
arch/xtensa/platform-iss/network.c
drivers/i2c/busses/i2c-davinci.c
drivers/i2c/busses/i2c-gpio.c
drivers/i2c/busses/i2c-omap.c
drivers/i2c/chips/isp1301_omap.c
drivers/media/common/saa7146_video.c
drivers/media/dvb/dvb-usb/Makefile
drivers/media/dvb/dvb-usb/dibusb-common.c
drivers/media/dvb/frontends/tda10086.c
drivers/media/dvb/frontends/zl10353.c
drivers/media/dvb/frontends/zl10353.h
drivers/media/video/bt8xx/bttv-cards.c
drivers/media/video/bt8xx/bttv-driver.c
drivers/media/video/cx88/cx88-blackbird.c
drivers/media/video/cx88/cx88-video.c
drivers/media/video/em28xx/em28xx-video.c
drivers/media/video/ivtv/ivtv-i2c.c
drivers/media/video/ivtv/ivtv-i2c.h
drivers/media/video/ivtv/ivtv-streams.c
drivers/media/video/saa5246a.c
drivers/media/video/saa5249.c
drivers/media/video/saa7134/saa7134-alsa.c
drivers/media/video/saa7134/saa7134-cards.c
drivers/media/video/saa7134/saa7134-core.c
drivers/media/video/saa7134/saa7134-dvb.c
drivers/media/video/saa7134/saa7134-empress.c
drivers/media/video/saa7134/saa7134-video.c
drivers/media/video/tvp5150.c
drivers/media/video/videobuf-core.c
drivers/media/video/videobuf-vmalloc.c
drivers/media/video/vivi.c
drivers/net/Kconfig
drivers/net/bnx2.c
drivers/net/bnx2.h
drivers/net/e100.c
drivers/net/hamachi.c
drivers/net/ibm_newemac/debug.c
drivers/net/ixgb/ixgb_main.c
drivers/net/pcmcia/pcnet_cs.c
drivers/net/s2io.c
drivers/net/sis190.c
drivers/net/sky2.c
drivers/net/smc911x.h
drivers/net/starfire.c
drivers/net/sundance.c
drivers/net/ucc_geth.c
drivers/net/ucc_geth_mii.h
drivers/s390/net/ctcmain.c
drivers/s390/net/netiucv.c
drivers/serial/suncore.c
drivers/serial/suncore.h
drivers/serial/sunhv.c
drivers/serial/sunsab.c
drivers/serial/sunsu.c
drivers/serial/sunzilog.c
include/media/videobuf-core.h
net/8021q/vlan.c
net/core/dev.c
net/ipv4/devinet.c
net/ipv4/esp4.c
net/ipv6/esp6.c
net/ipv6/xfrm6_policy.c
net/xfrm/xfrm_policy.c

index 003c7319b8c7a6dbae0881ae513474eea86f727b..13ab076dcd92484149eec9ef9e8bc1fc33031397 100644 (file)
@@ -1,5 +1,3 @@
-This is an explanation of what i2c is, and what is supported in this package.
-
 I2C and SMBus
 =============
 
@@ -33,52 +31,17 @@ When we talk about I2C, we use the following terms:
             Client
 
 An Algorithm driver contains general code that can be used for a whole class
-of I2C adapters. Each specific adapter driver depends on one algorithm
-driver.
+of I2C adapters. Each specific adapter driver either depends on one algorithm
+driver, or includes its own implementation.
 
 A Driver driver (yes, this sounds ridiculous, sorry) contains the general
 code to access some type of device. Each detected device gets its own
 data in the Client structure. Usually, Driver and Client are more closely
 integrated than Algorithm and Adapter.
 
-For a given configuration, you will need a driver for your I2C bus (usually
-a separate Adapter and Algorithm driver), and drivers for your I2C devices
-(usually one driver for each device). There are no I2C device drivers
-in this package. See the lm_sensors project http://www.lm-sensors.nu
-for device drivers.
+For a given configuration, you will need a driver for your I2C bus, and
+drivers for your I2C devices (usually one driver for each device).
 
 At this time, Linux only operates I2C (or SMBus) in master mode; you can't
 use these APIs to make a Linux system behave as a slave/device, either to
 speak a custom protocol or to emulate some other device.
-
-
-Included Bus Drivers
-====================
-Note that only stable drivers are patched into the kernel by 'mkpatch'.
-
-
-Base modules
-------------
-
-i2c-core: The basic I2C code, including the /proc/bus/i2c* interface
-i2c-dev:  The /dev/i2c-* interface
-i2c-proc: The /proc/sys/dev/sensors interface for device (client) drivers
-
-Algorithm drivers
------------------
-
-i2c-algo-bit:    A bit-banging algorithm
-i2c-algo-pcf:    A PCF 8584 style algorithm
-i2c-algo-ibm_ocp: An algorithm for the I2C device in IBM 4xx processors (NOT BUILT BY DEFAULT)
-
-Adapter drivers
----------------
-
-i2c-elektor:     Elektor ISA card (uses i2c-algo-pcf)
-i2c-elv:         ELV parallel port adapter (uses i2c-algo-bit)
-i2c-pcf-epp:     PCF8584 on a EPP parallel port (uses i2c-algo-pcf) (NOT mkpatched)
-i2c-philips-par: Philips style parallel port adapter (uses i2c-algo-bit)
-i2c-adap-ibm_ocp: IBM 4xx processor I2C device (uses i2c-algo-ibm_ocp) (NOT BUILT BY DEFAULT)
-i2c-pport:       Primitive parallel port adapter (uses i2c-algo-bit)
-i2c-velleman:    Velleman K8000 parallel port adapter (uses i2c-algo-bit)
-
index 894b506f963673ec081b16845978719b3f3997ba..c39944927f1ac7f39f8ddb36671216ca6c2c0162 100644 (file)
@@ -476,7 +476,7 @@ static inline void spitfire_xcall_deliver(u64 data0, u64 data1, u64 data2, cpuma
  */
 static void cheetah_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mask)
 {
-       u64 pstate, ver;
+       u64 pstate, ver, busy_mask;
        int nack_busy_id, is_jbus, need_more;
 
        if (cpus_empty(mask))
@@ -508,14 +508,20 @@ retry:
                               "i" (ASI_INTR_W));
 
        nack_busy_id = 0;
+       busy_mask = 0;
        {
                int i;
 
                for_each_cpu_mask(i, mask) {
                        u64 target = (i << 14) | 0x70;
 
-                       if (!is_jbus)
+                       if (is_jbus) {
+                               busy_mask |= (0x1UL << (i * 2));
+                       } else {
                                target |= (nack_busy_id << 24);
+                               busy_mask |= (0x1UL <<
+                                             (nack_busy_id * 2));
+                       }
                        __asm__ __volatile__(
                                "stxa   %%g0, [%0] %1\n\t"
                                "membar #Sync\n\t"
@@ -531,15 +537,16 @@ retry:
 
        /* Now, poll for completion. */
        {
-               u64 dispatch_stat;
+               u64 dispatch_stat, nack_mask;
                long stuck;
 
                stuck = 100000 * nack_busy_id;
+               nack_mask = busy_mask << 1;
                do {
                        __asm__ __volatile__("ldxa      [%%g0] %1, %0"
                                             : "=r" (dispatch_stat)
                                             : "i" (ASI_INTR_DISPATCH_STAT));
-                       if (dispatch_stat == 0UL) {
+                       if (!(dispatch_stat & (busy_mask | nack_mask))) {
                                __asm__ __volatile__("wrpr %0, 0x0, %%pstate"
                                                     : : "r" (pstate));
                                if (unlikely(need_more)) {
@@ -556,12 +563,12 @@ retry:
                        }
                        if (!--stuck)
                                break;
-               } while (dispatch_stat & 0x5555555555555555UL);
+               } while (dispatch_stat & busy_mask);
 
                __asm__ __volatile__("wrpr %0, 0x0, %%pstate"
                                     : : "r" (pstate));
 
-               if ((dispatch_stat & ~(0x5555555555555555UL)) == 0) {
+               if (dispatch_stat & busy_mask) {
                        /* Busy bits will not clear, continue instead
                         * of freezing up on this cpu.
                         */
index 73681f14f9fc17daaf3261fcf1562e33fb71fbfb..3c6c44ca1ffa5785e1d6f34618628fc75cfea831 100644 (file)
@@ -98,10 +98,10 @@ static int uml_net_rx(struct net_device *dev)
        if (pkt_len > 0) {
                skb_trim(skb, pkt_len);
                skb->protocol = (*lp->protocol)(skb);
-               netif_rx(skb);
 
                lp->stats.rx_bytes += skb->len;
                lp->stats.rx_packets++;
+               netif_rx(skb);
                return pkt_len;
        }
 
index b61fb36674e7f7e571aac77bb534165aa750d875..f21b9b0899a8e3ae277d08256aab7207940f0aa2 100644 (file)
@@ -393,11 +393,11 @@ static int iss_net_rx(struct net_device *dev)
        if (pkt_len > 0) {
                skb_trim(skb, pkt_len);
                skb->protocol = lp->tp.protocol(skb);
-       //      netif_rx(skb);
-               netif_rx_ni(skb);
 
                lp->stats.rx_bytes += skb->len;
                lp->stats.rx_packets++;
+       //      netif_rx(skb);
+               netif_rx_ni(skb);
                return pkt_len;
        }
        kfree_skb(skb);
index bd7aaff35240c89bd48505b5543c8a56f9737c03..67679882ebef8f36d2722035c09b4f700c4105fd 100644 (file)
@@ -404,7 +404,7 @@ static irqreturn_t i2c_davinci_isr(int this_irq, void *dev_id)
                                                      DAVINCI_I2C_STR_REG,
                                                      w);
                        } else
-                               dev_err(dev->dev, "RDR IRQ while no"
+                               dev_err(dev->dev, "RDR IRQ while no "
                                        "data requested\n");
                        break;
 
@@ -423,7 +423,7 @@ static irqreturn_t i2c_davinci_isr(int this_irq, void *dev_id)
                                                      DAVINCI_I2C_IMR_REG,
                                                      w);
                        } else
-                               dev_err(dev->dev, "TDR IRQ while no data to"
+                               dev_err(dev->dev, "TDR IRQ while no data to "
                                        "send\n");
                        break;
 
index 44e1cd21bb0130ae1e4b0251893c451a630c4a6d..3ca19fc234fb45122be765f517288aa419b3d516 100644 (file)
@@ -140,6 +140,7 @@ static int __init i2c_gpio_probe(struct platform_device *pdev)
        adap->owner = THIS_MODULE;
        snprintf(adap->name, sizeof(adap->name), "i2c-gpio%d", pdev->id);
        adap->algo_data = bit_data;
+       adap->class = I2C_CLASS_HWMON;
        adap->dev.parent = &pdev->dev;
 
        /*
index 89a30028ddb6e40d9cd00402936460e196a32f9b..cb55cf2ba1e91a4279f3406f34216b4a59f4094e 100644 (file)
@@ -203,7 +203,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
                while (!(omap_i2c_read_reg(dev, OMAP_I2C_SYSS_REG) &
                         OMAP_I2C_SYSS_RDONE)) {
                        if (time_after(jiffies, timeout)) {
-                               dev_warn(dev->dev, "timeout waiting"
+                               dev_warn(dev->dev, "timeout waiting "
                                                "for controller reset\n");
                                return -ETIMEDOUT;
                        }
@@ -483,7 +483,7 @@ omap_i2c_isr(int this_irq, void *dev_id)
                                        dev->buf_len--;
                                }
                        } else
-                               dev_err(dev->dev, "RRDY IRQ while no data"
+                               dev_err(dev->dev, "RRDY IRQ while no data "
                                                "requested\n");
                        omap_i2c_ack_stat(dev, OMAP_I2C_STAT_RRDY);
                        continue;
@@ -498,7 +498,7 @@ omap_i2c_isr(int this_irq, void *dev_id)
                                        dev->buf_len--;
                                }
                        } else
-                               dev_err(dev->dev, "XRDY IRQ while no"
+                               dev_err(dev->dev, "XRDY IRQ while no "
                                        "data to send\n");
                        omap_i2c_write_reg(dev, OMAP_I2C_DATA_REG, w);
                        omap_i2c_ack_stat(dev, OMAP_I2C_STAT_XRDY);
index fe04e46991aa9911967c267166c4b11db944cc6f..b767603a07ba38d41c08269e727823c89b910c47 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
 #include <linux/usb/ch9.h>
-#include <linux/usb_gadget.h>
+#include <linux/usb/gadget.h>
 #include <linux/usb.h>
 #include <linux/usb/otg.h>
 #include <linux/i2c.h>
index f245a3b2ef470e6819fcdc90d1458372646fa198..ae36d101006b6d0600898b76af319b95d90c1c31 100644 (file)
@@ -1205,13 +1205,10 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
                DEB_D(("VIDIOCGMBUF \n"));
 
                q = &fh->video_q;
-               mutex_lock(&q->lock);
                err = videobuf_mmap_setup(q,gbuffers,gbufsize,
                                          V4L2_MEMORY_MMAP);
-               if (err < 0) {
-                       mutex_unlock(&q->lock);
+               if (err < 0)
                        return err;
-               }
 
                gbuffers = err;
                memset(mbuf,0,sizeof(*mbuf));
@@ -1219,7 +1216,6 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
                mbuf->size   = gbuffers * gbufsize;
                for (i = 0; i < gbuffers; i++)
                        mbuf->offsets[i] = i * gbufsize;
-               mutex_unlock(&q->lock);
                return 0;
        }
 #endif
@@ -1440,10 +1436,7 @@ static void video_close(struct saa7146_dev *dev, struct file *file)
                err = saa7146_stop_preview(fh);
        }
 
-       // release all capture buffers
-       mutex_lock(&q->lock);
-       videobuf_read_stop(q);
-       mutex_unlock(&q->lock);
+       videobuf_stop(q);
 
        /* hmm, why is this function declared void? */
        /* return err */
index 73ac0a93fdebdfe2a68af50c2798a046c7d59b56..60a910052c16fa0c0488214b5daadd36782e38a5 100644 (file)
@@ -62,3 +62,6 @@ dvb-usb-af9005-remote-objs = af9005-remote.o
 obj-$(CONFIG_DVB_USB_AF9005_REMOTE) += dvb-usb-af9005-remote.o
 
 EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
+# due to tuner-xc3028
+EXTRA_CFLAGS += -Idrivers/media/video
+
index 9a184da01c47385ae4772c3a2ce45774b4b7a807..8ee6cd4da9e7c1053099792ef5ec0700bbd29ccf 100644 (file)
@@ -223,6 +223,9 @@ static struct dibx000_agc_config dib3000p_panasonic_agc_config = {
        .agc2_slope2 = 0x1e,
 };
 
+#if defined(CONFIG_DVB_DIB3000MC) ||                                   \
+       (defined(CONFIG_DVB_DIB3000MC_MODULE) && defined(MODULE))
+
 static struct dib3000mc_config mod3000p_dib3000p_config = {
        &dib3000p_panasonic_agc_config,
 
@@ -305,6 +308,7 @@ int dibusb_dib3000mc_tuner_attach(struct dvb_usb_adapter *adap)
        return 0;
 }
 EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach);
+#endif
 
 /*
  * common remote control stuff
index 9a8ddc537f8f338d9c055d186321a499d66e1b4c..9d26ace651518389d1cbd3255ee6b05ef83eba34 100644 (file)
@@ -158,7 +158,7 @@ static int tda10086_init(struct dvb_frontend* fe)
        tda10086_write_byte(state, 0x3d, 0x80);
 
        // setup SEC
-       tda10086_write_byte(state, 0x36, 0x00); // all SEC off
+       tda10086_write_byte(state, 0x36, 0x80); // all SEC off, no 22k tone
        tda10086_write_byte(state, 0x34, (((1<<19) * (22000/1000)) / (SACLK/1000)));      // } tone frequency
        tda10086_write_byte(state, 0x35, (((1<<19) * (22000/1000)) / (SACLK/1000)) >> 8); // }
 
@@ -183,13 +183,13 @@ static int tda10086_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone)
 
        dprintk ("%s\n", __FUNCTION__);
 
-       switch(tone) {
+       switch (tone) {
        case SEC_TONE_OFF:
-               tda10086_write_byte(state, 0x36, 0x00);
+               tda10086_write_byte(state, 0x36, 0x80);
                break;
 
        case SEC_TONE_ON:
-               tda10086_write_byte(state, 0x36, 0x01);
+               tda10086_write_byte(state, 0x36, 0x81);
                break;
        }
 
@@ -212,7 +212,7 @@ static int tda10086_send_master_cmd (struct dvb_frontend* fe,
        for(i=0; i< cmd->msg_len; i++) {
                tda10086_write_byte(state, 0x48+i, cmd->msg[i]);
        }
-       tda10086_write_byte(state, 0x36, 0x08 | ((cmd->msg_len - 1) << 4));
+       tda10086_write_byte(state, 0x36, 0x88 | ((cmd->msg_len - 1) << 4));
 
        tda10086_diseqc_wait(state);
 
@@ -230,11 +230,11 @@ static int tda10086_send_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t minic
 
        switch(minicmd) {
        case SEC_MINI_A:
-               tda10086_write_byte(state, 0x36, 0x04);
+               tda10086_write_byte(state, 0x36, 0x84);
                break;
 
        case SEC_MINI_B:
-               tda10086_write_byte(state, 0x36, 0x06);
+               tda10086_write_byte(state, 0x36, 0x86);
                break;
        }
 
index a97a7fd2c89132a596027619d8e3e9fbfedc6be9..0106df4c55e827da3410630463888b7bcecda789 100644 (file)
@@ -122,7 +122,7 @@ static void zl10353_calc_nominal_rate(struct dvb_frontend *fe,
                                      enum fe_bandwidth bandwidth,
                                      u16 *nominal_rate)
 {
-       u32 adc_clock = 22528; /* 20.480 MHz on the board(!?) */
+       u32 adc_clock = 45056; /* 45.056 MHz */
        u8 bw;
        struct zl10353_state *state = fe->demodulator_priv;
 
@@ -142,7 +142,7 @@ static void zl10353_calc_nominal_rate(struct dvb_frontend *fe,
                break;
        }
 
-       *nominal_rate = (64 * bw * (1<<16) / (7 * 8) * 4000 / adc_clock + 2) / 4;
+       *nominal_rate = (bw * (1 << 23) / 7 * 125 + adc_clock / 2) / adc_clock;
 
        dprintk("%s: bw %d, adc_clock %d => 0x%x\n",
                __FUNCTION__, bw, adc_clock, *nominal_rate);
index cb274dc12b82596ead31dfd1f5bf5667197992d5..1c3d494a6da9e3bd04ba06ba646c2d4c7beb5c0d 100644 (file)
@@ -30,7 +30,7 @@ struct zl10353_config
        u8 demod_address;
 
        /* frequencies in kHz */
-       int adc_clock;  // default: 22528
+       int adc_clock;  /* default: 45056 */
 
        /* set if no pll is connected to the secondary i2c bus */
        int no_tuner;
index 3abd9fa54d2cd5a856f8b0d2af24b57e88dec493..585d1ef95afdd6956d5dca05b50c524f4e5511d7 100644 (file)
@@ -5080,7 +5080,7 @@ static void PXC200_muxsel(struct bttv *btv, unsigned int input)
 /* ----------------------------------------------------------------------- */
 /* motherboard chipset specific stuff                                      */
 
-void __devinit bttv_check_chipset(void)
+void __init bttv_check_chipset(void)
 {
        int pcipci_fail = 0;
        struct pci_dev *dev = NULL;
index a88b56e6ca05c3c2d990e2313c2bd79b857124f6..c02d92deacd2aab2b1009ca573183c898b818d42 100644 (file)
@@ -3827,10 +3827,7 @@ static int bttv_release(struct inode *inode, struct file *file)
 
        /* stop vbi capture */
        if (check_btres(fh, RESOURCE_VBI)) {
-               if (fh->vbi.streaming)
-                       videobuf_streamoff(&fh->vbi);
-               if (fh->vbi.reading)
-                       videobuf_read_stop(&fh->vbi);
+               videobuf_stop(&fh->vbi);
                free_btres(btv,fh,RESOURCE_VBI);
        }
 
@@ -4988,7 +4985,7 @@ static struct pci_driver bttv_pci_driver = {
 #endif
 };
 
-static int bttv_init_module(void)
+static int __init bttv_init_module(void)
 {
        int ret;
 
@@ -5021,7 +5018,7 @@ static int bttv_init_module(void)
        return pci_register_driver(&bttv_pci_driver);
 }
 
-static void bttv_cleanup_module(void)
+static void __exit bttv_cleanup_module(void)
 {
        pci_unregister_driver(&bttv_pci_driver);
        bus_unregister(&bttv_sub_bus_type);
index f33f0b47142cd319b75942ab4d19ec269cb85922..f802b5653569874fa0a6dbef531c964566c784c8 100644 (file)
@@ -1085,10 +1085,7 @@ static int mpeg_release(struct inode *inode, struct file *file)
 
        cx8802_cancel_buffers(fh->dev);
        /* stop mpeg capture */
-       if (fh->mpegq.streaming)
-               videobuf_streamoff(&fh->mpegq);
-       if (fh->mpegq.reading)
-               videobuf_read_stop(&fh->mpegq);
+       videobuf_stop(&fh->mpegq);
 
        videobuf_mmap_free(&fh->mpegq);
        file->private_data = NULL;
index 5ee05f8f3fad3091d11e2d8381012f5533bbadaa..c84dafbdb991aae420a0f4bc80f3b8f71174110c 100644 (file)
@@ -851,10 +851,7 @@ static int video_release(struct inode *inode, struct file *file)
 
        /* stop vbi capture */
        if (res_check(fh, RESOURCE_VBI)) {
-               if (fh->vbiq.streaming)
-                       videobuf_streamoff(&fh->vbiq);
-               if (fh->vbiq.reading)
-                       videobuf_read_stop(&fh->vbiq);
+               videobuf_stop(&fh->vbiq);
                res_free(dev,fh,RESOURCE_VBI);
        }
 
index 2529c298b862a4c80c83404894783af34ca4534a..0906bc5766cc0b46becbe85735df042333c56b59 100644 (file)
@@ -144,7 +144,8 @@ static int em28xx_config(struct em28xx *dev)
 {
 
        /* Sets I2C speed to 100 KHz */
-       em28xx_write_regs_req(dev, 0x00, 0x06, "\x40", 1);
+       if (!dev->is_em2800)
+               em28xx_write_regs_req(dev, 0x00, 0x06, "\x40", 1);
 
        /* enable vbi capturing */
 
@@ -570,7 +571,9 @@ static void em28xx_vm_close(struct vm_area_struct *vma)
 {
        /* NOTE: buffers are not freed here */
        struct em28xx_frame_t *f = vma->vm_private_data;
-       f->vma_use_count--;
+
+       if (f->vma_use_count)
+               f->vma_use_count--;
 }
 
 static struct vm_operations_struct em28xx_vm_ops = {
index 623eea2652ca1fda2844d29b4c5cb0fb7c792163..77b27dc750b1bc9ef5592cbbad1a4e76cb7b2edd 100644 (file)
@@ -706,7 +706,7 @@ void ivtv_call_i2c_clients(struct ivtv *itv, unsigned int cmd, void *arg)
 }
 
 /* init + register i2c algo-bit adapter */
-int __devinit init_ivtv_i2c(struct ivtv *itv)
+int init_ivtv_i2c(struct ivtv *itv)
 {
        IVTV_DEBUG_I2C("i2c init\n");
 
index de6a07442298d44d6735cde7266a201a48cba39c..987042c09b643fb42ef4faabbb7843359e9bdd41 100644 (file)
@@ -35,7 +35,7 @@ int ivtv_call_i2c_client(struct ivtv *itv, int addr, unsigned int cmd, void *arg
 void ivtv_call_i2c_clients(struct ivtv *itv, unsigned int cmd, void *arg);
 
 /* init + register i2c algo-bit adapter */
-int __devinit init_ivtv_i2c(struct ivtv *itv);
+int init_ivtv_i2c(struct ivtv *itv);
 void exit_ivtv_i2c(struct ivtv *itv);
 
 #endif
index aa03e61ef310f59b84bc4372a23921c4f7517128..74fb0e021979eec1b805c8f16b34d14f21287ba6 100644 (file)
@@ -76,7 +76,7 @@ static struct {
        int minor_offset;
        int dma, pio;
        enum v4l2_buf_type buf_type;
-       struct file_operations *fops;
+       const struct file_operations *fops;
 } ivtv_stream_info[] = {
        {       /* IVTV_ENC_STREAM_TYPE_MPG */
                "encoder MPG",
index ad0232935df6fb760f176f97695f8ce81ed38957..996b49491f5a2f29c5ca6c3ed02604a47239faa1 100644 (file)
@@ -187,12 +187,14 @@ static int i2c_senddata(struct saa5246a_device *t, ...)
 {
        unsigned char buf[64];
        int v;
-       int ct=0;
+       int ct = 0;
        va_list argp;
-       va_start(argp,t);
+       va_start(argp, t);
 
-       while((v=va_arg(argp,int))!=-1)
-               buf[ct++]=v;
+       while ((v = va_arg(argp, int)) != -1)
+               buf[ct++] = v;
+
+       va_end(argp);
        return i2c_sendbuf(t, buf[0], ct-1, buf+1);
 }
 
index 94bb59a32b17e3e984dfb0ec03905ef99a4dc855..f55d6e85f20f34c59d93e4ae9a5f70c59ecd0a32 100644 (file)
@@ -282,12 +282,14 @@ static int i2c_senddata(struct saa5249_device *t, ...)
 {
        unsigned char buf[64];
        int v;
-       int ct=0;
+       int ct = 0;
        va_list argp;
        va_start(argp,t);
 
-       while((v=va_arg(argp,int))!=-1)
-               buf[ct++]=v;
+       while ((v = va_arg(argp, int)) != -1)
+               buf[ct++] = v;
+
+       va_end(argp);
        return i2c_sendbuf(t, buf[0], ct-1, buf+1);
 }
 
index b9c5cf7dc849224c1cfcd83da1f20ff074a29e1c..4878f3067787e5e046f3625e0510471cf6e38b0c 100644 (file)
@@ -222,7 +222,8 @@ static irqreturn_t saa7134_alsa_irq(int irq, void *dev_id)
 
                if (report & SAA7134_IRQ_REPORT_DONE_RA3) {
                        handled = 1;
-                       saa_writel(SAA7134_IRQ_REPORT,report);
+                       saa_writel(SAA7134_IRQ_REPORT,
+                                  SAA7134_IRQ_REPORT_DONE_RA3);
                        saa7134_irq_alsa_done(dev, status);
                } else {
                        goto out;
@@ -457,7 +458,7 @@ static struct snd_pcm_hardware snd_card_saa7134_capture =
        .buffer_bytes_max =     (256*1024),
        .period_bytes_min =     64,
        .period_bytes_max =     (256*1024),
-       .periods_min =          2,
+       .periods_min =          4,
        .periods_max =          1024,
 };
 
@@ -491,7 +492,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
 
        snd_assert(period_size >= 0x100 && period_size <= 0x10000,
                   return -EINVAL);
-       snd_assert(periods >= 2, return -EINVAL);
+       snd_assert(periods >= 4, return -EINVAL);
        snd_assert(period_size * periods <= 1024 * 1024, return -EINVAL);
 
        dev = saa7134->dev;
@@ -647,7 +648,14 @@ static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream)
                saa7134_tvaudio_setmute(dev);
        }
 
-       if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
+       err = snd_pcm_hw_constraint_integer(runtime,
+                                               SNDRV_PCM_HW_PARAM_PERIODS);
+       if (err < 0)
+               return err;
+
+       err = snd_pcm_hw_constraint_step(runtime, 0,
+                                               SNDRV_PCM_HW_PARAM_PERIODS, 2);
+       if (err < 0)
                return err;
 
        return 0;
index 4f3dad9ae6d6a3193434ee9ccfabad677b2791e1..c6eb1e37a46eaabbaaec05b062edd6a8fec63f4e 100644 (file)
@@ -334,7 +334,7 @@ struct saa7134_board saa7134_boards[] = {
                        .tv   = 1,
                },{
                        .name = name_comp1,
-                       .vmux = 2,
+                       .vmux = 0,
                        .amux = LINE1,
                },{
                        .name = name_comp2,
index a499eea379e65a4e3209ff5c464f5ac83c45b57a..4fd187ac9d7088378498f408c1b2efa2e732c142 100644 (file)
@@ -569,21 +569,22 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id)
        for (loop = 0; loop < 10; loop++) {
                report = saa_readl(SAA7134_IRQ_REPORT);
                status = saa_readl(SAA7134_IRQ_STATUS);
-               if (0 == report) {
-                       if (irq_debug > 1)
-                               printk(KERN_DEBUG "%s/irq: no (more) work\n",
-                                      dev->name);
-                       goto out;
-               }
-
-               /* If dmasound support is active and we get a sound report, exit
-                  and let the saa7134-alsa/oss module deal with it */
 
+               /* If dmasound support is active and we get a sound report,
+                * mask out the report and let the saa7134-alsa module deal
+                * with it */
                if ((report & SAA7134_IRQ_REPORT_DONE_RA3) &&
                        (dev->dmasound.priv_data != NULL) )
                {
                        if (irq_debug > 1)
-                               printk(KERN_DEBUG "%s/irq: ignoring interrupt for DMA sound\n",
+                               printk(KERN_DEBUG "%s/irq: preserving DMA sound interrupt\n",
+                                      dev->name);
+                       report &= ~SAA7134_IRQ_REPORT_DONE_RA3;
+               }
+
+               if (0 == report) {
+                       if (irq_debug > 1)
+                               printk(KERN_DEBUG "%s/irq: no (more) work\n",
                                       dev->name);
                        goto out;
                }
index 38d87332cc5dcd312fd815bece3d40709ee38c42..e1ab099ec4c62ecdf2fdebc4a018bb27e96f1272 100644 (file)
@@ -662,6 +662,7 @@ static struct tda1004x_config hauppauge_hvr_1110_config = {
        .if_freq       = TDA10046_FREQ_045,
        .i2c_gate      = 0x4b,
        .tuner_address = 0x61,
+       .tuner_config  = 1,
        .request_firmware = philips_tda1004x_request_firmware
 };
 
index 75d0c5bf46d284def842762960d060304e882a02..9322f44865b8341ee74976b76c0fb107e1bf0088 100644 (file)
@@ -110,11 +110,8 @@ static int ts_release(struct inode *inode, struct file *file)
 {
        struct saa7134_dev *dev = file->private_data;
 
-       if (dev->empress_tsq.streaming)
-               videobuf_streamoff(&dev->empress_tsq);
        mutex_lock(&dev->empress_tsq.lock);
-       if (dev->empress_tsq.reading)
-               videobuf_read_stop(&dev->empress_tsq);
+       videobuf_stop(&dev->empress_tsq);
        videobuf_mmap_free(&dev->empress_tsq);
        dev->empress_users--;
 
index 3b9ffb4b648a67fcf8eeb4eb5637fbec605a5e06..6396d9b5c0636ced4538fc47460078b54ec0c6d3 100644 (file)
@@ -1445,10 +1445,7 @@ static int video_release(struct inode *inode, struct file *file)
 
        /* stop vbi capture */
        if (res_check(fh, RESOURCE_VBI)) {
-               if (fh->vbi.streaming)
-                       videobuf_streamoff(&fh->vbi);
-               if (fh->vbi.reading)
-                       videobuf_read_stop(&fh->vbi);
+               videobuf_stop(&fh->vbi);
                res_free(dev,fh,RESOURCE_VBI);
        }
 
index 25d0aef88ef51392c69e15992cbc0fbcb93414f9..445eba4174d75b3c48b694fcf3dea2e769e9e541 100644 (file)
@@ -290,6 +290,7 @@ static inline void tvp5150_selmux(struct i2c_client *c)
        int opmode=0;
        struct tvp5150 *decoder = i2c_get_clientdata(c);
        int input = 0;
+       unsigned char val;
 
        if ((decoder->route.output & TVP5150_BLACK_SCREEN) || !decoder->enable)
                input = 8;
@@ -315,6 +316,16 @@ static inline void tvp5150_selmux(struct i2c_client *c)
 
        tvp5150_write(c, TVP5150_OP_MODE_CTL, opmode);
        tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, input);
+
+       /* Svideo should enable YCrCb output and disable GPCL output
+        * For Composite and TV, it should be the reverse
+        */
+       val = tvp5150_read(c, TVP5150_MISC_CTL);
+       if (decoder->route.input == TVP5150_SVIDEO)
+               val = (val & ~0x40) | 0x10;
+       else
+               val = (val & ~0x10) | 0x40;
+       tvp5150_write(c, TVP5150_MISC_CTL, val);
 };
 
 struct i2c_reg_value {
index 89a44f16f0ba50892be204f19f66c576cf46a2e1..81f77d2b4bd39c48edeff93d548b66ff989f518f 100644 (file)
@@ -141,6 +141,7 @@ void videobuf_queue_core_init(struct videobuf_queue* q,
        INIT_LIST_HEAD(&q->stream);
 }
 
+/* Locking: Only usage in bttv unsafe find way to remove */
 int videobuf_queue_is_busy(struct videobuf_queue *q)
 {
        int i;
@@ -178,6 +179,7 @@ int videobuf_queue_is_busy(struct videobuf_queue *q)
        return 0;
 }
 
+/* Locking: Caller holds q->lock */
 void videobuf_queue_cancel(struct videobuf_queue *q)
 {
        unsigned long flags=0;
@@ -208,6 +210,7 @@ void videobuf_queue_cancel(struct videobuf_queue *q)
 
 /* --------------------------------------------------------------------- */
 
+/* Locking: Caller holds q->lock */
 enum v4l2_field videobuf_next_field(struct videobuf_queue *q)
 {
        enum v4l2_field field = q->field;
@@ -226,6 +229,7 @@ enum v4l2_field videobuf_next_field(struct videobuf_queue *q)
        return field;
 }
 
+/* Locking: Caller holds q->lock */
 static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b,
                            struct videobuf_buffer *vb, enum v4l2_buf_type type)
 {
@@ -281,20 +285,108 @@ static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b,
        b->sequence  = vb->field_count >> 1;
 }
 
+/* Locking: Caller holds q->lock */
+static int __videobuf_mmap_free(struct videobuf_queue *q)
+{
+       int i;
+       int rc;
+
+       if (!q)
+               return 0;
+
+       MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS);
+
+       rc  = CALL(q,mmap_free,q);
+       if (rc<0)
+               return rc;
+
+       for (i = 0; i < VIDEO_MAX_FRAME; i++) {
+               if (NULL == q->bufs[i])
+                       continue;
+               q->ops->buf_release(q,q->bufs[i]);
+               kfree(q->bufs[i]);
+               q->bufs[i] = NULL;
+       }
+
+       return rc;
+}
+
+int videobuf_mmap_free(struct videobuf_queue *q)
+{
+       int ret;
+       mutex_lock(&q->lock);
+       ret = __videobuf_mmap_free(q);
+       mutex_unlock(&q->lock);
+       return ret;
+}
+
+/* Locking: Caller holds q->lock */
+static int __videobuf_mmap_setup(struct videobuf_queue *q,
+                       unsigned int bcount, unsigned int bsize,
+                       enum v4l2_memory memory)
+{
+       unsigned int i;
+       int err;
+
+       MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS);
+
+       err = __videobuf_mmap_free(q);
+       if (0 != err)
+               return err;
+
+       /* Allocate and initialize buffers */
+       for (i = 0; i < bcount; i++) {
+               q->bufs[i] = videobuf_alloc(q);
+
+               if (q->bufs[i] == NULL)
+                       break;
+
+               q->bufs[i]->i      = i;
+               q->bufs[i]->input  = UNSET;
+               q->bufs[i]->memory = memory;
+               q->bufs[i]->bsize  = bsize;
+               switch (memory) {
+               case V4L2_MEMORY_MMAP:
+                       q->bufs[i]->boff  = bsize * i;
+                       break;
+               case V4L2_MEMORY_USERPTR:
+               case V4L2_MEMORY_OVERLAY:
+                       /* nothing */
+                       break;
+               }
+       }
+
+       if (!i)
+               return -ENOMEM;
+
+       dprintk(1,"mmap setup: %d buffers, %d bytes each\n",
+               i, bsize);
+
+       return i;
+}
+
+int videobuf_mmap_setup(struct videobuf_queue *q,
+                       unsigned int bcount, unsigned int bsize,
+                       enum v4l2_memory memory)
+{
+       int ret;
+       mutex_lock(&q->lock);
+       ret = __videobuf_mmap_setup(q, bcount, bsize, memory);
+       mutex_unlock(&q->lock);
+       return ret;
+}
+
 int videobuf_reqbufs(struct videobuf_queue *q,
                 struct v4l2_requestbuffers *req)
 {
        unsigned int size,count;
        int retval;
 
-       if (req->type != q->type) {
-               dprintk(1,"reqbufs: queue type invalid\n");
-               return -EINVAL;
-       }
        if (req->count < 1) {
                dprintk(1,"reqbufs: count invalid (%d)\n",req->count);
                return -EINVAL;
        }
+
        if (req->memory != V4L2_MEMORY_MMAP     &&
            req->memory != V4L2_MEMORY_USERPTR  &&
            req->memory != V4L2_MEMORY_OVERLAY) {
@@ -303,6 +395,12 @@ int videobuf_reqbufs(struct videobuf_queue *q,
        }
 
        mutex_lock(&q->lock);
+       if (req->type != q->type) {
+               dprintk(1,"reqbufs: queue type invalid\n");
+               retval = -EINVAL;
+               goto done;
+       }
+
        if (q->streaming) {
                dprintk(1,"reqbufs: streaming already exists\n");
                retval = -EBUSY;
@@ -323,7 +421,7 @@ int videobuf_reqbufs(struct videobuf_queue *q,
        dprintk(1,"reqbufs: bufs=%d, size=0x%x [%d pages total]\n",
                count, size, (count*size)>>PAGE_SHIFT);
 
-       retval = videobuf_mmap_setup(q,count,size,req->memory);
+       retval = __videobuf_mmap_setup(q,count,size,req->memory);
        if (retval < 0) {
                dprintk(1,"reqbufs: mmap setup returned %d\n",retval);
                goto done;
@@ -338,20 +436,28 @@ int videobuf_reqbufs(struct videobuf_queue *q,
 
 int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b)
 {
+       int ret = -EINVAL;
+
+       mutex_lock(&q->lock);
        if (unlikely(b->type != q->type)) {
                dprintk(1,"querybuf: Wrong type.\n");
-               return -EINVAL;
+               goto done;
        }
        if (unlikely(b->index < 0 || b->index >= VIDEO_MAX_FRAME)) {
                dprintk(1,"querybuf: index out of range.\n");
-               return -EINVAL;
+               goto done;
        }
        if (unlikely(NULL == q->bufs[b->index])) {
                dprintk(1,"querybuf: buffer is null.\n");
-               return -EINVAL;
+               goto done;
        }
+
        videobuf_status(q,b,q->bufs[b->index],q->type);
-       return 0;
+
+       ret = 0;
+done:
+       mutex_unlock(&q->lock);
+       return ret;
 }
 
 int videobuf_qbuf(struct videobuf_queue *q,
@@ -541,22 +647,30 @@ int videobuf_streamon(struct videobuf_queue *q)
        return retval;
 }
 
-int videobuf_streamoff(struct videobuf_queue *q)
+/* Locking: Caller holds q->lock */
+static int __videobuf_streamoff(struct videobuf_queue *q)
 {
-       int retval = -EINVAL;
-
-       mutex_lock(&q->lock);
        if (!q->streaming)
-               goto done;
+               return -EINVAL;
+
        videobuf_queue_cancel(q);
        q->streaming = 0;
-       retval = 0;
 
- done:
+       return 0;
+}
+
+int videobuf_streamoff(struct videobuf_queue *q)
+{
+       int retval;
+
+       mutex_lock(&q->lock);
+       retval = __videobuf_streamoff(q);
        mutex_unlock(&q->lock);
+
        return retval;
 }
 
+/* Locking: Caller holds q->lock */
 static ssize_t videobuf_read_zerocopy(struct videobuf_queue *q,
                                      char __user *data,
                                      size_t count, loff_t *ppos)
@@ -691,7 +805,8 @@ ssize_t videobuf_read_one(struct videobuf_queue *q,
        return retval;
 }
 
-int videobuf_read_start(struct videobuf_queue *q)
+/* Locking: Caller holds q->lock */
+int __videobuf_read_start(struct videobuf_queue *q)
 {
        enum v4l2_field field;
        unsigned long flags=0;
@@ -705,7 +820,7 @@ int videobuf_read_start(struct videobuf_queue *q)
                count = VIDEO_MAX_FRAME;
        size = PAGE_ALIGN(size);
 
-       err = videobuf_mmap_setup(q, count, size, V4L2_MEMORY_USERPTR);
+       err = __videobuf_mmap_setup(q, count, size, V4L2_MEMORY_USERPTR);
        if (err < 0)
                return err;
 
@@ -728,12 +843,13 @@ int videobuf_read_start(struct videobuf_queue *q)
        return 0;
 }
 
-void videobuf_read_stop(struct videobuf_queue *q)
+static void __videobuf_read_stop(struct videobuf_queue *q)
 {
        int i;
 
+
        videobuf_queue_cancel(q);
-       videobuf_mmap_free(q);
+       __videobuf_mmap_free(q);
        INIT_LIST_HEAD(&q->stream);
        for (i = 0; i < VIDEO_MAX_FRAME; i++) {
                if (NULL == q->bufs[i])
@@ -743,8 +859,41 @@ void videobuf_read_stop(struct videobuf_queue *q)
        }
        q->read_buf = NULL;
        q->reading  = 0;
+       
 }
 
+int videobuf_read_start(struct videobuf_queue *q)
+{
+       int rc;
+
+       mutex_lock(&q->lock);
+       rc = __videobuf_read_start(q);
+       mutex_unlock(&q->lock);
+
+       return rc;
+}
+
+void videobuf_read_stop(struct videobuf_queue *q)
+{
+       mutex_lock(&q->lock);
+       __videobuf_read_stop(q);
+       mutex_unlock(&q->lock);
+}
+
+void videobuf_stop(struct videobuf_queue *q)
+{
+       mutex_lock(&q->lock);
+
+       if (q->streaming)
+               __videobuf_streamoff(q);
+
+       if (q->reading)
+               __videobuf_read_stop(q);
+
+       mutex_unlock(&q->lock);
+}
+
+
 ssize_t videobuf_read_stream(struct videobuf_queue *q,
                             char __user *data, size_t count, loff_t *ppos,
                             int vbihack, int nonblocking)
@@ -858,75 +1007,6 @@ unsigned int videobuf_poll_stream(struct file *file,
        return rc;
 }
 
-int videobuf_mmap_setup(struct videobuf_queue *q,
-                       unsigned int bcount, unsigned int bsize,
-                       enum v4l2_memory memory)
-{
-       unsigned int i;
-       int err;
-
-       MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS);
-
-       err = videobuf_mmap_free(q);
-       if (0 != err)
-               return err;
-
-       /* Allocate and initialize buffers */
-       for (i = 0; i < bcount; i++) {
-               q->bufs[i] = videobuf_alloc(q);
-
-               if (q->bufs[i] == NULL)
-                       break;
-
-               q->bufs[i]->i      = i;
-               q->bufs[i]->input  = UNSET;
-               q->bufs[i]->memory = memory;
-               q->bufs[i]->bsize  = bsize;
-               switch (memory) {
-               case V4L2_MEMORY_MMAP:
-                       q->bufs[i]->boff  = bsize * i;
-                       break;
-               case V4L2_MEMORY_USERPTR:
-               case V4L2_MEMORY_OVERLAY:
-                       /* nothing */
-                       break;
-               }
-       }
-
-       if (!i)
-               return -ENOMEM;
-
-       dprintk(1,"mmap setup: %d buffers, %d bytes each\n",
-               i, bsize);
-
-       return i;
-}
-
-int videobuf_mmap_free(struct videobuf_queue *q)
-{
-       int i;
-       int rc;
-
-       if (!q)
-               return 0;
-
-       MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS);
-
-       rc  = CALL(q,mmap_free,q);
-       if (rc<0)
-               return rc;
-
-       for (i = 0; i < VIDEO_MAX_FRAME; i++) {
-               if (NULL == q->bufs[i])
-                       continue;
-               q->ops->buf_release(q,q->bufs[i]);
-               kfree(q->bufs[i]);
-               q->bufs[i] = NULL;
-       }
-
-       return rc;
-}
-
 int videobuf_mmap_mapper(struct videobuf_queue *q,
                         struct vm_area_struct *vma)
 {
@@ -991,6 +1071,7 @@ EXPORT_SYMBOL_GPL(videobuf_streamoff);
 
 EXPORT_SYMBOL_GPL(videobuf_read_start);
 EXPORT_SYMBOL_GPL(videobuf_read_stop);
+EXPORT_SYMBOL_GPL(videobuf_stop);
 EXPORT_SYMBOL_GPL(videobuf_read_stream);
 EXPORT_SYMBOL_GPL(videobuf_read_one);
 EXPORT_SYMBOL_GPL(videobuf_poll_stream);
index cd74341c984fd0cd37678c955e5689b2b55697ea..e01259438bb2755bd8bf284554675145282086aa 100644 (file)
@@ -51,7 +51,7 @@ videobuf_vm_open(struct vm_area_struct *vma)
 {
        struct videobuf_mapping *map = vma->vm_private_data;
 
-       dprintk(2,"vm_open %p [count=%d,vma=%08lx-%08lx]\n",map,
+       dprintk(2,"vm_open %p [count=%u,vma=%08lx-%08lx]\n",map,
                map->count,vma->vm_start,vma->vm_end);
 
        map->count++;
@@ -64,7 +64,7 @@ videobuf_vm_close(struct vm_area_struct *vma)
        struct videobuf_queue *q = map->q;
        int i;
 
-       dprintk(2,"vm_close %p [count=%d,vma=%08lx-%08lx]\n",map,
+       dprintk(2,"vm_close %p [count=%u,vma=%08lx-%08lx]\n",map,
                map->count,vma->vm_start,vma->vm_end);
 
        map->count--;
@@ -221,7 +221,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,
        }
 
        /* create mapping + update buffer list */
-       map = q->bufs[first]->map = kmalloc(sizeof(struct videobuf_mapping),GFP_KERNEL);
+       map = q->bufs[first]->map = kzalloc(sizeof(struct videobuf_mapping),GFP_KERNEL);
        if (NULL == map)
                return -ENOMEM;
 
index ee73dc75131ccb5348089ed9548f737937d4cc0c..9b54ff9d2e36210209d2335489fb5fb1fd901ad6 100644 (file)
@@ -1076,6 +1076,7 @@ static int vivi_release(struct inode *inode, struct file *file)
        int minor = iminor(inode);
 
        vivi_stop_thread(vidq);
+       videobuf_stop(&fh->vb_vidq);
        videobuf_mmap_free(&fh->vb_vidq);
 
        kfree (fh);
index 6cde4edc846b1f20f4a28ed67f4d3d00ed5a2988..d9107e542dface363ef53d71339361d99f7619de 100644 (file)
@@ -2588,7 +2588,6 @@ config MLX4_DEBUG
 config TEHUTI
        tristate "Tehuti Networks 10G Ethernet"
        depends on PCI
-       select ZLIB_INFLATE
        help
          Tehuti Networks 10G Ethernet NIC
 
index da767d3d5af5bb552a6d0dce0792112a3179fc6c..4e7b46e44874ea94f33015a9c058fc2969e95dd9 100644 (file)
@@ -56,8 +56,8 @@
 
 #define DRV_MODULE_NAME                "bnx2"
 #define PFX DRV_MODULE_NAME    ": "
-#define DRV_MODULE_VERSION     "1.6.8"
-#define DRV_MODULE_RELDATE     "October 17, 2007"
+#define DRV_MODULE_VERSION     "1.6.9"
+#define DRV_MODULE_RELDATE     "December 8, 2007"
 
 #define RUN_AT(x) (jiffies + (x))
 
@@ -2387,18 +2387,24 @@ bnx2_reuse_rx_skb(struct bnx2 *bp, struct sk_buff *skb,
        prod_bd->rx_bd_haddr_lo = cons_bd->rx_bd_haddr_lo;
 }
 
+static inline u16
+bnx2_get_hw_rx_cons(struct bnx2 *bp)
+{
+       u16 cons = bp->status_blk->status_rx_quick_consumer_index0;
+
+       if (unlikely((cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT))
+               cons++;
+       return cons;
+}
+
 static int
 bnx2_rx_int(struct bnx2 *bp, int budget)
 {
-       struct status_block *sblk = bp->status_blk;
        u16 hw_cons, sw_cons, sw_ring_cons, sw_prod, sw_ring_prod;
        struct l2_fhdr *rx_hdr;
        int rx_pkt = 0;
 
-       hw_cons = bp->hw_rx_cons = sblk->status_rx_quick_consumer_index0;
-       if ((hw_cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT) {
-               hw_cons++;
-       }
+       hw_cons = bnx2_get_hw_rx_cons(bp);
        sw_cons = bp->rx_cons;
        sw_prod = bp->rx_prod;
 
@@ -2515,10 +2521,7 @@ next_rx:
 
                /* Refresh hw_cons to see if there is new work */
                if (sw_cons == hw_cons) {
-                       hw_cons = bp->hw_rx_cons =
-                               sblk->status_rx_quick_consumer_index0;
-                       if ((hw_cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT)
-                               hw_cons++;
+                       hw_cons = bnx2_get_hw_rx_cons(bp);
                        rmb();
                }
        }
@@ -2622,7 +2625,7 @@ bnx2_has_work(struct bnx2 *bp)
 {
        struct status_block *sblk = bp->status_blk;
 
-       if ((sblk->status_rx_quick_consumer_index0 != bp->hw_rx_cons) ||
+       if ((bnx2_get_hw_rx_cons(bp) != bp->rx_cons) ||
            (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons))
                return 1;
 
@@ -2655,7 +2658,7 @@ static int bnx2_poll_work(struct bnx2 *bp, int work_done, int budget)
        if (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons)
                bnx2_tx_int(bp);
 
-       if (sblk->status_rx_quick_consumer_index0 != bp->hw_rx_cons)
+       if (bnx2_get_hw_rx_cons(bp) != bp->rx_cons)
                work_done += bnx2_rx_int(bp, budget - work_done);
 
        return work_done;
@@ -4177,7 +4180,6 @@ bnx2_init_rx_ring(struct bnx2 *bp)
 
        ring_prod = prod = bp->rx_prod = 0;
        bp->rx_cons = 0;
-       bp->hw_rx_cons = 0;
        bp->rx_prod_bseq = 0;
 
        for (i = 0; i < bp->rx_max_ring; i++) {
@@ -6685,8 +6687,9 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
        } else if (CHIP_NUM(bp) == CHIP_NUM_5706 ||
                   CHIP_NUM(bp) == CHIP_NUM_5708)
                bp->phy_flags |= PHY_CRC_FIX_FLAG;
-       else if (CHIP_ID(bp) == CHIP_ID_5709_A0 ||
-                CHIP_ID(bp) == CHIP_ID_5709_A1)
+       else if (CHIP_NUM(bp) == CHIP_NUM_5709 &&
+                (CHIP_REV(bp) == CHIP_REV_Ax ||
+                 CHIP_REV(bp) == CHIP_REV_Bx))
                bp->phy_flags |= PHY_DIS_EARLY_DAC_FLAG;
 
        if ((CHIP_ID(bp) == CHIP_ID_5708_A0) ||
index 1dce0d1a258167139e591381fcdff21681e20421..30ba366608b0dd4f1e83ca59ee881f0979e562c0 100644 (file)
@@ -6513,7 +6513,6 @@ struct bnx2 {
        u32                     rx_prod_bseq;
        u16                     rx_prod;
        u16                     rx_cons;
-       u16                     hw_rx_cons;
 
        u32                     rx_csum;
 
index e1c8a0d023ea13546f5cb4fb006dfa503a874d45..2b06e4b4dabc1342fa66101c7a4f0628da5b3bf7 100644 (file)
@@ -2737,8 +2737,9 @@ static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
                pci_enable_wake(pdev, PCI_D3cold, 0);
        }
 
-       pci_disable_device(pdev);
        free_irq(pdev->irq, netdev);
+
+       pci_disable_device(pdev);
        pci_set_power_state(pdev, PCI_D3hot);
 
        return 0;
@@ -2780,6 +2781,8 @@ static void e100_shutdown(struct pci_dev *pdev)
                pci_enable_wake(pdev, PCI_D3cold, 0);
        }
 
+       free_irq(pdev->irq, netdev);
+
        pci_disable_device(pdev);
        pci_set_power_state(pdev, PCI_D3hot);
 }
index ed407c85708f13c31bcbaf4ad68dc4be995b6fe4..b53f6b6491b3f049bc69562dfbadf0536d47e409 100644 (file)
@@ -204,8 +204,10 @@ KERN_INFO "   Further modifications by Keith Underwood <keithu@parl.clemson.edu>
 /* Condensed bus+endian portability operations. */
 #if ADDRLEN == 64
 #define cpu_to_leXX(addr)      cpu_to_le64(addr)
+#define leXX_to_cpu(addr)      le64_to_cpu(addr)
 #else
 #define cpu_to_leXX(addr)      cpu_to_le32(addr)
+#define leXX_to_cpu(addr)      le32_to_cpu(addr)
 #endif
 
 
@@ -465,12 +467,12 @@ enum intr_status_bits {
 
 /* The Hamachi Rx and Tx buffer descriptors. */
 struct hamachi_desc {
-       u32 status_n_length;
+       __le32 status_n_length;
 #if ADDRLEN == 64
        u32 pad;
-       u64 addr;
+       __le64 addr;
 #else
-       u32 addr;
+       __le32 addr;
 #endif
 };
 
@@ -874,13 +876,13 @@ static int hamachi_open(struct net_device *dev)
 
 #if ADDRLEN == 64
        /* writellll anyone ? */
-       writel(cpu_to_le64(hmp->rx_ring_dma), ioaddr + RxPtr);
-       writel(cpu_to_le64(hmp->rx_ring_dma) >> 32, ioaddr + RxPtr + 4);
-       writel(cpu_to_le64(hmp->tx_ring_dma), ioaddr + TxPtr);
-       writel(cpu_to_le64(hmp->tx_ring_dma) >> 32, ioaddr + TxPtr + 4);
+       writel(hmp->rx_ring_dma, ioaddr + RxPtr);
+       writel(hmp->rx_ring_dma >> 32, ioaddr + RxPtr + 4);
+       writel(hmp->tx_ring_dma, ioaddr + TxPtr);
+       writel(hmp->tx_ring_dma >> 32, ioaddr + TxPtr + 4);
 #else
-       writel(cpu_to_le32(hmp->rx_ring_dma), ioaddr + RxPtr);
-       writel(cpu_to_le32(hmp->tx_ring_dma), ioaddr + TxPtr);
+       writel(hmp->rx_ring_dma, ioaddr + RxPtr);
+       writel(hmp->tx_ring_dma, ioaddr + TxPtr);
 #endif
 
        /* 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)
                skb = hmp->tx_skbuff[entry];
                if (skb) {
                        pci_unmap_single(hmp->pci_dev,
-                               hmp->tx_ring[entry].addr, skb->len,
-                               PCI_DMA_TODEVICE);
+                               leXX_to_cpu(hmp->tx_ring[entry].addr),
+                               skb->len, PCI_DMA_TODEVICE);
                        dev_kfree_skb(skb);
                        hmp->tx_skbuff[entry] = NULL;
                }
@@ -1071,10 +1073,10 @@ static void hamachi_tx_timeout(struct net_device *dev)
        {
                printk(KERN_DEBUG "  Rx ring %p: ", hmp->rx_ring);
                for (i = 0; i < RX_RING_SIZE; i++)
-                       printk(" %8.8x", (unsigned int)hmp->rx_ring[i].status_n_length);
+                       printk(" %8.8x", le32_to_cpu(hmp->rx_ring[i].status_n_length));
                printk("\n"KERN_DEBUG"  Tx ring %p: ", hmp->tx_ring);
                for (i = 0; i < TX_RING_SIZE; i++)
-                       printk(" %4.4x", hmp->tx_ring[i].status_n_length);
+                       printk(" %4.4x", le32_to_cpu(hmp->tx_ring[i].status_n_length));
                printk("\n");
        }
 
@@ -1099,14 +1101,15 @@ static void hamachi_tx_timeout(struct net_device *dev)
                struct sk_buff *skb;
 
                if (i >= TX_RING_SIZE - 1)
-                       hmp->tx_ring[i].status_n_length = cpu_to_le32(
-                               DescEndRing |
-                               (hmp->tx_ring[i].status_n_length & 0x0000FFFF));
+                       hmp->tx_ring[i].status_n_length =
+                               cpu_to_le32(DescEndRing) |
+                               (hmp->tx_ring[i].status_n_length &
+                                cpu_to_le32(0x0000ffff));
                else
-                       hmp->tx_ring[i].status_n_length &= 0x0000ffff;
+                       hmp->tx_ring[i].status_n_length &= cpu_to_le32(0x0000ffff);
                skb = hmp->tx_skbuff[i];
                if (skb){
-                       pci_unmap_single(hmp->pci_dev, hmp->tx_ring[i].addr,
+                       pci_unmap_single(hmp->pci_dev, leXX_to_cpu(hmp->tx_ring[i].addr),
                                skb->len, PCI_DMA_TODEVICE);
                        dev_kfree_skb(skb);
                        hmp->tx_skbuff[i] = NULL;
@@ -1128,7 +1131,8 @@ static void hamachi_tx_timeout(struct net_device *dev)
                struct sk_buff *skb = hmp->rx_skbuff[i];
 
                if (skb){
-                       pci_unmap_single(hmp->pci_dev, hmp->rx_ring[i].addr,
+                       pci_unmap_single(hmp->pci_dev,
+                               leXX_to_cpu(hmp->rx_ring[i].addr),
                                hmp->rx_buf_sz, PCI_DMA_FROMDEVICE);
                        dev_kfree_skb(skb);
                        hmp->rx_skbuff[i] = NULL;
@@ -1420,7 +1424,7 @@ static irqreturn_t hamachi_interrupt(int irq, void *dev_instance)
                                        /* Free the original skb. */
                                        if (skb){
                                                pci_unmap_single(hmp->pci_dev,
-                                                       hmp->tx_ring[entry].addr,
+                                                       leXX_to_cpu(hmp->tx_ring[entry].addr),
                                                        skb->len,
                                                        PCI_DMA_TODEVICE);
                                                dev_kfree_skb_irq(skb);
@@ -1500,11 +1504,11 @@ static int hamachi_rx(struct net_device *dev)
                if (desc_status & DescOwn)
                        break;
                pci_dma_sync_single_for_cpu(hmp->pci_dev,
-                                           desc->addr,
+                                           leXX_to_cpu(desc->addr),
                                            hmp->rx_buf_sz,
                                            PCI_DMA_FROMDEVICE);
                buf_addr = (u8 *) hmp->rx_skbuff[entry]->data;
-               frame_status = le32_to_cpu(get_unaligned((s32*)&(buf_addr[data_size - 12])));
+               frame_status = le32_to_cpu(get_unaligned((__le32*)&(buf_addr[data_size - 12])));
                if (hamachi_debug > 4)
                        printk(KERN_DEBUG "  hamachi_rx() status was %8.8x.\n",
                                frame_status);
@@ -1518,9 +1522,9 @@ static int hamachi_rx(struct net_device *dev)
                                   dev->name, desc, &hmp->rx_ring[hmp->cur_rx % RX_RING_SIZE]);
                        printk(KERN_WARNING "%s: Oversized Ethernet frame -- next status %x/%x last status %x.\n",
                                   dev->name,
-                                  hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length & 0xffff0000,
-                                  hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length & 0x0000ffff,
-                                  hmp->rx_ring[(hmp->cur_rx-1) % RX_RING_SIZE].status_n_length);
+                                  le32_to_cpu(hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length) & 0xffff0000,
+                                  le32_to_cpu(hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length) & 0x0000ffff,
+                                  le32_to_cpu(hmp->rx_ring[(hmp->cur_rx-1) % RX_RING_SIZE].status_n_length));
                        hmp->stats.rx_length_errors++;
                } /* else  Omit for prototype errata??? */
                if (frame_status & 0x00380000) {
@@ -1566,7 +1570,7 @@ static int hamachi_rx(struct net_device *dev)
 #endif
                                skb_reserve(skb, 2);    /* 16 byte align the IP header */
                                pci_dma_sync_single_for_cpu(hmp->pci_dev,
-                                                           hmp->rx_ring[entry].addr,
+                                                           leXX_to_cpu(hmp->rx_ring[entry].addr),
                                                            hmp->rx_buf_sz,
                                                            PCI_DMA_FROMDEVICE);
                                /* Call copy + cksum if available. */
@@ -1579,12 +1583,12 @@ static int hamachi_rx(struct net_device *dev)
                                        + entry*sizeof(*desc), pkt_len);
 #endif
                                pci_dma_sync_single_for_device(hmp->pci_dev,
-                                                              hmp->rx_ring[entry].addr,
+                                                              leXX_to_cpu(hmp->rx_ring[entry].addr),
                                                               hmp->rx_buf_sz,
                                                               PCI_DMA_FROMDEVICE);
                        } else {
                                pci_unmap_single(hmp->pci_dev,
-                                                hmp->rx_ring[entry].addr,
+                                                leXX_to_cpu(hmp->rx_ring[entry].addr),
                                                 hmp->rx_buf_sz, PCI_DMA_FROMDEVICE);
                                skb_put(skb = hmp->rx_skbuff[entry], pkt_len);
                                hmp->rx_skbuff[entry] = NULL;
@@ -1787,21 +1791,21 @@ static int hamachi_close(struct net_device *dev)
        for (i = 0; i < RX_RING_SIZE; i++) {
                skb = hmp->rx_skbuff[i];
                hmp->rx_ring[i].status_n_length = 0;
-               hmp->rx_ring[i].addr = 0xBADF00D0; /* An invalid address. */
                if (skb) {
                        pci_unmap_single(hmp->pci_dev,
-                               hmp->rx_ring[i].addr, hmp->rx_buf_sz,
-                               PCI_DMA_FROMDEVICE);
+                               leXX_to_cpu(hmp->rx_ring[i].addr),
+                               hmp->rx_buf_sz, PCI_DMA_FROMDEVICE);
                        dev_kfree_skb(skb);
                        hmp->rx_skbuff[i] = NULL;
                }
+               hmp->rx_ring[i].addr = cpu_to_leXX(0xBADF00D0); /* An invalid address. */
        }
        for (i = 0; i < TX_RING_SIZE; i++) {
                skb = hmp->tx_skbuff[i];
                if (skb) {
                        pci_unmap_single(hmp->pci_dev,
-                               hmp->tx_ring[i].addr, skb->len,
-                               PCI_DMA_TODEVICE);
+                               leXX_to_cpu(hmp->tx_ring[i].addr),
+                               skb->len, PCI_DMA_TODEVICE);
                        dev_kfree_skb(skb);
                        hmp->tx_skbuff[i] = NULL;
                }
index a2fc660ca5d436e35864a6bed6b46581eaacbf50..86b756a30784f844ffd48868edfe5a9161d01d2a 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "core.h"
 
-static spinlock_t emac_dbg_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(emac_dbg_lock);
 
 static void emac_desc_dump(struct emac_instance *p)
 {
index 3021234b1e173f5653603bcde3998db26ea3abba..bf9085fe035aa6d4c6476c7fdf4540704494f9e0 100644 (file)
@@ -320,10 +320,22 @@ ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog)
 void
 ixgb_reset(struct ixgb_adapter *adapter)
 {
+       struct ixgb_hw *hw = &adapter->hw;
 
-       ixgb_adapter_stop(&adapter->hw);
-       if(!ixgb_init_hw(&adapter->hw))
+       ixgb_adapter_stop(hw);
+       if (!ixgb_init_hw(hw))
                DPRINTK(PROBE, ERR, "ixgb_init_hw failed.\n");
+
+       /* restore frame size information */
+       IXGB_WRITE_REG(hw, MFS, hw->max_frame_size << IXGB_MFS_SHIFT);
+       if (hw->max_frame_size >
+           IXGB_MAX_ENET_FRAME_SIZE_WITHOUT_FCS + ENET_FCS_LENGTH) {
+               u32 ctrl0 = IXGB_READ_REG(hw, CTRL0);
+               if (!(ctrl0 & IXGB_CTRL0_JFE)) {
+                       ctrl0 |= IXGB_CTRL0_JFE;
+                       IXGB_WRITE_REG(hw, CTRL0, ctrl0);
+               }
+       }
 }
 
 /**
index db6a97d1d7b1e7292d60a4e642ed1e35e545b2a3..51bbd582f16c2ef40b0d508127d5bb39eb8ea39d 100644 (file)
@@ -1746,6 +1746,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
        PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "NE2K.cis"),
        PCMCIA_DEVICE_CIS_PROD_ID12("PMX   ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "PE-200.cis"),
        PCMCIA_DEVICE_CIS_PROD_ID12("TAMARACK", "Ethernet", 0xcf434fba, 0x00b2e941, "tamarack.cis"),
+       PCMCIA_DEVICE_PROD_ID12("Ethernet", "CF Size PC Card", 0x00b2e941, 0x43ac239b),
        PCMCIA_DEVICE_PROD_ID123("Fast Ethernet", "CF Size PC Card", "1.0",
                0xb4be14e3, 0x43ac239b, 0x0877b627),
        PCMCIA_DEVICE_NULL
index 121cb100f93a036fd2ae1ab226f00ffc5c7543ff..9d80f1cf73acbbe70a9eb8df62ef6a9c2f6be871 100644 (file)
@@ -3737,7 +3737,7 @@ static int s2io_enable_msi_x(struct s2io_nic *nic)
 }
 
 /* Handle software interrupt used during MSI(X) test */
-static irqreturn_t __devinit s2io_test_intr(int irq, void *dev_id)
+static irqreturn_t s2io_test_intr(int irq, void *dev_id)
 {
        struct s2io_nic *sp = dev_id;
 
@@ -3748,7 +3748,7 @@ static irqreturn_t __devinit s2io_test_intr(int irq, void *dev_id)
 }
 
 /* Test interrupt path by forcing a a software IRQ */
-static int __devinit s2io_test_msi(struct s2io_nic *sp)
+static int s2io_test_msi(struct s2io_nic *sp)
 {
        struct pci_dev *pdev = sp->pdev;
        struct XENA_dev_config __iomem *bar0 = sp->bar0;
index 720088396bb917a89552bedf521487c425649b58..7eab072ae79212daad67932a34c0fc4bcb425672 100644 (file)
@@ -474,7 +474,7 @@ static inline void sis190_map_to_asic(struct RxDesc *desc, dma_addr_t mapping,
 static inline void sis190_make_unusable_by_asic(struct RxDesc *desc)
 {
        desc->PSize = 0x0;
-       desc->addr = 0xdeadbeef;
+       desc->addr = cpu_to_le32(0xdeadbeef);
        desc->size &= cpu_to_le32(RingEnd);
        wmb();
        desc->status = 0x0;
@@ -580,7 +580,7 @@ static int sis190_rx_interrupt(struct net_device *dev,
                struct RxDesc *desc = tp->RxDescRing + entry;
                u32 status;
 
-               if (desc->status & OWNbit)
+               if (le32_to_cpu(desc->status) & OWNbit)
                        break;
 
                status = le32_to_cpu(desc->PSize);
@@ -1381,7 +1381,7 @@ out:
        return rc;
 }
 
-static void __devexit sis190_mii_remove(struct net_device *dev)
+static void sis190_mii_remove(struct net_device *dev)
 {
        struct sis190_private *tp = netdev_priv(dev);
 
@@ -1538,9 +1538,9 @@ static int __devinit sis190_get_mac_addr_from_eeprom(struct pci_dev *pdev,
 
        /* Get MAC address from EEPROM */
        for (i = 0; i < MAC_ADDR_LEN / 2; i++) {
-               __le16 w = sis190_read_eeprom(ioaddr, EEPROMMACAddr + i);
+               u16 w = sis190_read_eeprom(ioaddr, EEPROMMACAddr + i);
 
-               ((u16 *)dev->dev_addr)[i] = le16_to_cpu(w);
+               ((__le16 *)dev->dev_addr)[i] = cpu_to_le16(w);
        }
 
        sis190_set_rgmii(tp, sis190_read_eeprom(ioaddr, EEPROMInfo));
index 6197afb3ed8314671583455e89d69a8e7170494a..a74fc11a6482c51e9a8f43f2562cbfeea10dde4e 100644 (file)
@@ -822,8 +822,13 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
 
        sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), rx_reg);
 
-       /* Flush Rx MAC FIFO on any flow control or error */
-       sky2_write16(hw, SK_REG(port, RX_GMF_FL_MSK), GMR_FS_ANY_ERR);
+       if (hw->chip_id == CHIP_ID_YUKON_XL) {
+               /* Hardware errata - clear flush mask */
+               sky2_write16(hw, SK_REG(port, RX_GMF_FL_MSK), 0);
+       } else {
+               /* Flush Rx MAC FIFO on any flow control or error */
+               sky2_write16(hw, SK_REG(port, RX_GMF_FL_MSK), GMR_FS_ANY_ERR);
+       }
 
        /* Set threshold to 0xa (64 bytes) + 1 to workaround pause bug  */
        reg = RX_GMF_FL_THR_DEF + 1;
index d04e4fa35206b888d1d65e724d2baf38af1dd3c9..7defa63b9c747efd1cda1ea902079c0124340cac 100644 (file)
@@ -76,7 +76,7 @@
 
 
 
-#if     SMC_USE_PXA_DMA
+#ifdef SMC_USE_PXA_DMA
 #define SMC_USE_DMA
 
 /*
index bcc430bd9e493b0f89d0f0c85cae54debfcb9d86..6e00dc857afabf6b2d5ef3a20ae900d8083b622b 100644 (file)
@@ -1742,7 +1742,7 @@ static void set_rx_mode(struct net_device *dev)
                        if (vlan_group_get_device(np->vlgrp, i)) {
                                if (vlan_count >= 32)
                                        break;
-                               writew(cpu_to_be16(i), filter_addr);
+                               writew(i, filter_addr);
                                filter_addr += 16;
                                vlan_count++;
                        }
index ff98f5d597f117294ec870cce330bfd339a63bca..0a6186d4a48efba7869ce3a95bc6ab07bd439c08 100644 (file)
@@ -340,9 +340,9 @@ enum mac_ctrl1_bits {
 /* Note that using only 32 bit fields simplifies conversion to big-endian
    architectures. */
 struct netdev_desc {
-       u32 next_desc;
-       u32 status;
-       struct desc_frag { u32 addr, length; } frag[1];
+       __le32 next_desc;
+       __le32 status;
+       struct desc_frag { __le32 addr, length; } frag[1];
 };
 
 /* Bits in netdev_desc.status */
@@ -495,8 +495,8 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
                goto err_out_res;
 
        for (i = 0; i < 3; i++)
-               ((u16 *)dev->dev_addr)[i] =
-                       le16_to_cpu(eeprom_read(ioaddr, i + EEPROM_SA_OFFSET));
+               ((__le16 *)dev->dev_addr)[i] =
+                       cpu_to_le16(eeprom_read(ioaddr, i + EEPROM_SA_OFFSET));
        memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
 
        dev->base_addr = (unsigned long)ioaddr;
@@ -1090,8 +1090,8 @@ reset_tx (struct net_device *dev)
                skb = np->tx_skbuff[i];
                if (skb) {
                        pci_unmap_single(np->pci_dev,
-                               np->tx_ring[i].frag[0].addr, skb->len,
-                               PCI_DMA_TODEVICE);
+                               le32_to_cpu(np->tx_ring[i].frag[0].addr),
+                               skb->len, PCI_DMA_TODEVICE);
                        if (irq)
                                dev_kfree_skb_irq (skb);
                        else
@@ -1214,7 +1214,7 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
                                skb = np->tx_skbuff[entry];
                                /* Free the original skb. */
                                pci_unmap_single(np->pci_dev,
-                                       np->tx_ring[entry].frag[0].addr,
+                                       le32_to_cpu(np->tx_ring[entry].frag[0].addr),
                                        skb->len, PCI_DMA_TODEVICE);
                                dev_kfree_skb_irq (np->tx_skbuff[entry]);
                                np->tx_skbuff[entry] = NULL;
@@ -1233,7 +1233,7 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
                                skb = np->tx_skbuff[entry];
                                /* Free the original skb. */
                                pci_unmap_single(np->pci_dev,
-                                       np->tx_ring[entry].frag[0].addr,
+                                       le32_to_cpu(np->tx_ring[entry].frag[0].addr),
                                        skb->len, PCI_DMA_TODEVICE);
                                dev_kfree_skb_irq (np->tx_skbuff[entry]);
                                np->tx_skbuff[entry] = NULL;
@@ -1311,19 +1311,19 @@ static void rx_poll(unsigned long data)
                                && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) {
                                skb_reserve(skb, 2);    /* 16 byte align the IP header */
                                pci_dma_sync_single_for_cpu(np->pci_dev,
-                                                           desc->frag[0].addr,
+                                                           le32_to_cpu(desc->frag[0].addr),
                                                            np->rx_buf_sz,
                                                            PCI_DMA_FROMDEVICE);
 
                                skb_copy_to_linear_data(skb, np->rx_skbuff[entry]->data, pkt_len);
                                pci_dma_sync_single_for_device(np->pci_dev,
-                                                              desc->frag[0].addr,
+                                                              le32_to_cpu(desc->frag[0].addr),
                                                               np->rx_buf_sz,
                                                               PCI_DMA_FROMDEVICE);
                                skb_put(skb, pkt_len);
                        } else {
                                pci_unmap_single(np->pci_dev,
-                                       desc->frag[0].addr,
+                                       le32_to_cpu(desc->frag[0].addr),
                                        np->rx_buf_sz,
                                        PCI_DMA_FROMDEVICE);
                                skb_put(skb = np->rx_skbuff[entry], pkt_len);
@@ -1709,23 +1709,23 @@ static int netdev_close(struct net_device *dev)
        /* Free all the skbuffs in the Rx queue. */
        for (i = 0; i < RX_RING_SIZE; i++) {
                np->rx_ring[i].status = 0;
-               np->rx_ring[i].frag[0].addr = 0xBADF00D0; /* An invalid address. */
                skb = np->rx_skbuff[i];
                if (skb) {
                        pci_unmap_single(np->pci_dev,
-                               np->rx_ring[i].frag[0].addr, np->rx_buf_sz,
-                               PCI_DMA_FROMDEVICE);
+                               le32_to_cpu(np->rx_ring[i].frag[0].addr),
+                               np->rx_buf_sz, PCI_DMA_FROMDEVICE);
                        dev_kfree_skb(skb);
                        np->rx_skbuff[i] = NULL;
                }
+               np->rx_ring[i].frag[0].addr = cpu_to_le32(0xBADF00D0); /* poison */
        }
        for (i = 0; i < TX_RING_SIZE; i++) {
                np->tx_ring[i].next_desc = 0;
                skb = np->tx_skbuff[i];
                if (skb) {
                        pci_unmap_single(np->pci_dev,
-                               np->tx_ring[i].frag[0].addr, skb->len,
-                               PCI_DMA_TODEVICE);
+                               le32_to_cpu(np->tx_ring[i].frag[0].addr),
+                               skb->len, PCI_DMA_TODEVICE);
                        dev_kfree_skb(skb);
                        np->tx_skbuff[i] = NULL;
                }
index 7f689907ac28485c537559dfb3f90be2898ff741..abac7db3819eac943df7497b86735482a63170ca 100644 (file)
@@ -3447,7 +3447,7 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
        u16 length, howmany = 0;
        u32 bd_status;
        u8 *bdBuffer;
-       struct net_device * dev;
+       struct net_device *dev;
 
        ugeth_vdbg("%s: IN", __FUNCTION__);
 
index d8343703991916f24c29216d6a3a17ac29a3b3f7..1e45b2028a50c7f07d43d955979afd760acf42b4 100644 (file)
@@ -96,5 +96,5 @@ enum enet_tbi_mii_reg {
 int uec_mdio_read(struct mii_bus *bus, int mii_id, int regnum);
 int uec_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value);
 int __init uec_mdio_init(void);
-void __exit uec_mdio_exit(void);
+void uec_mdio_exit(void);
 #endif                         /* __UEC_MII_H */
index 97adc701a819404da67bcbd6c55f973b868212ae..77a503139e327fe7d1597c8aec6bf43b0301b438 100644 (file)
@@ -478,14 +478,14 @@ ctc_unpack_skb(struct channel *ch, struct sk_buff *pskb)
                skb->dev = pskb->dev;
                skb->protocol = pskb->protocol;
                pskb->ip_summed = CHECKSUM_UNNECESSARY;
-               netif_rx_ni(skb);
                /**
-                * Successful rx; reset logflags
+                * reset logflags
                 */
                ch->logflags = 0;
-               dev->last_rx = jiffies;
                privptr->stats.rx_packets++;
                privptr->stats.rx_bytes += skb->len;
+               netif_rx_ni(skb);
+               dev->last_rx = jiffies;
                if (len > 0) {
                        skb_pull(pskb, header->length);
                        if (skb_tailroom(pskb) < LL_HEADER_LENGTH) {
index 4d18d6419ddc016fd08560bdef7f46af58335b5b..c7ea9381db9f63050b8589ee05faa466d295120e 100644 (file)
@@ -639,14 +639,14 @@ static void netiucv_unpack_skb(struct iucv_connection *conn,
                skb->dev = pskb->dev;
                skb->protocol = pskb->protocol;
                pskb->ip_summed = CHECKSUM_UNNECESSARY;
+               privptr->stats.rx_packets++;
+               privptr->stats.rx_bytes += skb->len;
                /*
                 * Since receiving is always initiated from a tasklet (in iucv.c),
                 * we must use netif_rx_ni() instead of netif_rx()
                 */
                netif_rx_ni(skb);
                dev->last_rx = jiffies;
-               privptr->stats.rx_packets++;
-               privptr->stats.rx_bytes += skb->len;
                skb_pull(pskb, header->next);
                skb_put(pskb, NETIUCV_HDRLEN);
        }
index 70a09a3d5af0ee6999b98a57d766f4420688d94c..707c5b03bce92c1694f62721bbfe455a405b98bb 100644 (file)
 
 #include "suncore.h"
 
-int sunserial_current_minor = 64;
+static int sunserial_current_minor = 64;
 
-EXPORT_SYMBOL(sunserial_current_minor);
+int sunserial_register_minors(struct uart_driver *drv, int count)
+{
+       int err = 0;
+
+       drv->minor = sunserial_current_minor;
+       drv->nr += count;
+       /* Register the driver on the first call */
+       if (drv->nr == count)
+               err = uart_register_driver(drv);
+       if (err == 0) {
+               sunserial_current_minor += count;
+               drv->tty_driver->name_base = drv->minor - 64;
+       }
+       return err;
+}
+EXPORT_SYMBOL(sunserial_register_minors);
+
+void sunserial_unregister_minors(struct uart_driver *drv, int count)
+{
+       drv->nr -= count;
+       sunserial_current_minor -= count;
+
+       if (drv->nr == 0)
+               uart_unregister_driver(drv);
+}
+EXPORT_SYMBOL(sunserial_unregister_minors);
 
-int sunserial_console_match(struct console *con, struct device_node *dp,
+int __init sunserial_console_match(struct console *con, struct device_node *dp,
                            struct uart_driver *drv, int line)
 {
        int off;
@@ -133,8 +158,6 @@ sunserial_console_termios(struct console *con)
        con->cflag = cflag;
 }
 
-EXPORT_SYMBOL(sunserial_console_termios);
-
 /* Sun serial MOUSE auto baud rate detection.  */
 static struct mouse_baud_cflag {
        int baud;
index 829d7d65d6dbf4dec55e8992a8d77a795b0b02d2..042668aa602e756f00d8c011dbcc4307c04709ef 100644 (file)
@@ -22,7 +22,8 @@
 extern unsigned int suncore_mouse_baud_cflag_next(unsigned int, int *);
 extern int suncore_mouse_baud_detection(unsigned char, int);
 
-extern int sunserial_current_minor;
+extern int sunserial_register_minors(struct uart_driver *, int);
+extern void sunserial_unregister_minors(struct uart_driver *, int);
 
 extern int sunserial_console_match(struct console *, struct device_node *,
                                   struct uart_driver *, int);
index 8ff900b098116ebc7c54f4b5ec676223fe4cf54b..be0fe152891b762135ec1d72ff9a8cd200aea708 100644 (file)
@@ -562,16 +562,10 @@ static int __devinit hv_probe(struct of_device *op, const struct of_device_id *m
 
        port->dev = &op->dev;
 
-       sunhv_reg.minor = sunserial_current_minor;
-       sunhv_reg.nr = 1;
-
-       err = uart_register_driver(&sunhv_reg);
+       err = sunserial_register_minors(&sunhv_reg, 1);
        if (err)
                goto out_free_con_read_page;
 
-       sunhv_reg.tty_driver->name_base = sunhv_reg.minor - 64;
-       sunserial_current_minor += 1;
-
        sunserial_console_match(&sunhv_console, op->node,
                                &sunhv_reg, port->line);
 
@@ -591,8 +585,7 @@ out_remove_port:
        uart_remove_one_port(&sunhv_reg, port);
 
 out_unregister_driver:
-       sunserial_current_minor -= 1;
-       uart_unregister_driver(&sunhv_reg);
+       sunserial_unregister_minors(&sunhv_reg, 1);
 
 out_free_con_read_page:
        kfree(con_read_page);
@@ -614,8 +607,7 @@ static int __devexit hv_remove(struct of_device *dev)
 
        uart_remove_one_port(&sunhv_reg, port);
 
-       sunserial_current_minor -= 1;
-       uart_unregister_driver(&sunhv_reg);
+       sunserial_unregister_minors(&sunhv_reg, 1);
 
        kfree(port);
        sunhv_port = NULL;
index ff610c23314bd74e5b9fa9d3f103334c1c957581..543f93741e6f5e9b09e79fb9f40076554cc9cc1a 100644 (file)
@@ -832,7 +832,6 @@ static struct uart_driver sunsab_reg = {
 };
 
 static struct uart_sunsab_port *sunsab_ports;
-static int num_channels;
 
 #ifdef CONFIG_SERIAL_SUNSAB_CONSOLE
 
@@ -1102,8 +1101,8 @@ static int __init sunsab_init(void)
 {
        struct device_node *dp;
        int err;
+       int num_channels = 0;
 
-       num_channels = 0;
        for_each_node_by_name(dp, "se")
                num_channels += 2;
        for_each_node_by_name(dp, "serial") {
@@ -1117,20 +1116,14 @@ static int __init sunsab_init(void)
                if (!sunsab_ports)
                        return -ENOMEM;
 
-               sunsab_reg.minor = sunserial_current_minor;
-               sunsab_reg.nr = num_channels;
                sunsab_reg.cons = SUNSAB_CONSOLE();
-
-               err = uart_register_driver(&sunsab_reg);
+               err = sunserial_register_minors(&sunsab_reg, num_channels);
                if (err) {
                        kfree(sunsab_ports);
                        sunsab_ports = NULL;
 
                        return err;
                }
-
-               sunsab_reg.tty_driver->name_base = sunsab_reg.minor - 64;
-               sunserial_current_minor += num_channels;
        }
 
        return of_register_driver(&sab_driver, &of_bus_type);
@@ -1139,9 +1132,8 @@ static int __init sunsab_init(void)
 static void __exit sunsab_exit(void)
 {
        of_unregister_driver(&sab_driver);
-       if (num_channels) {
-               sunserial_current_minor -= num_channels;
-               uart_unregister_driver(&sunsab_reg);
+       if (sunsab_reg.nr) {
+               sunserial_unregister_minors(&sunsab_reg, sunsab_reg.nr);
        }
 
        kfree(sunsab_ports);
index e074943feff536bc6be21b435acb527a6453c75b..4e2302d43ab163966234da9091b173b955a9c131 100644 (file)
@@ -1528,14 +1528,12 @@ static struct of_platform_driver su_driver = {
        .remove         = __devexit_p(su_remove),
 };
 
-static int num_uart;
-
 static int __init sunsu_init(void)
 {
        struct device_node *dp;
        int err;
+       int num_uart = 0;
 
-       num_uart = 0;
        for_each_node_by_name(dp, "su") {
                if (su_get_type(dp) == SU_PORT_PORT)
                        num_uart++;
@@ -1552,26 +1550,22 @@ static int __init sunsu_init(void)
        }
 
        if (num_uart) {
-               sunsu_reg.minor = sunserial_current_minor;
-               sunsu_reg.nr = num_uart;
-               err = uart_register_driver(&sunsu_reg);
+               err = sunserial_register_minors(&sunsu_reg, num_uart);
                if (err)
                        return err;
-               sunsu_reg.tty_driver->name_base = sunsu_reg.minor - 64;
-               sunserial_current_minor += num_uart;
        }
 
        err = of_register_driver(&su_driver, &of_bus_type);
        if (err && num_uart)
-               uart_unregister_driver(&sunsu_reg);
+               sunserial_unregister_minors(&sunsu_reg, num_uart);
 
        return err;
 }
 
 static void __exit sunsu_exit(void)
 {
-       if (num_uart)
-               uart_unregister_driver(&sunsu_reg);
+       if (sunsu_reg.nr)
+               sunserial_unregister_minors(&sunsu_reg, sunsu_reg.nr);
 }
 
 module_init(sunsu_init);
index 283bef0d24cb47a0fa0e956af5ef5a95c800a9ce..cb2e405063794f97922aaa6f5eaf9e0d77a15302 100644 (file)
        readb(&((__channel)->control))
 #endif
 
-static int num_sunzilog;
-#define NUM_SUNZILOG   num_sunzilog
-#define NUM_CHANNELS   (NUM_SUNZILOG * 2)
-
 #define ZS_CLOCK               4915200 /* Zilog input clock rate. */
 #define ZS_CLOCK_DIVISOR       16      /* Divisor this driver uses. */
 
@@ -1031,18 +1027,19 @@ static struct uart_driver sunzilog_reg = {
        .major          =       TTY_MAJOR,
 };
 
-static int __init sunzilog_alloc_tables(void)
+static int __init sunzilog_alloc_tables(int num_sunzilog)
 {
        struct uart_sunzilog_port *up;
        unsigned long size;
+       int num_channels = num_sunzilog * 2;
        int i;
 
-       size = NUM_CHANNELS * sizeof(struct uart_sunzilog_port);
+       size = num_channels * sizeof(struct uart_sunzilog_port);
        sunzilog_port_table = kzalloc(size, GFP_KERNEL);
        if (!sunzilog_port_table)
                return -ENOMEM;
 
-       for (i = 0; i < NUM_CHANNELS; i++) {
+       for (i = 0; i < num_channels; i++) {
                up = &sunzilog_port_table[i];
 
                spin_lock_init(&up->port.lock);
@@ -1050,13 +1047,13 @@ static int __init sunzilog_alloc_tables(void)
                if (i == 0)
                        sunzilog_irq_chain = up;
 
-               if (i < NUM_CHANNELS - 1)
+               if (i < num_channels - 1)
                        up->next = up + 1;
                else
                        up->next = NULL;
        }
 
-       size = NUM_SUNZILOG * sizeof(struct zilog_layout __iomem *);
+       size = num_sunzilog * sizeof(struct zilog_layout __iomem *);
        sunzilog_chip_regs = kzalloc(size, GFP_KERNEL);
        if (!sunzilog_chip_regs) {
                kfree(sunzilog_port_table);
@@ -1496,34 +1493,28 @@ static int __init sunzilog_init(void)
        struct device_node *dp;
        int err, uart_count;
        int num_keybms;
+       int num_sunzilog = 0;
 
-       NUM_SUNZILOG = 0;
        num_keybms = 0;
        for_each_node_by_name(dp, "zs") {
-               NUM_SUNZILOG++;
+               num_sunzilog++;
                if (of_find_property(dp, "keyboard", NULL))
                        num_keybms++;
        }
 
        uart_count = 0;
-       if (NUM_SUNZILOG) {
+       if (num_sunzilog) {
                int uart_count;
 
-               err = sunzilog_alloc_tables();
+               err = sunzilog_alloc_tables(num_sunzilog);
                if (err)
                        goto out;
 
-               uart_count = (NUM_SUNZILOG * 2) - (2 * num_keybms);
+               uart_count = (num_sunzilog * 2) - (2 * num_keybms);
 
-               sunzilog_reg.nr = uart_count;
-               sunzilog_reg.minor = sunserial_current_minor;
-               err = uart_register_driver(&sunzilog_reg);
+               err = sunserial_register_minors(&sunzilog_reg, uart_count);
                if (err)
                        goto out_free_tables;
-
-               sunzilog_reg.tty_driver->name_base = sunzilog_reg.minor - 64;
-
-               sunserial_current_minor += uart_count;
        }
 
        err = of_register_driver(&zs_driver, &of_bus_type);
@@ -1557,8 +1548,8 @@ out_unregister_driver:
        of_unregister_driver(&zs_driver);
 
 out_unregister_uart:
-       if (NUM_SUNZILOG) {
-               uart_unregister_driver(&sunzilog_reg);
+       if (num_sunzilog) {
+               sunserial_unregister_minors(&sunzilog_reg, num_sunzilog);
                sunzilog_reg.cons = NULL;
        }
 
@@ -1590,8 +1581,8 @@ static void __exit sunzilog_exit(void)
                zilog_irq = -1;
        }
 
-       if (NUM_SUNZILOG) {
-               uart_unregister_driver(&sunzilog_reg);
+       if (sunzilog_reg.nr) {
+               sunserial_unregister_minors(&sunzilog_reg, sunzilog_reg.nr);
                sunzilog_free_tables();
        }
 }
index 0fa5d591255561b00e5cea79586c4eccdada9697..4fd5d0eaa935fba6dab336565f4c70004dd12555 100644 (file)
@@ -208,6 +208,8 @@ int videobuf_cgmbuf(struct videobuf_queue *q,
 int videobuf_streamon(struct videobuf_queue *q);
 int videobuf_streamoff(struct videobuf_queue *q);
 
+void videobuf_stop(struct videobuf_queue *q);
+
 int videobuf_read_start(struct videobuf_queue *q);
 void videobuf_read_stop(struct videobuf_queue *q);
 ssize_t videobuf_read_stream(struct videobuf_queue *q,
index 5b183156307a6c3f2ddc245206e2892b53f4d7c5..4add9bd4bc8d51c8785c65028211578e4bbe4508 100644 (file)
@@ -124,8 +124,8 @@ static void __exit vlan_cleanup_module(void)
 {
        int i;
 
-       vlan_netlink_fini();
        vlan_ioctl_set(NULL);
+       vlan_netlink_fini();
 
        /* Un-register us from receiving netdevice events */
        unregister_netdevice_notifier(&vlan_notifier_block);
index 86d62611f2fcc4583f2eaf9a40d600718944ad97..26a3a3a15be063564c95addc815b64457860c585 100644 (file)
@@ -3972,8 +3972,7 @@ void synchronize_net(void)
  *     @dev: device
  *
  *     This function shuts down a device interface and removes it
- *     from the kernel tables. On success 0 is returned, on a failure
- *     a negative errno code is returned.
+ *     from the kernel tables.
  *
  *     Callers must hold the rtnl semaphore.  You may want
  *     unregister_netdev() instead of this.
@@ -3991,8 +3990,7 @@ void unregister_netdevice(struct net_device *dev)
  *     @dev: device
  *
  *     This function shuts down a device interface and removes it
- *     from the kernel tables. On success 0 is returned, on a failure
- *     a negative errno code is returned.
+ *     from the kernel tables.
  *
  *     This is just a wrapper for unregister_netdevice that takes
  *     the rtnl semaphore.  In general you want to use this and not
index 55d199e4ae212813dd737a9cf2706b7f9cccbe38..3168c3de49193922a0b1ca641bcc3680e6a5107e 100644 (file)
@@ -516,8 +516,6 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh)
                goto errout;
        }
 
-       ipv4_devconf_setall(in_dev);
-
        ifa = inet_alloc_ifa();
        if (ifa == NULL) {
                /*
@@ -528,6 +526,7 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh)
                goto errout;
        }
 
+       ipv4_devconf_setall(in_dev);
        in_dev_hold(in_dev);
 
        if (tb[IFA_ADDRESS] == NULL)
index c31bccb9b526c99d539c1c13a94531f23c982318..1738113268bc12f1e1a23e4a1ca14bb82a637ffa 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/pfkeyv2.h>
 #include <linux/random.h>
 #include <linux/spinlock.h>
+#include <linux/in6.h>
 #include <net/icmp.h>
 #include <net/protocol.h>
 #include <net/udp.h>
@@ -224,6 +225,10 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
 
        /* ... check padding bits here. Silly. :-) */
 
+       /* RFC4303: Drop dummy packets without any error */
+       if (nexthdr[1] == IPPROTO_NONE)
+               goto out;
+
        iph = ip_hdr(skb);
        ihl = iph->ihl * 4;
 
index 7db66f10e00d18f80d705fd83459ac5aec43f327..44405325467626a5ca473ef647872ec8cdb14753 100644 (file)
@@ -230,6 +230,12 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
                }
                /* ... check padding bits here. Silly. :-) */
 
+               /* RFC4303: Drop dummy packets without any error */
+               if (nexthdr[1] == IPPROTO_NONE) {
+                       ret = -EINVAL;
+                       goto out;
+               }
+
                pskb_trim(skb, skb->len - alen - padlen - 2);
                ret = nexthdr[1];
        }
index 82e27b80d07d3d060112eb873d7b0a9774853cba..b8e9eb445d744e63e9430fa5ede84810236fcccc 100644 (file)
@@ -233,7 +233,7 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int
                dst_prev->output = dst_prev->xfrm->outer_mode->afinfo->output;
                /* Sheit... I remember I did this right. Apparently,
                 * it was magically lost, so this code needs audit */
-               x->u.rt6.rt6i_flags    = rt0->rt6i_flags&(RTCF_BROADCAST|RTCF_MULTICAST|RTCF_LOCAL);
+               x->u.rt6.rt6i_flags    = rt0->rt6i_flags&(RTF_ANYCAST|RTF_LOCAL);
                x->u.rt6.rt6i_metric   = rt0->rt6i_metric;
                x->u.rt6.rt6i_node     = rt0->rt6i_node;
                x->u.rt6.rt6i_gateway  = rt0->rt6i_gateway;
index 9a4cf2e45a15f2b10c94aaba287b1f534cc32989..b91b16671c1e78842f3e6b1496e0ef880c636a66 100644 (file)
@@ -1318,8 +1318,9 @@ restart:
 
        if (sk && sk->sk_policy[XFRM_POLICY_OUT]) {
                policy = xfrm_sk_policy_lookup(sk, XFRM_POLICY_OUT, fl);
+               err = PTR_ERR(policy);
                if (IS_ERR(policy))
-                       return PTR_ERR(policy);
+                       goto dropdst;
        }
 
        if (!policy) {
@@ -1330,8 +1331,9 @@ restart:
 
                policy = flow_cache_lookup(fl, dst_orig->ops->family,
                                           dir, xfrm_policy_lookup);
+               err = PTR_ERR(policy);
                if (IS_ERR(policy))
-                       return PTR_ERR(policy);
+                       goto dropdst;
        }
 
        if (!policy)
@@ -1501,8 +1503,9 @@ restart:
        return 0;
 
 error:
-       dst_release(dst_orig);
        xfrm_pols_put(pols, npols);
+dropdst:
+       dst_release(dst_orig);
        *dst_p = NULL;
        return err;
 }