Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 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>

authored by

Wolfram Sang and committed by
Wolfram Sang
bb7d93ff f78d4032

+2 -8
+2 -8
drivers/gpu/drm/drm_encoder_slave.c
··· 61 61 62 62 request_module("%s%s", I2C_MODULE_PREFIX, info->type); 63 63 64 - client = i2c_new_device(adap, info); 65 - if (!client) { 66 - err = -ENOMEM; 67 - goto fail; 68 - } 69 - 70 - if (!client->dev.driver) { 64 + client = i2c_new_client_device(adap, info); 65 + if (!i2c_client_has_driver(client)) { 71 66 err = -ENODEV; 72 67 goto fail_unregister; 73 68 } ··· 91 96 module_put(module); 92 97 fail_unregister: 93 98 i2c_unregister_device(client); 94 - fail: 95 99 return err; 96 100 } 97 101 EXPORT_SYMBOL(drm_i2c_encoder_init);