media: drm_tswrite printf EAGAIN repeat [1/1]
authorJoy Rao <joy.rao@amlogic.com>
Thu, 11 Jun 2020 04:06:25 +0000 (12:06 +0800)
committerJoy Rao <joy.rao@amlogic.com>
Wed, 17 Jun 2020 01:13:08 +0000 (18:13 -0700)
PD#SWPL-26485

Problem:
1. repeat print write no space for EAGAIN
2. offset need update

Solution:
1. when drm_tswrite EAGAIN, not to print
2. offset update for drm_tswrite

Verify:
u215

Change-Id: Icb277239913ab9280137acb2c3359337242d465c
Signed-off-by: Joy Rao <joy.rao@amlogic.com>
drivers/stream_input/parser/tsdemux.c

index ab2c79f8761a80b53d6692fb9ba40e30accee8f5..11895ed19e0ea2d80c174ec468dc963993ee2619 100644 (file)
@@ -835,7 +835,6 @@ ssize_t drm_tswrite(struct file *file,
 {
        s32 r;
        u32 realcount = count;
-       u32 re_count = count;
        u32 havewritebytes = 0;
 
        struct drm_info tmpmm;
@@ -894,12 +893,14 @@ ssize_t drm_tswrite(struct file *file,
                                        r = stbuf_wait_space(vbuf, wait_size);
 
                                        if (r < 0) {
-                                               pr_info
-                                               ("write no space--- ");
-                                               pr_info
-                                               ("no space,%d--%d,r-%d\n",
-                                                stbuf_space(vbuf),
-                                                stbuf_space(abuf), r);
+                                               if (r != -EAGAIN)
+                                                       pr_info
+                                                       ("write no space--- ");
+                                               if (r != -EAGAIN)
+                                                       pr_info
+                                                       ("no space,%d--%d,r-%d\n",
+                                                       stbuf_space(vbuf),
+                                                       stbuf_space(abuf), r);
                                                return r;
                                        }
                                }
@@ -933,9 +934,18 @@ ssize_t drm_tswrite(struct file *file,
                }
                /* pr_info("write_size = %d,count = %d,\n",*/
                   /*write_size, count); */
-               if (write_size > 0)
-                       r = _tsdemux_write((const char __user *)realbuf,
-                                        write_size, isphybuf);
+               if (write_size > 0) {
+                       r = _tsdemux_write((const char __user *)realbuf + havewritebytes,
+                               write_size, isphybuf);
+                       if (r < 0) {
+                               if (r != -EAGAIN)
+                                       pr_info
+                                       ("vspace %d--aspace %d,r-%d\n",
+                                       stbuf_space(vbuf),
+                                       stbuf_space(abuf), r);
+                               return r;
+                       }
+               }
                else
                        return -EAGAIN;
 
@@ -946,11 +956,12 @@ ssize_t drm_tswrite(struct file *file,
                if (havewritebytes == realcount)
                        break;  /* write ok; */
                else if (havewritebytes > realcount)
-                       pr_info(" error ! write too much\n");
+                       pr_info(" error ! write too much havewritebytes = %u, r = %u\n",
+                       (u32)havewritebytes,(u32)realcount);
 
                count -= r;
        }
-       return re_count;
+       return havewritebytes;
 }
 
 ssize_t tsdemux_write(struct file *file,