Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Linux 5.18 #18

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
19 changes: 10 additions & 9 deletions driver/x86_adapt_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1551,11 +1551,11 @@ static int __init x86_adapt_init(void)
{
int i,err;

get_online_cpus();
cpus_read_lock();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this avail. for older Linuxes? Since when? Also check unlock

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introduced in 8f553c498e17, first released in Linux 4.13.


#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)
put_online_cpus();
cpus_read_unlock();
cpu_notifier_register_begin();
#endif
#endif
Expand Down Expand Up @@ -1621,7 +1621,7 @@ static int __init x86_adapt_init(void)
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)
/* >= 3.15, < 4.10 */
__register_hotcpu_notifier(&x86_adapt_cpu_notifier);
put_online_cpus();
cpus_read_unlock();
#else
/* >= 4.10 */

Expand All @@ -1630,7 +1630,7 @@ static int __init x86_adapt_init(void)
if (err < 0)
goto fail;
cpuhp_x86a_state = err;
put_online_cpus();
cpus_read_unlock();
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)
/* >= 3.15, < 4.10 */
Expand All @@ -1639,7 +1639,7 @@ static int __init x86_adapt_init(void)
#else
/* < 3.15 */
register_hotcpu_notifier(&x86_adapt_cpu_notifier);
put_online_cpus();
cpus_read_unlock();
#endif


Expand Down Expand Up @@ -1700,10 +1700,10 @@ static int __init x86_adapt_init(void)
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)
cpu_notifier_register_done();
#else
put_online_cpus();
cpus_read_unlock();
#endif
#else
put_online_cpus();
cpus_read_unlock();
#endif

return err;
Expand All @@ -1713,7 +1713,8 @@ static void __exit x86_adapt_exit(void)
{
int i;

get_online_cpus();
//get_online_cpus();
cpus_read_lock();

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)
Expand Down Expand Up @@ -1774,7 +1775,7 @@ static void __exit x86_adapt_exit(void)
class_destroy(x86_adapt_class);
x86_adapt_class = NULL;

put_online_cpus();
cpus_read_unlock();

printk(KERN_INFO "Shutting Down x86 Adapt Processor Feature Device Driver\n");
}
Expand Down