Skip to content

Commit

Permalink
drm: encoder_slave: use new I2C API
Browse files Browse the repository at this point in the history
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: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
  • Loading branch information
Wolfram Sang authored and Wolfram Sang committed Jun 19, 2020
1 parent f78d403 commit bb7d93f
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions drivers/gpu/drm/drm_encoder_slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,8 @@ int drm_i2c_encoder_init(struct drm_device *dev,

request_module("%s%s", I2C_MODULE_PREFIX, info->type);

client = i2c_new_device(adap, info);
if (!client) {
err = -ENOMEM;
goto fail;
}

if (!client->dev.driver) {
client = i2c_new_client_device(adap, info);
if (!i2c_client_has_driver(client)) {
err = -ENODEV;
goto fail_unregister;
}
Expand Down Expand Up @@ -96,7 +91,6 @@ int drm_i2c_encoder_init(struct drm_device *dev,
module_put(module);
fail_unregister:
i2c_unregister_device(client);
fail:
return err;
}
EXPORT_SYMBOL(drm_i2c_encoder_init);
Expand Down

0 comments on commit bb7d93f

Please sign in to comment.