Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
media: media si2168: fully initialize si2168 on resume only when nece…
…ssary At connection time (or boot) in si2168_probe(), the firmware is not loaded to the device and the device is not fully activated. It is not useful or sensible to do this full initialization on resume in case it has not been previously initialized and is expected to be in this initialized state. Calling si2168_init() and therefore reading the firmware file for the first time during resume leads to problems and should be avoided. It is however safe to read the firmware file once it has already been read outside of a suspend/resume situation. Add a staus flag 'initialized' to store whether si2168_init() has successfully been called. If initialization fails (e.g. due to missing firmware file), the flag is not set. Register a separate si2168_resume callback which only calls si2168_init() once the 'initialized' flag has been set and it is safe to load the firmware at resume. The first call to si2168_init() will now always happen when the device is actually used for the first time and never during resume. This avoids the unsafe firmware file reading and should also speed up resume by skipping unnecessary device initialization. Link: https://lore.kernel.org/linux-media/[email protected] [mchehab: fix several Coding Style issues] Cc: Antti Palosaari <[email protected]> Signed-off-by: Lukas Middendorf <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
- Loading branch information