Commit c3af31c5 authored by Mathis MARION's avatar Mathis MARION Committed by Federico Vaga

Kernel 5.8 compatibility for i2c_new_device

The function `i2c_new_device` disappeared in kernel 5.8.
It is now required to use `i2c_new_client_device`.
Error check now requires using `IS_ERR` instead of just cheking for NULL.
Signed-off-by: 's avatarGwenhael GOAVEC <gwenhael.goavec@femto-st.fr>
Signed-off-by: 's avatarMathis MARION <mathis.marion@grenoble-inp.org>
parent 576432cd
......@@ -113,8 +113,13 @@ static int __fmc_slot_eeprom_add(struct fmc_slot *slot,
}
info_l.addr = fmc_slot_i2c_address(info_l.addr, slot->ga);
#if KERNEL_VERSION(5, 8, 0) <= LINUX_VERSION_CODE
slot->eeprom = i2c_new_client_device(slot->adapter, &info_l);
if (IS_ERR(slot->eeprom))
#else
slot->eeprom = i2c_new_device(slot->adapter, &info_l);
if (!slot->eeprom)
#endif
return -ENODEV;
err = sysfs_create_link(&slot->dev.kobj, &slot->eeprom->dev.kobj,
......
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