Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions kernel/realsense/d4xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2248,6 +2248,38 @@ static int ds5_hw_reset_with_recovery(struct ds5 *state)
int retry;
u16 status = 0;
bool device_went_down = false;
struct ds5_sensor *sensors[] = {
&state->depth.sensor,
&state->ir.sensor,
&state->rgb.sensor,
&state->imu.sensor,
};
int i;

if (state->dser_dev) {
mutex_lock(&serdes_lock__);
for (i = 0; i < ARRAY_SIZE(sensors); i++) {
struct ds5_sensor *sensor = sensors[i];

sensor->cached_dt_value = 0xFFFF;
sensor->cached_md_value = 0xFFFF;
sensor->cached_override_value = 0xFFFF;
sensor->cached_fps_value = 0xFFFF;
sensor->cached_width_value = 0xFFFF;
sensor->cached_height_value = 0xFFFF;

if (!sensor->pipe_configured) {
continue;
} else {
int release_ret = max9296_release_pipe(state->dser_dev,
sensor->pipe_id);
Comment on lines +2274 to +2275

Copilot AI Feb 19, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is calling max9296_release_pipe directly instead of using the interface abstraction pattern (state->dser_ops->release_pipe). This is inconsistent with the pattern used later in the same function at lines 2376-2377, which uses state->dser_ops->release_pipe. Direct calls bypass the interface abstraction and will fail if the deserializer is a MAX96712 instead of MAX9296. The code should use state->dser_ops->release_pipe to support both deserializer types.

Suggested change
int release_ret = max9296_release_pipe(state->dser_dev,
sensor->pipe_id);
int release_ret = state->dser_ops->release_pipe(state->dser_dev,
sensor->pipe_id);

Copilot uses AI. Check for mistakes.
dev_warn(&state->client->dev, "release pipe %d (%d)\n",
sensor->pipe_id, release_ret);
sensor->pipe_configured = false;
}
Comment on lines +2273 to +2279

Copilot AI Feb 19, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The else clause at line 2273 is redundant. Since the if block at line 2271-2272 uses continue, the else is unnecessary and makes the code less readable. The code within the else block can be unindented to the same level as the if statement. This follows standard best practices for early returns/continues to reduce nesting.

Suggested change
} else {
int release_ret = max9296_release_pipe(state->dser_dev,
sensor->pipe_id);
dev_warn(&state->client->dev, "release pipe %d (%d)\n",
sensor->pipe_id, release_ret);
sensor->pipe_configured = false;
}
}
int release_ret = max9296_release_pipe(state->dser_dev,
sensor->pipe_id);
dev_warn(&state->client->dev, "release pipe %d (%d)\n",
sensor->pipe_id, release_ret);
sensor->pipe_configured = false;

Copilot uses AI. Check for mistakes.
}
mutex_unlock(&serdes_lock__);
}
Comment on lines +2259 to +2282

Copilot AI Feb 19, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new code block is not wrapped in CONFIG_VIDEO_D4XX_SERDES conditional compilation guards, unlike the similar block at lines 2357-2392. The code accesses SERDES-specific fields (state->dser_dev, state->dser_ops) and uses the serdes_lock__ mutex, which are only defined when CONFIG_VIDEO_D4XX_SERDES is enabled. This will cause compilation errors when CONFIG_VIDEO_D4XX_SERDES is not defined. Wrap this code block with #ifdef CONFIG_VIDEO_D4XX_SERDES / #endif to match the pattern used elsewhere in the function.

Copilot uses AI. Check for mistakes.

dev_info(&state->client->dev, "%s(): Initiating HW reset with recovery\n",
__func__);
Expand Down