From 1e2bcbbb2bb548c3f5917ba9dcc254f79badb3da Mon Sep 17 00:00:00 2001 From: Alex Forencich Date: Wed, 13 Sep 2023 18:27:57 -0700 Subject: [PATCH] modules/mqnic: Add devlink kernel version ifdefs Signed-off-by: Alex Forencich --- modules/mqnic/mqnic_devlink.c | 4 ++++ modules/mqnic/mqnic_main.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/modules/mqnic/mqnic_devlink.c b/modules/mqnic/mqnic_devlink.c index a39fcd36f..ff1eb3d45 100644 --- a/modules/mqnic/mqnic_devlink.c +++ b/modules/mqnic/mqnic_devlink.c @@ -90,7 +90,11 @@ static const struct devlink_ops mqnic_devlink_ops = { struct devlink *mqnic_devlink_alloc(struct device *dev) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) return devlink_alloc(&mqnic_devlink_ops, sizeof(struct mqnic_dev), dev); +#else + return devlink_alloc(&mqnic_devlink_ops, sizeof(struct mqnic_dev)); +#endif } void mqnic_devlink_free(struct devlink *devlink) diff --git a/modules/mqnic/mqnic_main.c b/modules/mqnic/mqnic_main.c index aaa8f9d69..b0b86c2ea 100644 --- a/modules/mqnic/mqnic_main.c +++ b/modules/mqnic/mqnic_main.c @@ -441,7 +441,11 @@ fail_create_if: #endif // probe complete +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) devlink_register(devlink); +#else + devlink_register(devlink, dev); +#endif return 0; // error handling