• Dmitry Torokhov's avatar
    i2c: ensure timely release of driver-allocated resources · 5b547582
    Dmitry Torokhov authored
    More and more drivers rely on devres to manage their resources, however
    if bus' probe() and release() methods are not trivial and control some
    of resources as well (for example enable or disable clocks, or attach
    device to a power domain), we need to make sure that driver-allocated
    resources are released immediately after driver's remove() method
    returns, and not postponed until driver core gets around to releasing
    resources. To fix that we open a new devres group before calling
    driver's probe() and explicitly release it when we return from driver's
    remove().
    Tested-by: default avatarJeff LaBundy <jeff@labundy.com>
    Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
    5b547582
i2c-core-base.c 68.3 KB