Without the corresponding include file, these macros get always defined
locally and thus, shadows the ones from the system. This change ensures,
if the macros are found already defined in the system, then they are used.
Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
This patch replaces strcpy() + ioctl() by if_nametoindex() to avoid
overflows caused by long user input.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Fixes the following warning:
| cangen.c:524:7: warning: comparing floating-point with ‘==’ or ‘!=’ is unsafe [-Wfloat-equal]
| 524 | if (gap && burst_sent_count >= burst_count) /* gap == 0 => performance test :-] */
| | ^~~
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Silence the "comparison of integer expressions of different
signedness" warning. We want to compile the code as is from the
kernel, including bugs.
| calc-bit-timing/can-calc-bit-timing-v2_6_31.c: In function ‘can_update_spt_v2_6_31’:
| calc-bit-timing/can-calc-bit-timing-v2_6_31.c:51:13: warning: comparison of integer expressions of different signedness: ‘int’ and ‘__u32’ {aka ‘const unsigned int’} [-Wsign-compare]
Fixes: 18eb0ab784 ("can-calc-bit-timing: import bit timing calculation algorithm from v4.8")
Fixes: b777ce2e6d ("can-calc-bit-timing: import bit timing calculation algorithm from v3.18")
Fixes: c1f5dc53ec ("can-calc-bit-timing: import bit timing calculation algorithm from v2.6.31")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Vincent Mailhol <mailhol.vincent@wanadoo.fr> says:
This series contain cleanup patches and update of header files. There
is no real relation between each patch (aside of 2/6 and 3/6 which
form a pair) so I will end the cover letter here and let you refer to
the short description.
* Changelog *
v2 -> v3:
* reorder the patches so that related changes are next to each
other (especially patch 2/6 and 3/6).
* patch 2/6: new patch to update include/linux/can/error.h with the
latest hearder from Linux 6.0.0.
* patch 3/6: do not use an #ifdef anymore and make sure that the
code still work if run on old kernel version lower than 6.0.0.
* patch 6/6: rewrite commit description to point out that there is a
local copy of the linux headers under include/linux/.
v1 -> v2:
* patch 2/5: add a note in commit message to explain that slcanpty.c
debug is deactivated by default.
* patch 2/5: make the compiler check the pr_debug() syntax even if
debug is off.
* reorder the patches so that the lib.c and the candump.c patches
are next to each other in the series.
Link: https://lore.kernel.org/all/20221114163848.3398-1-mailhol.vincent@wanadoo.fr
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>