Looking at Linux source code for SD card drivers. Holy fuck. Hundreds upon hundreds of lines of code that will only ever execute once.
Conversation
Replying to
I wish I could tell you for sure. I reads the SD card's CSD and CID registers, and parses their values into structs, but...
1
Replying to
... how that data is used is beyond me. The source is > 1000 LOC, and 99% of it is just card capability discovery.
1
Replying to
Turning one mess into another? Strange because what you actually need to read/write isn't that much.
1
Replying to
But my use is very specific and we know the cards so I'm probably just ignorant. Maybe there are some quirks to work around?
1
Replying to
I'm focusing on just SDC cards right now; eventually I want to support SDHC and SDXC as well. But, still, 1KLOC?!
1
Replying to
Linux drivers overall are not good examples of properly factored code.
Replying to
I'm pretty convinced Linux drivers are a complete mess. I don't know how anyone can work with them at all.

