From: Hans de Goede <hdegoede@redhat.com>
To: Kate Hsuan <hpa@redhat.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-media@vger.kernel.org, linux-staging@lists.linux.dev
Subject: Re: [PATCH v2 5/5] staging: media: atomisp: sh_css_mipi: Remove #ifdef 2041
Date: Wed, 10 May 2023 20:34:32 +0200 [thread overview]
Message-ID: <b718122b-7935-d0e2-4e1d-a09e0943a84b@redhat.com> (raw)
In-Reply-To: <20230508062632.34537-5-hpa@redhat.com>
Hi Kate,
On 5/8/23 08:26, Kate Hsuan wrote:
> The actions of ISP2401 and 2400 are determined at the runtime.
>
> Signed-off-by: Kate Hsuan <hpa@redhat.com>
> ---
> .../staging/media/atomisp/pci/sh_css_mipi.c | 65 ++++++-------------
> 1 file changed, 20 insertions(+), 45 deletions(-)
>
> diff --git a/drivers/staging/media/atomisp/pci/sh_css_mipi.c b/drivers/staging/media/atomisp/pci/sh_css_mipi.c
> index bc6e8598a776..52a1ed63e9a5 100644
> --- a/drivers/staging/media/atomisp/pci/sh_css_mipi.c
> +++ b/drivers/staging/media/atomisp/pci/sh_css_mipi.c
> @@ -386,30 +381,22 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,
> return -EINVAL;
> }
>
> -#ifdef ISP2401
> - err = calculate_mipi_buff_size(&pipe->stream->config,
> - &my_css.mipi_frame_size[port]);
Before you changes this code always run ISP2401, now it only runs
when (ref_count_mipi_allocation[port] != 0) is not true.
So this statement should stay here in the code, just prefixed
with a if (IS_ISP2401) condition.
> - /*
> - * 2401 system allows multiple streams to use same physical port. This is not
> - * true for 2400 system. Currently 2401 uses MIPI buffers as a temporary solution.
> - * TODO AM: Once that is changed (removed) this code should be removed as well.
> - * In that case only 2400 related code should remain.
> - */
> - if (ref_count_mipi_allocation[port] != 0) {
> - ref_count_mipi_allocation[port]++;
> - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
> - "allocate_mipi_frames(%p) leave: nothing to do, already allocated for this port (port=%d).\n",
> - pipe, port);
> - return 0;
> - }
> -#else
> if (ref_count_mipi_allocation[port] != 0) {
> ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
> "allocate_mipi_frames(%p) exit: already allocated for this port (port=%d).\n",
> pipe, port);
> return 0;
> + } else {
> + /*
> + * 2401 system allows multiple streams to use same physical port. This is not
> + * true for 2400 system. Currently 2401 uses MIPI buffers as a temporary solution.
> + * TODO AM: Once that is changed (removed) this code should be removed as well.
> + * In that case only 2400 related code should remain.
> + */
This comment block actually belongs to the if (ref_count_mipi_allocation[port] != 0)
check, the code executed if that check passes was actually different between
the ISP2400 and ISP2401 (my bad, sorry). The ISP2401 case did an extra:
ref_count_mipi_allocation[port]++;
when (ref_count_mipi_allocation[port] != 0), so we need to add:
if (IS_ISP2401)
ref_count_mipi_allocation[port]++;
above the return 0 above.
> + if (IS_ISP2401)
> + err = calculate_mipi_buff_size(&pipe->stream->config,
> + &my_css.mipi_frame_size[port]);
I have fixed this all up while merging your series and the new
diff for this code-block now looks like this:
@@ -386,9 +381,10 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,
return -EINVAL;
}
-#ifdef ISP2401
- err = calculate_mipi_buff_size(&pipe->stream->config,
- &my_css.mipi_frame_size[port]);
+ if (IS_ISP2401)
+ err = calculate_mipi_buff_size(&pipe->stream->config,
+ &my_css.mipi_frame_size[port]);
+
/*
* 2401 system allows multiple streams to use same physical port. This is not
* true for 2400 system. Currently 2401 uses MIPI buffers as a temporary solution.
@@ -396,20 +392,14 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,
* In that case only 2400 related code should remain.
*/
if (ref_count_mipi_allocation[port] != 0) {
- ref_count_mipi_allocation[port]++;
+ if (IS_ISP2401)
+ ref_count_mipi_allocation[port]++;
+
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
"allocate_mipi_frames(%p) leave: nothing to do, already allocated for this port (port=%d).\n",
pipe, port);
return 0;
}
-#else
- if (ref_count_mipi_allocation[port] != 0) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
- "allocate_mipi_frames(%p) exit: already allocated for this port (port=%d).\n",
- pipe, port);
- return 0;
- }
-#endif
ref_count_mipi_allocation[port]++;
Regards,
Hans
next prev parent reply other threads:[~2023-05-10 18:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-08 6:26 [PATCH v2 1/5] staging: media: atomisp: sh_css: Remove #ifdef ISP2401 Kate Hsuan
2023-05-08 6:26 ` [PATCH v2 2/5] staging: media: atomisp: runtime: frame: remove " Kate Hsuan
2023-05-08 6:26 ` [PATCH v2 3/5] staging: media: atomisp: sh_css_sp: Remove " Kate Hsuan
2023-05-08 6:26 ` [PATCH v2 4/5] staging: media: atomisp: sh_css_firmware: determine firmware version at runtime Kate Hsuan
2023-05-08 6:26 ` [PATCH v2 5/5] staging: media: atomisp: sh_css_mipi: Remove #ifdef 2041 Kate Hsuan
2023-05-10 18:34 ` Hans de Goede [this message]
2023-05-11 11:18 ` Kate Hsuan
2023-05-10 18:40 ` [PATCH v2 1/5] staging: media: atomisp: sh_css: Remove #ifdef ISP2401 Hans de Goede
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=b718122b-7935-d0e2-4e1d-a09e0943a84b@redhat.com \
--to=hdegoede@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@redhat.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox