File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 265
265
/* #define ERRLOGMASK (CD_WARNING|CD_OPEN|CD_COUNT_TRACKS|CD_CLOSE) */
266
266
/* #define ERRLOGMASK (CD_WARNING|CD_REG_UNREG|CD_DO_IOCTL|CD_OPEN|CD_CLOSE|CD_COUNT_TRACKS) */
267
267
268
+ #include <linux/atomic.h>
268
269
#include <linux/module.h>
269
270
#include <linux/fs.h>
270
271
#include <linux/major.h>
@@ -3692,9 +3693,9 @@ static struct ctl_table_header *cdrom_sysctl_header;
3692
3693
3693
3694
static void cdrom_sysctl_register (void )
3694
3695
{
3695
- static int initialized ;
3696
+ static atomic_t initialized = ATOMIC_INIT ( 0 ) ;
3696
3697
3697
- if (initialized == 1 )
3698
+ if (! atomic_add_unless ( & initialized , 1 , 1 ) )
3698
3699
return ;
3699
3700
3700
3701
cdrom_sysctl_header = register_sysctl_table (cdrom_root_table );
@@ -3705,8 +3706,6 @@ static void cdrom_sysctl_register(void)
3705
3706
cdrom_sysctl_settings .debug = debug ;
3706
3707
cdrom_sysctl_settings .lock = lockdoor ;
3707
3708
cdrom_sysctl_settings .check = check_media_type ;
3708
-
3709
- initialized = 1 ;
3710
3709
}
3711
3710
3712
3711
static void cdrom_sysctl_unregister (void )
You can’t perform that action at this time.
0 commit comments