Message ID | 59041b6d888c886edef5a97fc6e3319d235e101a.1676557968.git.matthias.schiffer@ew.tq-group.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2388:b0:96:219d:e725 with SMTP id i8csp566605dyf; Thu, 16 Feb 2023 06:40:50 -0800 (PST) X-Google-Smtp-Source: AK7set9jyZcoG8KCbJzLfDPq65gASS2IzNVYowp/GWbk2qLA57lvxUNEaS6KfwAVnnSTd4xj6P6w X-Received: by 2002:a17:906:4e4d:b0:87e:a34b:9e2b with SMTP id g13-20020a1709064e4d00b0087ea34b9e2bmr6669980ejw.28.1676558450791; Thu, 16 Feb 2023 06:40:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676558450; cv=none; d=google.com; s=arc-20160816; b=nc+/ZZvb5nv0nX6axYdpoPPW0cSTPQiyIPuzoTncF9wcvx2gg/6qla7kZzG8hMDd5v qTsz5q+t+78ORfwzT1WhzDMSMqdqs/U5lJM1WYgCJwZbCJLCQi2czjrP2d9g7YMFW5kv t6uo2/GVog0uQo+Yk6/MPRXoVG+KFFsijvzru52GcBgjaUeiopmLhSNOGD1XKTTSc0yi p6FWp5+bwRfH/i2RVhlHkRUrursGKrYpM1zw3hMQIUVY3iTgDSNrtKreHpRET/zpa1q0 A7XicrpNjLHSezYGC0ljswCShOV9K1SMempcGtjNYpfYeM7TP8yrD6kwgyhqotrGSPaK /IBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=aKKyce9a/yh1UTJ7iZWXMOgAYVhma3+YBZifpiHyfnA=; b=FFztrvNbJJzEmY0jQ4PkvSoJKwexc9mF/sPErUI5ksavFjqH1fjl80GA1O9cb/klNi RpIc47V5vf9XfNQfxXK73vd2+ku6IG4WYdS+JDE0DWslsLI4vT8PF79XmE5Bzkskoepo AI3MojEx9yQfWlF4u4iK1dBChsLs3fETt3a8uU+Rz5fpkUFfJW73MxHbwpD5pu/VSnTZ 5S9VB2UMQ4NmswxoSsNRi/Nrx2MzvatQJxKD7qjco8Ils/bgtCsFPKc3+oWyeQlbfxYi cFxL3Di47/+lHax4e0PNMBWlr9LT1BJME2j1yEkWqRZ9UpMKRBYM1CF4FPSD51EOVopE 8YQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=Rtj95y+D; dkim=pass header.i=@tq-group.com header.s=key1 header.b=Ah6d29FV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mr42-20020a17090782aa00b0087f8b529f1asi1721469ejc.611.2023.02.16.06.40.27; Thu, 16 Feb 2023 06:40:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=Rtj95y+D; dkim=pass header.i=@tq-group.com header.s=key1 header.b=Ah6d29FV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229619AbjBPOfB (ORCPT <rfc822;aimixsaka@gmail.com> + 99 others); Thu, 16 Feb 2023 09:35:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbjBPOe7 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 16 Feb 2023 09:34:59 -0500 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FC2822A2E for <linux-kernel@vger.kernel.org>; Thu, 16 Feb 2023 06:34:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1676558098; x=1708094098; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=aKKyce9a/yh1UTJ7iZWXMOgAYVhma3+YBZifpiHyfnA=; b=Rtj95y+D05bLjSPYBkskd0GL1ZB2I2gcKQodDwAUelNKmsfOJrywpsoV oqPO4s3ijW9FT7IhysLEm1lYRUURMM9S1y9BUEHRb8VCutQSHP1iFNPff cMgED1s3UMNLYRcpdrkWegPn+6KxXTsjS3980coR2VYKDPjX6FrjvMGmC SbzY43Soe1N3/ImkXMbHbX94kzJN54G3u8iRjLKTuhJ+vtqM0YyBBhPcZ 3wDqxj9oMwmsd35QKfQxCNKdAfM3Eoo5/ESlIQMT8umUTAZLfznSUpLnt aq6KxrWtKtcZcGh0XNX++iNF6Vp4fSDpYXIEpvniDR6k6i2z32tNmWqqu w==; X-IronPort-AV: E=Sophos;i="5.97,302,1669071600"; d="scan'208";a="29134872" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 16 Feb 2023 15:34:56 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Thu, 16 Feb 2023 15:34:56 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Thu, 16 Feb 2023 15:34:56 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1676558096; x=1708094096; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=aKKyce9a/yh1UTJ7iZWXMOgAYVhma3+YBZifpiHyfnA=; b=Ah6d29FVUDv7jQvKX1pmouv6mB8BN2epmA5NDa5u3ZuMMw+Yvur97XRu cMfMs1k8gW2Thvi35qeQjTFx2hWIKGgYyuOeXRJ/BVjZDorLzNVlqfvt+ TsMIPPY81EikTJUI5gqwwCc5f1Ce2qREmS3qyKT0iUfHECN2GUB11ubMO FK9WaCp4gJe7C2/HfR+E3KaNw+aGWTjAoH3Cg9r0CP3XZEDjvv4/STRQT HZ5Lpee0Xiy7Kf61n57W1wzil1CnLvlzLh3n6K/W8L58CjKG+aifmtZVO 5CbGHTw7LpvnFrleip8nCzyko3goJ0ZGoRAFhU0yqXBEYnr+cHnRSB/1Y Q==; X-IronPort-AV: E=Sophos;i="5.97,302,1669071600"; d="scan'208";a="29134871" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 16 Feb 2023 15:34:56 +0100 Received: from localhost.localdomain (SCHIFFERM-M2.tq-net.de [10.121.49.14]) by vtuxmail01.tq-net.de (Postfix) with ESMTPA id 46EBF280056; Thu, 16 Feb 2023 15:34:56 +0100 (CET) From: Matthias Schiffer <matthias.schiffer@ew.tq-group.com> To: Lee Jones <lee@kernel.org> Cc: Andrew Lunn <andrew@lunn.ch>, linux-kernel@vger.kernel.org, linux@ew.tq-group.com, Matthias Schiffer <matthias.schiffer@ew.tq-group.com> Subject: [PATCH 1/3] mfd: tqmx86: do not access I2C_DETECT register through io_base Date: Thu, 16 Feb 2023 15:34:22 +0100 Message-Id: <59041b6d888c886edef5a97fc6e3319d235e101a.1676557968.git.matthias.schiffer@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757998954154379608?= X-GMAIL-MSGID: =?utf-8?q?1757998954154379608?= |
Series |
[1/3] mfd: tqmx86: do not access I2C_DETECT register through io_base
|
|
Commit Message
Matthias Schiffer
Feb. 16, 2023, 2:34 p.m. UTC
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>
---
drivers/mfd/tqmx86.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
Comments
> - i2c_det = ioread8(io_base + TQMX86_REG_I2C_DETECT); > + i2c_det = inb(TQMX86_REG_I2C_DETECT); I think it would be good to add a comment, since it now looks out of place compared to all the other ioread8(). Andrew
diff --git a/drivers/mfd/tqmx86.c b/drivers/mfd/tqmx86.c index 7ae906ff8e353..8dcbdafa88f4f 100644 --- a/drivers/mfd/tqmx86.c +++ b/drivers/mfd/tqmx86.c @@ -49,9 +49,8 @@ #define TQMX86_REG_IO_EXT_INT_MASK 0x3 #define TQMX86_REG_IO_EXT_INT_GPIO_SHIFT 4 -#define TQMX86_REG_I2C_DETECT 0x47 +#define TQMX86_REG_I2C_DETECT 0x1a7 #define TQMX86_REG_I2C_DETECT_SOFT 0xa5 -#define TQMX86_REG_I2C_INT_EN 0x49 static uint gpio_irq; module_param(gpio_irq, uint, 0); @@ -213,7 +212,7 @@ static int tqmx86_probe(struct platform_device *pdev) "Found %s - Board ID %d, PCB Revision %d, PLD Revision %d\n", board_name, board_id, rev >> 4, rev & 0xf); - i2c_det = ioread8(io_base + TQMX86_REG_I2C_DETECT); + i2c_det = inb(TQMX86_REG_I2C_DETECT); if (gpio_irq_cfg) { io_ext_int_val =