@@ -3271,14 +3271,13 @@ fw_crash_buffer_store(struct device *cdev,
32713271 struct megasas_instance * instance =
32723272 (struct megasas_instance * ) shost -> hostdata ;
32733273 int val = 0 ;
3274- unsigned long flags ;
32753274
32763275 if (kstrtoint (buf , 0 , & val ) != 0 )
32773276 return - EINVAL ;
32783277
3279- spin_lock_irqsave (& instance -> crashdump_lock , flags );
3278+ mutex_lock (& instance -> crashdump_lock );
32803279 instance -> fw_crash_buffer_offset = val ;
3281- spin_unlock_irqrestore (& instance -> crashdump_lock , flags );
3280+ mutex_unlock (& instance -> crashdump_lock );
32823281 return strlen (buf );
32833282}
32843283
@@ -3293,24 +3292,23 @@ fw_crash_buffer_show(struct device *cdev,
32933292 unsigned long dmachunk = CRASH_DMA_BUF_SIZE ;
32943293 unsigned long chunk_left_bytes ;
32953294 unsigned long src_addr ;
3296- unsigned long flags ;
32973295 u32 buff_offset ;
32983296
3299- spin_lock_irqsave (& instance -> crashdump_lock , flags );
3297+ mutex_lock (& instance -> crashdump_lock );
33003298 buff_offset = instance -> fw_crash_buffer_offset ;
33013299 if (!instance -> crash_dump_buf ||
33023300 !((instance -> fw_crash_state == AVAILABLE ) ||
33033301 (instance -> fw_crash_state == COPYING ))) {
33043302 dev_err (& instance -> pdev -> dev ,
33053303 "Firmware crash dump is not available\n" );
3306- spin_unlock_irqrestore (& instance -> crashdump_lock , flags );
3304+ mutex_unlock (& instance -> crashdump_lock );
33073305 return - EINVAL ;
33083306 }
33093307
33103308 if (buff_offset > (instance -> fw_crash_buffer_size * dmachunk )) {
33113309 dev_err (& instance -> pdev -> dev ,
33123310 "Firmware crash dump offset is out of range\n" );
3313- spin_unlock_irqrestore (& instance -> crashdump_lock , flags );
3311+ mutex_unlock (& instance -> crashdump_lock );
33143312 return 0 ;
33153313 }
33163314
@@ -3322,7 +3320,7 @@ fw_crash_buffer_show(struct device *cdev,
33223320 src_addr = (unsigned long )instance -> crash_buf [buff_offset / dmachunk ] +
33233321 (buff_offset % dmachunk );
33243322 memcpy (buf , (void * )src_addr , size );
3325- spin_unlock_irqrestore (& instance -> crashdump_lock , flags );
3323+ mutex_unlock (& instance -> crashdump_lock );
33263324
33273325 return size ;
33283326}
@@ -3347,7 +3345,6 @@ fw_crash_state_store(struct device *cdev,
33473345 struct megasas_instance * instance =
33483346 (struct megasas_instance * ) shost -> hostdata ;
33493347 int val = 0 ;
3350- unsigned long flags ;
33513348
33523349 if (kstrtoint (buf , 0 , & val ) != 0 )
33533350 return - EINVAL ;
@@ -3361,9 +3358,9 @@ fw_crash_state_store(struct device *cdev,
33613358 instance -> fw_crash_state = val ;
33623359
33633360 if ((val == COPIED ) || (val == COPY_ERROR )) {
3364- spin_lock_irqsave (& instance -> crashdump_lock , flags );
3361+ mutex_lock (& instance -> crashdump_lock );
33653362 megasas_free_host_crash_buffer (instance );
3366- spin_unlock_irqrestore (& instance -> crashdump_lock , flags );
3363+ mutex_unlock (& instance -> crashdump_lock );
33673364 if (val == COPY_ERROR )
33683365 dev_info (& instance -> pdev -> dev , "application failed to "
33693366 "copy Firmware crash dump\n" );
@@ -7422,7 +7419,7 @@ static inline void megasas_init_ctrl_params(struct megasas_instance *instance)
74227419 init_waitqueue_head (& instance -> int_cmd_wait_q );
74237420 init_waitqueue_head (& instance -> abort_cmd_wait_q );
74247421
7425- spin_lock_init (& instance -> crashdump_lock );
7422+ mutex_init (& instance -> crashdump_lock );
74267423 spin_lock_init (& instance -> mfi_pool_lock );
74277424 spin_lock_init (& instance -> hba_lock );
74287425 spin_lock_init (& instance -> stream_lock );
0 commit comments