rusoku / TouCAN-SocketCAN

SocketCAN Linux driver for UAB "Rusoku Technologies" TouCAN USB to CAN bus converter

Home Page:https://www.rusoku.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

implicit declaration of function ‘get_can_dlc’

Nodraak opened this issue · comments

In case anyone has the same issue:

$ uname -r
5.11.0-27-generic

$ cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.3 LTS"
NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

$ make
make -C /lib/modules/5.11.0-27-generic/build M=/home/adrien/Downloads/TouCAN-SocketCAN modules
make[1]: Entering directory '/usr/src/linux-headers-5.11.0-27-generic'
  CC [M]  /home/adrien/Downloads/TouCAN-SocketCAN/toucan.o
/home/adrien/Downloads/TouCAN-SocketCAN/toucan.c: In function ‘toucan_rx_can_msg’:
/home/adrien/Downloads/TouCAN-SocketCAN/toucan.c:526:17: error: implicit declaration of function ‘get_can_dlc’ [-Werror=implicit-function-declaration]
  526 |   cf->can_dlc = get_can_dlc(msg->dlc);
      |                 ^~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:287: /home/adrien/Downloads/TouCAN-SocketCAN/toucan.o] Error 1
make[1]: *** [Makefile:1848: /home/adrien/Downloads/TouCAN-SocketCAN] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.11.0-27-generic'
make: *** [Makefile:6: all] Error 2

Fix (inspired by https://www.spinics.net/lists/linux-can/msg05438.html):

sed -i s/get_can_dlc/can_cc_dlc2len/ toucan.c

Try branch v1.0 for kernel 5.11

Yes, correct.In this kernel version 5.11 get_can_dlc() is changed to can_cc_dlc2len()