Skip to content

Commit

Permalink
Merge pull request #110 from slaclab/update_class_create
Browse files Browse the repository at this point in the history
Fix class create call for newer kernels
  • Loading branch information
ruck314 authored Jan 27, 2024
2 parents 486d632 + 4d557a9 commit e9865b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2023, The Board of Trustees of the Leland Stanford Junior
Copyright (c) 2024, The Board of Trustees of the Leland Stanford Junior
University, through SLAC National Accelerator Laboratory (subject to receipt
of any required approvals from the U.S. Dept. of Energy). All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down
10 changes: 9 additions & 1 deletion common/driver/dma_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,18 @@ int Dma_Init(struct DmaDevice *dev) {
// Create class struct if it does not already exist
if (gCl == NULL) {
dev_info(dev->device,"Init: Creating device class\n");
if ((gCl = class_create(THIS_MODULE, dev->devName)) == NULL) {

#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
gCl = class_create(THIS_MODULE, dev->devName);
#else
gCl = class_create(dev->devName);
#endif

if (gCl == NULL) {
dev_err(dev->device,"Init: Failed to create device class\n");
goto cleanup_cdev_add;
}

gCl->devnode = (void *)Dma_DevNode;
}

Expand Down

0 comments on commit e9865b3

Please sign in to comment.