Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl
[linux-2.6.git] / drivers / media / dvb / dvb-core / dvb_net.c
index 441c064..4df42aa 100644 (file)
@@ -350,6 +350,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
        const u8 *ts, *ts_end, *from_where = NULL;
        u8 ts_remain = 0, how_much = 0, new_ts = 1;
        struct ethhdr *ethh = NULL;
+       bool error = false;
 
 #ifdef ULE_DEBUG
        /* The code inside ULE_DEBUG keeps a history of the last 100 TS cells processed. */
@@ -459,10 +460,16 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
 
                                                /* Drop partly decoded SNDU, reset state, resync on PUSI. */
                                                if (priv->ule_skb) {
-                                                       dev_kfree_skb( priv->ule_skb );
+                                                       error = true;
+                                                       dev_kfree_skb(priv->ule_skb);
+                                               }
+
+                                               if (error || priv->ule_sndu_remain) {
                                                        dev->stats.rx_errors++;
                                                        dev->stats.rx_frame_errors++;
+                                                       error = false;
                                                }
+
                                                reset_ule(priv);
                                                priv->need_pusi = 1;
                                                continue;
@@ -534,6 +541,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
                                from_where += 2;
                        }
 
+                       priv->ule_sndu_remain = priv->ule_sndu_len + 2;
                        /*
                         * State of current TS:
                         *   ts_remain (remaining bytes in the current TS cell)
@@ -543,6 +551,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
                         */
                        switch (ts_remain) {
                                case 1:
+                                       priv->ule_sndu_remain--;
                                        priv->ule_sndu_type = from_where[0] << 8;
                                        priv->ule_sndu_type_1 = 1; /* first byte of ule_type is set. */
                                        ts_remain -= 1; from_where += 1;
@@ -556,6 +565,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
                                default: /* complete ULE header is present in current TS. */
                                        /* Extract ULE type field. */
                                        if (priv->ule_sndu_type_1) {
+                                               priv->ule_sndu_type_1 = 0;
                                                priv->ule_sndu_type |= from_where[0];
                                                from_where += 1; /* points to payload start. */
                                                ts_remain -= 1;
@@ -1109,14 +1119,14 @@ static int dvb_net_feed_stop(struct net_device *dev)
 }
 
 
-static int dvb_set_mc_filter (struct net_device *dev, struct dev_mc_list *mc)
+static int dvb_set_mc_filter(struct net_device *dev, unsigned char *addr)
 {
        struct dvb_net_priv *priv = netdev_priv(dev);
 
        if (priv->multi_num == DVB_NET_MULTICAST_MAX)
                return -ENOMEM;
 
-       memcpy(priv->multi_macs[priv->multi_num], mc->dmi_addr, 6);
+       memcpy(priv->multi_macs[priv->multi_num], addr, ETH_ALEN);
 
        priv->multi_num++;
        return 0;
@@ -1140,8 +1150,7 @@ static void wq_set_multicast_list (struct work_struct *work)
                dprintk("%s: allmulti mode\n", dev->name);
                priv->rx_mode = RX_MODE_ALL_MULTI;
        } else if (!netdev_mc_empty(dev)) {
-               int mci;
-               struct dev_mc_list *mc;
+               struct netdev_hw_addr *ha;
 
                dprintk("%s: set_mc_list, %d entries\n",
                        dev->name, netdev_mc_count(dev));
@@ -1149,11 +1158,8 @@ static void wq_set_multicast_list (struct work_struct *work)
                priv->rx_mode = RX_MODE_MULTI;
                priv->multi_num = 0;
 
-               for (mci = 0, mc=dev->mc_list;
-                    mci < netdev_mc_count(dev);
-                    mc = mc->next, mci++) {
-                       dvb_set_mc_filter(dev, mc);
-               }
+               netdev_for_each_mc_addr(ha, dev)
+                       dvb_set_mc_filter(dev, ha->addr);
        }
 
        netif_addr_unlock_bh(dev);
@@ -1333,7 +1339,7 @@ static int dvb_net_remove_if(struct dvb_net *dvbnet, unsigned long num)
        return 0;
 }
 
-static int dvb_net_do_ioctl(struct inode *inode, struct file *file,
+static int dvb_net_do_ioctl(struct file *file,
                  unsigned int cmd, void *parg)
 {
        struct dvb_device *dvbdev = file->private_data;
@@ -1435,10 +1441,10 @@ static int dvb_net_do_ioctl(struct inode *inode, struct file *file,
        return 0;
 }
 
-static int dvb_net_ioctl(struct inode *inode, struct file *file,
+static long dvb_net_ioctl(struct file *file,
              unsigned int cmd, unsigned long arg)
 {
-       return dvb_usercopy(inode, file, cmd, arg, dvb_net_do_ioctl);
+       return dvb_usercopy(file, cmd, arg, dvb_net_do_ioctl);
 }
 
 static int dvb_net_close(struct inode *inode, struct file *file)
@@ -1459,9 +1465,10 @@ static int dvb_net_close(struct inode *inode, struct file *file)
 
 static const struct file_operations dvb_net_fops = {
        .owner = THIS_MODULE,
-       .ioctl = dvb_net_ioctl,
+       .unlocked_ioctl = dvb_net_ioctl,
        .open = dvb_generic_open,
        .release = dvb_net_close,
+       .llseek = noop_llseek,
 };
 
 static struct dvb_device dvbdev_net = {