All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frederic Chen <frederic.chen@mediatek.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Sean.Cheng@mediatek.com,
	laurent.pinchart+renesas@ideasonboard.com,
	christie.yu@mediatek.com, srv_heupstream@mediatek.com,
	tfiga@chromium.org, sj.huang@mediatek.com, yuzhao@chromium.org,
	hans.verkuil@cisco.com, zwisler@chromium.org,
	matthias.bgg@gmail.com, linux-mediatek@lists.infradead.org,
	mchehab@kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org
Subject: Re: [PATCH V1] media: mc-device.c: change media_device_request_alloc to match media_ioctl_info
Date: Thu, 6 Aug 2020 23:27:46 +0800	[thread overview]
Message-ID: <1596727666.963.2.camel@mtksdccf07> (raw)
In-Reply-To: <4b1291c4-ee97-8ada-fa2c-3eb5ed22305b@xs4all.nl>

Dear Hans,

On Thu, 2020-08-06 at 09:42 +0200, Hans Verkuil wrote:
> On 06/08/2020 09:29, frederic.chen@mediatek.com wrote:
> > From: Frederic Chen <frederic.chen@mediatek.com>
> > 
> > We modified the type of media_device_request_alloc()'s second
> > parameter from int* to void* so that it can match the interface
> > defined in struct media_ioctl_info.
> > 
> > Signed-off-by: Frederic Chen <frederic.chen@mediatek.com>
> > ---
> >  drivers/media/mc/mc-device.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/media/mc/mc-device.c b/drivers/media/mc/mc-device.c
> > index da8088351135..bc5b5ecb6581 100644
> > --- a/drivers/media/mc/mc-device.c
> > +++ b/drivers/media/mc/mc-device.c
> > @@ -370,9 +370,10 @@ static long media_device_get_topology(struct media_device *mdev, void *arg)
> >  	return ret;
> >  }
> >  
> > -static long media_device_request_alloc(struct media_device *mdev,
> > -				       int *alloc_fd)
> > +static long media_device_request_alloc(struct media_device *mdev, void *arg)
> >  {
> > +	int *alloc_fd = arg;
> > +
> >  #ifdef CONFIG_MEDIA_CONTROLLER_REQUEST_API
> >  	if (!mdev->ops || !mdev->ops->req_validate || !mdev->ops->req_queue)
> >  		return -ENOTTY;
> > 
> 
> This change is fine, but the reason this wasn't noticed before is the cast in
> the MEDIA_IOC_ARG define:
> 
> #define MEDIA_IOC_ARG(__cmd, func, fl, from_user, to_user)              \
>         [_IOC_NR(MEDIA_IOC_##__cmd)] = {                                \
>                 .cmd = MEDIA_IOC_##__cmd,                               \
>                 .fn = (long (*)(struct media_device *, void *))func,    \
>                 .flags = fl,                                            \
>                 .arg_from_user = from_user,                             \
>                 .arg_to_user = to_user,                                 \
>         }
> 
> When assigning to .fn the func is cast to a specific function prototype.
> Without that cast the compiler would have warned about the mismatch.
> 
> I see no reason for that cast, so drop that cast as well.

I got it. I will remove the cast in the next patch.

> 
> Regards,
> 
> 	Hans


Sincerely,

Frederic Chen

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Frederic Chen <frederic.chen@mediatek.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Sean.Cheng@mediatek.com,
	laurent.pinchart+renesas@ideasonboard.com,
	christie.yu@mediatek.com, srv_heupstream@mediatek.com,
	tfiga@chromium.org, sj.huang@mediatek.com, yuzhao@chromium.org,
	hans.verkuil@cisco.com, zwisler@chromium.org,
	matthias.bgg@gmail.com, linux-mediatek@lists.infradead.org,
	mchehab@kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org
Subject: Re: [PATCH V1] media: mc-device.c: change media_device_request_alloc to match media_ioctl_info
Date: Thu, 6 Aug 2020 23:27:46 +0800	[thread overview]
Message-ID: <1596727666.963.2.camel@mtksdccf07> (raw)
In-Reply-To: <4b1291c4-ee97-8ada-fa2c-3eb5ed22305b@xs4all.nl>

Dear Hans,

On Thu, 2020-08-06 at 09:42 +0200, Hans Verkuil wrote:
> On 06/08/2020 09:29, frederic.chen@mediatek.com wrote:
> > From: Frederic Chen <frederic.chen@mediatek.com>
> > 
> > We modified the type of media_device_request_alloc()'s second
> > parameter from int* to void* so that it can match the interface
> > defined in struct media_ioctl_info.
> > 
> > Signed-off-by: Frederic Chen <frederic.chen@mediatek.com>
> > ---
> >  drivers/media/mc/mc-device.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/media/mc/mc-device.c b/drivers/media/mc/mc-device.c
> > index da8088351135..bc5b5ecb6581 100644
> > --- a/drivers/media/mc/mc-device.c
> > +++ b/drivers/media/mc/mc-device.c
> > @@ -370,9 +370,10 @@ static long media_device_get_topology(struct media_device *mdev, void *arg)
> >  	return ret;
> >  }
> >  
> > -static long media_device_request_alloc(struct media_device *mdev,
> > -				       int *alloc_fd)
> > +static long media_device_request_alloc(struct media_device *mdev, void *arg)
> >  {
> > +	int *alloc_fd = arg;
> > +
> >  #ifdef CONFIG_MEDIA_CONTROLLER_REQUEST_API
> >  	if (!mdev->ops || !mdev->ops->req_validate || !mdev->ops->req_queue)
> >  		return -ENOTTY;
> > 
> 
> This change is fine, but the reason this wasn't noticed before is the cast in
> the MEDIA_IOC_ARG define:
> 
> #define MEDIA_IOC_ARG(__cmd, func, fl, from_user, to_user)              \
>         [_IOC_NR(MEDIA_IOC_##__cmd)] = {                                \
>                 .cmd = MEDIA_IOC_##__cmd,                               \
>                 .fn = (long (*)(struct media_device *, void *))func,    \
>                 .flags = fl,                                            \
>                 .arg_from_user = from_user,                             \
>                 .arg_to_user = to_user,                                 \
>         }
> 
> When assigning to .fn the func is cast to a specific function prototype.
> Without that cast the compiler would have warned about the mismatch.
> 
> I see no reason for that cast, so drop that cast as well.

I got it. I will remove the cast in the next patch.

> 
> Regards,
> 
> 	Hans


Sincerely,

Frederic Chen

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Frederic Chen <frederic.chen@mediatek.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: <hans.verkuil@cisco.com>,
	<laurent.pinchart+renesas@ideasonboard.com>, <tfiga@chromium.org>,
	<matthias.bgg@gmail.com>, <mchehab@kernel.org>,
	<yuzhao@chromium.org>, <zwisler@chromium.org>,
	<linux-mediatek@lists.infradead.org>,
	<linux-arm-kernel@lists.infradead.org>, <Sean.Cheng@mediatek.com>,
	<sj.huang@mediatek.com>, <christie.yu@mediatek.com>,
	<linux-media@vger.kernel.org>, <srv_heupstream@mediatek.com>
Subject: Re: [PATCH V1] media: mc-device.c: change media_device_request_alloc to match media_ioctl_info
Date: Thu, 6 Aug 2020 23:27:46 +0800	[thread overview]
Message-ID: <1596727666.963.2.camel@mtksdccf07> (raw)
In-Reply-To: <4b1291c4-ee97-8ada-fa2c-3eb5ed22305b@xs4all.nl>

Dear Hans,

On Thu, 2020-08-06 at 09:42 +0200, Hans Verkuil wrote:
> On 06/08/2020 09:29, frederic.chen@mediatek.com wrote:
> > From: Frederic Chen <frederic.chen@mediatek.com>
> > 
> > We modified the type of media_device_request_alloc()'s second
> > parameter from int* to void* so that it can match the interface
> > defined in struct media_ioctl_info.
> > 
> > Signed-off-by: Frederic Chen <frederic.chen@mediatek.com>
> > ---
> >  drivers/media/mc/mc-device.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/media/mc/mc-device.c b/drivers/media/mc/mc-device.c
> > index da8088351135..bc5b5ecb6581 100644
> > --- a/drivers/media/mc/mc-device.c
> > +++ b/drivers/media/mc/mc-device.c
> > @@ -370,9 +370,10 @@ static long media_device_get_topology(struct media_device *mdev, void *arg)
> >  	return ret;
> >  }
> >  
> > -static long media_device_request_alloc(struct media_device *mdev,
> > -				       int *alloc_fd)
> > +static long media_device_request_alloc(struct media_device *mdev, void *arg)
> >  {
> > +	int *alloc_fd = arg;
> > +
> >  #ifdef CONFIG_MEDIA_CONTROLLER_REQUEST_API
> >  	if (!mdev->ops || !mdev->ops->req_validate || !mdev->ops->req_queue)
> >  		return -ENOTTY;
> > 
> 
> This change is fine, but the reason this wasn't noticed before is the cast in
> the MEDIA_IOC_ARG define:
> 
> #define MEDIA_IOC_ARG(__cmd, func, fl, from_user, to_user)              \
>         [_IOC_NR(MEDIA_IOC_##__cmd)] = {                                \
>                 .cmd = MEDIA_IOC_##__cmd,                               \
>                 .fn = (long (*)(struct media_device *, void *))func,    \
>                 .flags = fl,                                            \
>                 .arg_from_user = from_user,                             \
>                 .arg_to_user = to_user,                                 \
>         }
> 
> When assigning to .fn the func is cast to a specific function prototype.
> Without that cast the compiler would have warned about the mismatch.
> 
> I see no reason for that cast, so drop that cast as well.

I got it. I will remove the cast in the next patch.

> 
> Regards,
> 
> 	Hans


Sincerely,

Frederic Chen


  reply	other threads:[~2020-08-06 15:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-06  7:29 [PATCH 0/1] media: change media_device_request_alloc to match media_ioctl_info frederic.chen
2020-08-06  7:29 ` frederic.chen
2020-08-06  7:29 ` frederic.chen
2020-08-06  7:29 ` [PATCH V1] media: mc-device.c: " frederic.chen
2020-08-06  7:29   ` frederic.chen
2020-08-06  7:29   ` frederic.chen
2020-08-06  7:42   ` Hans Verkuil
2020-08-06  7:42     ` Hans Verkuil
2020-08-06  7:42     ` Hans Verkuil
2020-08-06 15:27     ` Frederic Chen [this message]
2020-08-06 15:27       ` Frederic Chen
2020-08-06 15:27       ` Frederic Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1596727666.963.2.camel@mtksdccf07 \
    --to=frederic.chen@mediatek.com \
    --cc=Sean.Cheng@mediatek.com \
    --cc=christie.yu@mediatek.com \
    --cc=hans.verkuil@cisco.com \
    --cc=hverkuil@xs4all.nl \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=sj.huang@mediatek.com \
    --cc=srv_heupstream@mediatek.com \
    --cc=tfiga@chromium.org \
    --cc=yuzhao@chromium.org \
    --cc=zwisler@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.