Skip to content

♻️ refactor(device): rename input_clean_change to perper_change for c…#61

Merged
ZR233 merged 1 commit intomainfrom
dev
Jan 28, 2026
Merged

♻️ refactor(device): rename input_clean_change to perper_change for c…#61
ZR233 merged 1 commit intomainfrom
dev

Conversation

@ZR233
Copy link
Member

@ZR233 ZR233 commented Jan 28, 2026

…larity

Copilot AI review requested due to automatic review settings January 28, 2026 06:14
@ZR233 ZR233 merged commit 98ce56b into main Jan 28, 2026
5 checks passed
@ZR233 ZR233 deleted the dev branch January 28, 2026 06:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR attempts to refactor the code by renaming the input_clean_change method to perper_change for improved clarity. However, the new function name contains a critical spelling error. Additionally, the refactoring includes moving some calls to this renamed function to different locations in the code flow and removing redundant context flag setup code that is now handled by the renamed function.

Changes:

  • Renamed input_clean_change to perper_change in the ContextData implementation
  • Updated all call sites to use the new function name
  • Added a call to perper_change in setup_max_packet method and introduced a new line to set endpoint 0 context flag
  • Removed the call from evaluate method as it's now called before evaluate in the calling functions
  • Simplified update_hub_inner by removing manual context flag setup that is now handled by perper_change

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
usb-host/src/backend/kmod/xhci/context.rs Renames the input_clean_change method to perper_change
usb-host/src/backend/kmod/xhci/device.rs Updates all call sites to use perper_change and refactors context setup logic by removing redundant code and adding the renamed function call before operations that modify input context

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


let dci = Dci::CTRL;
self.ctx.with_input(|input| {
let _ = input.control_mut().add_context_flag(1); // Endpoint 0 Context
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

The method call appears to be incorrect. Based on the usage pattern elsewhere in the codebase (lines 208, 209, 415 in this file and line 111 in context.rs), this should be "set_add_context_flag" instead of "add_context_flag". The current code will fail to compile as the method "add_context_flag" does not exist. Additionally, the returned value is being discarded with "let _", but set_add_context_flag likely doesn't return a value that needs to be handled.

Suggested change
let _ = input.control_mut().add_context_flag(1); // Endpoint 0 Context
input.control_mut().set_add_context_flag(1); // Endpoint 0 Context

Copilot uses AI. Check for mistakes.
}

async fn setup_max_packet(&mut self, desc: DeviceDescriptorBase) -> Result {
self.ctx.perper_change();
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

The function name "perper_change" appears to be a typo. This should likely be "prepare_change" or "prepare_input_change" to match the function's purpose of preparing the input context for changes.

Suggested change
self.ctx.perper_change();
self.ctx.prepare_change();

Copilot uses AI. Check for mistakes.
}

async fn _set_configuration(&mut self, configuration_value: u8) -> Result {
self.ctx.perper_change();
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

The function name "perper_change" appears to be a typo. This should likely be "prepare_change" or "prepare_input_change" to match the function's purpose of preparing the input context for changes.

Suggested change
self.ctx.perper_change();
self.ctx.prepare_change();

Copilot uses AI. Check for mistakes.
}

async fn _claim_interface(&mut self, interface: u8, alternate: u8) -> Result {
self.ctx.perper_change();
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

The function name "perper_change" appears to be a typo. This should likely be "prepare_change" or "prepare_input_change" to match the function's purpose of preparing the input context for changes.

Copilot uses AI. Check for mistakes.
async fn setup_all_endpoints(&mut self, interface: u8, alternate: u8) -> Result {
let mut max_dci = 1;
self.ctx.input_clean_change();
self.ctx.perper_change();
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

The function name "perper_change" appears to be a typo. This should likely be "prepare_change" or "prepare_input_change" to match the function's purpose of preparing the input context for changes.

Copilot uses AI. Check for mistakes.
control_ctx.set_add_context_flag(0);
});

self.ctx.perper_change();
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

The function name "perper_change" appears to be a typo. This should likely be "prepare_change" or "prepare_input_change" to match the function's purpose of preparing the input context for changes.

Suggested change
self.ctx.perper_change();
self.ctx.prepare_change();

Copilot uses AI. Check for mistakes.
}

pub fn input_clean_change(&mut self) {
pub fn perper_change(&mut self) {
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

The function name "perper_change" appears to be a typo. Based on the function's behavior (clearing and preparing input context for changes), this should likely be "prepare_change" or "prepare_input_change" for clarity.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant