Module Name: src Committed By: riastradh Date: Mon Mar 17 18:24:08 UTC 2025
Modified Files: src/sys/dev/usb: umcpmio.c umcpmio.h umcpmio_hid_reports.h umcpmio_io.h umcpmio_subr.c umcpmio_subr.h Log Message: umcpmio(4): Fix a lot of KNF issues. - Space after comma. - Space between _keyword_ and parentheses: `for (...)' - No space between _function_ and parentheses: `foo(...)'. - Space around assignment operators: `x = y', not `x=y'. - Space after semicolons: `for (x = 0; x < n; x++)' - Break overlong lines. - Sort includes. - `do { ... } while (0)' in statement macros. - Parenthesize macro arguments (or just use functions if macros aren't necessary). - No parentheses needed for `return': say `return EINVAL;', not `return (EINVAL);' (but parenthesizing complex expressions is fine). - Various other things. /* * block comments like this */ Please, folks, read through /usr/share/misc/style and try to adhere to it _before_ committing. There's also an Emacs C style in /usr/share/misc/NetBSD.el and a clang-format configuration in /usr/share/misc/dot.clang-format to help you. Aside from KNF, I strongly encourage you to write: error = foo(); if (error) goto out; error = bar(); if (error) goto out; ... instead of error = foo(); if (!error) { error = bar(); if (!error) { ... } else { printf("error in bar\n"); } } else { printf("error in foo\n"); } It's hard to follow _both_ the success cases _and_ the failure cases when the success cases grow progressively more deeply indented, and the failure cases are farther and farther away from the logic handling them as you have more conditions. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/usb/umcpmio.c src/sys/dev/usb/umcpmio.h \ src/sys/dev/usb/umcpmio_hid_reports.h src/sys/dev/usb/umcpmio_io.h \ src/sys/dev/usb/umcpmio_subr.c src/sys/dev/usb/umcpmio_subr.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.