From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: Vikram Sharma <quic_vikramsa@quicinc.com>,
rfoss@kernel.org, todor.too@gmail.com, krzk+dt@kernel.org
Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel@quicinc.com
Subject: Re: [PATCH v1 1/1] media: qcom: camss: Restructure camss_link_entities
Date: Mon, 11 Nov 2024 23:29:21 +0000 [thread overview]
Message-ID: <3ffdab33-4680-43ec-95d6-fe889619dbcc@linaro.org> (raw)
In-Reply-To: <20241111173845.1773553-2-quic_vikramsa@quicinc.com>
On 11/11/2024 17:38, Vikram Sharma wrote:
> Refactor the camss_link_entities function by breaking it down into
> three distinct functions. Each function will handle the linking of
> a specific entity separately, enhancing readability.
>
> Signed-off-by: Suresh Vankadara <quic_svankada@quicinc.com>
> Signed-off-by: Trishansh Bhardwaj <quic_tbhardwa@quicinc.com>
> Signed-off-by: Vikram Sharma <quic_vikramsa@quicinc.com>
> ---
> drivers/media/platform/qcom/camss/camss.c | 159 ++++++++++++++--------
> 1 file changed, 105 insertions(+), 54 deletions(-)
>
> diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
> index fabe034081ed..1052c01b45f3 100644
> --- a/drivers/media/platform/qcom/camss/camss.c
> +++ b/drivers/media/platform/qcom/camss/camss.c
> @@ -1840,14 +1840,66 @@ static int camss_init_subdevices(struct camss *camss)
> }
>
> /*
> - * camss_link_entities - Register subdev nodes and create links
> + * camss_link_entities_csid - Register subdev nodes and create links
> * @camss: CAMSS device
> *
> * Return 0 on success or a negative error code on failure
> */
> -static int camss_link_entities(struct camss *camss)
> +static int camss_link_entities_csid(struct camss *camss)
> {
> - int i, j, k;
> + int i, j;
> + int ret, line_num;
> + u16 src_pad;
> + u16 sink_pad;
> + struct media_entity *src_entity;
> + struct media_entity *sink_entity;
Vikram.
Thanks for the patch.
Please reverse Christmas tree this declaration
struct media_entity *sink_entity;
struct media_entity *src_entity;
int ret, line_num;
u16 sink_pad;
u16 src_pad;
int i, j;
> +
> + for (i = 0; i < camss->res->csid_num; i++) {
> + if (camss->ispif)
> + line_num = camss->ispif->line_num;
> + else
> + line_num = camss->vfe[i].res->line_num;
> +
> + src_entity = &camss->csid[i].subdev.entity;
> + for (j = 0; j < line_num; j++) {
> + if (camss->ispif) {
> + sink_entity = &camss->ispif->line[j].subdev.entity;
> + src_pad = MSM_CSID_PAD_SRC;
> + sink_pad = MSM_ISPIF_PAD_SINK;
> + } else {
> + sink_entity = &camss->vfe[i].line[j].subdev.entity;
> + src_pad = MSM_CSID_PAD_FIRST_SRC + j;
> + sink_pad = MSM_VFE_PAD_SINK;
> + }
> +
> + ret = media_create_pad_link(src_entity,
> + src_pad,
> + sink_entity,
> + sink_pad,
> + 0);
> + if (ret < 0) {
> + dev_err(camss->dev,
> + "Failed to link %s->%s entities: %d\n",
> + src_entity->name,
> + sink_entity->name,
> + ret);
> + return ret;
We repeat this pattern over and over again.
I realise that's how it has evolved in this code but since we are going
in with the knife we may as well fix this too.
Please functionally decompose the "Failed to link" message down into a
function.
Once both of those are done:
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
bod
prev parent reply other threads:[~2024-11-11 23:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-11 17:38 [PATCH v1 0/1] media: qcom: camss: Re-structure camss_link_entities Vikram Sharma
2024-11-11 17:38 ` [PATCH v1 1/1] media: qcom: camss: Restructure camss_link_entities Vikram Sharma
2024-11-11 23:29 ` Bryan O'Donoghue [this message]
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=3ffdab33-4680-43ec-95d6-fe889619dbcc@linaro.org \
--to=bryan.odonoghue@linaro.org \
--cc=kernel@quicinc.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=quic_vikramsa@quicinc.com \
--cc=rfoss@kernel.org \
--cc=todor.too@gmail.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
all inboxes | Powered by JetHome®