2017-08-13 18:39:52

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH] [media] media: imx: use setup_timer

Use setup_timer function instead of initializing timer with the
function and data fields.

Generated by: scripts/coccinelle/api/setup_timer.cocci.

Signed-off-by: Cihangir Akturk <[email protected]>
---
drivers/staging/media/imx/imx-ic-prpencvf.c | 5 ++---
drivers/staging/media/imx/imx-media-csi.c | 5 ++---
2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c b/drivers/staging/media/imx/imx-ic-prpencvf.c
index ed363fe..65f5729 100644
--- a/drivers/staging/media/imx/imx-ic-prpencvf.c
+++ b/drivers/staging/media/imx/imx-ic-prpencvf.c
@@ -1278,9 +1278,8 @@ static int prp_init(struct imx_ic_priv *ic_priv)
priv->ic_priv = ic_priv;

spin_lock_init(&priv->irqlock);
- init_timer(&priv->eof_timeout_timer);
- priv->eof_timeout_timer.data = (unsigned long)priv;
- priv->eof_timeout_timer.function = prp_eof_timeout;
+ setup_timer(&priv->eof_timeout_timer, prp_eof_timeout,
+ (unsigned long)priv);

priv->vdev = imx_media_capture_device_init(&ic_priv->sd,
PRPENCVF_SRC_PAD);
diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c
index a2d2669..8fef5f1 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -1731,9 +1731,8 @@ static int imx_csi_probe(struct platform_device *pdev)
priv->csi_id = pdata->csi;
priv->smfc_id = (priv->csi_id == 0) ? 0 : 2;

- init_timer(&priv->eof_timeout_timer);
- priv->eof_timeout_timer.data = (unsigned long)priv;
- priv->eof_timeout_timer.function = csi_idmac_eof_timeout;
+ setup_timer(&priv->eof_timeout_timer, csi_idmac_eof_timeout,
+ (unsigned long)priv);
spin_lock_init(&priv->irqlock);

v4l2_subdev_init(&priv->sd, &csi_subdev_ops);
--
2.7.4


2017-08-14 07:27:00

by Philipp Zabel

[permalink] [raw]
Subject: Re: [PATCH] [media] media: imx: use setup_timer

On Sun, 2017-08-13 at 21:39 +0300, Cihangir Akturk wrote:
> Use setup_timer function instead of initializing timer with the
> function and data fields.
>
> Generated by: scripts/coccinelle/api/setup_timer.cocci.
>
> Signed-off-by: Cihangir Akturk <[email protected]>
> ---
>  drivers/staging/media/imx/imx-ic-prpencvf.c | 5 ++---
>  drivers/staging/media/imx/imx-media-csi.c   | 5 ++---
>  2 files changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c
> b/drivers/staging/media/imx/imx-ic-prpencvf.c
> index ed363fe..65f5729 100644
> --- a/drivers/staging/media/imx/imx-ic-prpencvf.c
> +++ b/drivers/staging/media/imx/imx-ic-prpencvf.c
> @@ -1278,9 +1278,8 @@ static int prp_init(struct imx_ic_priv
> *ic_priv)
>   priv->ic_priv = ic_priv;
>  
>   spin_lock_init(&priv->irqlock);
> - init_timer(&priv->eof_timeout_timer);
> - priv->eof_timeout_timer.data = (unsigned long)priv;
> - priv->eof_timeout_timer.function = prp_eof_timeout;
> + setup_timer(&priv->eof_timeout_timer, prp_eof_timeout,
> +     (unsigned long)priv);
>  
>   priv->vdev = imx_media_capture_device_init(&ic_priv->sd,
>      PRPENCVF_SRC_PAD)
> ;
> diff --git a/drivers/staging/media/imx/imx-media-csi.c
> b/drivers/staging/media/imx/imx-media-csi.c
> index a2d2669..8fef5f1 100644
> --- a/drivers/staging/media/imx/imx-media-csi.c
> +++ b/drivers/staging/media/imx/imx-media-csi.c
> @@ -1731,9 +1731,8 @@ static int imx_csi_probe(struct platform_device
> *pdev)
>   priv->csi_id = pdata->csi;
>   priv->smfc_id = (priv->csi_id == 0) ? 0 : 2;
>  
> - init_timer(&priv->eof_timeout_timer);
> - priv->eof_timeout_timer.data = (unsigned long)priv;
> - priv->eof_timeout_timer.function = csi_idmac_eof_timeout;
> + setup_timer(&priv->eof_timeout_timer, csi_idmac_eof_timeout,
> +     (unsigned long)priv);
>   spin_lock_init(&priv->irqlock);
>  
>   v4l2_subdev_init(&priv->sd, &csi_subdev_ops);

Reviewed-by: Philipp Zabel <[email protected]>

regards
Philipp

2017-08-14 23:05:41

by Steve Longerbeam

[permalink] [raw]
Subject: Re: [PATCH] [media] media: imx: use setup_timer

Thanks,

Reviewed-by: Steve Longerbeam <[email protected]>
Tested-by: Steve Longerbeam <[email protected]>

Steve


On 08/13/2017 11:39 AM, Cihangir Akturk wrote:
> Use setup_timer function instead of initializing timer with the
> function and data fields.
>
> Generated by: scripts/coccinelle/api/setup_timer.cocci.
>
> Signed-off-by: Cihangir Akturk <[email protected]>
> ---
> drivers/staging/media/imx/imx-ic-prpencvf.c | 5 ++---
> drivers/staging/media/imx/imx-media-csi.c | 5 ++---
> 2 files changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c b/drivers/staging/media/imx/imx-ic-prpencvf.c
> index ed363fe..65f5729 100644
> --- a/drivers/staging/media/imx/imx-ic-prpencvf.c
> +++ b/drivers/staging/media/imx/imx-ic-prpencvf.c
> @@ -1278,9 +1278,8 @@ static int prp_init(struct imx_ic_priv *ic_priv)
> priv->ic_priv = ic_priv;
>
> spin_lock_init(&priv->irqlock);
> - init_timer(&priv->eof_timeout_timer);
> - priv->eof_timeout_timer.data = (unsigned long)priv;
> - priv->eof_timeout_timer.function = prp_eof_timeout;
> + setup_timer(&priv->eof_timeout_timer, prp_eof_timeout,
> + (unsigned long)priv);
>
> priv->vdev = imx_media_capture_device_init(&ic_priv->sd,
> PRPENCVF_SRC_PAD);
> diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c
> index a2d2669..8fef5f1 100644
> --- a/drivers/staging/media/imx/imx-media-csi.c
> +++ b/drivers/staging/media/imx/imx-media-csi.c
> @@ -1731,9 +1731,8 @@ static int imx_csi_probe(struct platform_device *pdev)
> priv->csi_id = pdata->csi;
> priv->smfc_id = (priv->csi_id == 0) ? 0 : 2;
>
> - init_timer(&priv->eof_timeout_timer);
> - priv->eof_timeout_timer.data = (unsigned long)priv;
> - priv->eof_timeout_timer.function = csi_idmac_eof_timeout;
> + setup_timer(&priv->eof_timeout_timer, csi_idmac_eof_timeout,
> + (unsigned long)priv);
> spin_lock_init(&priv->irqlock);
>
> v4l2_subdev_init(&priv->sd, &csi_subdev_ops);