master/cdev.c
changeset 948 1cfab7161491
parent 938 5b936e8e39fa
child 949 e424c0074c67
equal deleted inserted replaced
947:6ca9c5fb56d5 948:1cfab7161491
   345                     break;
   345                     break;
   346                 }
   346                 }
   347                 break;
   347                 break;
   348             }
   348             }
   349 
   349 
       
   350         case EC_IOCTL_DOMAIN_COUNT:
       
   351             retval = ec_master_domain_count(master);
       
   352             break;
       
   353 
       
   354         case EC_IOCTL_DOMAIN:
       
   355             {
       
   356                 ec_ioctl_domain_t data;
       
   357                 const ec_domain_t *domain;
       
   358 
       
   359                 if (copy_from_user(&data, (void __user *) arg, sizeof(data))) {
       
   360                     retval = -EFAULT;
       
   361                     break;
       
   362                 }
       
   363                 
       
   364                 if (!(domain = ec_master_find_domain(master, data.index))) {
       
   365                     EC_ERR("Domain %u does not exist!\n", data.index);
       
   366                     retval = -EINVAL;
       
   367                     break;
       
   368                 }
       
   369 
       
   370                 data.data_size = domain->data_size;
       
   371                 data.logical_base_address = domain->logical_base_address;
       
   372                 data.working_counter = domain->working_counter;
       
   373                 data.expected_working_counter = domain->expected_working_counter;
       
   374 
       
   375                 if (copy_to_user((void __user *) arg, &data, sizeof(data))) {
       
   376                     retval = -EFAULT;
       
   377                     break;
       
   378                 }
       
   379                 break;
       
   380             }
       
   381 
   350         default:
   382         default:
   351             retval = -ENOIOCTLCMD;
   383             retval = -ENOIOCTLCMD;
   352     }
   384     }
   353 
   385 
   354     return retval;
   386     return retval;