From f422140e5a17557af48b10ea76a8b29777ce4e4b Mon Sep 17 00:00:00 2001 From: Himanshu Bhavani Date: Thu, 8 Jan 2026 11:24:54 +0530 Subject: [PATCH] media: i2c: os05b10: Few minor improvements Return 0 from disable_streams, use div_u64() instead of do_div(), use dev_dbg() for a debug message and move loop variable definition into the loop itself. Signed-off-by: Himanshu Bhavani Signed-off-by: Sakari Ailus Signed-off-by: Hans Verkuil --- drivers/media/i2c/os05b10.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/media/i2c/os05b10.c b/drivers/media/i2c/os05b10.c index 8912d54ea55a9..e0453c988e4a0 100644 --- a/drivers/media/i2c/os05b10.c +++ b/drivers/media/i2c/os05b10.c @@ -708,7 +708,7 @@ static int os05b10_disable_streams(struct v4l2_subdev *sd, pm_runtime_put(os05b10->dev); - return ret; + return 0; } static int os05b10_init_state(struct v4l2_subdev *sd, @@ -884,17 +884,13 @@ static u64 os05b10_pixel_rate(struct os05b10 *os05b10, const struct os05b10_mode *mode) { u64 link_freq = link_frequencies[os05b10->link_freq_index]; - const unsigned int lanes = os05b10->data_lanes; - u64 numerator = link_freq * 2 * lanes; - unsigned int bpp = mode->bpp; - - do_div(numerator, bpp); + u64 pixel_rate = div_u64(link_freq * 2 * os05b10->data_lanes, mode->bpp); - dev_info(os05b10->dev, - "link_freq=%llu bpp=%u lanes=%u pixel_rate=%llu\n", - link_freq, bpp, lanes, numerator); + dev_dbg(os05b10->dev, + "link_freq=%llu bpp=%u lanes=%u pixel_rate=%llu\n", + link_freq, mode->bpp, os05b10->data_lanes, pixel_rate); - return numerator; + return pixel_rate; } static int os05b10_init_controls(struct os05b10 *os05b10) @@ -977,7 +973,6 @@ static int os05b10_probe(struct i2c_client *client) { struct os05b10 *os05b10; unsigned int xclk_freq; - unsigned int i; int ret; os05b10 = devm_kzalloc(&client->dev, sizeof(*os05b10), GFP_KERNEL); @@ -1005,7 +1000,7 @@ static int os05b10_probe(struct i2c_client *client) "xclk frequency not supported: %d Hz\n", xclk_freq); - for (i = 0; i < ARRAY_SIZE(os05b10_supply_name); i++) + for (unsigned int i = 0; i < ARRAY_SIZE(os05b10_supply_name); i++) os05b10->supplies[i].supply = os05b10_supply_name[i]; ret = devm_regulator_bulk_get(os05b10->dev, -- 2.47.3