File tree 1 file changed +3
-4
lines changed
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>
@@ -3676,9 +3677,9 @@ static struct ctl_table_header *cdrom_sysctl_header;
3676
3677
3677
3678
static void cdrom_sysctl_register (void )
3678
3679
{
3679
- static int initialized ;
3680
+ static atomic_t initialized = ATOMIC_INIT ( 0 ) ;
3680
3681
3681
- if (initialized == 1 )
3682
+ if (! atomic_add_unless ( & initialized , 1 , 1 ) )
3682
3683
return ;
3683
3684
3684
3685
cdrom_sysctl_header = register_sysctl_table (cdrom_root_table );
@@ -3689,8 +3690,6 @@ static void cdrom_sysctl_register(void)
3689
3690
cdrom_sysctl_settings .debug = debug ;
3690
3691
cdrom_sysctl_settings .lock = lockdoor ;
3691
3692
cdrom_sysctl_settings .check = check_media_type ;
3692
-
3693
- initialized = 1 ;
3694
3693
}
3695
3694
3696
3695
static void cdrom_sysctl_unregister (void )
You can’t perform that action at this time.
0 commit comments