Errors and Retries

A "golden rule" in a driver/client architecture is

Do it or return an error if you can't.

When a piece of hardware needs retries, it is the driver's responsibility to do those retries, if appropriate, and hide this from the clients. Only the driver knows the behaviour of that particular piece of hardware and when retries are appropriate or not.

It is wrong to expect client applications to provide retries because this would force client authors to include device dependent logic to test possibly invisible conditions and make decisions as to the safety and efficacy of retrying a driver call. It breaks the driver/client layering, forcing client authors to independently guess and implement recovery code with less-than-sufficient knowledge of the inner workings of the device. This is an extension of The General Principle.