]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] dvb-core: get rid of demux optional circular buffer
authorMauro Carvalho Chehab <mchehab@s-opensource.com>
Thu, 13 Oct 2016 10:14:38 +0000 (07:14 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 21 Oct 2016 10:43:24 +0000 (08:43 -0200)
There is a provision at the dvb_demux.c to use a vmalloc'ed
circular buffer, enabled via an extra #ifdef option that it
is not at Kconfig. Enabling it will only make the Kernel to
allocate/deallocate such buffer, but no code would actually
use it. So, no practical effect, except for sparing some
memory without any good reason.

So, get rid of such dead code.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/dvb-core/demux.h
drivers/media/dvb-core/dmxdev.c
drivers/media/dvb-core/dvb_demux.c
drivers/media/dvb-core/dvb_demux.h
drivers/media/dvb-core/dvb_net.c

index aeda2b64931cfdf1cc718c58d31dd3fa89413aea..f8adf4506a45134796bb2139e772c599e52454dd 100644 (file)
@@ -103,7 +103,6 @@ struct dmx_ts_feed {
                   u16 pid,
                   int type,
                   enum dmx_ts_pes pes_type,
-                  size_t circular_buffer_size,
                   ktime_t timeout);
        int (*start_filtering)(struct dmx_ts_feed *feed);
        int (*stop_filtering)(struct dmx_ts_feed *feed);
@@ -181,7 +180,6 @@ struct dmx_section_feed {
        /* public: */
        int (*set)(struct dmx_section_feed *feed,
                   u16 pid,
-                  size_t circular_buffer_size,
                   int check_crc);
        int (*allocate_filter)(struct dmx_section_feed *feed,
                               struct dmx_section_filter **filter);
@@ -206,8 +204,7 @@ struct dmx_section_feed {
  * the &dmx_demux.
  * Any TS packets that match the filter settings are copied to a circular
  * buffer. The filtered TS packets are delivered to the client using this
- * callback function. The size of the circular buffer is controlled by the
- * circular_buffer_size parameter of the &dmx_ts_feed.@set function.
+ * callback function.
  * It is expected that the @buffer1 and @buffer2 callback parameters point to
  * addresses within the circular buffer, but other implementations are also
  * possible. Note that the called party should not try to free the memory
index 1e96a6f1b6f0f9685d425ff9de23f0fed76281ce..efe55a3e80d0c687c46be91a803327fbc50322fd 100644 (file)
@@ -595,7 +595,7 @@ static int dvb_dmxdev_start_feed(struct dmxdev *dmxdev,
        tsfeed = feed->ts;
        tsfeed->priv = filter;
 
-       ret = tsfeed->set(tsfeed, feed->pid, ts_type, ts_pes, 32768, timeout);
+       ret = tsfeed->set(tsfeed, feed->pid, ts_type, ts_pes, timeout);
        if (ret < 0) {
                dmxdev->demux->release_ts_feed(dmxdev->demux, tsfeed);
                return ret;
@@ -666,7 +666,7 @@ static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter)
                                return ret;
                        }
 
-                       ret = (*secfeed)->set(*secfeed, para->pid, 32768,
+                       ret = (*secfeed)->set(*secfeed, para->pid,
                                              (para->flags & DMX_CHECK_CRC) ? 1 : 0);
                        if (ret < 0) {
                                pr_err("DVB (%s): could not set feed\n",
index 51bf5eb2df497c3ba48dc67b9f30809973609933..3ad0b2cd26b11822666e87240719000c8cded6da 100644 (file)
@@ -36,8 +36,6 @@
 
 #include "dvb_demux.h"
 
-#define NOBUFS
-
 static int dvb_demux_tscheck;
 module_param(dvb_demux_tscheck, int, 0644);
 MODULE_PARM_DESC(dvb_demux_tscheck,
@@ -663,8 +661,7 @@ out:
 }
 
 static int dmx_ts_feed_set(struct dmx_ts_feed *ts_feed, u16 pid, int ts_type,
-                          enum dmx_ts_pes pes_type,
-                          size_t circular_buffer_size, ktime_t timeout)
+                          enum dmx_ts_pes pes_type, ktime_t timeout)
 {
        struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed;
        struct dvb_demux *demux = feed->demux;
@@ -694,23 +691,10 @@ static int dmx_ts_feed_set(struct dmx_ts_feed *ts_feed, u16 pid, int ts_type,
        dvb_demux_feed_add(feed);
 
        feed->pid = pid;
-       feed->buffer_size = circular_buffer_size;
        feed->timeout = timeout;
        feed->ts_type = ts_type;
        feed->pes_type = pes_type;
 
-       if (feed->buffer_size) {
-#ifdef NOBUFS
-               feed->buffer = NULL;
-#else
-               feed->buffer = vmalloc(feed->buffer_size);
-               if (!feed->buffer) {
-                       mutex_unlock(&demux->mutex);
-                       return -ENOMEM;
-               }
-#endif
-       }
-
        feed->state = DMX_STATE_READY;
        mutex_unlock(&demux->mutex);
 
@@ -799,7 +783,6 @@ static int dvbdmx_allocate_ts_feed(struct dmx_demux *dmx,
        feed->demux = demux;
        feed->pid = 0xffff;
        feed->peslen = 0xfffa;
-       feed->buffer = NULL;
 
        (*ts_feed) = &feed->feed.ts;
        (*ts_feed)->parent = dmx;
@@ -836,10 +819,6 @@ static int dvbdmx_release_ts_feed(struct dmx_demux *dmx,
                mutex_unlock(&demux->mutex);
                return -EINVAL;
        }
-#ifndef NOBUFS
-       vfree(feed->buffer);
-       feed->buffer = NULL;
-#endif
 
        feed->state = DMX_STATE_FREE;
        feed->filter->state = DMX_STATE_FREE;
@@ -891,8 +870,7 @@ static int dmx_section_feed_allocate_filter(struct dmx_section_feed *feed,
 }
 
 static int dmx_section_feed_set(struct dmx_section_feed *feed,
-                               u16 pid, size_t circular_buffer_size,
-                               int check_crc)
+                               u16 pid, int check_crc)
 {
        struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed;
        struct dvb_demux *dvbdmx = dvbdmxfeed->demux;
@@ -906,19 +884,8 @@ static int dmx_section_feed_set(struct dmx_section_feed *feed,
        dvb_demux_feed_add(dvbdmxfeed);
 
        dvbdmxfeed->pid = pid;
-       dvbdmxfeed->buffer_size = circular_buffer_size;
        dvbdmxfeed->feed.sec.check_crc = check_crc;
 
-#ifdef NOBUFS
-       dvbdmxfeed->buffer = NULL;
-#else
-       dvbdmxfeed->buffer = vmalloc(dvbdmxfeed->buffer_size);
-       if (!dvbdmxfeed->buffer) {
-               mutex_unlock(&dvbdmx->mutex);
-               return -ENOMEM;
-       }
-#endif
-
        dvbdmxfeed->state = DMX_STATE_READY;
        mutex_unlock(&dvbdmx->mutex);
        return 0;
@@ -1077,7 +1044,6 @@ static int dvbdmx_allocate_section_feed(struct dmx_demux *demux,
        dvbdmxfeed->feed.sec.secbufp = dvbdmxfeed->feed.sec.seclen = 0;
        dvbdmxfeed->feed.sec.tsfeedp = 0;
        dvbdmxfeed->filter = NULL;
-       dvbdmxfeed->buffer = NULL;
 
        (*feed) = &dvbdmxfeed->feed.sec;
        (*feed)->is_filtering = 0;
@@ -1106,10 +1072,6 @@ static int dvbdmx_release_section_feed(struct dmx_demux *demux,
                mutex_unlock(&dvbdmx->mutex);
                return -EINVAL;
        }
-#ifndef NOBUFS
-       vfree(dvbdmxfeed->buffer);
-       dvbdmxfeed->buffer = NULL;
-#endif
        dvbdmxfeed->state = DMX_STATE_FREE;
 
        dvb_demux_feed_del(dvbdmxfeed);
index 5ed3cab4ad28fc6522d78e1668512cf5d8a44f8f..9235b008ea0ab4db1a539bdce137044a0382a4f7 100644 (file)
@@ -80,8 +80,6 @@ struct dvb_demux_feed {
        int type;
        int state;
        u16 pid;
-       u8 *buffer;
-       int buffer_size;
 
        ktime_t timeout;
        struct dvb_demux_filter *filter;
index 063f635639190f9ef181c1d9d2646f05e2224b05..b9a46d5a1bb52d39253b320fe703fd2c14cdd7f7 100644 (file)
@@ -969,7 +969,7 @@ static int dvb_net_feed_start(struct net_device *dev)
                        goto error;
                }
 
-               ret = priv->secfeed->set(priv->secfeed, priv->pid, 32768, 1);
+               ret = priv->secfeed->set(priv->secfeed, priv->pid, 1);
 
                if (ret<0) {
                        pr_err("%s: could not set section feed\n", dev->name);
@@ -1023,7 +1023,6 @@ static int dvb_net_feed_start(struct net_device *dev)
                                        priv->pid, /* pid */
                                        TS_PACKET, /* type */
                                        DMX_PES_OTHER, /* pes type */
-                                       32768,     /* circular buffer size */
                                        timeout    /* timeout */
                                        );