From: Dan Carpenter <dan.carpenter@linaro.org>
To: Karthikey D Kadati <karthikey3608@gmail.com>
Cc: Hans de Goede <hansg@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
linux-media@vger.kernel.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 RESEND v2 1/3] media: atomisp: replace shadow zoom structs with v4l2_rect
Date: Wed, 7 Jan 2026 17:20:06 +0300 [thread overview]
Message-ID: <aV5rloYmYfLMkMKA@stanley.mountain> (raw)
In-Reply-To: <20260107134844.68074-2-karthikey3608@gmail.com>
On Wed, Jan 07, 2026 at 07:18:42PM +0530, Karthikey D Kadati wrote:
> Remove custom atomisp_zoom_point and atomisp_zoom_region structs and
>
> usage in favor of standard v4l2_rect within atomisp_dz_config.
>
> This aligns the driver with V4L2 standards and removes unnecessary
>
> custom types.
>
> Also standardizes the internal ia_css_region struct members to match
>
> V4L2 naming conventions (left, top, width, height) to facilitate the
>
> bridge mapping.
>
> Updates atomisp_cmd.c and sh_css_params.c to use the new member names
>
> and ensures safe math using long long casts to prevent overflow during
>
> resolution scaling.
>
The commit message has extra new lines obviously.
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
> index 327836372..4ed6b8aea 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
> @@ -1764,15 +1764,13 @@ int atomisp_calculate_real_zoom_region(struct atomisp_sub_device *asd,
> return -EINVAL;
> }
>
> - if (dz_config->zoom_region.resolution.width
> - == asd->sensor_array_res.width
> - || dz_config->zoom_region.resolution.height
> - == asd->sensor_array_res.height) {
> + if (dz_config->zoom_region.width == asd->sensor_array_res.width ||
> + dz_config->zoom_region.height == asd->sensor_array_res.height) {
> /*no need crop region*/
> - dz_config->zoom_region.origin.x = 0;
> - dz_config->zoom_region.origin.y = 0;
> - dz_config->zoom_region.resolution.width = eff_res.width;
> - dz_config->zoom_region.resolution.height = eff_res.height;
> + dz_config->zoom_region.left = 0;
> + dz_config->zoom_region.top = 0;
> + dz_config->zoom_region.width = eff_res.width;
> + dz_config->zoom_region.height = eff_res.height;
> return 0;
> }
>
> @@ -1783,18 +1781,18 @@ int atomisp_calculate_real_zoom_region(struct atomisp_sub_device *asd,
> */
>
> if (!IS_ISP2401) {
> - dz_config->zoom_region.origin.x = dz_config->zoom_region.origin.x
> - * eff_res.width
> - / asd->sensor_array_res.width;
> - dz_config->zoom_region.origin.y = dz_config->zoom_region.origin.y
> - * eff_res.height
> - / asd->sensor_array_res.height;
> - dz_config->zoom_region.resolution.width = dz_config->zoom_region.resolution.width
> - * eff_res.width
> - / asd->sensor_array_res.width;
> - dz_config->zoom_region.resolution.height = dz_config->zoom_region.resolution.height
> - * eff_res.height
> - / asd->sensor_array_res.height;
> + dz_config->zoom_region.left =
> + (s32)((long long)dz_config->zoom_region.left *
> + eff_res.width / asd->sensor_array_res.width);
> + dz_config->zoom_region.top =
> + (s32)((long long)dz_config->zoom_region.top *
> + eff_res.height / asd->sensor_array_res.height);
> + dz_config->zoom_region.width =
> + (u32)((long long)dz_config->zoom_region.width *
> + eff_res.width / asd->sensor_array_res.width);
> + dz_config->zoom_region.height =
> + (u32)((long long)dz_config->zoom_region.height *
> + eff_res.height / asd->sensor_array_res.height);
Why do we need this new casting? Is it a bugfix?
I don't love the casts to s32 and u32. Those are unnecessary. Also
width and height are s32 so why are we casting to u32? Same comments
for the other casts later on.
There are more style changes than strictly necessary to just rename the
struct members.
regards,
dan carpenter
next prev parent reply other threads:[~2026-01-07 14:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-04 16:40 [PATCH] media: atomisp: replace shadow zoom structs with v4l2_rect and fix error paths Karthikey D Kadati
2026-01-04 18:38 ` Hans de Goede
2026-01-05 14:57 ` [PATCH v2 0/3] media: atomisp: refactoring and fixes for V4L2 compliance Karthikey D Kadati
2026-01-05 14:57 ` [PATCH v2 1/3] media: atomisp: replace shadow zoom structs with v4l2_rect Karthikey D Kadati
2026-01-05 14:57 ` [PATCH v2 2/3] media: atomisp: consolidate statistics buffer allocation Karthikey D Kadati
2026-01-05 14:57 ` [PATCH v2 3/3] media: atomisp: propagate errors from ISP xnr and IRQ enable Karthikey D Kadati
2026-01-07 13:48 ` [PATCH v2 RESEND 0/3] media: atomisp: refactoring and fixes for V4L2 compliance Karthikey D Kadati
2026-01-07 13:48 ` [PATCH v2 RESEND v2 1/3] media: atomisp: replace shadow zoom structs with v4l2_rect Karthikey D Kadati
2026-01-07 14:20 ` Dan Carpenter [this message]
2026-01-07 13:48 ` [PATCH v2 RESEND v2 2/3] media: atomisp: consolidate statistics buffer allocation Karthikey D Kadati
2026-01-07 14:31 ` Dan Carpenter
2026-01-07 13:48 ` [PATCH v2 RESEND v2 3/3] media: atomisp: propagate errors from ISP xnr and IRQ enable Karthikey D Kadati
2026-01-07 14:33 ` Dan Carpenter
2026-01-07 14:22 ` [PATCH v2 RESEND 0/3] media: atomisp: refactoring and fixes for V4L2 compliance Dan Carpenter
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=aV5rloYmYfLMkMKA@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=hansg@kernel.org \
--cc=karthikey3608@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--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