equal
deleted
inserted
replaced
587 static ATTRIBUTES int ec_ioctl_master_debug( |
587 static ATTRIBUTES int ec_ioctl_master_debug( |
588 ec_master_t *master, /**< EtherCAT master. */ |
588 ec_master_t *master, /**< EtherCAT master. */ |
589 void *arg /**< ioctl() argument. */ |
589 void *arg /**< ioctl() argument. */ |
590 ) |
590 ) |
591 { |
591 { |
592 return ec_master_debug_level(master, (unsigned int) arg); |
592 return ec_master_debug_level(master, (unsigned long) arg); |
593 } |
593 } |
594 |
594 |
595 /*****************************************************************************/ |
595 /*****************************************************************************/ |
596 |
596 |
597 /** Issue a bus scan. |
597 /** Issue a bus scan. |
779 if (copy_from_user(&data, (void __user *) arg, sizeof(data))) { |
779 if (copy_from_user(&data, (void __user *) arg, sizeof(data))) { |
780 return -EFAULT; |
780 return -EFAULT; |
781 } |
781 } |
782 |
782 |
783 if (!(target = kmalloc(data.target_size, GFP_KERNEL))) { |
783 if (!(target = kmalloc(data.target_size, GFP_KERNEL))) { |
784 EC_MASTER_ERR(master, "Failed to allocate %u bytes" |
784 EC_MASTER_ERR(master, "Failed to allocate %zu bytes" |
785 " for SDO upload.\n", data.target_size); |
785 " for SDO upload.\n", data.target_size); |
786 return -ENOMEM; |
786 return -ENOMEM; |
787 } |
787 } |
788 |
788 |
789 ret = ecrt_master_sdo_upload(master, data.slave_position, |
789 ret = ecrt_master_sdo_upload(master, data.slave_position, |
823 if (copy_from_user(&data, (void __user *) arg, sizeof(data))) { |
823 if (copy_from_user(&data, (void __user *) arg, sizeof(data))) { |
824 return -EFAULT; |
824 return -EFAULT; |
825 } |
825 } |
826 |
826 |
827 if (!(sdo_data = kmalloc(data.data_size, GFP_KERNEL))) { |
827 if (!(sdo_data = kmalloc(data.data_size, GFP_KERNEL))) { |
828 EC_MASTER_ERR(master, "Failed to allocate %u bytes" |
828 EC_MASTER_ERR(master, "Failed to allocate %zu bytes" |
829 " for SDO download.\n", data.data_size); |
829 " for SDO download.\n", data.data_size); |
830 return -ENOMEM; |
830 return -ENOMEM; |
831 } |
831 } |
832 |
832 |
833 if (copy_from_user(sdo_data, (void __user *) data.data, data.data_size)) { |
833 if (copy_from_user(sdo_data, (void __user *) data.data, data.data_size)) { |
1584 ec_master_t *master, /**< EtherCAT master. */ |
1584 ec_master_t *master, /**< EtherCAT master. */ |
1585 void *arg, /**< ioctl() argument. */ |
1585 void *arg, /**< ioctl() argument. */ |
1586 ec_ioctl_context_t *ctx /**< Private data structure of file handle. */ |
1586 ec_ioctl_context_t *ctx /**< Private data structure of file handle. */ |
1587 ) |
1587 ) |
1588 { |
1588 { |
1589 uint32_t config_index = (uint32_t) arg; |
1589 unsigned long config_index = (unsigned long) arg; |
1590 ec_slave_config_t *sc = NULL; |
1590 ec_slave_config_t *sc = NULL; |
1591 int ret = 0; |
1591 int ret = 0; |
1592 |
1592 |
1593 if (unlikely(!ctx->requested)) { |
1593 if (unlikely(!ctx->requested)) { |
1594 ret = -EPERM; |
1594 ret = -EPERM; |
2752 if (down_interruptible(&master->master_sem)) { |
2752 if (down_interruptible(&master->master_sem)) { |
2753 return -EINTR; |
2753 return -EINTR; |
2754 } |
2754 } |
2755 |
2755 |
2756 list_for_each_entry(domain, &master->domains, list) { |
2756 list_for_each_entry(domain, &master->domains, list) { |
2757 if (domain->index == (unsigned int) arg) { |
2757 if (domain->index == (unsigned long) arg) { |
2758 up(&master->master_sem); |
2758 up(&master->master_sem); |
2759 return offset; |
2759 return offset; |
2760 } |
2760 } |
2761 offset += ecrt_domain_size(domain); |
2761 offset += ecrt_domain_size(domain); |
2762 } |
2762 } |
2781 return -EPERM; |
2781 return -EPERM; |
2782 |
2782 |
2783 /* no locking of master_sem needed, because domain will not be deleted in |
2783 /* no locking of master_sem needed, because domain will not be deleted in |
2784 * the meantime. */ |
2784 * the meantime. */ |
2785 |
2785 |
2786 if (!(domain = ec_master_find_domain(master, (unsigned int) arg))) { |
2786 if (!(domain = ec_master_find_domain(master, (unsigned long) arg))) { |
2787 return -ENOENT; |
2787 return -ENOENT; |
2788 } |
2788 } |
2789 |
2789 |
2790 ecrt_domain_process(domain); |
2790 ecrt_domain_process(domain); |
2791 return 0; |
2791 return 0; |
2807 return -EPERM; |
2807 return -EPERM; |
2808 |
2808 |
2809 /* no locking of master_sem needed, because domain will not be deleted in |
2809 /* no locking of master_sem needed, because domain will not be deleted in |
2810 * the meantime. */ |
2810 * the meantime. */ |
2811 |
2811 |
2812 if (!(domain = ec_master_find_domain(master, (unsigned int) arg))) { |
2812 if (!(domain = ec_master_find_domain(master, (unsigned long) arg))) { |
2813 return -ENOENT; |
2813 return -ENOENT; |
2814 } |
2814 } |
2815 |
2815 |
2816 ecrt_domain_queue(domain); |
2816 ecrt_domain_queue(domain); |
2817 return 0; |
2817 return 0; |
3744 return -EFAULT; |
3744 return -EFAULT; |
3745 } |
3745 } |
3746 |
3746 |
3747 data = kmalloc(ioctl.mem_size, GFP_KERNEL); |
3747 data = kmalloc(ioctl.mem_size, GFP_KERNEL); |
3748 if (!data) { |
3748 if (!data) { |
3749 EC_MASTER_ERR(master, "Failed to allocate %u bytes of IDN data.\n", |
3749 EC_MASTER_ERR(master, "Failed to allocate %zu bytes of IDN data.\n", |
3750 ioctl.mem_size); |
3750 ioctl.mem_size); |
3751 return -ENOMEM; |
3751 return -ENOMEM; |
3752 } |
3752 } |
3753 |
3753 |
3754 retval = ecrt_master_read_idn(master, ioctl.slave_position, |
3754 retval = ecrt_master_read_idn(master, ioctl.slave_position, |