[PATCH v2 0/3] drm: fix i2c adapter device driver user counter

Vladimir Zapolskiy vladimir_zapolskiy at mentor.com
Tue Sep 22 14:46:37 PDT 2015


of_find_i2c_adapter_by_node() call requires quite often missing
put_device(), and i2c_put_adapter() releases a device locked by
i2c_get_adapter() only.

Below is a common error reproduction scenario as a result of the
misusage described above (this is run on iMX6 platform with
HDMI and I2C bus drivers compiled as kernel modules for clearness):

    root at mx6q:~# lsmod | grep i2c
    i2c_imx                15348  0
    root at mx6q:~# lsmod | grep dw_hdmi_imx
    dw_hdmi_imx             3567  0
    dw_hdmi                15850  1 dw_hdmi_imx
    imxdrm                  8610  3 dw_hdmi_imx,imx_ipuv3_crtc,imx_ldb
    root at mx6q:~# rmmod dw_hdmi_imx
    root at mx6q:~# lsmod | grep i2c
    i2c_imx                15348  -1

                                 ^^^^^

    root at mx6q:~# rmmod i2c_imx
    rmmod: ERROR: Module i2c_imx is in use

To fix existing users of these interfaces use of_get_i2c_adapter_by_node()
interface, which is similar to i2c_get_adapter() in sense that an I2C bus
device driver found and locked by a user can be correctly unlocked by
i2c_put_adapter() call.

Changes from v1 to v2:
- none, this series is a straightforward bugfix, v1 was a blend of
  I2C core changes, bugfixes and improvements

The change is based on dri/drm-next.

Vladimir Zapolskiy (3):
  drm: dw_hdmi: use of_get_i2c_adapter_by_node interface
  drm: tilcdc: use of_get_i2c_adapter_by_node interface
  drm: tegra: use of_get_i2c_adapter_by_node interface

 drivers/gpu/drm/bridge/dw_hdmi.c       | 14 +++++++++-----
 drivers/gpu/drm/tegra/output.c         | 23 ++++++++++++-----------
 drivers/gpu/drm/tilcdc/tilcdc_tfp410.c |  6 ++----
 3 files changed, 23 insertions(+), 20 deletions(-)

-- 
2.5.0



More information about the dri-devel mailing list