[PATCH] kbuild: simplify access to the kernel's version

Sedat Dilek
2021-02-08T03:29:09Z

[ Please CC me directly ]

Hi Sasha,

I like that patch from [1].

What was the Linux-source base?

Searching in Linux v5.11-rc7:

$ git grep -E 'LINUX_VERSION_CODE >> (16|8)'
drivers/net/ethernet/mellanox/mlx5/core/main.c:
(u8)((LINUX_VERSION_CODE >> 16) & 0xff), (u8)((LINUX_VERSION_CODE >>
8) & 0xff),
drivers/scsi/gdth.c: osv.version = (u8)(LINUX_VERSION_CODE >> 16);
drivers/scsi/gdth.c: osv.subversion = (u8)(LINUX_VERSION_CODE >> 8);
drivers/usb/core/hcd.c:#define KERNEL_REL
bin2bcd(((LINUX_VERSION_CODE >> 16) & 0x0ff))
drivers/usb/core/hcd.c:#define KERNEL_VER
bin2bcd(((LINUX_VERSION_CODE >> 8) & 0x0ff))
drivers/usb/gadget/udc/aspeed-vhub/hub.c:#define KERNEL_REL
bin2bcd(((LINUX_VERSION_CODE >> 16) & 0x0ff))
drivers/usb/gadget/udc/aspeed-vhub/hub.c:#define KERNEL_VER
bin2bcd(((LINUX_VERSION_CODE >> 8) & 0x0ff))
include/linux/usb/composite.h: bcdDevice =
bin2bcd((LINUX_VERSION_CODE >> 16 & 0xff)) << 8;
include/linux/usb/composite.h: bcdDevice |=
bin2bcd((LINUX_VERSION_CODE >> 8 & 0xff));
kernel/sys.c: v = ((LINUX_VERSION_CODE >> 8) & 0xff) + 60;

So, drivers/scsi/gdth.c file is missing in your list of file:

Makefile | 5 ++++-
drivers/net/ethernet/mellanox/mlx5/core/main.c | 4 ++--
drivers/usb/core/hcd.c | 4 ++--
drivers/usb/gadget/udc/aspeed-vhub/hub.c | 4 ++--
include/linux/usb/composite.h | 4 ++--
kernel/sys.c | 2 +-
6 files changed, 13 insertions(+), 10 deletions(-)

Thanks.

Regards,
- Sedat -

[1] https://marc.info/?l=linux-kbuild&m=161271450004520&w=2