mfd: tqmx86: Do not access I2C_DETECT register through io_base
authorMatthias Schiffer <matthias.schiffer@ew.tq-group.com>
Mon, 20 Feb 2023 11:25:44 +0000 (12:25 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:03:37 +0000 (23:03 +0900)
commit8c989fa9e82f7a4dead49751b0ce88b0d56042d8
treeeeb54e2b0958100e53a52ae10dcb918fbec71fba
parentb3b3f66bd47cb6fcee710bb24bdffbf5e7c727c2
mfd: tqmx86: Do not access I2C_DETECT register through io_base

[ Upstream commit 1be1b23696b3d4b0231c694f5e0767b4471d33a9 ]

The I2C_DETECT register is at IO port 0x1a7, which is outside the range
passed to devm_ioport_map() for io_base, and was only working because
there aren't actually any bounds checks for IO port accesses.

Extending the range does not seem like a good solution here, as it would
then conflict with the IO resource assigned to the I2C controller. As
this is just a one-off access during probe, use a simple inb() instead.

While we're at it, drop the unused define TQMX86_REG_I2C_INT_EN.

Fixes: 2f17dd34ffed ("mfd: tqmx86: IO controller with I2C, Wachdog and GPIO")
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/e8300a30f0791afb67d79db8089fb6004855f378.1676892223.git.matthias.schiffer@ew.tq-group.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mfd/tqmx86.c