From patchwork Thu Mar 28 16:55:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13609152 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2134.outbound.protection.outlook.com [40.107.20.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 27CDD2C182; Thu, 28 Mar 2024 16:56:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.134 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711644972; cv=fail; b=koQ2F4V4TV/WFmfCNpPl4bdurDkMcyVn37SlwhxBlXco7mGfspILUvxgt33JtGI3SKiEWtgwmE0KiK0k2vEeao4JV+PlgVFKaBjWkOqVRqNFa0FuowpbNAHQsgbBqDJinpix/pVagVJjC0Q2zWTXdx0INQZ6djhLrLgt8YoEz78= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711644972; c=relaxed/simple; bh=XGGPJvkGtURQ8RfhDgYr49n4srDFMVXXTC4u6YyVuRc=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=T61ZmF+GLPYpI+NUDUEi2dMOOgsuSlWJiuXXhuTcSg5D60PdMb49DgB8BzlB7QH+NdvNAfu0jeEXXM1TT184X8bcwiyspfzMECCG1s0brdI5qtKA1VV9TGLfyRVj7QUpPHsYaExtqpL/pl/TUOTvj5VXHHIY1M23NTbPlnDhjdQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net; spf=pass smtp.mailfrom=wolfvision.net; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b=JV8KQfRr; arc=fail smtp.client-ip=40.107.20.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wolfvision.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b="JV8KQfRr" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V1x5fJyLTjw/Rc6ICcq2BTkfsNpFeIe8H0iOYF7pspLwxvnY5x51U0SaTOr1tjrTGzYzDL39pdKuVy1H5U6XHQMtBwMK+WzfjISTgUcgfGqpUSouJ02JPNpLuHhvFOOOupc9YJBMCxG0A1FDBnTOaSwvacBqcZSwXGgqRlsDHgh14rX//JC+VPtIZ0Zx3qvyamUCrO+c203IoEzcO7tiLTd1O5LJ1hwq0BGO1hDNSvyXPPX+7c071P0Lof+FAxx1E9Oavp4wveLCWonA/1u5Fn16+UHBpDBkkFcN4aqf2J9s2mz7jA2SsqEVaKbSwtKCHrDohAyHBklMUqdvj4WLkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+4Ta3uG0TigHUQ20gIUhmMMjWyvCjkfdwjoH3P+jiGo=; b=RkeK9rVitcaZeUYWto9ooPBVrUl8ueZytxZNjTS4vW57hM2nePMSA56RCyfvZ5t/msERXwUBN6B80QEJPKn/V7A911oUYpqdNZhoPi8ljdG23kVnXkhpkd/CX95HDZedy16PVsOh7ckYnDy0Cu5w3j9m/LAkH337hKc4D6YTWJX//u8d93xbHKKP/9J6/oPajiFMNvk2LVcTQk6o5WRnZoGNlnDHMzTjL0TOF+uKqrGEQvPF0541n/BD/akIVHeymDcldtlOND6H1gkGgj2jlrOYyhw77wkFA2+VD2Wiqn3RGtbTP9niLxFqqdYAECwXZ9uCvL3MSFyZ7cNg9X82lg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+4Ta3uG0TigHUQ20gIUhmMMjWyvCjkfdwjoH3P+jiGo=; b=JV8KQfRrnSoOW3RfHd3Rp281RYVkbDXPh2pJWTjA8DT2UaHhzTFdoaoGHFNSvreDZFg6BlD0qKdT6tMuA+ohvsTUvpCt4sX0E/xlTJ2M+LuRaNdy3+KBNBsoaCoYkooivCEfChDWbMRTww0b77OtdKQqfxHs95kDUOk3exxcF90= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) by VI1PR08MB10147.eurprd08.prod.outlook.com (2603:10a6:800:1ce::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Thu, 28 Mar 2024 16:56:04 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::9e35:6de9:e4fc:843f]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::9e35:6de9:e4fc:843f%7]) with mapi id 15.20.7409.031; Thu, 28 Mar 2024 16:56:04 +0000 From: Javier Carrasco Date: Thu, 28 Mar 2024 17:55:51 +0100 Subject: [PATCH RESEND 1/2] usb: typec: tipd: fix event checking for tps25750 Message-Id: <20240328-tps6598x_fix_event_handling-v1-1-502721ff705b@wolfvision.net> References: <20240328-tps6598x_fix_event_handling-v1-0-502721ff705b@wolfvision.net> In-Reply-To: <20240328-tps6598x_fix_event_handling-v1-0-502721ff705b@wolfvision.net> To: Heikki Krogerus , Greg Kroah-Hartman , Abdel Alkuor Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco , stable@vger.kernel.org X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1711644963; l=1960; i=javier.carrasco@wolfvision.net; s=20240320; h=from:subject:message-id; bh=XGGPJvkGtURQ8RfhDgYr49n4srDFMVXXTC4u6YyVuRc=; b=+eUBHuwmL5I35/9Lj6MQ01Rr1KdtMX2ppSimTf/3ZNgqT3vuCSZHwKuH305lbB9+ImJyygo8x iFDAwmC0lXdBwMuxAZOSf5KLOnQX6KhqA249mhXEO43cscfAyY2u1OD X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=Vxk2/0sGIxM8rsKnceszFuSuHVfQwa1Yo8+is7BX2nY= X-ClientProxiedBy: VI1PR07CA0136.eurprd07.prod.outlook.com (2603:10a6:802:16::23) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|VI1PR08MB10147:EE_ X-MS-Office365-Filtering-Correlation-Id: 82f2cf5d-bec6-4c60-d142-08dc4f47f447 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sFx+N7C7PB99KO/Qn1bqd34ZLnqwnS590xBFpxh3biymQ/1WoOHiDJ+T3Kf3xrSqsTH/9P7NWMB7gAmslkN+jRHdp69L8csh+soyEvam9RgihYrXv/rFKRYv4mCTiyxBMvDMwW8C2e+Bv2QwbTb3hvNWWTehMVv/4LQyuntbIT9VUMR4oX82vr1W7TFjZzWLJYpGPusFBb/cNARrWZtslO8IQOHZeeQxAemlTtUAnpaZGVirgmF23sKMXrnacvLIDokPELoZaF9T9Mw9bdswi1vDvELycpXNni66g3bod9fcgUl3d2AA41GhR0w9duu4P/zQek19WZBWceqGB/ZeBW2/8Cfa056lEm9kH6n7BQ7mZU6lx+5eGA54K1pIg+C6I8RZt2GY0Q7Mhbj2zlstct8zbBL08HlohGQssIwP3SFmD/a7Vm2AV6jG1/r2Z3vLnCtEX5c6scLbYl0ZMZyi+AQeHo53+kh6X89MyCWa+fzcsjXLsaIxcFjBOHRIyEhMF/lqgZsUYgtpTZih5MvzlMrDBlMrOQYWXQJdhA2yD+irYTEzMMRJG8wJ903+5KP8Pa9CHuhm3EO3gmNFK8HZ4uwHSgjmjGpw144lFUdbahVW1Eff2hWc+D5o9uHdd6x1AUNAVDBHWmOrXyWlmr9YUtCCUhQ/F4KglB68t8qXZx2xY4f8V3g2jsj1nWezX3DDeM0kKSX6pqFTjYAgeVRxF7eUDhw472usU9TK1gzBlLM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR08MB4974.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(376005)(1800799015)(52116005)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?LW0zJh7DGc+Tpc9PW8xN4+rvJS6H?= =?utf-8?q?iiHKjD+T/2kkHEwv43b3AliT57YIocE6+8LZdrFj9qA0wc4m533J1RQ5pctuONvrg?= =?utf-8?q?WyCA+08fSEWs3PYQZC+s/WkHtIBNtEP/JXZW4sUp9uDBlOS4+tfNuJaPnkRtQ+hwf?= =?utf-8?q?sOyuFZpjQvzlsH0o7UqYTjbOLzCW57c9Zj/SmNuqMVmWJUaBEuDc1j5wnVBWw/25s?= =?utf-8?q?xEsjpZcpx5r04AcyFb3IGbS3j7/biuCKqNWy8o0Qp7+brn8ujwKF5BT6sk1Tk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f-8?q?GS7XsqSkaufDxV3q4rzs8qF+/HgklyXdi+DTZEoQRq3FBXB1PZhhRXcuWGSaG1/Z6?= =?utf-8?q?nJfQQ2kziffZOwc5faCgt3kncZhOnk5iwpNRFD/sUAP7baE3ePGlGbktbWb379T0F?= =?utf-8?q?yQylPH0BpSXHs3uHe/XkAe1HXXPHwwTIVjXi7AMxVsgylBNrQj2bcXtyYF6vqjrnM?= =?utf-8?q?CrfkP/eSA95NGtotLg8cTqd5gxezktRNOcSLCCMm+ENTnPuwaSwI+ekaywNyy7Xzm?= =?utf-8?q?t7ICcbqqmUS/EqSmlJF6lOMjshicHdWLP3ORJJON8Lng8d8qD5tKmVQmOnPDPkWR3?= =?utf-8?q?Uc5mQBIbV7J8jLg8VHLCCV+33vEvLFegqGDIPEya+8km+08ct6D/eLLF4PCxjNotd?= =?utf-8?q?l2o3EBzr3SMl2P8pgYUIGnQcnJ1jYw+GBk1GWHuUquqB7bqny854Mws=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: 82f2cf5d-bec6-4c60-d142-08dc4f47f447 X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2024 16:56:04.0384 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NpWLwWMp3mmjR96wLR0zIZaBrOqcM4w9sV3QBF4gpUryhZIwPO5RTCNVZwtXzYRij5JzmNIMwdd93hVOsEt+2yvmikNaKxhrhag5yuTgJM0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB10147 In its current form, the interrupt service routine of the tps25750 checks the event flags in the lowest 64 bits of the interrupt event register (event[0]), but also in the upper part (event[1]). Given that all flags are defined as BIT() or BIT_ULL(), they are restricted to the first 64 bits of the INT_EVENT1 register. Including the upper part of the register can lead to false positives e.g. if the event 64 bits above the one being checked is set, but the one being checked is not. Restrict the flag checking to the first 64 bits of the INT_EVENT1 register. Fixes: 7e7a3c815d22 ("USB: typec: tps6598x: Add TPS25750 support") Cc: stable@vger.kernel.org Signed-off-by: Javier Carrasco Acked-by: Heikki Krogerus --- drivers/usb/typec/tipd/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index 0717cfcd9f8c..7c2f01344860 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -604,11 +604,11 @@ static irqreturn_t tps25750_interrupt(int irq, void *data) if (!tps6598x_read_status(tps, &status)) goto err_clear_ints; - if ((event[0] | event[1]) & TPS_REG_INT_POWER_STATUS_UPDATE) + if (event[0] & TPS_REG_INT_POWER_STATUS_UPDATE) if (!tps6598x_read_power_status(tps)) goto err_clear_ints; - if ((event[0] | event[1]) & TPS_REG_INT_DATA_STATUS_UPDATE) + if (event[0] & TPS_REG_INT_DATA_STATUS_UPDATE) if (!tps6598x_read_data_status(tps)) goto err_clear_ints; @@ -617,7 +617,7 @@ static irqreturn_t tps25750_interrupt(int irq, void *data) * a plug event. Therefore, we need to check * for pr/dr status change to set TypeC dr/pr accordingly. */ - if ((event[0] | event[1]) & TPS_REG_INT_PLUG_EVENT || + if (event[0] & TPS_REG_INT_PLUG_EVENT || tps6598x_has_role_changed(tps, status)) tps6598x_handle_plug_event(tps, status);