oxidecomputer / oxidecomputer/hubris

VSC7448 SPI driver recurses

Open Beginner friendly
#2,593 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
3.6k
Forks
239
Avg merge
1d 12h
Merged PRs (30d)
23

Description

https://github.com/oxidecomputer/hubris/blob/6e9305941d41877b8327d61f05067eddbfe66bcb/drv/vsc7448/src/spi.rs#L35-L96

The current SPI driver attempts to read a register, and if that returns a certain value, we call ourselves indirectly again to read a status register.

I noticed this while improving stack analysis, we probably should hoist this check up one level to call read_core twice from read, instead of read -> read_core -> read -> ....

In practice, this will only ever "iterate" twice, but we might want to avoid it entirely to make our lives easier.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in drv/vsc7448/src/spi.rs, lines 35-96, and trace how read and read_core handle the register value that triggers the status-register lookup. Restructure the call path so the lookup does not recurse indirectly, while preserving the existing SPI behavior. Verify that the resulting stack behavior no longer includes the recursive path and that the driver still builds.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
embedded-iot
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.