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

media: ir-kbd-i2c: convert to i2c_new_dummy_device()

Convert this driver to use the new i2c_new_dummy_device() call and bail
out if the dummy device cannot be registered to make failure more
visible to the user.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

authored by

Wolfram Sang and committed by
Mauro Carvalho Chehab
1b09a2af 92ffdb61

+6 -5
+6 -5
drivers/media/i2c/ir-kbd-i2c.c
··· 885 885 INIT_DELAYED_WORK(&ir->work, ir_work); 886 886 887 887 if (probe_tx) { 888 - ir->tx_c = i2c_new_dummy(client->adapter, 0x70); 889 - if (!ir->tx_c) { 888 + ir->tx_c = i2c_new_dummy_device(client->adapter, 0x70); 889 + if (IS_ERR(ir->tx_c)) { 890 890 dev_err(&client->dev, "failed to setup tx i2c address"); 891 + err = PTR_ERR(ir->tx_c); 892 + goto err_out_free; 891 893 } else if (!zilog_init(ir)) { 892 894 ir->carrier = 38000; 893 895 ir->duty_cycle = 40; ··· 906 904 return 0; 907 905 908 906 err_out_free: 909 - if (ir->tx_c) 907 + if (!IS_ERR(ir->tx_c)) 910 908 i2c_unregister_device(ir->tx_c); 911 909 912 910 /* Only frees rc if it were allocated internally */ ··· 920 918 921 919 cancel_delayed_work_sync(&ir->work); 922 920 923 - if (ir->tx_c) 924 - i2c_unregister_device(ir->tx_c); 921 + i2c_unregister_device(ir->tx_c); 925 922 926 923 rc_unregister_device(ir->rc); 927 924