----- Original Message ----- > From: "Martyn Welch" <martyn@xxxxxxxxxxxx> > Sent: Thursday, September 8, 2016 2:24:11 PM > On Fri, Sep 02, 2016 at 04:16:55PM -0500, Aaron Sierra wrote: >> Assign a pointer to the image descriptor once at the beginning of >> the ioctl to help keep code concise. >> > > Same with this patch. I'm not sure what's gained by doing this. Martyn, As with my "1/3" patch, this allows my "3/3" patch to feel cleaner and be easier to read. Since I can't define this variable local to the VME_SET_SLAVE case that I modify in that patch, it seemed a shame to introduce it early in the function and not use it throughout. -Aaron S. > >> Signed-off-by: Aaron Sierra <asierra@xxxxxxxxxxx> >> --- >> drivers/staging/vme/devices/vme_user.c | 13 +++++++------ >> 1 file changed, 7 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/staging/vme/devices/vme_user.c >> b/drivers/staging/vme/devices/vme_user.c >> index 5aa53c4..c68e2b8 100644 >> --- a/drivers/staging/vme/devices/vme_user.c >> +++ b/drivers/staging/vme/devices/vme_user.c >> @@ -302,6 +302,7 @@ static int vme_user_ioctl(struct inode *inode, struct file >> *file, >> int retval = -EINVAL; >> dma_addr_t pci_addr; >> void __user *argp = (void __user *)arg; >> + struct image_desc *img = &image[minor]; >> >> switch (type[minor]) { >> case CONTROL_MINOR: >> @@ -328,7 +329,7 @@ static int vme_user_ioctl(struct inode *inode, struct file >> *file, >> /* XXX We do not want to push aspace, cycle and width >> * to userspace as they are >> */ >> - retval = vme_master_get(image[minor].resource, >> + retval = vme_master_get(img->resource, >> &master.enable, >> &master.vme_addr, >> &master.size, &master.aspace, >> @@ -343,7 +344,7 @@ static int vme_user_ioctl(struct inode *inode, struct file >> *file, >> >> break; >> case VME_SET_MASTER: >> - if (image[minor].mmap_count != 0) { >> + if (img->mmap_count != 0) { >> pr_warn("Can't adjust mapped window\n"); >> return -EPERM; >> } >> @@ -357,7 +358,7 @@ static int vme_user_ioctl(struct inode *inode, struct file >> *file, >> /* XXX We do not want to push aspace, cycle and width >> * to userspace as they are >> */ >> - retval = vme_master_set(image[minor].resource, >> + retval = vme_master_set(img->resource, >> master.enable, master.vme_addr, master.size, >> master.aspace, master.cycle, master.dwidth); >> >> @@ -372,7 +373,7 @@ static int vme_user_ioctl(struct inode *inode, struct file >> *file, >> /* XXX We do not want to push aspace, cycle and width >> * to userspace as they are >> */ >> - retval = vme_slave_get(image[minor].resource, >> + retval = vme_slave_get(img->resource, >> &slave.enable, &slave.vme_addr, >> &slave.size, &pci_addr, >> &slave.aspace, &slave.cycle); >> @@ -396,9 +397,9 @@ static int vme_user_ioctl(struct inode *inode, struct file >> *file, >> /* XXX We do not want to push aspace, cycle and width >> * to userspace as they are >> */ >> - retval = vme_slave_set(image[minor].resource, >> + retval = vme_slave_set(img->resource, >> slave.enable, slave.vme_addr, slave.size, >> - image[minor].pci_buf, slave.aspace, >> + img->pci_buf, slave.aspace, >> slave.cycle); >> >> break; >> -- > > 1.9.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel