linux/drivers/media
Michael Bunk 0e148a522b media: dw2102: Don't translate i2c read into write
The code ignored the I2C_M_RD flag on I2C messages.  Instead it assumed
an i2c transaction with a single message must be a write operation and a
transaction with two messages would be a read operation.

Though this works for the driver code, it leads to problems once the i2c
device is exposed to code not knowing this convention.  For example,
I did "insmod i2c-dev" and issued read requests from userspace, which
were translated into write requests and destroyed the EEPROM of my
device.

So, just check and respect the I2C_M_READ flag, which indicates a read
when set on a message.  If it is absent, it is a write message.

Incidentally, changing from the case statement to a while loop allows
the code to lift the limitation to two i2c messages per transaction.

There are 4 more *_i2c_transfer functions affected by the same behaviour
and limitation that should be fixed in the same way.

Link: https://lore.kernel.org/linux-media/20220116112238.74171-2-micha@freedict.org
Signed-off-by: Michael Bunk <micha@freedict.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-04-29 09:21:50 +01:00
..
cec media: cec: return -ENODEV instead of -ENXIO if unregistered 2024-04-24 13:49:55 +02:00
common media: videobuf2: improve max_num_buffers sanity checks 2024-04-24 13:49:55 +02:00
dvb-core media: dvbdev: Initialize sbuf 2024-04-08 13:48:19 +02:00
dvb-frontends media: m88ds3103: Fix lock led support 2024-04-29 09:19:55 +01:00
firewire media: firewire: firedtv-avc.c: replace BUG with proper, error return 2023-08-10 07:58:37 +02:00
i2c media: i2c: max9271: Add header include guards to max9271.h 2024-04-29 09:17:52 +01:00
mc media: mc: mark the media devnode as registered from the, start 2024-04-22 11:41:04 +02:00
mmc media: mmc: siano: simplify module initialization 2024-04-08 13:48:19 +02:00
pci media: ttpci: coding style fixes: logging 2024-04-16 00:02:53 +02:00
platform media: mediatek: vcodec: fix possible unbalanced PM counter 2024-04-27 10:04:30 +02:00
radio media: radio-shark2: Avoid led_names truncations 2024-04-08 13:48:19 +02:00
rc media: imon: Convert sprintf/snprintf to sysfs_emit 2024-03-25 10:13:44 +01:00
spi media: cxd2880: Replaze kmalloc with kzalloc 2024-04-15 13:42:38 +02:00
test-drivers media: v4l2: Add mem2mem helpers for REMOVE_BUFS ioctl 2024-03-25 12:00:44 +01:00
tuners media: tunner: xc5000: Refactor firmware load 2024-04-15 13:42:38 +02:00
usb media: dw2102: Don't translate i2c read into write 2024-04-29 09:21:50 +01:00
v4l2-core media: v4l: async: Set owner for async sub-devices 2024-04-26 11:31:19 +01:00
Kconfig media: Kconfig: Make DVB_CORE=m possible when MEDIA_SUPPORT=y 2022-12-07 17:58:46 +01:00
Makefile