.. | .. |
---|
74 | 74 | struct dfl_fme *fme; |
---|
75 | 75 | unsigned long minsz; |
---|
76 | 76 | void *buf = NULL; |
---|
| 77 | + size_t length; |
---|
77 | 78 | int ret = 0; |
---|
78 | 79 | u64 v; |
---|
79 | 80 | |
---|
.. | .. |
---|
83 | 84 | return -EFAULT; |
---|
84 | 85 | |
---|
85 | 86 | if (port_pr.argsz < minsz || port_pr.flags) |
---|
86 | | - return -EINVAL; |
---|
87 | | - |
---|
88 | | - if (!IS_ALIGNED(port_pr.buffer_size, 4)) |
---|
89 | 87 | return -EINVAL; |
---|
90 | 88 | |
---|
91 | 89 | /* get fme header region */ |
---|
.. | .. |
---|
99 | 97 | return -EINVAL; |
---|
100 | 98 | } |
---|
101 | 99 | |
---|
102 | | - if (!access_ok(VERIFY_READ, |
---|
103 | | - (void __user *)(unsigned long)port_pr.buffer_address, |
---|
104 | | - port_pr.buffer_size)) |
---|
105 | | - return -EFAULT; |
---|
| 100 | + /* |
---|
| 101 | + * align PR buffer per PR bandwidth, as HW ignores the extra padding |
---|
| 102 | + * data automatically. |
---|
| 103 | + */ |
---|
| 104 | + length = ALIGN(port_pr.buffer_size, 4); |
---|
106 | 105 | |
---|
107 | | - buf = vmalloc(port_pr.buffer_size); |
---|
| 106 | + buf = vmalloc(length); |
---|
108 | 107 | if (!buf) |
---|
109 | 108 | return -ENOMEM; |
---|
110 | 109 | |
---|
.. | .. |
---|
141 | 140 | fpga_image_info_free(region->info); |
---|
142 | 141 | |
---|
143 | 142 | info->buf = buf; |
---|
144 | | - info->count = port_pr.buffer_size; |
---|
| 143 | + info->count = length; |
---|
145 | 144 | info->region_id = port_pr.port_id; |
---|
146 | 145 | region->info = info; |
---|
147 | 146 | |
---|
.. | .. |
---|
160 | 159 | mutex_unlock(&pdata->lock); |
---|
161 | 160 | free_exit: |
---|
162 | 161 | vfree(buf); |
---|
163 | | - if (copy_to_user((void __user *)arg, &port_pr, minsz)) |
---|
164 | | - return -EFAULT; |
---|
165 | | - |
---|
166 | 162 | return ret; |
---|
167 | 163 | } |
---|
168 | 164 | |
---|
.. | .. |
---|
444 | 440 | struct dfl_feature *feature) |
---|
445 | 441 | { |
---|
446 | 442 | struct dfl_feature_platform_data *pdata = dev_get_platdata(&pdev->dev); |
---|
447 | | - struct dfl_fme *priv; |
---|
448 | 443 | |
---|
449 | 444 | mutex_lock(&pdata->lock); |
---|
450 | | - priv = dfl_fpga_pdata_get_private(pdata); |
---|
451 | 445 | |
---|
452 | 446 | dfl_fme_destroy_regions(pdata); |
---|
453 | 447 | dfl_fme_destroy_bridges(pdata); |
---|
.. | .. |
---|
472 | 466 | return ret; |
---|
473 | 467 | } |
---|
474 | 468 | |
---|
475 | | -const struct dfl_feature_ops pr_mgmt_ops = { |
---|
| 469 | +const struct dfl_feature_id fme_pr_mgmt_id_table[] = { |
---|
| 470 | + {.id = FME_FEATURE_ID_PR_MGMT,}, |
---|
| 471 | + {0} |
---|
| 472 | +}; |
---|
| 473 | + |
---|
| 474 | +const struct dfl_feature_ops fme_pr_mgmt_ops = { |
---|
476 | 475 | .init = pr_mgmt_init, |
---|
477 | 476 | .uinit = pr_mgmt_uinit, |
---|
478 | 477 | .ioctl = fme_pr_ioctl, |
---|