[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <33a0c8c2-3754-583d-230e-72d5d82650fb@nvidia.com>
Date: Wed, 4 Jan 2017 18:06:57 +0530
From: Kirti Wankhede <kwankhede@...dia.com>
To: Paul Gortmaker <paul.gortmaker@...driver.com>,
<linux-kernel@...r.kernel.org>
CC: Neo Jia <cjia@...dia.com>,
Alex Williamson <alex.williamson@...hat.com>,
<kvm@...r.kernel.org>
Subject: Re: [PATCH] vfio-mdev: fix non-standard ioctl return val causing i386
build fail
Thanks Paul for catching this.
In that case we should go with 'long' since mdev_parent_ops->ioctl() is
called from vfio_device_ops->ioctl() for which the return type is 'long'.
Thanks,
Kirti
On 1/4/2017 1:06 AM, Paul Gortmaker wrote:
> 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
>
> Use the standard "int" ioctl return value in both the header and
> the sample code to fix the issue.
>
> Fixes: 9d1a546c53b4 ("docs: Sample driver to demonstrate how to use Mediated device framework.")
> Cc: Kirti Wankhede <kwankhede@...dia.com>
> Cc: Neo Jia <cjia@...dia.com>
> Cc: Alex Williamson <alex.williamson@...hat.com>
> Cc: kvm@...r.kernel.org
> Signed-off-by: Paul Gortmaker <paul.gortmaker@...driver.com>
> ---
> include/linux/mdev.h | 2 +-
> samples/vfio-mdev/mtty.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/mdev.h b/include/linux/mdev.h
> index 3ee44b8d2bb3..46659572ab00 100644
> --- a/include/linux/mdev.h
> +++ b/include/linux/mdev.h
> @@ -78,7 +78,7 @@ struct mdev_parent_ops {
> size_t count, loff_t *ppos);
> ssize_t (*write)(struct mdev_device *mdev, const char __user *buf,
> size_t count, loff_t *ppos);
> - ssize_t (*ioctl)(struct mdev_device *mdev, unsigned int cmd,
> + int (*ioctl)(struct mdev_device *mdev, unsigned int cmd,
> unsigned long arg);
> int (*mmap)(struct mdev_device *mdev, struct vm_area_struct *vma);
> };
> diff --git a/samples/vfio-mdev/mtty.c b/samples/vfio-mdev/mtty.c
> index 919c10d5b12e..6f0713b1f717 100644
> --- a/samples/vfio-mdev/mtty.c
> +++ b/samples/vfio-mdev/mtty.c
> @@ -1147,7 +1147,7 @@ int mtty_get_device_info(struct mdev_device *mdev,
> return 0;
> }
>
> -static long mtty_ioctl(struct mdev_device *mdev, unsigned int cmd,
> +static int mtty_ioctl(struct mdev_device *mdev, unsigned int cmd,
> unsigned long arg)
> {
> int ret = 0;
>
Powered by blists - more mailing lists