Skip to content

Commit e0640ca

Browse files
AKoskovichshashankarora07
authored andcommitted
Fix Linux version check for class_create signature
The first version the new signature was introduced in was v6.4-rc1: torvalds/linux@dcfbb67 For RHEL it was backported to the 5.14.0-387.el9 release, so check RHEL_RELEASE_CODE to see if we are running RHEL 9.3 or higher. Issue-Id: RHEL-1023 Signed-off-by: Alexander Koskovich <akoskovich@pm.me>
1 parent 8e41706 commit e0640ca

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

QdssDiag/qtiDiag.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3836,10 +3836,11 @@ static int QTIDevUSBModInit(void)
38363836
}
38373837
#endif
38383838

3839-
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(6,3,13))
3840-
gpDiagClass = class_create(THIS_MODULE, QTIDEV_PORT_CLASS_NAME);
3841-
#else
3839+
#if (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 3)) || \
3840+
(LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0))
38423841
gpDiagClass = class_create(QTIDEV_PORT_CLASS_NAME);
3842+
#else
3843+
gpDiagClass = class_create(THIS_MODULE, QTIDEV_PORT_CLASS_NAME);
38433844
#endif
38443845
if (IS_ERR(gpDiagClass) == true)
38453846
{
@@ -3851,10 +3852,11 @@ static int QTIDevUSBModInit(void)
38513852
return -ENOMEM;
38523853
}
38533854

3854-
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(6,3,13))
3855-
gpQdssClass = class_create(THIS_MODULE, QTIDEV_USB_CLASS_NAME);
3856-
#else
3855+
#if (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 3)) || \
3856+
(LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0))
38573857
gpQdssClass = class_create(QTIDEV_USB_CLASS_NAME);
3858+
#else
3859+
gpQdssClass = class_create(THIS_MODULE, QTIDEV_USB_CLASS_NAME);
38583860
#endif
38593861
if (IS_ERR(gpQdssClass) == true)
38603862
{

rmnet/GobiUSBNet.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "QMIDevice.h"
3636
#include "QMI.h"
3737
#include "qmap.h"
38+
#include "../version.h"
3839
#include <linux/device.h>
3940
#include <linux/if_arp.h>
4041
#include <linux/platform_device.h>
@@ -3215,10 +3216,11 @@ static int GobiUSBNetModInit(void)
32153216
}
32163217
#endif
32173218

3218-
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(6,3,13))
3219-
gpClass = class_create( THIS_MODULE, "GobiQMI" );
3220-
#else
3219+
#if (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 3)) || \
3220+
(LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0))
32213221
gpClass = class_create("GobiQMI" );
3222+
#else
3223+
gpClass = class_create( THIS_MODULE, "GobiQMI" );
32223224
#endif
32233225
if (IS_ERR( gpClass ) == true)
32243226
{

0 commit comments

Comments
 (0)