Skip to contentSkip to conversation

media: imx: remove code for non-existing config IMX_GPT_ICAP

PATCH Superseded Lukas Bulwahn 4 participants 8 messages Nov 22, 2022 – Nov 23, 2022

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: imx: remove code for non-existing config IMX_GPT_ICAP

There never was a config IMX_GPT_ICAP in the repository. So remove the code conditional on this config and simplify the callers that just called empty functions.

---
 drivers/staging/media/imx/imx-media-fim.c | 54 -----------------------
 1 file changed, 54 deletions(-)
drivers/staging/media/imx/imx-media-fim.c +0 -54
index 3a9182933508..19a48eb445fd 100644
@@ -187,54 +187,6 @@ static void frame_interval_monitor(struct imx_media_fim *fim,
 		send_fim_event(fim, error_avg);
 }
 
-#ifdef CONFIG_IMX_GPT_ICAP
-/*
- * Input Capture method of measuring frame intervals. Not subject
- * to interrupt latency.
- */
-static void fim_input_capture_handler(int channel, void *dev_id,
-				      ktime_t timestamp)
-{
-	struct imx_media_fim *fim = dev_id;
-	unsigned long flags;
-
-	spin_lock_irqsave(&fim->lock, flags);
-
-	frame_interval_monitor(fim, timestamp);
-
-	if (!completion_done(&fim->icap_first_event))
-		complete(&fim->icap_first_event);
-
-	spin_unlock_irqrestore(&fim->lock, flags);
-}
-
-static int fim_request_input_capture(struct imx_media_fim *fim)
-{
-	init_completion(&fim->icap_first_event);
-
-	return mxc_request_input_capture(fim->icap_channel,
-					 fim_input_capture_handler,
-					 fim->icap_flags, fim);
-}
-
-static void fim_free_input_capture(struct imx_media_fim *fim)
-{
-	mxc_free_input_capture(fim->icap_channel, fim);
-}
-
-#else /* CONFIG_IMX_GPT_ICAP */
-
-static int fim_request_input_capture(struct imx_media_fim *fim)
-{
-	return 0;
-}
-
-static void fim_free_input_capture(struct imx_media_fim *fim)
-{
-}
-
-#endif /* CONFIG_IMX_GPT_ICAP */
-
 /*
  * In case we are monitoring the first frame interval after streamon
  * (when fim->num_skip = 0), we need a valid fim->last_ts before we
@@ -435,14 +387,8 @@ int imx_media_fim_set_stream(struct imx_media_fim *fim,
 		spin_unlock_irqrestore(&fim->lock, flags);
 
 		if (icap_enabled(fim)) {
-			ret = fim_request_input_capture(fim);
-			if (ret)
-				goto out;
 			fim_acquire_first_ts(fim);
 		}
-	} else {
-		if (icap_enabled(fim))
-			fim_free_input_capture(fim);
 	}
 
 	fim->stream_on = on;
Signature · 1 line
2.17.1
#1 lore raw

Hi Lukas,

Quoted 69 lines · Lukas Bulwahn

There never was a config IMX_GPT_ICAP in the repository. So remove the code conditional on this config and simplify the callers that just called empty functions.

---
 drivers/staging/media/imx/imx-media-fim.c | 54 -----------------------
 1 file changed, 54 deletions(-)
drivers/staging/media/imx/imx-media-fim.c +0 -48
index 3a9182933508..19a48eb445fd 100644
@@ -187,54 +187,6 @@ static void frame_interval_monitor(struct imx_media_fim *fim,
 		send_fim_event(fim, error_avg);
 }
 
-#ifdef CONFIG_IMX_GPT_ICAP
-/*
- * Input Capture method of measuring frame intervals. Not subject
- * to interrupt latency.
- */
-static void fim_input_capture_handler(int channel, void *dev_id,
-				      ktime_t timestamp)
-{
-	struct imx_media_fim *fim = dev_id;
-	unsigned long flags;
-
-	spin_lock_irqsave(&fim->lock, flags);
-
-	frame_interval_monitor(fim, timestamp);
-
-	if (!completion_done(&fim->icap_first_event))
-		complete(&fim->icap_first_event);
-
-	spin_unlock_irqrestore(&fim->lock, flags);
-}
-
-static int fim_request_input_capture(struct imx_media_fim *fim)
-{
-	init_completion(&fim->icap_first_event);
-
-	return mxc_request_input_capture(fim->icap_channel,
-					 fim_input_capture_handler,
-					 fim->icap_flags, fim);
-}
-
-static void fim_free_input_capture(struct imx_media_fim *fim)
-{
-	mxc_free_input_capture(fim->icap_channel, fim);
-}
-
-#else /* CONFIG_IMX_GPT_ICAP */
-
-static int fim_request_input_capture(struct imx_media_fim *fim)
-{
-	return 0;
-}
-
-static void fim_free_input_capture(struct imx_media_fim *fim)
-{
-}
-
-#endif /* CONFIG_IMX_GPT_ICAP */
-
 /*
  * In case we are monitoring the first frame interval after streamon
  * (when fim->num_skip = 0), we need a valid fim->last_ts before we

drivers/staging/media/imx/imx-media-fim.c int imx_media_fim_set_stream(struct imx_media_fim *fim, · line 391

Quoted 8 lines
drivers/staging/media/imx/imx-media-fim.c +0 -3
@@ -435,14 +387,8 @@ int imx_media_fim_set_stream(struct imx_media_fim *fim,
 		spin_unlock_irqrestore(&fim->lock, flags);
 
 		if (icap_enabled(fim)) {
-			ret = fim_request_input_capture(fim);
-			if (ret)
-				goto out;
 			fim_acquire_first_ts(fim);
 		}

As suggested by the checkpatch.pl:
WARNING: braces {} are not necessary for single statement blocks

Quoted 9 lines
drivers/staging/media/imx/imx-media-fim.c +0 -3
-	} else {
-		if (icap_enabled(fim))
-			fim_free_input_capture(fim);
 	}
 
 	fim->stream_on = on;
Signature · 1 line
2.17.1

Apart of this, patch looks good to me.
Thanks.

Regards,
Tommaso

Signature · 10 lines
Tommaso Merciai
Embedded Linux Engineer
[email protected]
__________________________________

Amarula Solutions SRL
Via Le Canevare 30, 31100 Treviso, Veneto, IT
T. +39 042 243 5310
[email protected]
www.amarulasolutions.com
#2 lore raw
Quoted 75 lines · Tommaso Merciai

Hi Lukas,

Quoted 71 lines · Lukas Bulwahn

There never was a config IMX_GPT_ICAP in the repository. So remove the code conditional on this config and simplify the callers that just called empty functions.

---
 drivers/staging/media/imx/imx-media-fim.c | 54 -----------------------
 1 file changed, 54 deletions(-)
drivers/staging/media/imx/imx-media-fim.c +0 -48
index 3a9182933508..19a48eb445fd 100644
@@ -187,54 +187,6 @@ static void frame_interval_monitor(struct imx_media_fim *fim,
              send_fim_event(fim, error_avg);
 }
 
-#ifdef CONFIG_IMX_GPT_ICAP
-/*
- * Input Capture method of measuring frame intervals. Not subject
- * to interrupt latency.
- */
-static void fim_input_capture_handler(int channel, void *dev_id,
-                                   ktime_t timestamp)
-{
-     struct imx_media_fim *fim = dev_id;
-     unsigned long flags;
-
-     spin_lock_irqsave(&fim->lock, flags);
-
-     frame_interval_monitor(fim, timestamp);
-
-     if (!completion_done(&fim->icap_first_event))
-             complete(&fim->icap_first_event);
-
-     spin_unlock_irqrestore(&fim->lock, flags);
-}
-
-static int fim_request_input_capture(struct imx_media_fim *fim)
-{
-     init_completion(&fim->icap_first_event);
-
-     return mxc_request_input_capture(fim->icap_channel,
-                                      fim_input_capture_handler,
-                                      fim->icap_flags, fim);
-}
-
-static void fim_free_input_capture(struct imx_media_fim *fim)
-{
-     mxc_free_input_capture(fim->icap_channel, fim);
-}
-
-#else /* CONFIG_IMX_GPT_ICAP */
-
-static int fim_request_input_capture(struct imx_media_fim *fim)
-{
-     return 0;
-}
-
-static void fim_free_input_capture(struct imx_media_fim *fim)
-{
-}
-
-#endif /* CONFIG_IMX_GPT_ICAP */
-
 /*
  * In case we are monitoring the first frame interval after streamon
  * (when fim->num_skip = 0), we need a valid fim->last_ts before we
@@ -435,14 +387,8 @@ int imx_media_fim_set_stream(struct imx_media_fim *fim,
              spin_unlock_irqrestore(&fim->lock, flags);
 
Quoted 20 lines

drivers/staging/media/imx/imx-media-fim.c int imx_media_fim_set_stream(struct imx_media_fim *fim, · line 391

Quoted 6 lines
drivers/staging/media/imx/imx-media-fim.c +0 -3
              if (icap_enabled(fim)) {
-                     ret = fim_request_input_capture(fim);
-                     if (ret)
-                             goto out;
                      fim_acquire_first_ts(fim);
              }

As suggested by the checkpatch.pl:
WARNING: braces {} are not necessary for single statement blocks

Quoted 9 lines
drivers/staging/media/imx/imx-media-fim.c +0 -4
-     } else {
-             if (icap_enabled(fim))
-                     fim_free_input_capture(fim);
      }
 
      fim->stream_on = on;
--

2.17.1

Strangely, my checkpatch invocation on next-20221116 did not show that warning and I am unaware that I made any specific changes to checkpatch or its configuration.

Anyway, checkpatch and you, Tommaso, are right and the patch can of course be improved. I sent out a patch v2:

https://lore.kernel.org/all/[email protected]/

I hope to get an Acked-by: tag from you now. Thanks.

Lukas

Quoted 17 lines

Apart of this, patch looks good to me.
Thanks.

Regards,
Tommaso

--
Tommaso Merciai
Embedded Linux Engineer
[email protected]
__________________________________

Amarula Solutions SRL
Via Le Canevare 30, 31100 Treviso, Veneto, IT
T. +39 042 243 5310
[email protected]
www.amarulasolutions.com

#3 lore raw
Quoted 5 lines · Lukas Bulwahn

Strangely, my checkpatch invocation on next-20221116 did not show that warning and I am unaware that I made any specific changes to checkpatch or its configuration.

I think you need to apply the patch and retest with the -f option.

regards,
dan carpenter

#5 lore raw
In reply to Lukas Bulwahn

Hi Lukas,

Quoted 102 lines · Lukas Bulwahn
Quoted 75 lines · Tommaso Merciai

Hi Lukas,

Quoted 71 lines · Lukas Bulwahn

There never was a config IMX_GPT_ICAP in the repository. So remove the code conditional on this config and simplify the callers that just called empty functions.

---
 drivers/staging/media/imx/imx-media-fim.c | 54 -----------------------
 1 file changed, 54 deletions(-)
drivers/staging/media/imx/imx-media-fim.c +0 -48
index 3a9182933508..19a48eb445fd 100644
@@ -187,54 +187,6 @@ static void frame_interval_monitor(struct imx_media_fim *fim,
              send_fim_event(fim, error_avg);
 }
 
-#ifdef CONFIG_IMX_GPT_ICAP
-/*
- * Input Capture method of measuring frame intervals. Not subject
- * to interrupt latency.
- */
-static void fim_input_capture_handler(int channel, void *dev_id,
-                                   ktime_t timestamp)
-{
-     struct imx_media_fim *fim = dev_id;
-     unsigned long flags;
-
-     spin_lock_irqsave(&fim->lock, flags);
-
-     frame_interval_monitor(fim, timestamp);
-
-     if (!completion_done(&fim->icap_first_event))
-             complete(&fim->icap_first_event);
-
-     spin_unlock_irqrestore(&fim->lock, flags);
-}
-
-static int fim_request_input_capture(struct imx_media_fim *fim)
-{
-     init_completion(&fim->icap_first_event);
-
-     return mxc_request_input_capture(fim->icap_channel,
-                                      fim_input_capture_handler,
-                                      fim->icap_flags, fim);
-}
-
-static void fim_free_input_capture(struct imx_media_fim *fim)
-{
-     mxc_free_input_capture(fim->icap_channel, fim);
-}
-
-#else /* CONFIG_IMX_GPT_ICAP */
-
-static int fim_request_input_capture(struct imx_media_fim *fim)
-{
-     return 0;
-}
-
-static void fim_free_input_capture(struct imx_media_fim *fim)
-{
-}
-
-#endif /* CONFIG_IMX_GPT_ICAP */
-
 /*
  * In case we are monitoring the first frame interval after streamon
  * (when fim->num_skip = 0), we need a valid fim->last_ts before we
@@ -435,14 +387,8 @@ int imx_media_fim_set_stream(struct imx_media_fim *fim,
              spin_unlock_irqrestore(&fim->lock, flags);
 
Quoted 20 lines

drivers/staging/media/imx/imx-media-fim.c int imx_media_fim_set_stream(struct imx_media_fim *fim, · line 391

Quoted 6 lines
drivers/staging/media/imx/imx-media-fim.c +0 -3
              if (icap_enabled(fim)) {
-                     ret = fim_request_input_capture(fim);
-                     if (ret)
-                             goto out;
                      fim_acquire_first_ts(fim);
              }

As suggested by the checkpatch.pl:
WARNING: braces {} are not necessary for single statement blocks

Quoted 9 lines
drivers/staging/media/imx/imx-media-fim.c +0 -4
-     } else {
-             if (icap_enabled(fim))
-                     fim_free_input_capture(fim);
      }
 
      fim->stream_on = on;
--

2.17.1

Strangely, my checkpatch invocation on next-20221116 did not show that warning and I am unaware that I made any specific changes to checkpatch or its configuration.

Quoted 6 lines

Anyway, checkpatch and you, Tommaso, are right and the patch can of course be improved. I sent out a patch v2:

https://lore.kernel.org/all/[email protected]/

I hope to get an Acked-by: tag from you now. Thanks.

Sorry I miss the tag :)

Apply the patch then run:
scripts/checkpatch.pl -f drivers/staging/media/imx/imx-media-fim.c

Regards,
Tommaso

Quoted 20 lines

Lukas

Quoted 17 lines

Apart of this, patch looks good to me.
Thanks.

Regards,
Tommaso

--
Tommaso Merciai
Embedded Linux Engineer
[email protected]
__________________________________

Amarula Solutions SRL
Via Le Canevare 30, 31100 Treviso, Veneto, IT
T. +39 042 243 5310
[email protected]
www.amarulasolutions.com

Signature · 10 lines
Tommaso Merciai
Embedded Linux Engineer
[email protected]
__________________________________

Amarula Solutions SRL
Via Le Canevare 30, 31100 Treviso, Veneto, IT
T. +39 042 243 5310
[email protected]
www.amarulasolutions.com
#6 lore raw
Quoted 111 lines · Tommaso Merciai

Hi Lukas,

Quoted 107 lines · Lukas Bulwahn
Quoted 75 lines · Tommaso Merciai

Hi Lukas,

Quoted 71 lines · Lukas Bulwahn

There never was a config IMX_GPT_ICAP in the repository. So remove the code conditional on this config and simplify the callers that just called empty functions.

---
 drivers/staging/media/imx/imx-media-fim.c | 54 -----------------------
 1 file changed, 54 deletions(-)
drivers/staging/media/imx/imx-media-fim.c +0 -48
index 3a9182933508..19a48eb445fd 100644
@@ -187,54 +187,6 @@ static void frame_interval_monitor(struct imx_media_fim *fim,
              send_fim_event(fim, error_avg);
 }
 
-#ifdef CONFIG_IMX_GPT_ICAP
-/*
- * Input Capture method of measuring frame intervals. Not subject
- * to interrupt latency.
- */
-static void fim_input_capture_handler(int channel, void *dev_id,
-                                   ktime_t timestamp)
-{
-     struct imx_media_fim *fim = dev_id;
-     unsigned long flags;
-
-     spin_lock_irqsave(&fim->lock, flags);
-
-     frame_interval_monitor(fim, timestamp);
-
-     if (!completion_done(&fim->icap_first_event))
-             complete(&fim->icap_first_event);
-
-     spin_unlock_irqrestore(&fim->lock, flags);
-}
-
-static int fim_request_input_capture(struct imx_media_fim *fim)
-{
-     init_completion(&fim->icap_first_event);
-
-     return mxc_request_input_capture(fim->icap_channel,
-                                      fim_input_capture_handler,
-                                      fim->icap_flags, fim);
-}
-
-static void fim_free_input_capture(struct imx_media_fim *fim)
-{
-     mxc_free_input_capture(fim->icap_channel, fim);
-}
-
-#else /* CONFIG_IMX_GPT_ICAP */
-
-static int fim_request_input_capture(struct imx_media_fim *fim)
-{
-     return 0;
-}
-
-static void fim_free_input_capture(struct imx_media_fim *fim)
-{
-}
-
-#endif /* CONFIG_IMX_GPT_ICAP */
-
 /*
  * In case we are monitoring the first frame interval after streamon
  * (when fim->num_skip = 0), we need a valid fim->last_ts before we
@@ -435,14 +387,8 @@ int imx_media_fim_set_stream(struct imx_media_fim *fim,
              spin_unlock_irqrestore(&fim->lock, flags);
 
Quoted 20 lines

drivers/staging/media/imx/imx-media-fim.c int imx_media_fim_set_stream(struct imx_media_fim *fim, · line 391

Quoted 6 lines
drivers/staging/media/imx/imx-media-fim.c +0 -3
              if (icap_enabled(fim)) {
-                     ret = fim_request_input_capture(fim);
-                     if (ret)
-                             goto out;
                      fim_acquire_first_ts(fim);
              }

As suggested by the checkpatch.pl:
WARNING: braces {} are not necessary for single statement blocks

Quoted 9 lines
drivers/staging/media/imx/imx-media-fim.c +0 -4
-     } else {
-             if (icap_enabled(fim))
-                     fim_free_input_capture(fim);
      }
 
      fim->stream_on = on;
--

2.17.1

Strangely, my checkpatch invocation on next-20221116 did not show that warning and I am unaware that I made any specific changes to checkpatch or its configuration.

Anyway, checkpatch and you, Tommaso, are right and the patch can of course be improved. I sent out a patch v2:

https://lore.kernel.org/all/[email protected]/

Quoted 9 lines
Quoted 1 line

I hope to get an Acked-by: tag from you now. Thanks.

Sorry I miss the tag :)

Apply the patch then run:
scripts/checkpatch.pl -f drivers/staging/media/imx/imx-media-fim.c

I see. I usually just run checkpatch.pl on the patch, but do not apply the patch and run checkpatch on the file. That explains the difference of observations. Good to know.

Lukas

Quoted 35 lines

Regards,
Tommaso

Quoted 20 lines

Lukas

Quoted 17 lines

Apart of this, patch looks good to me.
Thanks.

Regards,
Tommaso

--
Tommaso Merciai
Embedded Linux Engineer
[email protected]
__________________________________

Amarula Solutions SRL
Via Le Canevare 30, 31100 Treviso, Veneto, IT
T. +39 042 243 5310
[email protected]
www.amarulasolutions.com

--
Tommaso Merciai
Embedded Linux Engineer
[email protected]
__________________________________

Amarula Solutions SRL
Via Le Canevare 30, 31100 Treviso, Veneto, IT
T. +39 042 243 5310
[email protected]
www.amarulasolutions.com

#4 lore raw
In reply to Dan Carpenter
Quoted 10 lines · Dan Carpenter
Quoted 5 lines · Lukas Bulwahn

Strangely, my checkpatch invocation on next-20221116 did not show that warning and I am unaware that I made any specific changes to checkpatch or its configuration.

I think you need to apply the patch and retest with the -f option.

Thanks, Dan, for the hint. Now, I know. I need to see if this can become part of my usual patch submission workflow.

Lukas

Quoted 3 lines

regards,
dan carpenter

#7 lore raw
In reply to Lukas Bulwahn
Quoted 7 lines · Lukas Bulwahn
Quoted 1 line · Tommaso Merciai

I see. I usually just run checkpatch.pl on the patch, but do not apply the patch and run checkpatch on the file. That explains the difference of observations. Good to know.

There is a section "Git post-commit hooks" on this [1] web-link that is useful to configure auto-checkpatch verification at the time of commit.

Hope this is useful.

[1] https://kernelnewbies.org/Outreachyfirstpatch

./drv

Quoted 2 lines

Lukas