CHECK: Macro argument 'pbuf' may be better as '(pbuf)' to avoid precedence issues #184: FILE: include/linux/packing.h:46: +#define pack_fields(pbuf, ustruct, fields, quirks) \ + ({ \ + typeof(fields[0]) *__f = fields; \ + size_t pbuflen = sizeof(*pbuf); \ + size_t num_fields = ARRAY_SIZE(fields); \ + BUILD_BUG_ON(__f[0].startbit >= BITS_PER_BYTE * pbuflen); \ + BUILD_BUG_ON(__f[num_fields - 1].startbit >= BITS_PER_BYTE * pbuflen); \ + _Generic((fields), \ + const struct packed_field_s * : pack_fields_s, \ + const struct packed_field_m * : pack_fields_m \ + )(pbuf, pbuflen, ustruct, __f, num_fields, quirks); \ + }) WARNING: line length of 88 exceeds 80 columns #190: FILE: include/linux/packing.h:52: + BUILD_BUG_ON(__f[num_fields - 1].startbit >= BITS_PER_BYTE * pbuflen); \ CHECK: Macro argument 'pbuf' may be better as '(pbuf)' to avoid precedence issues #197: FILE: include/linux/packing.h:59: +#define unpack_fields(pbuf, ustruct, fields, quirks) \ + ({ \ + typeof(fields[0]) *__f = fields; \ + size_t pbuflen = sizeof(*pbuf); \ + size_t num_fields = ARRAY_SIZE(fields); \ + BUILD_BUG_ON(__f[0].startbit >= BITS_PER_BYTE * pbuflen); \ + BUILD_BUG_ON(__f[num_fields - 1].startbit >= BITS_PER_BYTE * pbuflen); \ + _Generic((fields), \ + const struct packed_field_s * : unpack_fields_s, \ + const struct packed_field_m * : unpack_fields_m \ + )(pbuf, pbuflen, ustruct, __f, num_fields, quirks); \ + }) WARNING: line length of 88 exceeds 80 columns #203: FILE: include/linux/packing.h:65: + BUILD_BUG_ON(__f[num_fields - 1].startbit >= BITS_PER_BYTE * pbuflen); \ ERROR: Macros with multiple statements should be enclosed in a do - while loop #230: FILE: include/linux/packing_types.h:14: +#define GEN_PACKED_FIELD_MEMBERS(__type) \ + __type startbit; \ + __type endbit; \ + __type offset; \ + __type size; WARNING: macros should not use a trailing semicolon #230: FILE: include/linux/packing_types.h:14: +#define GEN_PACKED_FIELD_MEMBERS(__type) \ + __type startbit; \ + __type endbit; \ + __type offset; \ + __type size; WARNING: line length of 81 exceeds 80 columns #278: FILE: lib/packing.c:13: +#define __pack_fields(pbuf, pbuflen, ustruct, fields, num_fields, quirks) \ WARNING: line length of 81 exceeds 80 columns #279: FILE: lib/packing.c:14: + ({ \ WARNING: line length of 81 exceeds 80 columns #280: FILE: lib/packing.c:15: + for (size_t i = 0; i < (num_fields); i++) { \ WARNING: line length of 81 exceeds 80 columns #281: FILE: lib/packing.c:16: + typeof(&(fields)[0]) field = &(fields)[i]; \ WARNING: line length of 81 exceeds 80 columns #282: FILE: lib/packing.c:17: + u64 uval; \ WARNING: line length of 81 exceeds 80 columns #283: FILE: lib/packing.c:18: + \ WARNING: line length of 91 exceeds 80 columns #284: FILE: lib/packing.c:19: + uval = ustruct_field_to_u64(ustruct, field->offset, field->size); \ WARNING: line length of 81 exceeds 80 columns #285: FILE: lib/packing.c:20: + \ WARNING: line length of 81 exceeds 80 columns #286: FILE: lib/packing.c:21: + __pack(pbuf, uval, field->startbit, field->endbit, \ WARNING: line length of 81 exceeds 80 columns #287: FILE: lib/packing.c:22: + pbuflen, quirks); \ WARNING: line length of 81 exceeds 80 columns #288: FILE: lib/packing.c:23: + } \ WARNING: line length of 81 exceeds 80 columns #291: FILE: lib/packing.c:26: +#define __unpack_fields(pbuf, pbuflen, ustruct, fields, num_fields, quirks) \ WARNING: line length of 81 exceeds 80 columns #292: FILE: lib/packing.c:27: + ({ \ WARNING: line length of 81 exceeds 80 columns #293: FILE: lib/packing.c:28: + for (size_t i = 0; i < (num_fields); i++) { \ WARNING: line length of 81 exceeds 80 columns #294: FILE: lib/packing.c:29: + typeof(&(fields)[0]) field = &fields[i]; \ WARNING: line length of 81 exceeds 80 columns #295: FILE: lib/packing.c:30: + u64 uval; \ WARNING: line length of 81 exceeds 80 columns #296: FILE: lib/packing.c:31: + \ WARNING: line length of 81 exceeds 80 columns #297: FILE: lib/packing.c:32: + __unpack(pbuf, &uval, field->startbit, field->endbit, \ WARNING: line length of 81 exceeds 80 columns #298: FILE: lib/packing.c:33: + pbuflen, quirks); \ WARNING: line length of 81 exceeds 80 columns #299: FILE: lib/packing.c:34: + \ WARNING: line length of 90 exceeds 80 columns #300: FILE: lib/packing.c:35: + u64_to_ustruct_field(ustruct, field->offset, field->size, uval); \ WARNING: line length of 81 exceeds 80 columns #301: FILE: lib/packing.c:36: + } \ CHECK: Prefer kernel type 'u16' over 'uint16_t' #592: FILE: scripts/mod/packed_fields.c:17: +typedef uint16_t u16; CHECK: Prefer kernel type 'u8' over 'uint8_t' #593: FILE: scripts/mod/packed_fields.c:18: +typedef uint8_t u8; CHECK: Prefer kernel type 'u64' over 'uint64_t' #614: FILE: scripts/mod/packed_fields.c:39: + uint64_t startbit; CHECK: Prefer kernel type 'u64' over 'uint64_t' #615: FILE: scripts/mod/packed_fields.c:40: + uint64_t endbit; CHECK: Prefer kernel type 'u64' over 'uint64_t' #616: FILE: scripts/mod/packed_fields.c:41: + uint64_t offset; CHECK: Prefer kernel type 'u64' over 'uint64_t' #617: FILE: scripts/mod/packed_fields.c:42: + uint64_t size; WARNING: line length of 87 exceeds 80 columns #641: FILE: scripts/mod/packed_fields.c:66: + error("attempted to get field size for unknown packed field type %u\n", WARNING: line length of 91 exceeds 80 columns #670: FILE: scripts/mod/packed_fields.c:95: + error("attempted to get field contents for unknown packed field type %u\n", WARNING: line length of 102 exceeds 80 columns #709: FILE: scripts/mod/packed_fields.c:134: + error("[%s.ko] \"%s\" has size %zu which is not a multiple of the field size (%zu)\n", WARNING: line length of 109 exceeds 80 columns #723: FILE: scripts/mod/packed_fields.c:148: + error("[%s.ko] \"%s\" field %zu unpacked size (%" PRIu64 ") must be 1, 2, 4, or 8\n", WARNING: line length of 115 exceeds 80 columns #727: FILE: scripts/mod/packed_fields.c:152: + error("[%s.ko] \"%s\" field %zu (%" PRIu64 "-%" PRIu64 "): start bit must be >= end bit\n", WARNING: line length of 190 exceeds 80 columns #732: FILE: scripts/mod/packed_fields.c:157: + error("[%s.ko] \"%s\" field %zu (%" PRIu64 "-%" PRIu64 ") has a width of %" PRIu64 " bits which does not fit into the unpacked structure field (%" PRIu64 " bytes)\n", WARNING: line length of 140 exceeds 80 columns #741: FILE: scripts/mod/packed_fields.c:166: + error("[%s.ko] \"%s\" field %zu (%" PRIu64 "-%" PRIu64 ") overlaps with previous field (%" PRIu64 "-%" PRIu64 ")\n", WARNING: line length of 161 exceeds 80 columns #757: FILE: scripts/mod/packed_fields.c:182: + error("[%s.ko] \"%s\" field %zu (%" PRIu64 "-%" PRIu64") not in ascending order with previous field (%" PRIu64 "-%" PRIu64 ")\n", CHECK: Concatenated strings should use spaces between elements #757: FILE: scripts/mod/packed_fields.c:182: + error("[%s.ko] \"%s\" field %zu (%" PRIu64 "-%" PRIu64") not in ascending order with previous field (%" PRIu64 "-%" PRIu64 ")\n", WARNING: line length of 162 exceeds 80 columns #765: FILE: scripts/mod/packed_fields.c:190: + error("[%s.ko] \"%s\" field %zu (%" PRIu64 "-%" PRIu64") not in descending order with previous field (%" PRIu64 "-%" PRIu64 ")\n", CHECK: Concatenated strings should use spaces between elements #765: FILE: scripts/mod/packed_fields.c:190: + error("[%s.ko] \"%s\" field %zu (%" PRIu64 "-%" PRIu64") not in descending order with previous field (%" PRIu64 "-%" PRIu64 ")\n", total: 1 errors, 34 warnings, 10 checks, 649 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. Commit 8b6400abf010 ("lib: packing: add pack_fields() and unpack_fields()") has style problems, please review. NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT BAD_REPORTED_BY_LINK CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS.