]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: vidtv: cleanup PSI version numbers
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sun, 20 Sep 2020 07:17:45 +0000 (09:17 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 1 Oct 2020 07:20:56 +0000 (09:20 +0200)
There's no reason to use static vars to store PSI version
numbers.

Also, currently, version numbers are starting with 0x01,
because there's a code being called that increases it to
1 for all table initializer code, as the code may support
dynamic changes at the PS tables on some future.

So, let's just initialize them to 0x1f, in order for the
versions to be reported as starting from 0.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/test-drivers/vidtv/vidtv_psi.c

index 5fe3fbb765b89f7980c9db1124356407c045ac34..82cf67dd27c015d927da3d4991feff394a544394 100644 (file)
@@ -756,7 +756,6 @@ vidtv_psi_pat_program_assign(struct vidtv_psi_table_pat *pat,
 struct vidtv_psi_table_pat *vidtv_psi_pat_table_init(u16 transport_stream_id)
 {
        struct vidtv_psi_table_pat *pat = kzalloc(sizeof(*pat), GFP_KERNEL);
-       static u8 pat_version;
        const u16 SYNTAX = 0x1;
        const u16 ZERO = 0x0;
        const u16 ONES = 0x03;
@@ -767,7 +766,7 @@ struct vidtv_psi_table_pat *vidtv_psi_pat_table_init(u16 transport_stream_id)
        pat->header.id           = cpu_to_be16(transport_stream_id);
        pat->header.current_next = 0x1;
 
-       pat->header.version = pat_version;
+       pat->header.version = 0x1f;
 
        pat->header.one2         = 0x03;
        pat->header.section_id   = 0x0;
@@ -935,7 +934,6 @@ struct vidtv_psi_table_pmt *vidtv_psi_pmt_table_init(u16 program_number,
                                                     u16 pcr_pid)
 {
        struct vidtv_psi_table_pmt *pmt = kzalloc(sizeof(*pmt), GFP_KERNEL);
-       static u8 pmt_version;
        const u16 SYNTAX = 0x1;
        const u16 ZERO = 0x0;
        const u16 ONES = 0x03;
@@ -953,7 +951,7 @@ struct vidtv_psi_table_pmt *vidtv_psi_pmt_table_init(u16 program_number,
        pmt->header.id = cpu_to_be16(program_number);
        pmt->header.current_next = 0x1;
 
-       pmt->header.version = pmt_version;
+       pmt->header.version = 0x1f;
 
        pmt->header.one2 = ONES;
        pmt->header.section_id   = 0;
@@ -1083,7 +1081,6 @@ void vidtv_psi_pmt_table_destroy(struct vidtv_psi_table_pmt *pmt)
 struct vidtv_psi_table_sdt *vidtv_psi_sdt_table_init(u16 transport_stream_id)
 {
        struct vidtv_psi_table_sdt *sdt = kzalloc(sizeof(*sdt), GFP_KERNEL);
-       static u8 sdt_version;
        const u16 SYNTAX = 0x1;
        const u16 ONE = 0x1;
        const u16 ONES = 0x03;
@@ -1101,7 +1098,7 @@ struct vidtv_psi_table_sdt *vidtv_psi_sdt_table_init(u16 transport_stream_id)
        sdt->header.id = cpu_to_be16(transport_stream_id);
        sdt->header.current_next = ONE;
 
-       sdt->header.version = sdt_version;
+       sdt->header.version = 0x1f;
 
        sdt->header.one2  = ONES;
        sdt->header.section_id   = 0;