Commit Graph

133 Commits

Author SHA1 Message Date
Konrad Dybcio
fb1118346d Merge pull request #28 from lumag/fix-ci
Makefile: adapt for libftdi vs libftdi1 differences
2023-09-21 15:42:57 +02:00
Dmitry Baryshkov
b6ef0718d4 ci: install pkg-config or pkgconf
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2023-09-21 16:37:48 +03:00
Dmitry Baryshkov
2bbe855662 Makefile: adapt for libftdi vs libftdi1 differences
Use the cflags and libs from pkg-config. This allows us to adapt to the
distro differences. Also, make sure to autodetect if the distro provides
libftdi or libftdi1, preferring the latter one.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2023-09-21 15:03:40 +03:00
Konrad Dybcio
38d05e8d95 Merge pull request #23 from lumag/tilde-handling
cdba: fix console handling
2023-09-21 12:43:29 +02:00
Konrad Dybcio
f2d2828dd8 Merge pull request #22 from lumag/set_active
device: support specifying active slot
2023-09-21 12:43:18 +02:00
Dmitry Baryshkov
bfcbff6439 cdba: fix console handling
Current default is to interpret 20 tilde characters as a signal to power
cycle the board and if there are no power cycles left to exit cdba.
Unfortunately gcc started spurting tilde chars in compile log, so
compiling software on the cdba target can cause cdba exit.

Change the defaults so that by default cdba doesn't interpret received
lines. One can specify '-c 0' on the cdba command line to restore
previous behaviour.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2023-09-21 13:36:58 +03:00
Dmitry Baryshkov
327da0b5b5 device: support specifying active slot
For different reasons it might be desirable to keep slot 'b' as an
active slot. Add support for specifying the active slot in the config
file. The default is still slot 'a'.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2023-09-21 13:35:04 +03:00
Konrad Dybcio
ace20c95f5 Merge pull request #26 from linux-msm/konradybcio-patch-1
cdba-server: Remove dead code
2023-09-21 12:29:51 +02:00
Konrad Dybcio
9e0edd42ce Merge pull request #20 from lumag/debian-cross-ci
Improve debian-cross CI scripts
2023-09-21 12:28:00 +02:00
Dmitry Baryshkov
35836467e4 c/debian: use dpkg-architecture to detect gcc-cross package name
Rather than specifying GCC packages manually, generate package name
using dpkg-architecture.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2023-09-21 13:26:29 +03:00
Dmitry Baryshkov
d6d2554182 ci/debian: don't install libc6-dev-ARCH-cross packages
There is no need to manually install libc6-dev-ARCH-cross packages.
Corresponding target arch packages will be pulled out via the dependency
of library dev packages.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2023-09-21 13:23:59 +03:00
Konrad Dybcio
5850ee756d cdba-server: Remove dead code
Don't count the timers, as it's not used anywhere. Clang is unhappy with that:

cdba-server.c:307:6: warning: variable 'count' set but not used [-Wunused-but-set-variable]
        int count = 0;

Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2023-09-21 09:24:24 +02:00
Konrad Dybcio
6ea5f8f123 ci: Drop EOL ubuntu kinetic
and leave a comment about lunar EOL

Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2023-09-21 01:53:05 +02:00
Konrad Dybcio
f3ec38a754 Merge pull request #24 from linux-msm/konradybcio-patch-1
Drop EOL fedora branches
2023-09-21 01:51:27 +02:00
Konrad Dybcio
721f440e7d Drop EOL fedora branches
Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2023-09-21 01:36:12 +02:00
Krzysztof Kozlowski
acb6508e4f Makefile: enable several warnings and -Werror
After fixing all the warnings (at least on gcc v11.3.0), enable them as
errors, so any silent builds will explicitly fail (also in Continuous
Integration builds).

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2023-05-08 15:02:37 -05:00
Krzysztof Kozlowski
a785bd1ab1 list: fix clang -Wcast-align on container_of
Cast via (void *) to fix -Wcast-align clang and GCC on armv7
(arm-linux-gnueabi-gcc) warning for container_of:

  device.c:91:2: warning: cast from 'char *' to 'typeof (*(device)) *' (aka 'struct device *') increases required alignment from 1 to 8 [-Wcast-align]
          list_for_each_entry(device, &devices, node) {
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ./list.h:91:14: note: expanded from macro 'list_for_each_entry'
          for (item = list_entry_first(list, typeof(*(item)), member); \
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ./list.h:85:2: note: expanded from macro 'list_entry_first'
          container_of((list)->next, type, member)
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ./list.h:39:3: note: expanded from macro 'container_of'
                  (type *)((char *)__mptr - offsetof(type, member)); \
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2023-05-08 15:02:37 -05:00
Krzysztof Kozlowski
7653f1afdb circ_buf: fix clang -Wunused-but-set-variable
Fixes clang warning:

  circ_buf.c:49:9: warning: variable 'count' set but not used [-Wunused-but-set-variable]
          size_t count = 0;
                 ^

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2023-05-08 15:02:37 -05:00
Krzysztof Kozlowski
7e577538fc cdba-server: fix -Wpointer-arith
Pointer arithmetic should not be done on void pointers.

  cdba-server.c:146:21: warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
    146 |         memcpy(newp + fastboot_size, data, len);
        |                     ^

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2023-05-08 15:02:37 -05:00
Krzysztof Kozlowski
ca2d4b08dd cdba-server: correct cast to fix -Wcast-qual
Fixes:

  cdba-server.c: In function ‘fastboot_info’:
  cdba-server.c:98:33: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual]
     98 |         fprintf(stderr, "%s\n", (char *)buf);
        |                                 ^

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2023-05-08 15:02:37 -05:00
Krzysztof Kozlowski
044be470d2 device: fix -Wsign-compare
Code should avoid comparing signed and unsigned integers, because of
implicit case.  Explicit casts are safe because 'lock' size is PATH_MAX.

  device.c: In function ‘device_lock’:
  device.c:64:15: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
     64 |         if (n >= sizeof(lock))
        |               ^~

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2023-05-08 15:02:37 -05:00
Krzysztof Kozlowski
c7e7a81a6c device_parser: fix -Wformat=
Fixes:

  device_parser.c: In function ‘nextsym’:
  device_parser.c:53:56: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘unsigned int’ [-Wformat=]
     53 |                 fprintf(stderr, "device parser: error %d\n", dp->parser.error);
        |                                                       ~^     ~~~~~~~~~~~~~~~~
        |                                                        |               |
        |                                                        int             unsigned int
        |                                                       %d
  device_parser.c: In function ‘expect’:
  device_parser.c:80:58: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘unsigned int’ [-Wformat=]
     80 |         fprintf(stderr, "device parser: expected %d got %d\n", type, dp->event.type);
        |                                                         ~^           ~~~~~~~~~~~~~~
        |                                                          |                    |
        |                                                          int                  unsigned int

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2023-05-08 15:02:37 -05:00
Krzysztof Kozlowski
edb41596e5 conmux: fix -Wsign-compare
Code should avoid comparing signed and unsigned integers, because of
implicit case.  Explicit casts are safe because 'buf' size is 256.

  conmux.c: In function ‘registry_lookup’:
  conmux.c:169:17: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
    169 |         if (ret >= sizeof(buf))
        |                 ^~

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2023-05-08 15:02:37 -05:00
Krzysztof Kozlowski
f47098ba58 cdb_assist: fix -Wformat=
Fixes:

  cdb_assist.c: In function ‘cdb_assist_print_status’:
  cdb_assist.c:351:28: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘unsigned int’ [-Wformat=]
    351 |         n = sprintf(buf, "%dmV %dmA%s%s%s%s%s ref: %dmV",
        |                           ~^
        |                            |
        |                            int
        |                           %d
    352 |                          cdb->voltage_set,
        |                          ~~~~~~~~~~~~~~~~
        |                             |
        |                             unsigned int

  cdb_assist.c:372:29: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘unsigned int’ [-Wformat=]
    372 |         n = sprintf(buf, "u%d\r\n", mV);
        |                            ~^       ~~
        |                             |       |
        |                             int     unsigned int
        |                            %d

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2023-05-08 15:02:37 -05:00
Krzysztof Kozlowski
352dc1abca circ_buf: fix -Wpointer-arith
Pointer arithmetic should not be done on void pointers.

  circ_buf.c: In function ‘circ_read’:
  circ_buf.c:104:25: warning: pointer of type ‘void *’ used in subtraction [-Wpointer-arith]
    104 |         return (void*)p - buf;
        |                         ^

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2023-05-08 15:02:37 -05:00