@@ -123,6 +123,32 @@ static u32 overflow;
static u32 stripped;
#endif
+static inline void tsin_copy_stripped(struct ngene *dev, void *buf)
+{
+ if (memcmp(buf, fill_ts, sizeof(fill_ts)) != 0) {
+ if (dvb_ringbuffer_free(&dev->tsin_rbuf) >= 188) {
+ dvb_ringbuffer_write(&dev->tsin_rbuf, buf, 188);
+ wake_up(&dev->tsin_rbuf.queue);
+#ifdef DEBUG_CI_XFER
+ ok++;
+#endif
+ }
+#ifdef DEBUG_CI_XFER
+ else
+ overflow++;
+#endif
+ }
+#ifdef DEBUG_CI_XFER
+ else
+ stripped++;
+
+ if (ok % 100 == 0 && overflow)
+ dev_warn(&dev->pci_dev->dev,
+ "%s: ok %u overflow %u dropped %u\n",
+ __func__, ok, overflow, stripped);
+#endif
+}
+
void *tsin_exchange(void *priv, void *buf, u32 len, u32 clock, u32 flags)
{
struct ngene_channel *chan = priv;
@@ -134,28 +160,8 @@ void *tsin_exchange(void *priv, void *buf, u32 len, u32 clock, u32 flags)
if (dev->ci.en && chan->number == 2) {
while (len >= 188) {
- if (memcmp(buf, fill_ts, sizeof fill_ts) != 0) {
- if (dvb_ringbuffer_free(&dev->tsin_rbuf) >= 188) {
- dvb_ringbuffer_write(&dev->tsin_rbuf, buf, 188);
- wake_up(&dev->tsin_rbuf.queue);
-#ifdef DEBUG_CI_XFER
- ok++;
-#endif
- }
-#ifdef DEBUG_CI_XFER
- else
- overflow++;
-#endif
- }
-#ifdef DEBUG_CI_XFER
- else
- stripped++;
+ tsin_copy_stripped(dev, buf);
- if (ok % 100 == 0 && overflow)
- dev_warn(&dev->pci_dev->dev,
- "%s: ok %u overflow %u dropped %u\n",
- __func__, ok, overflow, stripped);
-#endif
buf += 188;
len -= 188;
}