Commit bb7d93ff authored by Wolfram Sang's avatar Wolfram Sang Committed by Wolfram Sang

drm: encoder_slave: use new I2C API

i2c_new_client() is deprecated, use the replacement
i2c_new_client_device(). Also, we have a helper to check if a driver is
bound. Use it to simplify the code. Note that this changes the errno for
a failed device creation from ENOMEM to ENODEV. No callers currently
interpret this errno, though, so we use this condensed error check.
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: default avatarEmil Velikov <emil.l.velikov@gmail.com>
Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent f78d4032
...@@ -61,13 +61,8 @@ int drm_i2c_encoder_init(struct drm_device *dev, ...@@ -61,13 +61,8 @@ int drm_i2c_encoder_init(struct drm_device *dev,
request_module("%s%s", I2C_MODULE_PREFIX, info->type); request_module("%s%s", I2C_MODULE_PREFIX, info->type);
client = i2c_new_device(adap, info); client = i2c_new_client_device(adap, info);
if (!client) { if (!i2c_client_has_driver(client)) {
err = -ENOMEM;
goto fail;
}
if (!client->dev.driver) {
err = -ENODEV; err = -ENODEV;
goto fail_unregister; goto fail_unregister;
} }
...@@ -96,7 +91,6 @@ int drm_i2c_encoder_init(struct drm_device *dev, ...@@ -96,7 +91,6 @@ int drm_i2c_encoder_init(struct drm_device *dev,
module_put(module); module_put(module);
fail_unregister: fail_unregister:
i2c_unregister_device(client); i2c_unregister_device(client);
fail:
return err; return err;
} }
EXPORT_SYMBOL(drm_i2c_encoder_init); EXPORT_SYMBOL(drm_i2c_encoder_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment