Skip to content

Commit

Permalink
Fix Linux version check for class_create signature
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
AKoskovich authored and shashankarora07 committed Jan 27, 2025
1 parent 8e41706 commit e0640ca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
14 changes: 8 additions & 6 deletions QdssDiag/qtiDiag.c
Original file line number Diff line number Diff line change
Expand Up @@ -3836,10 +3836,11 @@ static int QTIDevUSBModInit(void)
}
#endif

#if (LINUX_VERSION_CODE <= KERNEL_VERSION(6,3,13))
gpDiagClass = class_create(THIS_MODULE, QTIDEV_PORT_CLASS_NAME);
#else
#if (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 3)) || \
(LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0))
gpDiagClass = class_create(QTIDEV_PORT_CLASS_NAME);
#else
gpDiagClass = class_create(THIS_MODULE, QTIDEV_PORT_CLASS_NAME);
#endif
if (IS_ERR(gpDiagClass) == true)
{
Expand All @@ -3851,10 +3852,11 @@ static int QTIDevUSBModInit(void)
return -ENOMEM;
}

#if (LINUX_VERSION_CODE <= KERNEL_VERSION(6,3,13))
gpQdssClass = class_create(THIS_MODULE, QTIDEV_USB_CLASS_NAME);
#else
#if (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 3)) || \
(LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0))
gpQdssClass = class_create(QTIDEV_USB_CLASS_NAME);
#else
gpQdssClass = class_create(THIS_MODULE, QTIDEV_USB_CLASS_NAME);
#endif
if (IS_ERR(gpQdssClass) == true)
{
Expand Down
8 changes: 5 additions & 3 deletions rmnet/GobiUSBNet.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "QMIDevice.h"
#include "QMI.h"
#include "qmap.h"
#include "../version.h"
#include <linux/device.h>
#include <linux/if_arp.h>
#include <linux/platform_device.h>
Expand Down Expand Up @@ -3215,10 +3216,11 @@ static int GobiUSBNetModInit(void)
}
#endif

#if (LINUX_VERSION_CODE <= KERNEL_VERSION(6,3,13))
gpClass = class_create( THIS_MODULE, "GobiQMI" );
#else
#if (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 3)) || \
(LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0))
gpClass = class_create("GobiQMI" );
#else
gpClass = class_create( THIS_MODULE, "GobiQMI" );
#endif
if (IS_ERR( gpClass ) == true)
{
Expand Down

0 comments on commit e0640ca

Please sign in to comment.