summaryrefslogtreecommitdiff
path: root/drivers/i2c/busses/i2c-cp2615.c
AgeCommit message (Collapse)AuthorFilesLines
2024-07-11i2c: cp2615: reword according to newest specificationWolfram Sang1-5/+5
Change the wording of this driver wrt. the newest I2C v7 and SMBus 3.2 specifications and replace "master/slave" with more appropriate terms. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Bence Csókás <bence98@sch.bme.hu> Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2023-11-08i2c: cp2615: Fix 'assignment to __be16' warningBence Csókás1-1/+1
While the preamble field _is_ technically big-endian, its value is always 0x2A2A, which is the same in either endianness. However, to avoid generating a warning, we should still call `htons()` explicitly. Signed-off-by: Bence Csókás <bence98@sch.bme.hu> Signed-off-by: Wolfram Sang <wsa@kernel.org>
2023-09-22i2c: cp2615: replace deprecated strncpy with strscpyJustin Stitt1-1/+1
`strncpy` is deprecated for use on NUL-terminated destination strings [1]. We should prefer more robust and less ambiguous string interfaces. We expect name to be NUL-terminated based on its numerous uses with functions that expect NUL-terminated strings. For example in i2c-core-base.c +1533: | dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name); NUL-padding is not required as `adap` is already zero-alloacted with: | adap = devm_kzalloc(&usbif->dev, sizeof(struct i2c_adapter), GFP_KERNEL); With the above in mind, a suitable replacement is `strscpy` [2] due to the fact that it guarantees NUL-termination on the destination buffer without unnecessarily NUL-padding. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Signed-off-by: Justin Stitt <justinstitt@google.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
2021-06-21i2c: cp2615: check for allocation failure in cp2615_i2c_recv()Dan Carpenter1-4/+10
We need to add a check for if the kzalloc() fails. Fixes: 4a7695429ead ("i2c: cp2615: add i2c driver for Silicon Labs' CP2615 Digital Audio Bridge") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Bence Csókás <bence98@sch.bme.hu> Signed-off-by: Wolfram Sang <wsa@kernel.org>
2021-04-06i2c: cp2615: add i2c driver for Silicon Labs' CP2615 Digital Audio BridgeBence Csókás1-0/+330
Create an i2c_adapter for CP2615's I2C master interface Signed-off-by: Bence Csókás <bence98@sch.bme.hu> [wsa: switched to '__packed', added some 'static' and an include] Signed-off-by: Wolfram Sang <wsa@kernel.org>