124 INIT_LIST_HEAD(&master->slaves); |
124 INIT_LIST_HEAD(&master->slaves); |
125 master->slave_count = 0; |
125 master->slave_count = 0; |
126 |
126 |
127 INIT_LIST_HEAD(&master->configs); |
127 INIT_LIST_HEAD(&master->configs); |
128 |
128 |
129 master->scan_state = EC_REQUEST_IN_PROGRESS; |
129 master->scan_state = EC_REQUEST_COMPLETE; |
130 master->allow_scan = 1; |
130 master->allow_scan = 1; |
131 init_MUTEX(&master->scan_sem); |
131 init_MUTEX(&master->scan_sem); |
132 init_waitqueue_head(&master->scan_queue); |
132 init_waitqueue_head(&master->scan_queue); |
133 |
133 |
134 master->config_state = EC_REQUEST_COMPLETE; |
134 master->config_state = EC_REQUEST_COMPLETE; |
452 } |
452 } |
453 |
453 |
454 if (master->debug_level) |
454 if (master->debug_level) |
455 EC_DBG("Waiting for pending slave configuration returned.\n"); |
455 EC_DBG("Waiting for pending slave configuration returned.\n"); |
456 |
456 |
|
457 if (master->debug_level) |
|
458 EC_DBG("Disable scanning, current scan state: %u\n", |
|
459 master->scan_state); |
457 down(&master->scan_sem); |
460 down(&master->scan_sem); |
458 master->allow_scan = 0; // 'lock' the slave list |
461 master->allow_scan = 0; // 'lock' the slave list |
459 up(&master->scan_sem); |
462 up(&master->scan_sem); |
460 |
463 |
461 // wait for slave scan to complete |
464 if (master->scan_state == EC_REQUEST_IN_PROGRESS) { |
462 if (wait_event_interruptible(master->scan_queue, |
465 // wait for slave scan to complete |
463 master->scan_state != EC_REQUEST_IN_PROGRESS)) { |
466 if (wait_event_interruptible(master->scan_queue, |
464 EC_INFO("Waiting for slave scan interrupted by signal.\n"); |
467 master->scan_state != EC_REQUEST_IN_PROGRESS)) { |
465 goto out_allow; |
468 EC_INFO("Waiting for slave scan interrupted by signal.\n"); |
|
469 goto out_allow; |
|
470 } |
466 } |
471 } |
467 |
472 |
468 if (master->debug_level) |
473 if (master->debug_level) |
469 EC_DBG("Waiting for pending slave scan returned.\n"); |
474 EC_DBG("Waiting for pending slave scan returned.\n"); |
470 |
475 |
1345 } |
1350 } |
1346 |
1351 |
1347 // request slave configuration |
1352 // request slave configuration |
1348 down(&master->config_sem); |
1353 down(&master->config_sem); |
1349 master->allow_config = 1; // request the current configuration |
1354 master->allow_config = 1; // request the current configuration |
1350 master->config_state = EC_REQUEST_IN_PROGRESS; |
|
1351 up(&master->config_sem); |
1355 up(&master->config_sem); |
1352 |
1356 |
1353 // wait for configuration to complete |
1357 if (master->main_device.link_state) { |
1354 if (wait_event_interruptible(master->config_queue, |
1358 // wait for configuration to complete |
1355 master->config_state != EC_REQUEST_IN_PROGRESS)) { |
1359 master->config_state = EC_REQUEST_IN_PROGRESS; |
1356 EC_INFO("Waiting for configuration interrupted by signal.\n"); |
1360 if (wait_event_interruptible(master->config_queue, |
1357 return -1; |
1361 master->config_state != EC_REQUEST_IN_PROGRESS)) { |
1358 } |
1362 EC_INFO("Waiting for configuration interrupted by signal.\n"); |
1359 |
1363 return -1; |
1360 if (master->config_state != EC_REQUEST_COMPLETE) { |
1364 } |
1361 EC_ERR("Failed to configure slaves.\n"); |
1365 |
1362 return -1; |
1366 if (master->config_state != EC_REQUEST_COMPLETE) { |
|
1367 EC_ERR("Failed to configure slaves.\n"); |
|
1368 return -1; |
|
1369 } |
1363 } |
1370 } |
1364 |
1371 |
1365 // restart EoE process and master thread with new locking |
1372 // restart EoE process and master thread with new locking |
1366 #ifdef EC_EOE |
1373 #ifdef EC_EOE |
1367 ec_master_eoe_stop(master); |
1374 ec_master_eoe_stop(master); |