--- a/master/cdev.c Thu Dec 23 09:48:56 2010 +0100
+++ b/master/cdev.c Wed Jan 05 08:36:53 2011 +0100
@@ -186,7 +186,7 @@
ec_ioctl_master_t data;
unsigned int i;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
data.slave_count = master->slave_count;
data.config_count = ec_master_config_count(master);
@@ -197,9 +197,9 @@
data.phase = (uint8_t) master->phase;
data.active = (uint8_t) master->active;
data.scan_busy = master->scan_busy;
- up(&master->master_sem);
-
- if (down_interruptible(&master->device_sem))
+ ec_mutex_unlock(&master->master_mutex);
+
+ if (ec_mutex_lock_interruptible(&master->device_mutex))
return -EINTR;
if (master->main_device.dev) {
@@ -242,7 +242,7 @@
data.devices[1].loss_rates[i] = master->backup_device.loss_rates[i];
}
- up(&master->device_sem);
+ ec_mutex_unlock(&master->device_mutex);
data.app_time = master->app_time;
data.ref_clock =
@@ -271,12 +271,12 @@
return -EFAULT;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(slave = ec_master_find_slave_const(
master, 0, data.position))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Slave %u does not exist!\n", data.position);
return -EINVAL;
}
@@ -330,7 +330,7 @@
ec_cdev_strcpy(data.order, slave->sii.order);
ec_cdev_strcpy(data.name, slave->sii.name);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
if (copy_to_user((void __user *) arg, &data, sizeof(data)))
return -EFAULT;
@@ -355,19 +355,19 @@
return -EFAULT;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(slave = ec_master_find_slave_const(
master, 0, data.slave_position))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Slave %u does not exist!\n",
data.slave_position);
return -EINVAL;
}
if (data.sync_index >= slave->sii.sync_count) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_SLAVE_ERR(slave, "Sync manager %u does not exist!\n",
data.sync_index);
return -EINVAL;
@@ -381,7 +381,7 @@
data.enable = sync->enable;
data.pdo_count = ec_pdo_list_count(&sync->pdos);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
if (copy_to_user((void __user *) arg, &data, sizeof(data)))
return -EFAULT;
@@ -407,19 +407,19 @@
return -EFAULT;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(slave = ec_master_find_slave_const(
master, 0, data.slave_position))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Slave %u does not exist!\n",
data.slave_position);
return -EINVAL;
}
if (data.sync_index >= slave->sii.sync_count) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_SLAVE_ERR(slave, "Sync manager %u does not exist!\n",
data.sync_index);
return -EINVAL;
@@ -428,7 +428,7 @@
sync = &slave->sii.syncs[data.sync_index];
if (!(pdo = ec_pdo_list_find_pdo_by_pos_const(
&sync->pdos, data.pdo_pos))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_SLAVE_ERR(slave, "Sync manager %u does not contain a PDO with "
"position %u!\n", data.sync_index, data.pdo_pos);
return -EINVAL;
@@ -438,7 +438,7 @@
data.entry_count = ec_pdo_entry_count(pdo);
ec_cdev_strcpy(data.name, pdo->name);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
if (copy_to_user((void __user *) arg, &data, sizeof(data)))
return -EFAULT;
@@ -465,19 +465,19 @@
return -EFAULT;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(slave = ec_master_find_slave_const(
master, 0, data.slave_position))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Slave %u does not exist!\n",
data.slave_position);
return -EINVAL;
}
if (data.sync_index >= slave->sii.sync_count) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_SLAVE_ERR(slave, "Sync manager %u does not exist!\n",
data.sync_index);
return -EINVAL;
@@ -486,7 +486,7 @@
sync = &slave->sii.syncs[data.sync_index];
if (!(pdo = ec_pdo_list_find_pdo_by_pos_const(
&sync->pdos, data.pdo_pos))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_SLAVE_ERR(slave, "Sync manager %u does not contain a PDO with "
"position %u!\n", data.sync_index, data.pdo_pos);
return -EINVAL;
@@ -494,7 +494,7 @@
if (!(entry = ec_pdo_find_entry_by_pos_const(
pdo, data.entry_pos))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_SLAVE_ERR(slave, "PDO 0x%04X does not contain an entry with "
"position %u!\n", data.pdo_pos, data.entry_pos);
return -EINVAL;
@@ -505,7 +505,7 @@
data.bit_length = entry->bit_length;
ec_cdev_strcpy(data.name, entry->name);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
if (copy_to_user((void __user *) arg, &data, sizeof(data)))
return -EFAULT;
@@ -529,11 +529,11 @@
return -EFAULT;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(domain = ec_master_find_domain_const(master, data.index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Domain %u does not exist!\n", data.index);
return -EINVAL;
}
@@ -545,7 +545,7 @@
data.expected_working_counter = domain->expected_working_counter;
data.fmmu_count = ec_domain_fmmu_count(domain);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
if (copy_to_user((void __user *) arg, &data, sizeof(data)))
return -EFAULT;
@@ -570,18 +570,18 @@
return -EFAULT;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(domain = ec_master_find_domain_const(master, data.domain_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Domain %u does not exist!\n",
data.domain_index);
return -EINVAL;
}
if (!(fmmu = ec_domain_find_fmmu(domain, data.fmmu_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Domain %u has less than %u"
" fmmu configurations.\n",
data.domain_index, data.fmmu_index + 1);
@@ -596,7 +596,7 @@
data.domain_address = fmmu->domain_address;
data.data_size = fmmu->data_size;
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
if (copy_to_user((void __user *) arg, &data, sizeof(data)))
return -EFAULT;
@@ -620,18 +620,18 @@
return -EFAULT;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(domain = ec_master_find_domain_const(master, data.domain_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Domain %u does not exist!\n",
data.domain_index);
return -EINVAL;
}
if (domain->data_size != data.data_size) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Data size mismatch %u/%zu!\n",
data.data_size, domain->data_size);
return -EFAULT;
@@ -639,11 +639,11 @@
if (copy_to_user((void __user *) data.target, domain->data,
domain->data_size)) {
- up(&master->master_sem);
- return -EFAULT;
- }
-
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
+ return -EFAULT;
+ }
+
+ ec_mutex_unlock(&master->master_mutex);
return 0;
}
@@ -688,12 +688,12 @@
return -EFAULT;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(slave = ec_master_find_slave(
master, 0, data.slave_position))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Slave %u does not exist!\n",
data.slave_position);
return -EINVAL;
@@ -701,7 +701,7 @@
ec_slave_request_state(slave, data.al_state);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return 0;
}
@@ -722,12 +722,12 @@
return -EFAULT;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(slave = ec_master_find_slave_const(
master, 0, data.slave_position))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Slave %u does not exist!\n",
data.slave_position);
return -EINVAL;
@@ -735,7 +735,7 @@
if (!(sdo = ec_slave_get_sdo_by_pos_const(
slave, data.sdo_position))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_SLAVE_ERR(slave, "SDO %u does not exist!\n", data.sdo_position);
return -EINVAL;
}
@@ -744,7 +744,7 @@
data.max_subindex = sdo->max_subindex;
ec_cdev_strcpy(data.name, sdo->name);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
if (copy_to_user((void __user *) arg, &data, sizeof(data)))
return -EFAULT;
@@ -770,12 +770,12 @@
return -EFAULT;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(slave = ec_master_find_slave_const(
master, 0, data.slave_position))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Slave %u does not exist!\n",
data.slave_position);
return -EINVAL;
@@ -784,14 +784,14 @@
if (data.sdo_spec <= 0) {
if (!(sdo = ec_slave_get_sdo_by_pos_const(
slave, -data.sdo_spec))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_SLAVE_ERR(slave, "SDO %u does not exist!\n", -data.sdo_spec);
return -EINVAL;
}
} else {
if (!(sdo = ec_slave_get_sdo_const(
slave, data.sdo_spec))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_SLAVE_ERR(slave, "SDO 0x%04X does not exist!\n",
data.sdo_spec);
return -EINVAL;
@@ -800,7 +800,7 @@
if (!(entry = ec_sdo_get_entry_const(
sdo, data.sdo_entry_subindex))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_SLAVE_ERR(slave, "SDO entry 0x%04X:%02X does not exist!\n",
sdo->index, data.sdo_entry_subindex);
return -EINVAL;
@@ -822,7 +822,7 @@
entry->write_access[EC_SDO_ENTRY_ACCESS_OP];
ec_cdev_strcpy(data.description, entry->description);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
if (copy_to_user((void __user *) arg, &data, sizeof(data)))
return -EFAULT;
@@ -857,13 +857,13 @@
data.sdo_index, data.sdo_entry_subindex);
ecrt_sdo_request_read(&request->req);
- if (down_interruptible(&master->master_sem)) {
+ if (ec_mutex_lock_interruptible(&master->master_mutex)) {
kref_put(&request->refcount,ec_master_sdo_request_release);
return -EINTR;
}
if (!(request->slave = ec_master_find_slave(
master, 0, data.slave_position))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
kref_put(&request->refcount,ec_master_sdo_request_release);
EC_MASTER_ERR(master, "Slave %u does not exist!\n",
data.slave_position);
@@ -876,7 +876,7 @@
kref_get(&request->refcount);
list_add_tail(&request->list, &request->slave->slave_sdo_requests);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
// wait for processing through FSM
if (wait_event_interruptible(request->slave->sdo_queue,
@@ -964,13 +964,13 @@
request->req.data_size = data.data_size;
ecrt_sdo_request_write(&request->req);
- if (down_interruptible(&master->master_sem)) {
+ if (ec_mutex_lock_interruptible(&master->master_mutex)) {
kref_put(&request->refcount,ec_master_sdo_request_release);
return -EINTR;
}
if (!(request->slave = ec_master_find_slave(
master, 0, data.slave_position))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Slave %u does not exist!\n",
data.slave_position);
kref_put(&request->refcount,ec_master_sdo_request_release);
@@ -983,7 +983,7 @@
kref_get(&request->refcount);
list_add_tail(&request->list, &request->slave->slave_sdo_requests);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
// wait for processing through FSM
if (wait_event_interruptible(request->slave->sdo_queue,
@@ -1030,12 +1030,12 @@
return -EFAULT;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(slave = ec_master_find_slave_const(
master, 0, data.slave_position))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Slave %u does not exist!\n",
data.slave_position);
return -EINVAL;
@@ -1043,7 +1043,7 @@
if (!data.nwords
|| data.offset + data.nwords > slave->sii_nwords) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_SLAVE_ERR(slave, "Invalid SII read offset/size %u/%u for slave SII"
" size %zu!\n", data.offset, data.nwords, slave->sii_nwords);
return -EINVAL;
@@ -1055,7 +1055,7 @@
else
retval = 0;
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return retval;
}
@@ -1094,12 +1094,12 @@
return -EFAULT;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(slave = ec_master_find_slave(
master, 0, data.slave_position))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Slave %u does not exist!\n",
data.slave_position);
kfree(words);
@@ -1117,21 +1117,21 @@
// schedule SII write request.
list_add_tail(&request.list, &master->sii_requests);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
// wait for processing through FSM
if (wait_event_interruptible(master->sii_queue,
request.state != EC_INT_REQUEST_QUEUED)) {
// interrupted by signal
- down(&master->master_sem);
+ ec_mutex_lock(&master->master_mutex);
if (request.state == EC_INT_REQUEST_QUEUED) {
// abort request
list_del(&request.list);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
kfree(words);
return -EINTR;
}
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
}
// wait until master FSM has finished processing
@@ -1169,12 +1169,12 @@
return -ENOMEM;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(slave = ec_master_find_slave(
master, 0, data.slave_position))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Slave %u does not exist!\n",
data.slave_position);
return -EINVAL;
@@ -1192,21 +1192,21 @@
// schedule request.
list_add_tail(&request.list, &master->reg_requests);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
// wait for processing through FSM
if (wait_event_interruptible(master->reg_queue,
request.state != EC_INT_REQUEST_QUEUED)) {
// interrupted by signal
- down(&master->master_sem);
+ ec_mutex_lock(&master->master_mutex);
if (request.state == EC_INT_REQUEST_QUEUED) {
// abort request
list_del(&request.list);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
kfree(contents);
return -EINTR;
}
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
}
// wait until master FSM has finished processing
@@ -1253,12 +1253,12 @@
return -EFAULT;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(slave = ec_master_find_slave(
master, 0, data.slave_position))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Slave %u does not exist!\n",
data.slave_position);
kfree(contents);
@@ -1277,21 +1277,21 @@
// schedule request.
list_add_tail(&request.list, &master->reg_requests);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
// wait for processing through FSM
if (wait_event_interruptible(master->reg_queue,
request.state != EC_INT_REQUEST_QUEUED)) {
// interrupted by signal
- down(&master->master_sem);
+ ec_mutex_lock(&master->master_mutex);
if (request.state == EC_INT_REQUEST_QUEUED) {
// abort request
list_del(&request.list);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
kfree(contents);
return -EINTR;
}
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
}
// wait until master FSM has finished processing
@@ -1319,12 +1319,12 @@
return -EFAULT;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config_const(
master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Slave config %u does not exist!\n",
data.config_index);
return -EINVAL;
@@ -1350,7 +1350,7 @@
data.dc_sync[i] = sc->dc_sync[i];
}
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
if (copy_to_user((void __user *) arg, &data, sizeof(data)))
return -EFAULT;
@@ -1381,12 +1381,12 @@
return -EINVAL;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config_const(
master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Slave config %u does not exist!\n",
data.config_index);
return -EINVAL;
@@ -1395,7 +1395,7 @@
if (!(pdo = ec_pdo_list_find_pdo_by_pos_const(
&sc->sync_configs[data.sync_index].pdos,
data.pdo_pos))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Invalid PDO position!\n");
return -EINVAL;
}
@@ -1404,7 +1404,7 @@
data.entry_count = ec_pdo_entry_count(pdo);
ec_cdev_strcpy(data.name, pdo->name);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
if (copy_to_user((void __user *) arg, &data, sizeof(data)))
return -EFAULT;
@@ -1436,12 +1436,12 @@
return -EINVAL;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config_const(
master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Slave config %u does not exist!\n",
data.config_index);
return -EINVAL;
@@ -1450,14 +1450,14 @@
if (!(pdo = ec_pdo_list_find_pdo_by_pos_const(
&sc->sync_configs[data.sync_index].pdos,
data.pdo_pos))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Invalid PDO position!\n");
return -EINVAL;
}
if (!(entry = ec_pdo_find_entry_by_pos_const(
pdo, data.entry_pos))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Entry not found!\n");
return -EINVAL;
}
@@ -1467,7 +1467,7 @@
data.bit_length = entry->bit_length;
ec_cdev_strcpy(data.name, entry->name);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
if (copy_to_user((void __user *) arg, &data, sizeof(data)))
return -EFAULT;
@@ -1492,12 +1492,12 @@
return -EFAULT;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config_const(
master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Slave config %u does not exist!\n",
data.config_index);
return -EINVAL;
@@ -1505,7 +1505,7 @@
if (!(req = ec_slave_config_get_sdo_by_pos_const(
sc, data.sdo_pos))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Invalid SDO position!\n");
return -EINVAL;
}
@@ -1516,7 +1516,7 @@
memcpy(&data.data, req->data,
min((u32) data.size, (u32) EC_MAX_SDO_DATA_SIZE));
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
if (copy_to_user((void __user *) arg, &data, sizeof(data)))
return -EFAULT;
@@ -1541,12 +1541,12 @@
return -EFAULT;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config_const(
master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Slave config %u does not exist!\n",
data.config_index);
return -EINVAL;
@@ -1554,7 +1554,7 @@
if (!(req = ec_slave_config_get_idn_by_pos_const(
sc, data.idn_pos))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Invalid IDN position!\n");
return -EINVAL;
}
@@ -1566,7 +1566,7 @@
memcpy(&data.data, req->data,
min((u32) data.size, (u32) EC_MAX_IDN_DATA_SIZE));
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
if (copy_to_user((void __user *) arg, &data, sizeof(data)))
return -EFAULT;
@@ -1592,11 +1592,11 @@
return -EFAULT;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(eoe = ec_master_get_eoe_handler_const(master, data.eoe_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "EoE handler %u does not exist!\n",
data.eoe_index);
return -EINVAL;
@@ -1616,7 +1616,7 @@
data.tx_queued_frames = eoe->tx_queued_frames;
data.tx_queue_size = eoe->tx_queue_size;
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
if (copy_to_user((void __user *) arg, &data, sizeof(data)))
return -EFAULT;
@@ -1698,7 +1698,7 @@
data.config_index = 0;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
list_for_each_entry(entry, &master->configs, list) {
@@ -1707,7 +1707,7 @@
data.config_index++;
}
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
if (copy_to_user((void __user *) arg, &data, sizeof(data)))
return -EFAULT;
@@ -1736,14 +1736,14 @@
priv->process_data_size = 0;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
list_for_each_entry(domain, &master->domains, list) {
priv->process_data_size += ecrt_domain_size(domain);
}
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
if (priv->process_data_size) {
priv->process_data = vmalloc(priv->process_data_size);
@@ -1806,10 +1806,10 @@
return -EFAULT;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
ec_master_set_send_interval(master,send_interval);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return 0;
}
@@ -1828,9 +1828,9 @@
if (unlikely(!priv->requested))
return -EPERM;
- down(&master->io_sem);
+ ec_mutex_lock(&master->io_mutex);
ecrt_master_send(master);
- up(&master->io_sem);
+ ec_mutex_unlock(&master->io_mutex);
return 0;
}
@@ -1847,9 +1847,9 @@
if (unlikely(!priv->requested))
return -EPERM;
- down(&master->io_sem);
+ ec_mutex_lock(&master->io_mutex);
ecrt_master_receive(master);
- up(&master->io_sem);
+ ec_mutex_unlock(&master->io_mutex);
return 0;
}
@@ -1935,9 +1935,9 @@
if (unlikely(!priv->requested))
return -EPERM;
- down(&master->io_sem);
+ ec_mutex_lock(&master->io_mutex);
ecrt_master_sync_reference_clock(master);
- up(&master->io_sem);
+ ec_mutex_unlock(&master->io_mutex);
return 0;
}
@@ -1954,9 +1954,9 @@
if (unlikely(!priv->requested))
return -EPERM;
- down(&master->io_sem);
+ ec_mutex_lock(&master->io_mutex);
ecrt_master_sync_slave_clocks(master);
- up(&master->io_sem);
+ ec_mutex_unlock(&master->io_mutex);
return 0;
}
@@ -1973,9 +1973,9 @@
if (unlikely(!priv->requested))
return -EPERM;
- down(&master->io_sem);
+ ec_mutex_lock(&master->io_mutex);
ecrt_master_sync_monitor_queue(master);
- up(&master->io_sem);
+ ec_mutex_unlock(&master->io_mutex);
return 0;
}
@@ -1994,9 +1994,9 @@
if (unlikely(!priv->requested))
return -EPERM;
- down(&master->io_sem);
+ ec_mutex_lock(&master->io_mutex);
time_diff = ecrt_master_sync_monitor_process(master);
- up(&master->io_sem);
+ ec_mutex_unlock(&master->io_mutex);
if (copy_to_user((void __user *) arg, &time_diff, sizeof(time_diff)))
return -EFAULT;
@@ -2029,7 +2029,7 @@
goto out_return;
}
- if (down_interruptible(&master->master_sem)) {
+ if (ec_mutex_lock_interruptible(&master->master_mutex)) {
ret = -EINTR;
goto out_return;
}
@@ -2050,7 +2050,7 @@
}
out_up:
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
out_return:
return ret;
}
@@ -2079,7 +2079,7 @@
goto out_return;
}
- if (down_interruptible(&master->master_sem)) {
+ if (ec_mutex_lock_interruptible(&master->master_mutex)) {
ret = -EINTR;
goto out_return;
}
@@ -2093,7 +2093,7 @@
data.watchdog_divider, data.watchdog_intervals);
out_up:
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
out_return:
return ret;
}
@@ -2123,7 +2123,7 @@
goto out_return;
}
- if (down_interruptible(&master->master_sem)) {
+ if (ec_mutex_lock_interruptible(&master->master_mutex)) {
ret = -EINTR;
goto out_return;
}
@@ -2137,7 +2137,7 @@
data.allow_overlapping_pdos);
out_up:
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
out_return:
return ret;
}
@@ -2161,15 +2161,15 @@
if (copy_from_user(&data, (void __user *) arg, sizeof(data)))
return -EFAULT;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config(master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
- up(&master->master_sem); // FIXME
+ ec_mutex_unlock(&master->master_mutex); // FIXME
return ecrt_slave_config_pdo_assign_add(sc, data.sync_index, data.index);
}
@@ -2193,15 +2193,15 @@
if (copy_from_user(&data, (void __user *) arg, sizeof(data)))
return -EFAULT;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config(master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
- up(&master->master_sem); // FIXME
+ ec_mutex_unlock(&master->master_mutex); // FIXME
ecrt_slave_config_pdo_assign_clear(sc, data.sync_index);
return 0;
@@ -2226,15 +2226,15 @@
if (copy_from_user(&data, (void __user *) arg, sizeof(data)))
return -EFAULT;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config(master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
- up(&master->master_sem); // FIXME
+ ec_mutex_unlock(&master->master_mutex); // FIXME
return ecrt_slave_config_pdo_mapping_add(sc, data.pdo_index,
data.entry_index, data.entry_subindex, data.entry_bit_length);
@@ -2259,15 +2259,15 @@
if (copy_from_user(&data, (void __user *) arg, sizeof(data)))
return -EFAULT;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config(master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
- up(&master->master_sem); // FIXME
+ ec_mutex_unlock(&master->master_mutex); // FIXME
ecrt_slave_config_pdo_mapping_clear(sc, data.index);
return 0;
@@ -2294,20 +2294,20 @@
if (copy_from_user(&data, (void __user *) arg, sizeof(data)))
return -EFAULT;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config(master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
if (!(domain = ec_master_find_domain(master, data.domain_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
- up(&master->master_sem); // FIXME
+ ec_mutex_unlock(&master->master_mutex); // FIXME
ret = ecrt_slave_config_reg_pdo_entry(sc, data.entry_index,
data.entry_subindex, domain, &data.bit_position);
@@ -2337,11 +2337,11 @@
if (copy_from_user(&data, (void __user *) arg, sizeof(data)))
return -EFAULT;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config(master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
@@ -2351,7 +2351,7 @@
data.dc_sync[1].cycle_time,
data.dc_sync[1].shift_time);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return 0;
}
@@ -2389,18 +2389,18 @@
return -EFAULT;
}
- if (down_interruptible(&master->master_sem)) {
+ if (ec_mutex_lock_interruptible(&master->master_mutex)) {
kfree(sdo_data);
return -EINTR;
}
if (!(sc = ec_master_get_config(master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
kfree(sdo_data);
return -ENOENT;
}
- up(&master->master_sem); // FIXME
+ ec_mutex_unlock(&master->master_mutex); // FIXME
if (data.complete_access) {
ret = ecrt_slave_config_complete_sdo(sc,
@@ -2436,12 +2436,12 @@
data.request_index = 0;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
sc = ec_master_get_config(master, data.config_index);
if (!sc) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
@@ -2449,7 +2449,7 @@
data.request_index++;
}
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
req = ecrt_slave_config_create_sdo_request_err(sc, data.sdo_index,
data.sdo_subindex, data.size);
@@ -2485,12 +2485,12 @@
data.voe_index = 0;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
sc = ec_master_get_config(master, data.config_index);
if (!sc) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
@@ -2498,7 +2498,7 @@
data.voe_index++;
}
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
voe = ecrt_slave_config_create_voe_handler_err(sc, data.size);
if (IS_ERR(voe))
@@ -2531,17 +2531,17 @@
return -EFAULT;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config_const(master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
ecrt_slave_config_state(sc, &state);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
if (copy_to_user((void __user *) data.state, &state, sizeof(state)))
return -EFAULT;
@@ -2582,18 +2582,18 @@
return -EFAULT;
}
- if (down_interruptible(&master->master_sem)) {
+ if (ec_mutex_lock_interruptible(&master->master_mutex)) {
kfree(data);
return -EINTR;
}
if (!(sc = ec_master_get_config(master, ioctl.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
kfree(data);
return -ENOENT;
}
- up(&master->master_sem); // FIXME
+ ec_mutex_unlock(&master->master_mutex); // FIXME
ret = ecrt_slave_config_idn(
sc, ioctl.drive_no, ioctl.idn, ioctl.al_state, data, ioctl.size);
@@ -2617,19 +2617,19 @@
if (unlikely(!priv->requested))
return -EPERM;
- if (down_interruptible(&master->master_sem)) {
+ if (ec_mutex_lock_interruptible(&master->master_mutex)) {
return -EINTR;
}
list_for_each_entry(domain, &master->domains, list) {
if (domain->index == arg) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return offset;
}
offset += ecrt_domain_size(domain);
}
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
@@ -2648,16 +2648,16 @@
if (unlikely(!priv->requested))
return -EPERM;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(domain = ec_master_find_domain(master, arg))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
ecrt_domain_process(domain);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return 0;
}
@@ -2676,16 +2676,16 @@
if (unlikely(!priv->requested))
return -EPERM;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(domain = ec_master_find_domain(master, arg))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
ecrt_domain_queue(domain);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return 0;
}
@@ -2710,17 +2710,17 @@
return -EFAULT;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(domain = ec_master_find_domain_const(master, data.domain_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
ecrt_domain_state(domain, &state);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
if (copy_to_user((void __user *) data.state, &state, sizeof(state)))
return -EFAULT;
@@ -2748,20 +2748,20 @@
if (copy_from_user(&data, (void __user *) arg, sizeof(data)))
return -EFAULT;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config(master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
if (!(req = ec_slave_config_find_sdo_request(sc, data.request_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
ecrt_sdo_request_timeout(req, data.timeout);
return 0;
@@ -2787,16 +2787,16 @@
if (copy_from_user(&data, (void __user *) arg, sizeof(data)))
return -EFAULT;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config(master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
if (!(req = ec_slave_config_find_sdo_request(sc, data.request_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
@@ -2806,7 +2806,7 @@
else
data.size = 0;
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
if (copy_to_user((void __user *) arg, &data, sizeof(data)))
return -EFAULT;
@@ -2834,20 +2834,20 @@
if (copy_from_user(&data, (void __user *) arg, sizeof(data)))
return -EFAULT;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config(master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
if (!(req = ec_slave_config_find_sdo_request(sc, data.request_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
ecrt_sdo_request_read(req);
return 0;
@@ -2879,20 +2879,20 @@
return -EINVAL;
}
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config(master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
if (!(req = ec_slave_config_find_sdo_request(sc, data.request_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
ret = ec_sdo_request_alloc(req, data.size);
if (ret)
@@ -2926,20 +2926,20 @@
if (copy_from_user(&data, (void __user *) arg, sizeof(data)))
return -EFAULT;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config(master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
if (!(req = ec_slave_config_find_sdo_request(sc, data.request_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
if (copy_to_user((void __user *) data.data, ecrt_sdo_request_data(req),
ecrt_sdo_request_data_size(req)))
@@ -2976,20 +2976,20 @@
if (get_user(vendor_type, data.vendor_type))
return -EFAULT;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config(master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
if (!(voe = ec_slave_config_find_voe_handler(sc, data.voe_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
ecrt_voe_handler_send_header(voe, vendor_id, vendor_type);
return 0;
@@ -3017,22 +3017,22 @@
if (copy_from_user(&data, (void __user *) arg, sizeof(data)))
return -EFAULT;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config(master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
if (!(voe = ec_slave_config_find_voe_handler(sc, data.voe_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
ecrt_voe_handler_received_header(voe, &vendor_id, &vendor_type);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
if (likely(data.vendor_id))
if (put_user(vendor_id, data.vendor_id))
@@ -3065,20 +3065,20 @@
if (copy_from_user(&data, (void __user *) arg, sizeof(data)))
return -EFAULT;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config(master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
if (!(voe = ec_slave_config_find_voe_handler(sc, data.voe_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
ecrt_voe_handler_read(voe);
return 0;
@@ -3104,20 +3104,20 @@
if (copy_from_user(&data, (void __user *) arg, sizeof(data)))
return -EFAULT;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config(master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
if (!(voe = ec_slave_config_find_voe_handler(sc, data.voe_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
ecrt_voe_handler_read_nosync(voe);
return 0;
@@ -3143,20 +3143,20 @@
if (copy_from_user(&data, (void __user *) arg, sizeof(data)))
return -EFAULT;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config(master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
if (!(voe = ec_slave_config_find_voe_handler(sc, data.voe_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
if (data.size) {
if (data.size > ec_voe_handler_mem_size(voe))
@@ -3191,20 +3191,20 @@
if (copy_from_user(&data, (void __user *) arg, sizeof(data)))
return -EFAULT;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config(master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
if (!(voe = ec_slave_config_find_voe_handler(sc, data.voe_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
data.state = ecrt_voe_handler_execute(voe);
if (data.state == EC_REQUEST_SUCCESS && voe->dir == EC_DIR_INPUT)
@@ -3238,20 +3238,20 @@
if (copy_from_user(&data, (void __user *) arg, sizeof(data)))
return -EFAULT;
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(sc = ec_master_get_config(master, data.config_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
if (!(voe = ec_slave_config_find_voe_handler(sc, data.voe_index))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
return -ENOENT;
}
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
if (copy_to_user((void __user *) data.data, ecrt_voe_handler_data(voe),
ecrt_voe_handler_data_size(voe)))
@@ -3281,12 +3281,12 @@
ec_foe_request_read(&request.req);
ec_foe_request_alloc(&request.req, 10000); // FIXME
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(request.slave = ec_master_find_slave(
master, 0, data.slave_position))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
ec_foe_request_clear(&request.req);
EC_MASTER_ERR(master, "Slave %u does not exist!\n",
data.slave_position);
@@ -3296,7 +3296,7 @@
// schedule request.
list_add_tail(&request.list, &request.slave->foe_requests);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_SLAVE_DBG(request.slave, 1, "Scheduled FoE read request.\n");
@@ -3304,15 +3304,15 @@
if (wait_event_interruptible(request.slave->foe_queue,
request.req.state != EC_INT_REQUEST_QUEUED)) {
// interrupted by signal
- down(&master->master_sem);
+ ec_mutex_lock(&master->master_mutex);
if (request.req.state == EC_INT_REQUEST_QUEUED) {
list_del(&request.list);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
ec_foe_request_clear(&request.req);
return -EINTR;
}
// request already processing: interrupt not possible.
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
}
// wait until master FSM has finished processing
@@ -3387,12 +3387,12 @@
request.req.data_size = data.buffer_size;
ec_foe_request_write(&request.req);
- if (down_interruptible(&master->master_sem))
+ if (ec_mutex_lock_interruptible(&master->master_mutex))
return -EINTR;
if (!(request.slave = ec_master_find_slave(
master, 0, data.slave_position))) {
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
EC_MASTER_ERR(master, "Slave %u does not exist!\n",
data.slave_position);
ec_foe_request_clear(&request.req);
@@ -3404,21 +3404,21 @@
// schedule FoE write request.
list_add_tail(&request.list, &request.slave->foe_requests);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
// wait for processing through FSM
if (wait_event_interruptible(request.slave->foe_queue,
request.req.state != EC_INT_REQUEST_QUEUED)) {
// interrupted by signal
- down(&master->master_sem);
+ ec_mutex_lock(&master->master_mutex);
if (request.req.state == EC_INT_REQUEST_QUEUED) {
// abort request
list_del(&request.list);
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
ec_foe_request_clear(&request.req);
return -EINTR;
}
- up(&master->master_sem);
+ ec_mutex_unlock(&master->master_mutex);
}
// wait until master FSM has finished processing