* [PATCH 1/1] media: ov02c10: Use div_u64 to divide a 64-bit number
@ 2025-05-09 6:25 Sakari Ailus
2025-05-09 6:43 ` Stanislaw Gruszka
2025-05-09 8:20 ` Hans de Goede
0 siblings, 2 replies; 3+ messages in thread
From: Sakari Ailus @ 2025-05-09 6:25 UTC (permalink / raw)
To: linux-media; +Cc: hans, Hans de Goede, Bryan O'Donoghue
The ov02c10 driver divides a 64-bit number but reply relies on division
operator to do that. Use div_u64() so this will compile everywhere.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/media/i2c/ov02c10.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/ov02c10.c b/drivers/media/i2c/ov02c10.c
index 9e3d4a4e12ce..089a4fd9627c 100644
--- a/drivers/media/i2c/ov02c10.c
+++ b/drivers/media/i2c/ov02c10.c
@@ -497,8 +497,8 @@ static int ov02c10_init_controls(struct ov02c10 *ov02c10)
ov02c10->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
/* MIPI lanes are DDR -> use link-freq * 2 */
- pixel_rate = link_freq_menu_items[ov02c10->link_freq_index] * 2 *
- ov02c10->mipi_lanes / OV02C10_RGB_DEPTH;
+ pixel_rate = div_u64(link_freq_menu_items[ov02c10->link_freq_index] *
+ 2 * ov02c10->mipi_lanes, OV02C10_RGB_DEPTH);
ov02c10->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &ov02c10_ctrl_ops,
V4L2_CID_PIXEL_RATE, 0,
--
2.39.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] media: ov02c10: Use div_u64 to divide a 64-bit number
2025-05-09 6:25 [PATCH 1/1] media: ov02c10: Use div_u64 to divide a 64-bit number Sakari Ailus
@ 2025-05-09 6:43 ` Stanislaw Gruszka
2025-05-09 8:20 ` Hans de Goede
1 sibling, 0 replies; 3+ messages in thread
From: Stanislaw Gruszka @ 2025-05-09 6:43 UTC (permalink / raw)
To: Sakari Ailus; +Cc: linux-media, hans, Hans de Goede, Bryan O'Donoghue
On Fri, May 09, 2025 at 09:25:11AM +0300, Sakari Ailus wrote:
> The ov02c10 driver divides a 64-bit number but reply relies on division
> operator to do that. Use div_u64() so this will compile everywhere.
>
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
> ---
> drivers/media/i2c/ov02c10.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/i2c/ov02c10.c b/drivers/media/i2c/ov02c10.c
> index 9e3d4a4e12ce..089a4fd9627c 100644
> --- a/drivers/media/i2c/ov02c10.c
> +++ b/drivers/media/i2c/ov02c10.c
> @@ -497,8 +497,8 @@ static int ov02c10_init_controls(struct ov02c10 *ov02c10)
> ov02c10->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
>
> /* MIPI lanes are DDR -> use link-freq * 2 */
> - pixel_rate = link_freq_menu_items[ov02c10->link_freq_index] * 2 *
> - ov02c10->mipi_lanes / OV02C10_RGB_DEPTH;
> + pixel_rate = div_u64(link_freq_menu_items[ov02c10->link_freq_index] *
> + 2 * ov02c10->mipi_lanes, OV02C10_RGB_DEPTH);
>
> ov02c10->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &ov02c10_ctrl_ops,
> V4L2_CID_PIXEL_RATE, 0,
> --
> 2.39.5
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] media: ov02c10: Use div_u64 to divide a 64-bit number
2025-05-09 6:25 [PATCH 1/1] media: ov02c10: Use div_u64 to divide a 64-bit number Sakari Ailus
2025-05-09 6:43 ` Stanislaw Gruszka
@ 2025-05-09 8:20 ` Hans de Goede
1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2025-05-09 8:20 UTC (permalink / raw)
To: Sakari Ailus, linux-media; +Cc: hans, Hans de Goede, Bryan O'Donoghue
Hi,
On 9-May-25 8:25 AM, Sakari Ailus wrote:
> The ov02c10 driver divides a 64-bit number but reply relies on division
> operator to do that. Use div_u64() so this will compile everywhere.
>
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
I was just going to start working on fixing this myself, thank you,
patch looks good to me:
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Regards,
Hans
> ---
> drivers/media/i2c/ov02c10.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/i2c/ov02c10.c b/drivers/media/i2c/ov02c10.c
> index 9e3d4a4e12ce..089a4fd9627c 100644
> --- a/drivers/media/i2c/ov02c10.c
> +++ b/drivers/media/i2c/ov02c10.c
> @@ -497,8 +497,8 @@ static int ov02c10_init_controls(struct ov02c10 *ov02c10)
> ov02c10->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
>
> /* MIPI lanes are DDR -> use link-freq * 2 */
> - pixel_rate = link_freq_menu_items[ov02c10->link_freq_index] * 2 *
> - ov02c10->mipi_lanes / OV02C10_RGB_DEPTH;
> + pixel_rate = div_u64(link_freq_menu_items[ov02c10->link_freq_index] *
> + 2 * ov02c10->mipi_lanes, OV02C10_RGB_DEPTH);
>
> ov02c10->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &ov02c10_ctrl_ops,
> V4L2_CID_PIXEL_RATE, 0,
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-05-09 8:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-09 6:25 [PATCH 1/1] media: ov02c10: Use div_u64 to divide a 64-bit number Sakari Ailus
2025-05-09 6:43 ` Stanislaw Gruszka
2025-05-09 8:20 ` Hans de Goede
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox