vfio-mdev: fix non-standard ioctl return val causing i386 build fail
authorPaul Gortmaker <paul.gortmaker@windriver.com>
Wed, 4 Jan 2017 20:08:15 +0000 (15:08 -0500)
committerAlex Williamson <alex.williamson@redhat.com>
Wed, 4 Jan 2017 20:22:38 +0000 (13:22 -0700)
commitc6ef7fd40eddad38a8825cbd6bb2ce8bdbba88f5
treed7b398cea5abb297dbf873d7185dfb87f44f9a01
parente19f32da5ded958238eac1bbe001192acef191a2
vfio-mdev: fix non-standard ioctl return val causing i386 build fail

What appears to be a copy and paste error from the line above gets
the ioctl a ssize_t return value instead of the traditional "int".

The associated sample code used "long" which meant it would compile
for x86-64 but not i386, with the latter failing as follows:

  CC [M]  samples/vfio-mdev/mtty.o
samples/vfio-mdev/mtty.c:1418:20: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
  .ioctl          = mtty_ioctl,
                    ^
samples/vfio-mdev/mtty.c:1418:20: note: (near initialization for ‘mdev_fops.ioctl’)
cc1: some warnings being treated as errors

Since in this case, vfio is working with struct file_operations; as such:

    long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
    long (*compat_ioctl) (struct file *, unsigned int, unsigned long);

...and so here we just standardize on long vs. the normal int that user
space typically sees and documents as per "man ioctl" and similar.

Fixes: 9d1a546c53b4 ("docs: Sample driver to demonstrate how to use Mediated device framework.")
Cc: Kirti Wankhede <kwankhede@nvidia.com>
Cc: Neo Jia <cjia@nvidia.com>
Cc: kvm@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
include/linux/mdev.h