From patchwork Sat Feb 10 21:51:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Zaidman X-Patchwork-Id: 199299 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1667552dyd; Sat, 10 Feb 2024 13:53:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IGcdpOzZdPRbtHec8MxRF75VFVV+nB4oRjXtog4FRPc4qyvDbGlnKoNzi1Zil+J2sjsz/Zh X-Received: by 2002:a0c:f2ca:0:b0:68c:e3b9:967c with SMTP id c10-20020a0cf2ca000000b0068ce3b9967cmr2871878qvm.9.1707601995172; Sat, 10 Feb 2024 13:53:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707601995; cv=pass; d=google.com; s=arc-20160816; b=WkMwvm8Ljf4aFxbz2Nwosmvf7N8LtYZ8zYtn5tCLS++PnTA98X9KcibBkpuwFi94cY GOLjvVuwhS0wdImrH7K0oZT/RtR/JkdXgrP4j69DbCwNnesCu5e9fwU+B3txh6M0YgOt I2sKYbeWwZ+9IvyK5gF8PwwQrfL686u9OAZw9nmi4+N9+c1+xcYPh5AqRsMTyih+t61Y hRbNBqg2HKnDh4y4e8BPz96AANoPRKctBldjai1hayrpyoQ1QJ8os604QMHhKmxUxous sPUhOSJGNf1O6392F30HMqHQjIPvrR6z6HM1CJ15TzlV25Usp92OvbJBB2vHOGmzKbw2 3YgQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=5bVIdnxLoNAiGQ5a+gFJnwc3L5NJOVMhNajT8rAnKq8=; fh=9TN8j8IM7ELdhJ34548r73m/EqTZJaB9QuVx5urXy5g=; b=vElkmmO17nReWd8+fJCDBlb/fr8YBgiNOTyIQ9IOrxZv/nEnMtqiUdVkxgE4LqSF5B ZDLq0NtszE13yjDo90ZQJ76xqboZG+TMds+/jifFEt6qlXdNTReL+J/YAolEot2ZXAPp jb2/nU6PczQFW4itOs3wqjf9x6DoXut9G9NbhnSqAShscxAnv8JuwfNz4EPjl8bUaOHr LCiK2ahfsZ83BPeZu0GoaG5zk2ykBBUVDOSo9lsROCgJMaOyhM+y1mkHpJcBoeCITZdy tO07/1uxZz5pwiCZBnubqCOwTZ1K8Rp3Bi7Rzkx/JUilUjNvHF//FnZpqd/3zCE6jBkv kczw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QsqB+9Oi; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60548-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60548-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCVrgRuUzRoh21T2mw6QpzJ9fR+aoPzhwNF4WafE2NT1A+jM/CvSNP1X19qfkrYfy1WNsXGvujRHLg0VJiCL5xJXhTlrsA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id e4-20020a0562140d8400b0068c88fe1959si5107740qve.537.2024.02.10.13.53.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:53:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60548-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QsqB+9Oi; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60548-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60548-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 976591C21E45 for ; Sat, 10 Feb 2024 21:53:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 361E65FF0E; Sat, 10 Feb 2024 21:52:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QsqB+9Oi" Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC2505C022; Sat, 10 Feb 2024 21:52:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707601964; cv=none; b=bXjcQvBYYbFQzYHHR+SUCFFWxarzfQWeo+/oOgydy9sOp04TiyR8hkdonYTqxvzgv1bzYEl0izkw1fLF5sOHNszCN6FNlQkJL+MUkWIdVhlvxFV0Ja3FwNzVB8UcdeJhBetl4fzU6CbHGN+9K/j+QcwwQU9/6iGZIhz1SqK+NU0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707601964; c=relaxed/simple; bh=In6AjzUhpjR1wsN2+PVjNyG0mJE7eCf5Z00CO0JRxII=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=Wweh74nH8EGF6Yrh++gR1xWz7jKqDsjjJOz0qKwCz23TR7pgpalkQFbOFx0hFo5FPXKa/EGCQRr/FQDJFhbrktjjb+3IQpCBN6s/c0mwfN/GaeGnyx/lawTEShzF0vOO/i2RsvOm2DAmk7BK2/ylCNmhRxuDkGfIs9+F6Msv1U0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QsqB+9Oi; arc=none smtp.client-ip=209.85.167.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-5112bd13a4fso3307012e87.0; Sat, 10 Feb 2024 13:52:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707601961; x=1708206761; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5bVIdnxLoNAiGQ5a+gFJnwc3L5NJOVMhNajT8rAnKq8=; b=QsqB+9Oinb533P77nIIzRpXFmjCEc6hlFgal+J6xVCCfUse5W1NOg8dIJpMvVM8zit VKBuF9LtRB4LfG2X4RZnVTJNoPgYeL8tjcaK93Pr+xfaZiG/GKTP0KLRJamY3bW7syfy E102SApxg7+h7q9HA4RZzk/qR18HiMrhb2rg7J6tT7NXhGMa1NKUND9AeTxeEHIwWsma jnCh5Ez24ts6E8ivsGgB1pWc0YF9dGRJ8qmamQGRU4J6AdNWlf4LrIiPrlALDrX8RSWO /BGgI57NMFencl9slV/Q9tNVIfTC/tymrCE8+LlLGDHfOGnaHjfY0dsTTAl6UAjuoMUo x33w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707601961; x=1708206761; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5bVIdnxLoNAiGQ5a+gFJnwc3L5NJOVMhNajT8rAnKq8=; b=lZzAQMB6MRtC5E4vW/WCEMzuiMgqRxBBS2wwsGNaewwZ4vTicg72gQ9qzNOOyBGd4p jOxKSRhipw7mTHLu+wrjOWPghM0EDSBnj6KgfGkpmGVbPTraf1+d7UeT5VF6Sv2jnZvs 2NIliQlUtU7xC0Fd2L7/wH+b9sQPDQjK8Ir6yIV+a2+/IBc3WfEHoFnNCUTVf3bWx1gT 7r7ncz0TnfOuDva6GEv2WvWhXMO27hskXbBzqsgzzkdEwYzQvP3kJsJeZpiQu9t8EHhj WZOfFhGmQ6wOXChAsWqBuXmMQv+9lJ33B2/xBDHK0AHTrlNC2Yvpf5v1NtIYiurAt1XB gaKA== X-Gm-Message-State: AOJu0Yz88hFol1H76MBSPbEeuWjoxurcZwOyWwOWvBiMM3Pq7RPVid1t iYmMGfVMNKAiZBHjjt/6diUAaXSiR0p0x+hKl+7EbIXgW6rVDfUw X-Received: by 2002:a05:6512:3e28:b0:511:737d:661a with SMTP id i40-20020a0565123e2800b00511737d661amr1911687lfv.28.1707601960449; Sat, 10 Feb 2024 13:52:40 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVy15nubP7lErYdPg9hq3DaopTIunsgke2MGdUAKi4yNlfd/emmlZSYH/N99ZLcsLUqZioozu50SjpstyYCfvQy1p08FE9CRNR1SE3RmD/WDbFyzrst9Hci615G2EMsqvtVeGRsPAlRoT5RpInYdmA+FCx+7/69UdV2Xu94EOG8iBVyStLt57cFs/wq2k2jE98FnesnwWCSzIaLDCh/7S6asUkQ9lbm7mHjptJugf1fvmGpnkEo+4aChq/13Mz7eHvQb1qgP7K2SHCZ2HFDI/mMt5iGfWdJ9XNEMT6G27q+dtpaZca8AYl8VLSAzPQYlIhrQ6+IqUx6kbIVotgh3nR8kgCowTkJ/Gj7RjQy0gBY+4e0EsmgiQ== Received: from m2.. (89-139-223-180.bb.netvision.net.il. [89.139.223.180]) by smtp.googlemail.com with ESMTPSA id a7-20020a19ca07000000b0051189b53f93sm24005lfg.302.2024.02.10.13.52.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:52:40 -0800 (PST) From: Michael Zaidman To: chrysh@christina-quast.de, daniel.beer@igorinstitute.com, jikos@kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-serial@vger.kernel.org, ilpo.jarvinen@linux.intel.com, johan@kernel.org, gregkh@linuxfoundation.org, equinox@diac24.net, michael.zaidman@gmail.com Subject: [PATCH v1 01/19] hid-ft260: fix incompatible-pointer-types error Date: Sat, 10 Feb 2024 23:51:29 +0200 Message-Id: <20240210215147.77629-2-michael.zaidman@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240210215147.77629-1-michael.zaidman@gmail.com> References: <20240210215147.77629-1-michael.zaidman@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790550469398601954 X-GMAIL-MSGID: 1790550469398601954 Fixed compilation error introduced by "hid-ft260: Add serial driver" patch https://lore.kernel.org/all/20231218093153.192268-1-contact@christina-quast.de/ You are using: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0 CC [M] /home/michael/sw/hid-ft260/hid-ft260.o /home/michael/sw/hid-ft260/hid-ft260.c:1426:35: error: initialization of ‘int (*)(struct tty_struct *, const unsigned char *, int)’ from incompatible pointer type ‘ssize_t (*)(struct tty_struct *, const unsigned char *, size_t)’ {aka ‘long int (*)(struct tty_struct *, const unsigned char *, long unsigned int)’} [-Werror=incompatible-pointer-types] 1426 | .write = ft260_uart_write, | ^~~~~~~~~~~~~~~~ /home/michael/sw/hid-ft260/hid-ft260.c:1426:35: note: (near initialization for ‘ft260_uart_ops.write’) cc1: some warnings being treated as errors make[3]: *** [scripts/Makefile.build:251: /home/michael/sw/hid-ft260/hid-ft260.o] Error 1 make[2]: *** [/usr/src/linux-headers-6.5.0-14-generic/Makefile:2037: /home/michael/sw/hid-ft260] Error 2 make[1]: *** [Makefile:234: __sub-make] Error 2 Signed-off-by: Michael Zaidman --- drivers/hid/hid-ft260.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index cc2cce3698e3..7273d401337a 100644 --- a/drivers/hid/hid-ft260.c +++ b/drivers/hid/hid-ft260.c @@ -1220,8 +1220,8 @@ static int ft260_uart_receive_chars(struct ft260_device *port, return ret; } -static ssize_t ft260_uart_write(struct tty_struct *tty, const unsigned char *buf, - size_t count) +static int ft260_uart_write(struct tty_struct *tty, const unsigned char *buf, + int count) { struct ft260_device *port = tty->driver_data; struct hid_device *hdev = port->hdev; From patchwork Sat Feb 10 21:51:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Zaidman X-Patchwork-Id: 199300 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1667673dyd; Sat, 10 Feb 2024 13:53:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUP1yhzEoOpMGOx1lBKmDvRsAMlAuUuTp8fsXl/xg9/ku/a0qQyCij0HS93hgkYv+LHvFERboiMHVv3cO4DJtz0bDYnzg== X-Google-Smtp-Source: AGHT+IHw/u/g/E9WWo2BvEynxZEibkrjDoO2C/iHlsY8WOJ63L4E4mUqoAErsppdpnX1Ey5THJ0z X-Received: by 2002:a05:6808:3997:b0:3bf:ebb9:cc6c with SMTP id gq23-20020a056808399700b003bfebb9cc6cmr5220927oib.30.1707602031521; Sat, 10 Feb 2024 13:53:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707602031; cv=pass; d=google.com; s=arc-20160816; b=UY2ozfDLpH4G70hGoJRXcieWzs/YdahYu3YwNFvIR9O+GnUufuOBU2FX1KIBp/eFMC eJpa9722la9xOQSlRX91Sum/GzIaOb3Gh4UNTCOQ0OgVHHsz5bv3Aqh8BrSJ2acUFpmZ rrbFcrSWwI1EbsZaI16EaCeubnf/qeCTdV/ElGitSuSH2V/8u7SsRRNRACwTTGpdv/Dy 5YYGBUfHT5gF+yTsXxvxeMazI/jFjnZzuBjqgKEWs3FJpGGD5GtUkb7NtD5UbEw1NasH DDSvFZTygqkLIpBPXcezcwPM1wHsUE5IDA7aAPUVAH+lerk3VK5KfTPxlmQ1U5nzM2f6 O6kA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=bVxhkjh/5tBWW60EFdNQVc5luLCi3ZBwXFOGT84jAw0=; fh=EqlA/V4hFYCFCXG8AnB0ZlKgYgxSWTHxCOjSaoYhA9A=; b=b4ue5WDAwbzq7wml7I2K73zJayXeNR9QhbY8yIe9NL6fcx86X7iRTv4X6w63mxeNn3 h/4txW1IobNE3F5Fvcv5cIgy/Bqqqcw6EexehL3N2Jb2CCAy3BapEEq7dyUfiKL+TGuf NF6dqWO9x/vNECccFokuLRq/lbsQRbU0wz6eskB/QqRnvrWSX2U+1p/cU+iqDwroellX DVCkYmMErABdh4ikolBj7cTdheqYiKe7EHqFp9cFFkFL+dUAzOigyHac5MqbmlTj4wyP Xf0SiT2AtNT7r8vyefhsJK4vYzU/7ZmLOg48GqFiNgEtb5aOouFFwIoEEp7RIWSU7W4R aryw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LO8PTBP8; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60550-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60550-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCXQuSZ1iKwfFRZSrMqTyNQx9lo/xXaiO4+9EVqQLq9mH3Ucgnvj57en+X2mwNplrQidcMJwnd4mPvcdIaDLq/6Z2xpQ/w== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id ll13-20020a170903090d00b001d71c8871e4si3962140plb.165.2024.02.10.13.53.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:53:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60550-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LO8PTBP8; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60550-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60550-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2B120285BCB for ; Sat, 10 Feb 2024 21:53:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD0F960265; Sat, 10 Feb 2024 21:53:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LO8PTBP8" Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45F4E5FF1A; Sat, 10 Feb 2024 21:52:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707601977; cv=none; b=rWJaiNF+QYCAgPSWQrulBS+sobr1CJ49ExCiIc5tyFLLHjbf8MO7764oJGDn61R2PVSHq6ODNh5KKN9qsZPxDCE+f/Axy3CioiZnzONe+ispzMN0GSimaIrFP7l1U/ntN+3T3SPAe46umFozmcoSonAGIdCO6cWk4q3wGfEcq/U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707601977; c=relaxed/simple; bh=tYkc4h4Bp8NHCaXbI+vtqrPfsBIKoN0wVgseUk6XCjo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=G7uPQUXcWR0ubs2YrIwvpWhe51myKAZzsZ+ZgLtfsKoCl/JTWiZ29w+HHk7Ecwh4HCkHiUwj6zS1Vti2ghGIKDP4DMAb65t+czJSRXE/+y5eoUK8+fi5vC5HnGBgPeoZGx/Aw5lTd43HHSEPuritE2l2isw4JNljT77T4ZduIyA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LO8PTBP8; arc=none smtp.client-ip=209.85.167.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-51182f8590bso697806e87.0; Sat, 10 Feb 2024 13:52:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707601974; x=1708206774; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bVxhkjh/5tBWW60EFdNQVc5luLCi3ZBwXFOGT84jAw0=; b=LO8PTBP8YMAc2ZhLCB4w6V9aMGRFP2TG4Arl3XHo4vrcA7FMeYHD/UOvxBqFW/GxrI xUEAGBd/gUxK7uPcyyGu2vZN0h7RS+bLEQHo+vuHgyfdyRwL7SaxpLbeAGGUpiSrJ2JO cSFeYdXLX8aTfrvTw1EC0tqUkfYE7aEz66mAnMIdBk2k30oiaHiPWOlOPM2CdTS7TGmN e4YWXxDJA6X0SBExx6TDSuCedCJie7d3C3GwpEulZghCM8K84CbGud+6OayzkvXK+qIx VaHRwV+ZR6W62k8skKf0TJeqOoGeFYc0//59TKN8nUuldlf14STCHlhyFnhUAnPKu8Ej tafg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707601974; x=1708206774; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bVxhkjh/5tBWW60EFdNQVc5luLCi3ZBwXFOGT84jAw0=; b=jV9e8TYxiMFHRvmXq6C5piq0o/p/eNJmKROY6R3AoLP0oIXT1WRssI22Qm4P2Pjizn vALlKgy+N6dkdfsprmNBH7SiPgRpatitG8hxqjI1g0KE3VoGgJSZRm/lYDAvklq4ofu5 zSbSd/nixulDG8Q8S2RF8dIyugP8qg7VW1oXLO7//8bdxWquNvGDlLj0+Q/VQGCp0YAs M/yJo45lLvOGtc8hX3D4fZSja71c0BtwyeXOnaBG8CH4hCFMWxNn0Rt+v06rsM77GaIR lKuEhfQgja2VcE4Xzn4Me3DwddshO+0S14GIidoLM8ZXgwBmv1kmBFWxEGwVhFXo4WVe PyVw== X-Forwarded-Encrypted: i=1; AJvYcCUNvPgg9HQf/8poLPcYEeiGn+3k5UgzY4bZk0R7q+4Sn62zacMtregszEl1YVuZIsZsFzFSA1P24FHuMqA1q1L2kukvlxYXtD9MAGQW9FmK/BEcrDa0A5DbWG+Gc1JwtANu8yVfCxI0LIg= X-Gm-Message-State: AOJu0YzfD2L/DVow3czyejMN/XZPV7xhA3pNcLBUV41SdZllSUzWomWo 79yXp1WjB0djIqT9RFO/fwtkdQYZ+xmIbf2+vYXvbtdRpJtrZmmo X-Received: by 2002:ac2:4a99:0:b0:511:86a1:fbe8 with SMTP id l25-20020ac24a99000000b0051186a1fbe8mr726188lfp.1.1707601974290; Sat, 10 Feb 2024 13:52:54 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXc0/2chnx0D0t1iCvdzBQ0haZRG3cbeuWr4bTFtGRlVJhusDLPRwFnCDPIwEQLXvUVinpbCeePa50YHotJZKvrd7u3k7fsJlA4QOpPW3WL1RE1P/GKx2JFariM1jxbmQUrYCVdFCS7QPXoTKN37lzE9vAIR+L6+z+I+s20taQ/FIfiBZu4U+4NyHRtZlGPZDrOe0lHQJPI+Hi9X3hLqFKtrDXft8xyi/zvS/ILeOJxSiz2gizGwuGDYxcHzmfPnlp5PxyUrrHtZ7zO9/WVY11NC2McRyY7PD9KfOZ+jDp1TjTgeEl5gRK0LPiD2YHN+vWJnBuisr4BzG1RpEuX3riOFHOlcko6ISCDCGRumI9/EY6gpbFUtg== Received: from m2.. (89-139-223-180.bb.netvision.net.il. [89.139.223.180]) by smtp.googlemail.com with ESMTPSA id a7-20020a19ca07000000b0051189b53f93sm24005lfg.302.2024.02.10.13.52.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:52:54 -0800 (PST) From: Michael Zaidman To: chrysh@christina-quast.de, daniel.beer@igorinstitute.com, jikos@kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-serial@vger.kernel.org, ilpo.jarvinen@linux.intel.com, johan@kernel.org, gregkh@linuxfoundation.org, equinox@diac24.net, michael.zaidman@gmail.com Subject: [PATCH v1 03/19] hid-ft260: fix i2c driver regression in ft260_raw_event Date: Sat, 10 Feb 2024 23:51:31 +0200 Message-Id: <20240210215147.77629-4-michael.zaidman@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240210215147.77629-1-michael.zaidman@gmail.com> References: <20240210215147.77629-1-michael.zaidman@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790550507753670686 X-GMAIL-MSGID: 1790550507753670686 Fix i2c regression in ft260_raw_event introduced by "[PATCH v4 RESEND] hid-ft260: Add serial driver" patch: https://lore.kernel.org/all/20231218093153.192268-1-contact@christina-quast.de/ It caused wrong printout per every hid input report: [21912.237393] ft260 0003:0403:6030.000C: unhandled report 0xde [21912.247405] ft260 0003:0403:6030.000C: unhandled report 0xde [21912.249403] ft260 0003:0403:6030.000C: unhandled report 0xd1 [21912.275399] ft260 0003:0403:6030.000C: unhandled report 0xde [21912.285404] ft260 0003:0403:6030.000C: unhandled report 0xde [21912.287403] ft260 0003:0403:6030.000C: unhandled report 0xd1 [21912.315406] ft260 0003:0403:6030.000C: unhandled report 0xde [21912.326390] ft260 0003:0403:6030.000C: unhandled report 0xde [21912.327402] ft260 0003:0403:6030.000C: unhandled report 0xd1 Signed-off-by: Michael Zaidman --- drivers/hid/hid-ft260.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index a67c625c9165..a348f11600c6 100644 --- a/drivers/hid/hid-ft260.c +++ b/drivers/hid/hid-ft260.c @@ -1755,6 +1755,8 @@ static int ft260_raw_event(struct hid_device *hdev, struct hid_report *report, if (dev->read_idx == dev->read_len) complete(&dev->wait); + return 0; + } else if (xfer->length > FT260_RD_DATA_MAX) { hid_err(hdev, "Received data too long (%d)\n", xfer->length); return -EBADR; From patchwork Sat Feb 10 21:51:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Zaidman X-Patchwork-Id: 199303 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1667920dyd; Sat, 10 Feb 2024 13:55:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXn9Lft/YfvtqD1y/HfQSRA6dQOROIhvLCdIQ4B/8Spd2ChuaDUEUHsvPfKAIe+1Ir4qbIyQoiLOUn0scQ5Qw6Qk1P9oA== X-Google-Smtp-Source: AGHT+IEebB/pLuHLotfxxN1LMliCg4w8LJqcSnFmHxox+8E7F9v8L+ocruv76FEXFGWzXe0rC7d5 X-Received: by 2002:a05:6a00:b4e:b0:6e0:4717:7a0d with SMTP id p14-20020a056a000b4e00b006e047177a0dmr4457603pfo.5.1707602099892; Sat, 10 Feb 2024 13:54:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707602099; cv=pass; d=google.com; s=arc-20160816; b=uTuYBcnh1H3Aa+EEw6Om4fiRY7Iz7Skx5lgAavldMc/zIdYuYKpf1pQ2hkOUQw/a2S cWehTfKL6PNMhw2YbYWthRx69lirxNzLlSD1a8iU1Cbfbynbe6eJWAhLnTQkpTm9MOb4 Du+Yr9efXGrZAf63GZYBSm7Xl6uSnaYpaScG+IfyhoFt4458kTjbWkxMxkQH0VJx018w iSf0KJ2oq/5Q72qhRlxbLssdFKuV9CVFKkkHPThJSPDQkKERde0Nwt3yUMXx6ygRjR9Y XUjmaSATePz+3FcLapBkkZaS6NQlqrNSr/wibz8pg3OnZD3DvtnMbcAzCbNKvUpXWqBk NB7w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=BIdw/Yz0Q97V7CTgaGjXXRg1G+fU20Qvt8n1MGF3Yf0=; fh=t8YM2W3tYO3ss2HZR4uaX2f5xQocD8P5w7RGCxZ/dVY=; b=Q0AvTp+925wtYsYIC2p0BPKzuepEY+qRKIuEPW9IYTcModzh/ykzL2ht5AJVmVzK6L lby+w0IotQs8R80Uuk4jHnjhMM8A6F1ezNqI0AVwdvDN7vUSOjD01xx9dTpsTEvXRJlj /C7DHVVJYUCH/vnVgV/bv0Jf9ECVwwFvuME0XWb+TKFry5GMN7lXpnI/5a5fPgQuiSbb w+2VlKo3+H78JzULfrNz/SMmcpxfU2pvvn+hrlC5Uv7IiJN701vQ0sR11SwjDnTyIaiV v7OKbHfScpnEbiotvUiav7sfErqBeT+TAeclT9Hk8q9PoNU+6kLyP/MA//SmBIPYDSuv eE+w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dhr4Mrvb; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60551-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60551-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCUpXkPWAF1ePiVuaai0dOHreYGGJkCwa2kFqaUu987vjDzuRsdcyEimcIH6kFiQpr0R9Ekf75T6b61zAOF3eUx7tugb5w== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i64-20020a636d43000000b005cdfdfcd033si3984333pgc.180.2024.02.10.13.54.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:54:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60551-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dhr4Mrvb; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60551-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60551-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DF804281CBF for ; Sat, 10 Feb 2024 21:54:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7552D604A6; Sat, 10 Feb 2024 21:53:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dhr4Mrvb" Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D4C65FEE7; Sat, 10 Feb 2024 21:52:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707601980; cv=none; b=SkAVjlyX44Ok9lSFBM4OYor87+XN0JyD7ASVM/hW/aFzF2BAUk9jIbblI8NbjllZJk2liRRN7c5s/TSkO0iUTkpGsa3wco26P6oD4VPOMT+Kvp5YXZJ77Y2D2K9NUHjC9O0f99uwJ4HNqyGNBrFhGXSmzjN+iYEqk7+7Gh1zox4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707601980; c=relaxed/simple; bh=+gpFQT4ELKCeTcAffH47le2OqwH0PUarupoW82tKagk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qr+qEgrv8D2z3F7qjZxlojk6anTE51enpjKJuBzCQsLOcAQRda8n1wyDQ/MulbO5FKvHA4WgVNG7BDjumYlZKVG3pAQkAwv/8zLkoCRcAr/El31AGYOOVEGpZhH8JvqCIVwhrHcb5IUsbCDj6aBHmrY2VyLBEYzGxz5Hq4dlnQ4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dhr4Mrvb; arc=none smtp.client-ip=209.85.167.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-51142b5b76dso3208872e87.2; Sat, 10 Feb 2024 13:52:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707601977; x=1708206777; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BIdw/Yz0Q97V7CTgaGjXXRg1G+fU20Qvt8n1MGF3Yf0=; b=dhr4MrvbRqC4ZU7po7Lu6Mtj8xuAp8ececwH/zvWU9T665DXLHVfzHgB8gvLL7f358 kZ3Yu2pcxtPRuMXai8HK6Qhio73dE/oB060aUoxeINL+OjpJSfEfMDYPcPLScYnk/nFi rXypb8gS/c9jJVuZHGl0oikl6Zm+jEBdfgr8iy0XdwD9ue6JoIM/bv4OncT4VZ9zKsct B9TLe6c2ftmSqqFoK5xXfb/yx/Kkw+NvacTjk8ypS3oI2Dtu59P06vTjnjltp1S+01ED tGmYthAEHIOJ7TA0d9fr7myLxNzWrlAefIkMVDIaw5jA7UY4/ZJQ9paX8NvxQwzFqkXp VUog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707601977; x=1708206777; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BIdw/Yz0Q97V7CTgaGjXXRg1G+fU20Qvt8n1MGF3Yf0=; b=ZhVtAWRfXROUpEU3tGIGh34AROLok3uORizTIAqNQ8UOKfslr02lkSGTOx5bsHRebk ow9sCHhV0M7yWU7x+66fyMQrrHXtr9dD+u0TFrZQS+Qrc4sMscmwtagVE80sezMiIgP2 ACMOQG6w1Q7ILBUjR1JMQhxsku9zklHRcH5f6X08PTzn5/ABA1nnBghcAlv7FFjh+OAF nln6wIC3WY+q1Y9iWoQbsvc4I07p1LMDkBnLr2gvqm0caHDU0/sIlU9pQUJTS971281y w49Yd4/cCRmdhIHiQjb9ACUrpmQQ1juGJLuLOy3MIOhhAyeMZKO3MWFdTJaGsABfo61P 7euQ== X-Forwarded-Encrypted: i=1; AJvYcCUglLEmBL8jmRRY73kyI2+wckM1KT8qgZcCvntWp1u3iqMxM163LaTRfJgDFF3BfJqIpwKNKDGu3kIfVQI5ldBjKcdnVkb3eQS+gc75pkVf1JbBc8AKgFWsGrPf1z1Ssnkes91mRFcSgIw= X-Gm-Message-State: AOJu0Yx+SzdAAsoDREGEws8Jhudat4bZo+LRRzccXfhVVvVbCJGc/qoR tUEOoHlb3N8m+3a7DgQEnz3Jyq5liQpX9VhxCiF7UadFBXZ8tmEP X-Received: by 2002:ac2:44ab:0:b0:511:87ee:297b with SMTP id c11-20020ac244ab000000b0051187ee297bmr422417lfm.53.1707601977045; Sat, 10 Feb 2024 13:52:57 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVKWen3NWtIxj8+5gqx8iABYDfx49aOEBAmRmf7Z2U8DH0HhkB++Y2dMBRcOjPbQvYzOTY5hsY0MwZA6Wgo4Z7/d7MYm4I9TX6LwK7dLqCN6gYyR0+w6KqoYJ8NchF9FtAItLfWAS2TePvmkk0qnJThWRUH8HH7fuxgMDDTUtLPDmSrmGW18/hJe/WlbM5DniHYlDh7Cp/rNmOkyqSz7XfIrXVkOg1eW8K1/8H14cA5T4SeFEMsvEYsVkczd66MtHDv+t4dYIRwqMERWBnRxtgmaEtIIRDs9R5EZZHp79XbOlzgt0DnzeFo1Ax4nM1m6LVpTUAk+GxkY07K9XioMdLmXv7/zNShAu5binsF/FDprvbz+++8tQ== Received: from m2.. (89-139-223-180.bb.netvision.net.il. [89.139.223.180]) by smtp.googlemail.com with ESMTPSA id a7-20020a19ca07000000b0051189b53f93sm24005lfg.302.2024.02.10.13.52.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:52:56 -0800 (PST) From: Michael Zaidman To: chrysh@christina-quast.de, daniel.beer@igorinstitute.com, jikos@kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-serial@vger.kernel.org, ilpo.jarvinen@linux.intel.com, johan@kernel.org, gregkh@linuxfoundation.org, equinox@diac24.net, michael.zaidman@gmail.com Subject: [PATCH v1 04/19] hid-ft260: remove dead code in ft260_uart_receive_chars Date: Sat, 10 Feb 2024 23:51:32 +0200 Message-Id: <20240210215147.77629-5-michael.zaidman@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240210215147.77629-1-michael.zaidman@gmail.com> References: <20240210215147.77629-1-michael.zaidman@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790550579440743784 X-GMAIL-MSGID: 1790550579440743784 Remove conditional expression, which will never be true here since it is already filtered in the ft260_raw_event procedure. Signed-off-by: Michael Zaidman --- drivers/hid/hid-ft260.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index a348f11600c6..77638cae595e 100644 --- a/drivers/hid/hid-ft260.c +++ b/drivers/hid/hid-ft260.c @@ -1202,16 +1202,11 @@ static int ft260_uart_receive_chars(struct ft260_device *port, u8 *data, u8 length) { struct hid_device *hdev = port->hdev; - int ret = 0; - - if (length > FT260_RD_DATA_MAX) { - hid_err(hdev, "Received too much data (%d)\n", length); - return -EBADR; - } + int ret; ret = tty_insert_flip_string(&port->port, data, length); if (ret != length) - hid_err(hdev, "%d char not inserted to flip buffer\n", length - ret); + hid_dbg(hdev, "%d char not inserted to flip buffer\n", length - ret); port->icount.rx += ret; if (ret) From patchwork Sat Feb 10 21:51:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Zaidman X-Patchwork-Id: 199301 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1667807dyd; Sat, 10 Feb 2024 13:54:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVGWgCVj72/8O61n/y9qhJM5PO9DTQnawls2SIAJSFyZuesSSCzYPGmW3GsWlRrSkyjik+NwOBs1mmKP8LZK8FU9o1rjQ== X-Google-Smtp-Source: AGHT+IE06O1BO2xSUmKxhBNEZzjfgBziUHYhbfyXDYdr68BBKevHDuWvwwxS0rEXGq/VTdlNXsnq X-Received: by 2002:a05:6214:300c:b0:68c:95a3:5a3 with SMTP id ke12-20020a056214300c00b0068c95a305a3mr5052591qvb.1.1707602068999; Sat, 10 Feb 2024 13:54:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707602068; cv=pass; d=google.com; s=arc-20160816; b=zm2FGw6ZUg/D8zdv0RAbpuaqJ17qdHxpeWtf7mA438AA7y3bK/QyCFdOlyYoKLpwzD syI5jASwZjYSEUwJI2ewzvmkxHuUeoNdGERtUi58MKy+TOH+QndTmXDe63ErWIpf5C4N mkGDl9kmBcpPkLb2drU1U1zV3vzj8KDh3Wld2xfGcUJ50rDlPNKzQ32p/JP/Rtq5O543 1Ygi1CCPS0uK3V3fMvW7s6pjXmVOp2idU+AOtya444jmkFkF9gj8Rfcwc46kTdymj/29 XgOW5NkNQukxU2GmmtyO2vVBDIGSDIZbJX3C1AAd8xyh4SIE8YHbuqsqd9JbsclxiSNL 2Srg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=s+VuQ9yysl3g1DNmr5ri0m5tR/HKq6LHQGQTGRbQekY=; fh=XqJgEEP4xS9qyEnJeDGJXdnZW8wcUz1M3YqetnHGdA4=; b=Em+6n0QMExDOVy/FPagF4Tsmkvxa8l/A+mbtD2KNIx7crgllBO4KiateeVIPejZfuk bI9SUKeKo9f/5kunoQ0L3I4hbEfFLgWtz4BmYvhbsL17CIdNCHDtnmMkAv69l+GT7quG CjoJ0EPhwXlMACevnZau+FfQXOZX4WWzq1gtucvUVLRcF5mzRmYJKGHV4vF+1br75LhC QCShsYlEsL/9YkHoQLR9Qe8pQO13TG/ApcFfnU6fdvRKd2/UTMR8XRIJaFOcZmoAYSnu 0zsXfp2uNdzgO2ehDElMN7iFkQMEShjIUUxdTIrOlhI+hcUC+eFipvEMr4EygnaAbtxJ EmTw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=efZhc3TJ; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60552-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60552-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCV/UTiFnhYnX4KsHB0uvvZ7/DqzMT3STEAvArd2LkVKMPz48oZm3iRgdimXKt8n+3Etyohumxt+fTnD7Vc25W0JaSQsZQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id if11-20020a0562141c4b00b0068cd1441ec5si5180305qvb.281.2024.02.10.13.54.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:54:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60552-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=efZhc3TJ; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60552-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60552-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C49DB1C238F8 for ; Sat, 10 Feb 2024 21:54:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BE5385FEF7; Sat, 10 Feb 2024 21:53:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="efZhc3TJ" Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C0B716027A; Sat, 10 Feb 2024 21:53:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707601983; cv=none; b=Qqs+RAemtkUC8SmvuA5z/kptIA6XUKSY6P3iX2NokI8wvv9luOcQEGUI3gK25MGlqgzJbVRtXbUWdwUYT5EmIoVjBXO2a1Yg2nusxqh2iGF0n4bnXdNrV9dFpPaTp33MxTLKePsT5pwmIjvzjWzh5n+ou9v+UEPGGvqt7gc8cvE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707601983; c=relaxed/simple; bh=9o7zsXvraSjsCEIhLU7II+BaKhLy7FlP98jc26bW638=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VGpJ1H/7ZIYO6cjOiS6/viJwnkfNmDqC3sFfHt3+M/Gzmx7gjgpZZZXpY9CFWLRTx0MYmK/yWeY+qG+1v9i6csvwoH/GKlK4IW29m8KMao0ft5pKRON3++aLGyhbgUmp5uEQb80nbVSpzphlfrHd2S6ncdtxP3z4kpnmN9J9goE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=efZhc3TJ; arc=none smtp.client-ip=209.85.208.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f179.google.com with SMTP id 38308e7fff4ca-2d0a4e1789cso22774381fa.3; Sat, 10 Feb 2024 13:53:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707601980; x=1708206780; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=s+VuQ9yysl3g1DNmr5ri0m5tR/HKq6LHQGQTGRbQekY=; b=efZhc3TJgQTF4sJR8WSMTw1p3qS1CXYCkKDnXoR0sr27FAMSJ1QWY8F4cSOkMhsInQ 28n543rlBSSf1ok+bGgLqkrCusgMJ3Kzq7uvIFeuAbYQd/y9pQe4OZLrhKAsBc8WOWxT 49NOoRmLHJ482yr44uCtXnoH/tOxFt8u01ZkPewveiwBC6+ufyAwsdEPtdvy+DXSS0zO bgM0K/CJW6KPG4AFUIYxNsH5b+tTqouC/nn0p2vWhKQBI8g2WVI68ydpdQ+hlXci9WwV R13QNtHZkyOOJmEOKEPXk/euUMuCsciFOKU7CFQz+qvWrQFFCqzh55Fc8Dhha9C1xdvF Xagw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707601980; x=1708206780; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s+VuQ9yysl3g1DNmr5ri0m5tR/HKq6LHQGQTGRbQekY=; b=qGyyFkiA8/DVUJPig4HkpNUVH4mWlTtPFZevFDP2cPjHmuicLrv5Tu25z3rhtQS2BN MExpmjuA4fF3LK1paMagLtswliu9HtvBvhQYQ7OL2Cp3e6axFAH6PTTh5a9HU1smghWt 7gbDErZrg8XMHJIqb1fx8QHeIC9riyR558hsHyiVxD4N0egLvIoESsBuSj+JcDjFcJkG 9IXAK8pouo+UKUE1ymZ49STel7UtRK0saUcHa762muGWc/z6gikSoCpWcGUmmmkoUGU+ /H4PscjLhLVSN8Bspk1ToWpXN4ZrVVgj/TFpkOFWXD0uAh+EESJXKxrnQC8PiTVVXX1N tHXg== X-Forwarded-Encrypted: i=1; AJvYcCXOUScT95L3ea628hR3+sAG16U//oKuvofbveQC12LDw8dttYHsgoMv7kO8/nSZ35CeU1T2yRIZGikfXKQEGTofJv49RY66OvrISlShVq1YaYWwgSrbOLzSGv8pcgPEu2crJQ/96vyyMOc= X-Gm-Message-State: AOJu0YwmY0wJWkNGh0wvPVNC/rfIulcaJBs5gGhWs+E9Q39g2ZpvZyrp TUanHMJR16C1HRwu3kEDT6BZzRxWGVv8B9TlFXDv6XB9fNXvnBWe X-Received: by 2002:a19:2d47:0:b0:511:47a4:ef0e with SMTP id t7-20020a192d47000000b0051147a4ef0emr1677909lft.7.1707601979600; Sat, 10 Feb 2024 13:52:59 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCW2cPEPDaaSC/hrzZi+46NnAVWNP88hnIjxa10U8y44az98mEw8yO7NnW0zgknZAIvkOEZePm7dtPrLpXjOSIF/iDY36PUYTcXVdtUpYzpz4d41vs6jD39ZlxLMMFa0o69BbtyBnRVGKT7hv7T3ZJRitxjBEzzdgrnu1niUHF6Tgf3/z/gtqV9H/fAV/vXMez9nGi9/XFAI4Suy+XI64cbyPQU6uzLT0vVwDSmBbDaExoO8owVPhsVD5v8vaaXpHIq/f0jsxX2llD4wCoUVR/wJf6FYsIwYl70loRr4YESmRR9nIzIDg2jPILkxOp+p0chcbry1MnnHHuRx0v0OWT5CGyl/TVfyUh09wKbZa29nS1nXuXZfgw== Received: from m2.. (89-139-223-180.bb.netvision.net.il. [89.139.223.180]) by smtp.googlemail.com with ESMTPSA id a7-20020a19ca07000000b0051189b53f93sm24005lfg.302.2024.02.10.13.52.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:52:59 -0800 (PST) From: Michael Zaidman To: chrysh@christina-quast.de, daniel.beer@igorinstitute.com, jikos@kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-serial@vger.kernel.org, ilpo.jarvinen@linux.intel.com, johan@kernel.org, gregkh@linuxfoundation.org, equinox@diac24.net, michael.zaidman@gmail.com Subject: [PATCH v1 05/19] hid-ft260: fix unprotected write_buf concurrent access Date: Sat, 10 Feb 2024 23:51:33 +0200 Message-Id: <20240210215147.77629-6-michael.zaidman@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240210215147.77629-1-michael.zaidman@gmail.com> References: <20240210215147.77629-1-michael.zaidman@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790550546737411185 X-GMAIL-MSGID: 1790550546737411185 The UART code uses the write_buf unsafely, compromising the data integrity of both I2C and UART channels. The I2C channel uses the write_buf to send the HID reports. It uses mutex to make it atomically. For UART to use this buffer, it should grab the same mutex first. But then it will degrade the performance of both channels. The better approach is to have a separate Tx buffer for UART. I fixed it and briefly tested the data integrity simultaneously writing via I2C and UART channels. Signed-off-by: Michael Zaidman --- drivers/hid/hid-ft260.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index 77638cae595e..3d6beac0b8b6 100644 --- a/drivers/hid/hid-ft260.c +++ b/drivers/hid/hid-ft260.c @@ -38,9 +38,12 @@ MODULE_PARM_DESC(debug, "Toggle FT260 debugging messages"); pr_info("%s: " format, __func__, ##arg); \ } while (0) -#define FT260_REPORT_MAX_LENGTH (64) -#define FT260_I2C_DATA_REPORT_ID(len) (FT260_I2C_REPORT_MIN + (len - 1) / 4) -#define FT260_UART_DATA_REPORT_ID(len) (FT260_UART_REPORT_MIN + (len - 1) / 4) +#define FT260_REPORT_MAX_LEN (64) +#define FT260_DATA_REPORT_ID(min, len) (min + (len - 1) / 4) +#define FT260_I2C_DATA_REPORT_ID(len) \ + FT260_DATA_REPORT_ID(FT260_I2C_REPORT_MIN, len) +#define FT260_UART_DATA_REPORT_ID(len) \ + FT260_DATA_REPORT_ID(FT260_UART_REPORT_MIN, len) #define FT260_WAKEUP_NEEDED_AFTER_MS (4800) /* 5s minus 200ms margin */ @@ -56,7 +59,8 @@ MODULE_PARM_DESC(debug, "Toggle FT260 debugging messages"); * read payload length to be 180 bytes. */ #define FT260_RD_DATA_MAX (180) -#define FT260_WR_DATA_MAX (60) +#define FT260_WR_I2C_DATA_MAX (60) +#define FT260_WR_UART_DATA_MAX (62) /* * Device interface configuration. @@ -229,7 +233,7 @@ struct ft260_i2c_write_request_report { u8 address; /* 7-bit I2C address */ u8 flag; /* I2C transaction condition */ u8 length; /* data payload length */ - u8 data[FT260_WR_DATA_MAX]; /* data payload */ + u8 data[FT260_WR_I2C_DATA_MAX]; /* data payload */ } __packed; struct ft260_i2c_read_request_report { @@ -249,7 +253,7 @@ struct ft260_input_report { struct ft260_uart_write_request_report { u8 report; /* FT260_UART_REPORT */ u8 length; /* data payload length */ - u8 data[] __counted_by(length); /* variable data payload */ + u8 data[FT260_WR_UART_DATA_MAX]; /* data payload */ } __packed; struct ft260_configure_uart_request { @@ -318,10 +322,10 @@ struct ft260_device { struct work_struct wakeup_work; bool reschedule_work; - struct completion wait; struct mutex lock; - u8 write_buf[FT260_REPORT_MAX_LENGTH]; + u8 i2c_wr_buf[FT260_REPORT_MAX_LEN]; + u8 uart_wr_buf[FT260_REPORT_MAX_LEN]; unsigned long need_wakeup_at; u8 *read_buf; u16 read_idx; @@ -503,7 +507,7 @@ static int ft260_i2c_write(struct ft260_device *dev, u8 addr, u8 *data, int ret, wr_len, idx = 0; struct hid_device *hdev = dev->hdev; struct ft260_i2c_write_request_report *rep = - (struct ft260_i2c_write_request_report *)dev->write_buf; + (struct ft260_i2c_write_request_report *)dev->i2c_wr_buf; if (len < 1) return -EINVAL; @@ -511,12 +515,12 @@ static int ft260_i2c_write(struct ft260_device *dev, u8 addr, u8 *data, rep->flag = FT260_FLAG_START; do { - if (len <= FT260_WR_DATA_MAX) { + if (len <= FT260_WR_I2C_DATA_MAX) { wr_len = len; if (flag == FT260_FLAG_START_STOP) rep->flag |= FT260_FLAG_STOP; } else { - wr_len = FT260_WR_DATA_MAX; + wr_len = FT260_WR_I2C_DATA_MAX; } rep->report = FT260_I2C_DATA_REPORT_ID(wr_len); @@ -552,7 +556,7 @@ static int ft260_smbus_write(struct ft260_device *dev, u8 addr, u8 cmd, int len = 4; struct ft260_i2c_write_request_report *rep = - (struct ft260_i2c_write_request_report *)dev->write_buf; + (struct ft260_i2c_write_request_report *)dev->i2c_wr_buf; if (data_len >= sizeof(rep->data)) return -EINVAL; @@ -1167,10 +1171,10 @@ static int ft260_uart_transmit_chars(struct ft260_device *port) goto tty_out; } - rep = (struct ft260_uart_write_request_report *)port->write_buf; + rep = (struct ft260_uart_write_request_report *)port->uart_wr_buf; do { - len = min(data_len, FT260_WR_DATA_MAX); + len = min(data_len, FT260_WR_UART_DATA_MAX); rep->report = FT260_UART_DATA_REPORT_ID(len); rep->length = len; From patchwork Sat Feb 10 21:51:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Zaidman X-Patchwork-Id: 199302 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1667879dyd; Sat, 10 Feb 2024 13:54:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IElyLskW7EoqSplBdI5IOgIAHkU+/J/b5Rhrk4Bz2CV2dylF+Iwt7PCJZhWEj5DOBeS6G2f X-Received: by 2002:a05:620a:4094:b0:785:cad6:c3ba with SMTP id f20-20020a05620a409400b00785cad6c3bamr3687125qko.15.1707602088004; Sat, 10 Feb 2024 13:54:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707602087; cv=pass; d=google.com; s=arc-20160816; b=KRijlFrF1KzU+8WD6gD/w3jfaQZw7aY7ZH2qyv6kwRUCaKYPXcAbPGtcIP9ZGfUo54 tp1CuTouHGR8E0MQah61lvZZDQsCFJuEs1EC/p6vscUe08oCSG6XOdgmcF4R8SZL8vED OVJuxsVpJ74rvHuB7vmb4dmKvwRCBIFnvzyXcQFMF3pDeepVrKW8zUTZ8q1kzdLPImmJ 6OSq/ZlbofVUhehvhB2uXEVsbz7uLsMHZwQggr9h1ofoWSdgFLYFtIP1ZRjv/jfW8aVI Y0pS9RMos0SeZhEGwq7xC83wXyj8OEQuaTbcaF9mRwr5dQjmuK6FfjLvzYOJRkRbNKE2 TUYQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=pMdjM6y7kF9azHHy8v2BrI6Kc/oC+WGprWIMEkx9WQo=; fh=IlFh/Elg7FrskB3VdtbCxCUHmbKsBiQuATgM8bYHpGQ=; b=JiMLfnLbXdPA98tmQfpQjR7ccyvGV8wwAIWZS1+lv0SMmovxmhmWddJTW4PlZ0/vkD /xpzq5K3GJo7goMXFJRo3epboPO8+qjj9CTJcC3oeUS51zxnypM2Me5pG1dfLjAvWKSK OejZmd9pQdf4Ef2T0j0has2YalRRQt+qiw52gEsExus0HrI6c6XyqALVn+VlXL66Sbgn MetmhApLfNT8oY8nNwMiiyRHMcar/OTrXxZJoMD64mL182w2cE451RUBS8d/pHUNVQPh Idwz1Mm/fyRse/2XH0lRB4wRkszFhTrzfzSrhRMWKjNAS6qSHY66ZqSn1Nm29ju1uvgh Csww==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FwgLb6wL; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60553-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60553-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCUnBgoRTfejNQCkWxex9lAmBybhNTQtPHKgUptEX8NjuH0wGOpq3acYFlBJld84lql2SOlgLFN/ONQ+lwt90Qgbd9WiiQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id q29-20020a05620a039d00b007859e5f1befsi2598679qkm.518.2024.02.10.13.54.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:54:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60553-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FwgLb6wL; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60553-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60553-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B47E01C238D6 for ; Sat, 10 Feb 2024 21:54:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B4536027A; Sat, 10 Feb 2024 21:53:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FwgLb6wL" Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0871E604C6; Sat, 10 Feb 2024 21:53:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602001; cv=none; b=el5cACoWlvvStaLxZtno73YPr7Pw8E6japp8d1wMbJ0CnveV8xQsGfCIhVsE4BEdy9CmPU6ihscnCmV0WUIrvRGVd2+Pvbcxtu8woInuMyZitanLOO8ZYaH1xCKpQM+xmEVkou0mAI0VYMjSo/nZIl5s0pkKznDNyegB2UQ2TTE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602001; c=relaxed/simple; bh=QeLwyWmd7NPkYXcDqCuEyzt6u/pRusg8+Tyv90sqj9g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rK1aMV46caM386ykDvZ7MDricHYmrDf1Tj+eedTqMUGAeGUv9mBQDy9zi6zOlL4s71v3M+qfOiVk4GuoI7QOg+RJcxOAT/LUfMWzYnxBJWNAjN3yOzrhN/QjAamVLxvVgPo2O6GSCPNwbaL0bavzZIunfWnNPpKohtG5ZJl650Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FwgLb6wL; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-51167e470f7so2601295e87.2; Sat, 10 Feb 2024 13:53:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707601998; x=1708206798; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pMdjM6y7kF9azHHy8v2BrI6Kc/oC+WGprWIMEkx9WQo=; b=FwgLb6wLlvmf4AbLRG2XQnG3fZaTplWO7W4OQfyDYcYY3k5Zt0xdD7IoqbNaFj0D7t V/abVZiBk19xt5q+K4l88sbN8809wf7shnol/aH2WDUMY7+K2++jFm8iMNQ4tck79Y7y XeYoqKpudej7Kubb0+dVhYksRfPELqu33odHaWSlk5xazBYykoAXCDpGfQ6sh90j+mhh 1atXVaLsg09zgxuUapKv2jT8zHKWrKKjrgh/MRDSrNtaeWOh7p12DaD9AqYnSobiTRpW UkmqWOOYMfOldLGZRKSJO/LoBlTcFnxaGeD4KtMyo/8kUSbljTB6Q4JL2xlKzCjfDqrn 0I0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707601998; x=1708206798; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pMdjM6y7kF9azHHy8v2BrI6Kc/oC+WGprWIMEkx9WQo=; b=SZFdCjyXDtZenMOpTsvyalmwJMX9hlyWuB1ZKhPplVD4HRBR2gq6GmanLpkhN7NMWK JToVigakLSs6dRolgHk++qb6Pu/Mnolu/rrz/FfjLc47lAUJEm+Zyc+HIFDLJYKo2eSU 5hb/Pyc+FyjvoMD9nHPea37QAGN0ewiYnMz+nSJBpm8CFUSKK7sWuJpXxheava6GvP2U eeMfomJ9CsI5X5jlsQnc/GtzTL5hHYV0G0ddeFUH5yozsGi8i1o36pAVPrdel9uyRbl/ 3A9kjGbgYtY/Kta760WXBMFUn6V8lxOicNQZ15fUbBjbAA7+W0wJfI4ND2XPQhyKdQPy NqzQ== X-Gm-Message-State: AOJu0YyRrHZ8VLoksVkE/tfqeqwDAZjqsH1+LQaTNJnGLDGjcCdriXJB 0rYrLHmSEcytaZzBsyFKOcWEVgAaa+WVrbP0739RRxoP/I+Ox/Oa X-Received: by 2002:a19:f805:0:b0:511:5361:20df with SMTP id a5-20020a19f805000000b00511536120dfmr1790854lff.13.1707601998077; Sat, 10 Feb 2024 13:53:18 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCW9FrSZtrtzkAYHkZCEv3npM/qj+QrBYwEKI8UB4dCsHfGDISwwAfwY2sPB+uLw5CLe4fZiEDQnsE+n3cstkOHzNmPMACy5+6qxflVGGXjrTQ5k5qlyyRafvbqxCyOWOAx3xlMd0WBH/mV+VPkm2GvC75yjeG0LsKAKxaM4rj/2PIzrSckFQZpVZuJTM93uKYxGjhqL+y16/SZR4yfJixuvZ3xnOPr5NRNG5yzuY7q9chpOceV/2WJN42SIcGZtQTo8mcZ5FBACT9kDQc4Q8RS4lK2mxhU1wkdyZ9vYAO3ypnPgDgmRf69zFCjydoU13lbwq1Qi5kAs2uXJ3C2efK4SswCQOSRnauw4bWji7MRIAK1vcWAAFA== Received: from m2.. (89-139-223-180.bb.netvision.net.il. [89.139.223.180]) by smtp.googlemail.com with ESMTPSA id a7-20020a19ca07000000b0051189b53f93sm24005lfg.302.2024.02.10.13.53.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:53:17 -0800 (PST) From: Michael Zaidman To: chrysh@christina-quast.de, daniel.beer@igorinstitute.com, jikos@kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-serial@vger.kernel.org, ilpo.jarvinen@linux.intel.com, johan@kernel.org, gregkh@linuxfoundation.org, equinox@diac24.net, michael.zaidman@gmail.com Subject: [PATCH v1 06/19] hid-ft260: uart: enable wakeup workaround Date: Sat, 10 Feb 2024 23:51:34 +0200 Message-Id: <20240210215147.77629-7-michael.zaidman@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240210215147.77629-1-michael.zaidman@gmail.com> References: <20240210215147.77629-1-michael.zaidman@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790550566985070897 X-GMAIL-MSGID: 1790550566985070897 The FT260 has a "power saving mode" that causes the device to switch to a 30 kHz oscillator if there's no activity for 5 seconds. Unfortunately, this mode can only be disabled by reprogramming internal fuses, or external eeprom if exists. One effect of this mode is to cause data loss on an Rx line at baud rates higher than 4800 after being idle for longer than 5 seconds. We work around this by sending a dummy report at least once per 4.8 seconds if the UART is in use. But it is not acctivated in the "[PATCH v4 RESEND] hid-ft260: Add serial driver" https://lore.kernel.org/all/20231218093153.192268-1-contact@christina-quast.de/ It causes data loss on the Rx line at the driver's default 9600 baud rate. Enable periodic dummy report to prevent data loss on Rx line upon exiting from power saving mode. Signed-off-by: Michael Zaidman --- drivers/hid/hid-ft260.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index 3d6beac0b8b6..19599e64c6be 100644 --- a/drivers/hid/hid-ft260.c +++ b/drivers/hid/hid-ft260.c @@ -1575,7 +1575,7 @@ static int ft260_uart_probe(struct hid_device *hdev, struct ft260_device *dev) INIT_WORK(&dev->wakeup_work, ft260_uart_do_wakeup); // FIXME: Do I need that if I have cancel_work_sync? // FIXME: are all kfifo access secured by lock? with irq or not? - dev->reschedule_work = false; + dev->reschedule_work = true; /* Work not started at this point */ timer_setup(&dev->wakeup_timer, ft260_uart_start_wakeup, 0); From patchwork Sat Feb 10 21:51:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Zaidman X-Patchwork-Id: 199313 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1668841dyd; Sat, 10 Feb 2024 13:59:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXrzpkS88gYuyOyrsJYpGMl7kwZu7kAbaLKYWV9Cgdo3mOPGL7uBIAwf5Sf2Yxevm5a4mJ0RsfMYBYYJxT03gbNDXjkpA== X-Google-Smtp-Source: AGHT+IHyi82H5ET+wm75JIoxRrv+PzdlEdrCpHw94Imc/GUK6+9+tT1T5cn2VWmafk9XhK1qs8YS X-Received: by 2002:a05:6a00:b4e:b0:6e0:4717:7a0d with SMTP id p14-20020a056a000b4e00b006e047177a0dmr4466753pfo.5.1707602347700; Sat, 10 Feb 2024 13:59:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707602347; cv=pass; d=google.com; s=arc-20160816; b=dR7mntIyI9UsQOhW9HvkrOxWBI0zbAF/j1kTaVTcY5LEh8frBUjz9hhMkjQxGHzyfE 10zYI2KBbJWGh3gH63BYlIy/sZKf6clwNcOHBxN4cGeJma+6g3A4/tjqVnpoyBOxPV7D mHcDjgjsgBPW64FbYfkcVIzakoBrxd6SDPwtV66DVBNzRKSxnNYofuN7lJ2y1LD14tcZ dqk79SZxCSv5FedYDoN77vmFCKIcSGeki80//4sNAQkVlK0kKTZsRs+f3ofSe+1e7JO5 grn/k3EpI4XlVwz2ZWOLh3FGKTt34z1h158Gu8FCBYL7xaTcvqKR6KsbkZr2Kf86ekuk oISA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=TwWx4fA7QO2mU5cwtgYuWebfDJVD7zwbCewKNc48h3M=; fh=39JoVWdZW9DEFzOlKo3PWDsAur/MpPi220CDLqDlKsE=; b=tooK16jftxsAuvqFCqKzeFYLQYG2onOONwrJsv3CnsMXHi0g3mZqvnq4p26W8/DCKk AxDXaGLsl3jCXxE6EUltWU0nMPD0+w4Cb3SGIniLs5luLo2C/J45nhVBgM2b8SVvITMx Wn3LGDXFSQukB6dl9OjTHChhBWz+6b3tE/JM6cBLtd6XqEB3yd68a1rle7JglrBI60yY ihQHUU9Lnc9y/suTBruo+zW7/Q5MKPjRcBXk68XiO8uuJdEX55jjRlP5aNBuBv8cqSDZ zNIonT179lDqIV4QFTmdafkSI2M1sxwokWixed3fHJRZT3252s6GoU0KZxErX0Ed6OeD N2uw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VvXmV+IC; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60554-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60554-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCV8/MMwbLqufKmfipRkhak7PCBkLA4AKdjpwA/+kECS1SVc1LdEMMcyqosnJn4wODXNOoo96a7/j+rM5xCBItBn/UiKug== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id dw14-20020a056a00368e00b006e069957604si2631442pfb.91.2024.02.10.13.59.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:59:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60554-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VvXmV+IC; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60554-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60554-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 03F4CB24795 for ; Sat, 10 Feb 2024 21:55:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0AA015FF13; Sat, 10 Feb 2024 21:53:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VvXmV+IC" Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8BB25FEFE; Sat, 10 Feb 2024 21:53:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602004; cv=none; b=H9wTAFThywDmgHq5x53pKI58R0mIAwILdKpaKaf/gcvWwC2XE2iHP2mztABEyQ6hkIIYp3j5wR/uDntMIJellLXOdO5mm8/daVDRjKMW3I2tKGUgBg2TOLDtAt92CrBtL9p2gcH9RU+zBdrIWrKEZQ7Bk7Pd9xgEpuCC3WlnlIs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602004; c=relaxed/simple; bh=pwSX1S4pRoynSdWjUaQZWgc7CRvfTwI/pHP/UuzHyyQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Rg17wgEYGaH4hSx6fwpQxUQf9//v9ap7+LOZgp9VMuxUHrEDVz8H0cHd41EWDTM/E5mbNI8/qqS7fGfWhCdAizDFR7uqA2jGbmE+1yCNB+rhauQ/2gcsvt4wRU6qOdbkYwVoI9O8QlNRp/yAybDR4odg2KT+jIovskxtnHVOq5k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VvXmV+IC; arc=none smtp.client-ip=209.85.167.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-5116b540163so3043968e87.1; Sat, 10 Feb 2024 13:53:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707602001; x=1708206801; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TwWx4fA7QO2mU5cwtgYuWebfDJVD7zwbCewKNc48h3M=; b=VvXmV+ICZ+aMiCR+KUz6mavN46OMokygOkLOZ9GALAX/iOiaoA8C62BH5T4ZQqAjgI 9r4Zba1gOZaE4dOmRW6pbFZZItcf13/4KU0eZ0KvuO5AgDlbmuZUZ8pfkFqRvEasAAx6 xXdv2YTy3Lu8mNxU9BfoqhMPxAXqdCcMJ5roBcAjbnvhiJpE0QRrgF2LGN4tfjeHe1MK komPoLhQLf6IKtlM2VerHINQcV0j2/tucabrNtmFHQdqBJ/pecDg4GkbJX6vRpaA4Jsb UyfFZh/0MMvP3mOb7ibZrgwrze/T2gjEU6ZJuN0TKssXEOKzod9Bzkw4NxsOJU42gtse huNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707602001; x=1708206801; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TwWx4fA7QO2mU5cwtgYuWebfDJVD7zwbCewKNc48h3M=; b=YvWnfEOGsI+Kui4oN9Tf+u20JmdM72VopCk1N/AJ+ahNn1cnWU/EgR0tgaIHTT+BbJ 8ZRCVJuGVTVWlGFZRyZeF5fL0e0+zTkHuvC1+gEYJRwo4Cazjs1dVumIzLlxuXe/gmo0 mwDx/tYPTnR2ZXT8w3k2brz78DP7D/UPhXS7h8JybYgWf2i9pSo0Zv1EvTQ8h2OdCbIt wJJNXCmgknLkDldoIGtH1twNLq1Iq+XX5khkwcjnHQicPXe4wxh4Q/tbAHo0/EVvcaEd i4vrq2pASgLDQ1X71KPjd31ABwPBMxfb57ltbZML+4m/uG4xEYG34X5IetM+y8bi8jE5 FuZg== X-Forwarded-Encrypted: i=1; AJvYcCVXQneo2cv2aFsjvUksAkI/+/pzxvynScwjvhqnIwt/XgD8/z6vz3GqbGO11aKl39UEvmlKQTJy4Wu2p26dnIhTle1jww3MSlhs56qi0tv5SbHMYA7GZu6KhiSYNJVo7nZidUKwGpfnYZ4= X-Gm-Message-State: AOJu0YyM/DeR8LAiPmGKXSTGDDFkKzWY0pBe9KnOuPiRpasuoqEaLLzw 7OXqYDI2qiuTeLmmiyH3sUoN3ASO6u1alCBYqhbqEBANt089zSIl X-Received: by 2002:ac2:4ac9:0:b0:511:7b35:9563 with SMTP id m9-20020ac24ac9000000b005117b359563mr1497168lfp.19.1707602000706; Sat, 10 Feb 2024 13:53:20 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCU7SKRtSC3z2GhqNZMTUsbMPy8izpVUK5n8o9Q8uxdOhOMj/yjoBiWihcZxOOc2LX27JaXymFlZjs1CP6Pqg7x1CXCnNW1u874a3MVnOxyvXS5N3OntQDJHdITfW5iKX+2p2JPbIPLwEas/wfMG9b0RC5G6WwvbAxs3+pvN+G8a4TiSvFjWXaWUr/PGDRC+qWCCEkxHbO3Y799j+Y2qpDk9JbDA/fHr1XtSLQRt5H2PSb+y5mBecXeBPzlrNhWqZAExGKYWkfmS58kjpcMagK4B/hvOaQvgd+ZkUY9Mr4Q70AQ5WwiyJc3LJuy9KDl4uGBHEAFLfSzG/X5dKOaaloh5fAVd878HXPjf8Dh2YTFf79gYWli1oQ== Received: from m2.. (89-139-223-180.bb.netvision.net.il. [89.139.223.180]) by smtp.googlemail.com with ESMTPSA id a7-20020a19ca07000000b0051189b53f93sm24005lfg.302.2024.02.10.13.53.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:53:20 -0800 (PST) From: Michael Zaidman To: chrysh@christina-quast.de, daniel.beer@igorinstitute.com, jikos@kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-serial@vger.kernel.org, ilpo.jarvinen@linux.intel.com, johan@kernel.org, gregkh@linuxfoundation.org, equinox@diac24.net, michael.zaidman@gmail.com Subject: [PATCH v1 07/19] hid-ft260: depend wakeup workaround activation on uart baud rate Date: Sat, 10 Feb 2024 23:51:35 +0200 Message-Id: <20240210215147.77629-8-michael.zaidman@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240210215147.77629-1-michael.zaidman@gmail.com> References: <20240210215147.77629-1-michael.zaidman@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790550839526861933 X-GMAIL-MSGID: 1790550839526861933 The ft260 chip enters power save mode after 5 seconds of being in idle state. It causes the data loss on the Rx line. The implemented workaround sends a dummy report every 4.8 seconds, preventing the chip from entering the power save mode. But the baud rates below 4800 work fine without a wakeup workaround. This commit makes the wakeup workaround activation dependent on the UART rate, allowing entering the power saving mode for the UART rates below 4800 bauds. [11238.542841] ft260_uart_wakeup_workaraund_enable: Activate wakeup workaround [11238.542843] ft260_uart_change_speed: Configured termios: flow control: 0, baudrate: 9600, [11238.542845] ft260_uart_change_speed: data_bit: 8, parity: 0, stop_bit: 0, breaking: 0 [11238.543671] ft260_uart_wakeup_workaraund_enable: Deactivate wakeup workaround [11238.543683] ft260_uart_change_speed: Configured termios: flow control: 0, baudrate: 4800, [11238.543684] ft260_uart_change_speed: data_bit: 8, parity: 0, stop_bit: 0, breaking: 0 Signed-off-by: Michael Zaidman --- drivers/hid/hid-ft260.c | 48 +++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index 19599e64c6be..b24998092d22 100644 --- a/drivers/hid/hid-ft260.c +++ b/drivers/hid/hid-ft260.c @@ -296,6 +296,8 @@ enum { FT260_CFG_BAUD_MAX = 12000000, }; +#define FT260_UART_EN_PW_SAVE_BAUD 4800 + static const struct hid_device_id ft260_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_FUTURE_TECHNOLOGY, USB_DEVICE_ID_FT260) }, @@ -1056,6 +1058,15 @@ static const struct attribute_group ft260_attr_group = { static DEFINE_MUTEX(ft260_uart_list_lock); static LIST_HEAD(ft260_uart_device_list); +static void ft260_uart_wakeup(struct ft260_device *dev); + +static void ft260_uart_wakeup_workaraund_enable(struct ft260_device *port, + bool enable) +{ + port->reschedule_work = enable; + ft260_dbg("%s wakeup workaround", enable ? "Activate" : "Deactivate"); +} + static struct ft260_device *ft260_dev_by_index(int index) { struct ft260_device *port; @@ -1108,7 +1119,7 @@ static void ft260_uart_port_remove(struct ft260_device *port) spin_unlock(&port->write_lock); mutex_lock(&port->port.mutex); - port->reschedule_work = false; + ft260_uart_wakeup_workaraund_enable(port, false); tty_port_tty_hangup(&port->port, false); mutex_unlock(&port->port.mutex); @@ -1266,8 +1277,11 @@ static int ft260_uart_change_speed(struct ft260_device *port, struct hid_device *hdev = port->hdev; unsigned int baud; struct ft260_configure_uart_request req; + bool wakeup_workaraund = false; int ret; + ft260_uart_wakeup(port); + memset(&req, 0, sizeof(req)); req.report = FT260_SYSTEM_SETTINGS; @@ -1309,6 +1323,12 @@ static int ft260_uart_change_speed(struct ft260_device *port, tty_encode_baud_rate(tty, baud, baud); tty_kref_put(tty); } + + if (baud > FT260_UART_EN_PW_SAVE_BAUD) + wakeup_workaraund = true; + + ft260_uart_wakeup_workaraund_enable(port, wakeup_workaraund); + put_unaligned_le32(cpu_to_le32(baud), &req.baudrate); if (termios->c_cflag & CRTSCTS) @@ -1435,13 +1455,13 @@ static const struct tty_operations ft260_uart_ops = { /* The FT260 has a "power saving mode" that causes the device to switch * to a 30 kHz oscillator if there's no activity for 5 seconds. - * Unfortunately this mode can only be disabled by reprogramming + * Unfortunately, this mode can only be disabled by reprogramming * internal fuses, which requires an additional programming voltage. * - * One effect of this mode is to cause data loss on a fast UART that - * transmits after being idle for longer than 5 seconds. We work around - * this by sending a dummy report at least once per 4 seconds if the - * UART is in use. + * One effect of this mode is to cause data loss on an Rx line at baud + * rates higher than 4800 after being idle for longer than 5 seconds. + * We work around this by sending a dummy report at least once per 4.8 + * seconds if the UART is in use. */ static void ft260_uart_start_wakeup(struct timer_list *t) { @@ -1455,10 +1475,8 @@ static void ft260_uart_start_wakeup(struct timer_list *t) } } -static void ft260_uart_do_wakeup(struct work_struct *work) +static void ft260_uart_wakeup(struct ft260_device *dev) { - struct ft260_device *dev = - container_of(work, struct ft260_device, wakeup_work); struct ft260_get_chip_version_report version; int ret; @@ -1472,12 +1490,20 @@ static void ft260_uart_do_wakeup(struct work_struct *work) } } +static void ft260_uart_do_wakeup(struct work_struct *work) +{ + struct ft260_device *dev = + container_of(work, struct ft260_device, wakeup_work); + + ft260_uart_wakeup(dev); +} + static void ft260_uart_shutdown(struct tty_port *tport) { struct ft260_device *port = container_of(tport, struct ft260_device, port); - port->reschedule_work = false; + ft260_uart_wakeup_workaraund_enable(port, false); } static int ft260_uart_activate(struct tty_port *tport, struct tty_struct *tty) @@ -1575,7 +1601,7 @@ static int ft260_uart_probe(struct hid_device *hdev, struct ft260_device *dev) INIT_WORK(&dev->wakeup_work, ft260_uart_do_wakeup); // FIXME: Do I need that if I have cancel_work_sync? // FIXME: are all kfifo access secured by lock? with irq or not? - dev->reschedule_work = true; + ft260_uart_wakeup_workaraund_enable(dev, true); /* Work not started at this point */ timer_setup(&dev->wakeup_timer, ft260_uart_start_wakeup, 0); From patchwork Sat Feb 10 21:51:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Zaidman X-Patchwork-Id: 199314 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1668889dyd; Sat, 10 Feb 2024 13:59:22 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUBewi0asLOCpTsLHy6TZn4corMeLR57gEdTCgvDowfwjW8lVPWL2GB9CUTuAJerVj9zqlo2rj6dKX39/1vs8vWfsVMog== X-Google-Smtp-Source: AGHT+IE5qvHTBYiSgU8IZhAxzD9fTSXXNVH1bW7cbwi5johff7zaChZ5PSCXCQv9vOuOUpZEKEgh X-Received: by 2002:a05:6a21:594:b0:19e:987c:78a7 with SMTP id lw20-20020a056a21059400b0019e987c78a7mr3847720pzb.32.1707602362233; Sat, 10 Feb 2024 13:59:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707602362; cv=pass; d=google.com; s=arc-20160816; b=BJGlIy99oxEpU0/eZvdgPZqLLELDub3HR38XnVymg3m3s/NohINF+YDtAygknpkbts iYnilMLW3yffTM0xwn75C6Vhpvnqze11RXCU4JDAIpVD9mNhPArG+ljLjFpcSFnX4e61 1/sjebAWu+VuP9hjvukLO3GALeBeaJjpa+kxL7f3rHESZLsOOiFUeyJUALL9jgsamx+M TdlF7QKqGvekNSPnBKkJo0ZcuFpdUXQlTB5xXm2k7dyf0/wcIDJVp1DPXxwTL4R/cdID N1C4R5p1uIFi2tvBhKT862u9G0ADZ52ZFJXdT9o/hR5pgjUZbYHSmNzTGosj5SPXyv3i Brag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=UODuNfAGA+zsvY/n5h+6gJpvPpOhAjXDdRWfKreEhiw=; fh=cXDVU6iQg+rS2rEADDkgSN9qcfXxp6TDZpl6v9h6+DU=; b=m5LChx5I9aQWWRlsTYJynMaccziTviRXUCJvH7T0q07BWj4Scu3k3RvrCiYM9FUxGP XlUDVhAmQwgLYCPDf+JcWCOsJ1eXwQ6VgJpX8N87VLf5uSOt0v7ycxJC1iYW89cYzxdj JVN8FLDRRwEwAvwhIFdShNI7ykJjm8+BTPjxk/VrCHbe61PKRzjg8MM9C78BoNpTfVbI w5utNHXzTXTDJ2u05DQO1BlAExG9NWmpt243qY2ojfMe7+5YQHVxkZq2ABLYlllpPlxB hRoToNv/1x36XSNtJfWvc/ZJWx3N/xONC91SMGlk/UX+QQX3KybMFD2O5YsyiXSe2EFt hKfA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=AfFNn46a; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60555-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60555-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCVOC/BSsbgk+nB4Mxp9/jjFoV+2n99m8hH5n3FreSA0VVoCoJa5MdDizDQQjcU0G5L7kuNBQ/yHqcQ3LFd9NPO638c/Fg== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id l186-20020a6391c3000000b005dc42a836a3si3949850pge.625.2024.02.10.13.59.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:59:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60555-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=AfFNn46a; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60555-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60555-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C3700B248CB for ; Sat, 10 Feb 2024 21:55:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CE058605C9; Sat, 10 Feb 2024 21:53:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AfFNn46a" Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5071E604D7; Sat, 10 Feb 2024 21:53:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602007; cv=none; b=nivodCVHbiTJ2zWTXdbkNq/brJ3IwFu9EAMNM5udbZoKwz8rjKz3u5PT5re4+hj8Xm9Fv++KTKbJnajI8/m46oJG5znnDn/15Bli2quoRTCFqfGZfasg2JHlcVoOS2s6VmqglNAOwSVOtvzNTddnYSmPP+YzJJVZV4k4ZfKB3pc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602007; c=relaxed/simple; bh=gDhQUebaa7t6ieh8Y51ShSPwVNxKLw23nUX5WrKMldg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RGUHZxc5qjZ9t2X4xJ/yMFTHu1rxKEcYAkXEJwOeHfXS5AT0PV3pZ4XWOMw7BpgyfydDA11gxmXY0iEdtTNxGycVNw3F1Qkjat5WYlqMzijTXs1S1nPD+JlMhGvulGm5XdnrNeh1AfGXZzAQ4h1c1LH7WtHarf/fPlAM9HpYjNc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=AfFNn46a; arc=none smtp.client-ip=209.85.167.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-5114b2b3b73so2465693e87.0; Sat, 10 Feb 2024 13:53:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707602003; x=1708206803; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UODuNfAGA+zsvY/n5h+6gJpvPpOhAjXDdRWfKreEhiw=; b=AfFNn46a2zhBgqbUvk6eFwLa/Mh+3QrPL+1FUiIWS5rvYUL7lrAAKZ4+YAdwurXBYS uQV+UnQltKtJ0xBe3CgsApuR2wI9WsULbWAXGHh9IRjRSHTDMyN3ir92MOi48QMzsyaz NhHKp/zuY8KXI6oYoIx1KtiNdGrONRCV6pVfjxGBuykId+oqkqbM5SpLQtSQAaoKjUdB W1lpPJi/D5u4QdRa6URyqAA7eD1xPWDSnb//YTojRw627UI1VDfBtTmdkwRlXpnBl5bM Fo2mP9Nh7IF1IfF2ss4FaZWUWLSD0YXnRVTpnSO/6/TjDklXSAcMglhqAsHR6L54e/jV XNlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707602003; x=1708206803; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UODuNfAGA+zsvY/n5h+6gJpvPpOhAjXDdRWfKreEhiw=; b=CgDHyw3liX8ODbCZ5ek4lu2DGDOj6wrcUIIqYRBvH2zpDR1fddmW9t0lpQHajH70kp Fplu4wAX58s3rtt22fmNngRqYjbMJQOZM9I1iX3rD8DgW0SWhvE0Su4WYjXtZ9jV6dpE m/0SFlaXaSM+OPRfkqquInuKJWqKd5n5PG2CQEopsDALm5fQE1p2zG0diMAKz659v/7u qyOe3Z6U02BCEnqRuIDsBONs6sxWGGY+rQqXM6Lcb7vV14YkqreexdkwIV/LQlkcYhdU EXMuksj7HHxof1b7TQHr6eZhIha2eWTfxBo7zHe9UGuHb4hxJhuW4IalhC0Q2rrTpSK3 tpew== X-Forwarded-Encrypted: i=1; AJvYcCUoGp7+k7JJjULpiQpdRGR6Td/htlYuLYyA+pu7zLWW8QCxCXJweIsYnrX5bodINENLcgIUW3Ju1ZOLjmSx/dOgiRpwj8Qn4+jx91vxgfNdBmGtQJCeEz3z1H0AFsQPoFG3AeZE6EmxEC8= X-Gm-Message-State: AOJu0Yx7nMZp64PqMK+ly/YdSn9ekWv3rS/cTxn/Alpvw+yg2b5EbYrb P1VXJKq8W8YoxVzby1GtxSOUUXfz78tThI0EyV/IG1v5Jk6NFSmF X-Received: by 2002:ac2:4d91:0:b0:511:82f8:d30d with SMTP id g17-20020ac24d91000000b0051182f8d30dmr1738073lfe.32.1707602003255; Sat, 10 Feb 2024 13:53:23 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWujr/UBh0ujT5bxNwSXnL461jiku4Mw6uUMQEXaJ7m80CBselpdh0gltd+Qnal67DxWkC++wt+wI+92G+Xwf2fcC1r4g2MwDslhaQgaOYJ8OG3QglQMGd32QUMmSpGHs8hESyfdmayEceTc+63eiVKtt9znx+ZFg+CsFbfvAyU8A5BGAgUYDsf+CdCCUO9jUTSfE0buwwgVtIfirpsWD/+ZJkPJTOqxyqrZLzz4EGamsK/1o1Db+CzCoQCfovpI2JPTcyxa1Pn/hmCJoVqwo4A7dHyB1YLw21zeM6avXXdF7Hi76KzkjSI3PsQ8uzC45PrH9SWdukPDPs2tlxXOxf4/5OF4WlY2w4WcYySGjiutTvRLOe28Q== Received: from m2.. (89-139-223-180.bb.netvision.net.il. [89.139.223.180]) by smtp.googlemail.com with ESMTPSA id a7-20020a19ca07000000b0051189b53f93sm24005lfg.302.2024.02.10.13.53.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:53:22 -0800 (PST) From: Michael Zaidman To: chrysh@christina-quast.de, daniel.beer@igorinstitute.com, jikos@kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-serial@vger.kernel.org, ilpo.jarvinen@linux.intel.com, johan@kernel.org, gregkh@linuxfoundation.org, equinox@diac24.net, michael.zaidman@gmail.com Subject: [PATCH v1 08/19] hid-ft260: depend wakeup workaround activation on eeprom config Date: Sat, 10 Feb 2024 23:51:36 +0200 Message-Id: <20240210215147.77629-9-michael.zaidman@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240210215147.77629-1-michael.zaidman@gmail.com> References: <20240210215147.77629-1-michael.zaidman@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790550854462240470 X-GMAIL-MSGID: 1790550854462240470 Do not activate the 4.8-second wakeup workaround if power saving mode is disabled in EEPROM. Signed-off-by: Michael Zaidman --- drivers/hid/hid-ft260.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index b24998092d22..ccd20f590720 100644 --- a/drivers/hid/hid-ft260.c +++ b/drivers/hid/hid-ft260.c @@ -323,6 +323,7 @@ struct ft260_device { struct timer_list wakeup_timer; struct work_struct wakeup_work; bool reschedule_work; + bool power_saving_en; struct completion wait; struct mutex lock; @@ -889,6 +890,7 @@ static int ft260_get_interface_type(struct hid_device *hdev, struct ft260_device ft260_dbg("uart_mode: 0x%02x\n", cfg.uart_mode); dev->ft260_is_serial = false; + dev->power_saving_en = cfg.power_saving_en; switch (cfg.chip_mode) { case FT260_MODE_ALL: @@ -1063,8 +1065,11 @@ static void ft260_uart_wakeup(struct ft260_device *dev); static void ft260_uart_wakeup_workaraund_enable(struct ft260_device *port, bool enable) { - port->reschedule_work = enable; - ft260_dbg("%s wakeup workaround", enable ? "Activate" : "Deactivate"); + if (port->power_saving_en) { + port->reschedule_work = enable; + ft260_dbg("%s wakeup workaround", + enable ? "Activate" : "Deactivate"); + } } static struct ft260_device *ft260_dev_by_index(int index) From patchwork Sat Feb 10 21:51:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Zaidman X-Patchwork-Id: 199304 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1668287dyd; Sat, 10 Feb 2024 13:56:34 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXMC+yuepcqfvQJ7VJrUyM0rnb4EriodXM/Jhc0QGEI1I5xb7nb0OoSREfsWHgvEi0TMlM3Al4JiBa3mfXciammJ5jKWQ== X-Google-Smtp-Source: AGHT+IE7EKvQ3Jr6RlhlKAYAsPpJ7exMNgkeALK4TbN6Np9CyND0ueohDv8/s1CGmAmoZIuvmvZS X-Received: by 2002:a0c:e38c:0:b0:68c:c38c:a2e2 with SMTP id a12-20020a0ce38c000000b0068cc38ca2e2mr3883300qvl.59.1707602193846; Sat, 10 Feb 2024 13:56:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707602193; cv=pass; d=google.com; s=arc-20160816; b=FUGuFgBoD7cMvfVUrmNC+E8Fi8BUgzPwpqCmm5gFPSniNIPzYoai9RRYQpPHw2HhZp PyTRmBUmhC6Es8Rn/GeCCHsme16LB2/uuvB9yDD4NFkdKwBBDJ+eKL+PVJG3KULCY5Wq HSsAZbzY72KFPd4SbEy9kR9u3STIY0bwX+OJbFunXO5wznJabYmxHIwi+QqvZir33hAW L/vetJs/N0GKN5iFIYmJJCvgT6t8MCp7ct6U2xRz8khFle2RWEaWp45ZeyqpVhXbMHDN OzHfNciONjpzloCulh+pxKM9aXLFP+3XHf4L6JrTIy9xKvncBU/CODcCnqgLFx14icU7 jB8Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=OmNBPg3VhiKxOz/cULC4NqhIweOs07gq4ld1aCJ07ik=; fh=7bjyZSqRQDSsEkj7UtjaHzDpM4cGgbX0E/rup0wC+FA=; b=XltVcXTCFKZRq7r52AbbOTkPd0l9ID3Ris1nlAooYDuDlpa2ak+z/n6z8gycOxCmOg PG6FuHyKOMHh0vppoBo43MS9tQc8ZB3+Y98kEvcXv17r0nSFPTHKFnG80GqBfhOVUnT7 FD8apx7wj/KBgEvjd1fyvdTByhId8eadLV/1FLtMBUKBQkKX6nfCVMXB2X/Tt22imDV+ CBrVaVE2IBuzRJkLhvBrAZFWi3sCjrkHwgADWPDRH4lGmNWR2KcmprdHsaPVWMG16HRz sURFYSFTaeSUdudbTPdaTJdmpICUBOc1SoBiiiaWDomX/Wdd0NiUHjAYNysk/AM5h9kh Ucpg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="eR//btsk"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60556-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60556-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCVi6Nwt/B6RQ2iN7D5rAyDbcj0rw1eSoqpef/ZwxOyVfA2iyFjTQKacL2QS0+ZhCMPi5w8FzaTvfVo+G2yDvLaRTpauYA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id i7-20020ad45c67000000b0068caf39560dsi5369316qvh.429.2024.02.10.13.56.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:56:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60556-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="eR//btsk"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60556-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60556-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 02B601C2448B for ; Sat, 10 Feb 2024 21:55:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B6A960879; Sat, 10 Feb 2024 21:53:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eR//btsk" Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1882605B7; Sat, 10 Feb 2024 21:53:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602010; cv=none; b=bhS20jVm9PdI9ZvZkWpCfBkL8kxgNTzKwS1AeX//aCA/bCWSmSPyviDlmcq10+qqLUTcz+ERuT2+Z1UYuRx5SlyogSQ4hAS94vi5kY3bOEwXRqGyZTLNVE2wd26eV2NCRpC5nGUTsajC4K2GS0AHRuN635q2xfD11gnKKlbGRW8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602010; c=relaxed/simple; bh=j9Y4Ee2XnyCp19O67N0N+PzpLOj8tGQB3EHMYWxJ/sY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KFgYE6BfmzntkvFWN6Lxg2k+tT5tBCN4cV8scyYlZWMfHerkPQibaamHbN12yb1kBinKNyyTgYhg+eGSu0T1G4G1Q1BTcchD9oWmjZ4v7hjM1B2zl2kmBWImnPjgX6q0zLbRL+3zBT2T+62aVRe6Xt4VmnFunZtmSPuX4nZk1nk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=eR//btsk; arc=none smtp.client-ip=209.85.167.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-5116b2dbd16so1896344e87.1; Sat, 10 Feb 2024 13:53:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707602006; x=1708206806; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OmNBPg3VhiKxOz/cULC4NqhIweOs07gq4ld1aCJ07ik=; b=eR//btskc3xYMI32WmF2j4WJAmcIPQhmJyqI//tFcDwba+ucp8z4GWQgV47+xygtqS fFZHT8EUKLwbR7Fj8CGk6d3tUsupZJjIZUFNbAJ8y9Fb3kvP5elowQX+tbUsWRFE24Ir L3MW63/4TVDdpu2SFwwkisA2HjqDMtowTmonA3PJZSZgmpSR4hOt/UXycN1aDusky49k M0d8rZPyOLU/kybEk/62u757D3AklBLfqhJZfJeBcbWRUK+fDhT7vNECoE7I9ePQKVk7 UGnLUy0Dydog3j0b4rKx0taZ3iJhocu/k8CEw1nLlY8xLWCMzqiyMu04+/LwSL0sCciu /OrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707602006; x=1708206806; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OmNBPg3VhiKxOz/cULC4NqhIweOs07gq4ld1aCJ07ik=; b=tG5uMqD7hCEXB7EmIgyt+RVe/UYtAI1pPWA9BaedwFw1ZsptW4zPgoZALX+eoNfUKR eDtVNMRe+zO7X+M6SURrOKYGOarA9DTjQd1vCpRRnlzvUMvFNralitJwmoakme64GFy+ UxMZYkeBDuFAK7905ouWjKigz9LKWJ6i2OjAUWCXcorVjM5SNKY9O2H1f4PzxOzpB2aI R4JPTo29mwttlWAzbdglLxyymZF+Z9b1vDYuh4ABCQ7n1GQuLUOoGIWaGzzi+kcrm+Mm W4F/Re4+c3brF1iJCYY4PdiwxnX4ePzOejDG1nH24ugfBF9YRYDqQ/AmPV3btTtJ+Yhp aKTQ== X-Forwarded-Encrypted: i=1; AJvYcCU/cJV+MAY9aJnlWuFyA1rPChCEo2OtPxZG40cbVbSnIAPI/Xsd8i7YbymwPMxXjqDyWPhUaogZ8v0ubmRXgaY9tBYESKujdm+RpCp+0l0wvLhAG5XgA2RL0LT6G8ylnIx3ETQWdtAwYwI= X-Gm-Message-State: AOJu0YxdFtMkVYaPpKWC8yq68DWZyeZc95aL5fPfu1zLjsgAmXKjAsBi TUWaJeuJwy7Jg0//qSOpV7onLyxaFKsH/uGX9jsgdz0KrEm4GV+Y/JpcxDQr6MM= X-Received: by 2002:a05:6512:104f:b0:511:6ef0:33d1 with SMTP id c15-20020a056512104f00b005116ef033d1mr1893615lfb.13.1707602005668; Sat, 10 Feb 2024 13:53:25 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXpRR7HJZqaXevIfw6iIyhAwY/evQBQmdJ5JdA89zOvE6c8S4ZXVucky6TT2udu6PhZLAC2xaSQDSWsMwYQQVLk8uHWhGdfNmbVRA4r0suNeC6y0B/6T6+Nj2xGy9zDyUYUsymrPs9AEHHPrtp5Wk6IZ3pPdm2RkTQMCjBq+o/ED0QAhiHB55t76LI94E+zjYkdkfoLWSsh7qWVi4IHWSWSgfZyIewvuRbdRTy9sA34y+jWd2v+rpBVcpKRgQ+izYavgQLieMF8iX+4ebJV9qbDTB2D7oUhMKgABgoVGXo/FeAsiSYuAt65kbbTg5lm+afOD0Nkj6pfrhduFdWFJv3xOBudtjUiDKjI+ravAFkoCJ2NX81W1w== Received: from m2.. (89-139-223-180.bb.netvision.net.il. [89.139.223.180]) by smtp.googlemail.com with ESMTPSA id a7-20020a19ca07000000b0051189b53f93sm24005lfg.302.2024.02.10.13.53.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:53:25 -0800 (PST) From: Michael Zaidman To: chrysh@christina-quast.de, daniel.beer@igorinstitute.com, jikos@kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-serial@vger.kernel.org, ilpo.jarvinen@linux.intel.com, johan@kernel.org, gregkh@linuxfoundation.org, equinox@diac24.net, michael.zaidman@gmail.com Subject: [PATCH v1 09/19] hid-ft260: uart: wakeup device early to not lose rx data Date: Sat, 10 Feb 2024 23:51:37 +0200 Message-Id: <20240210215147.77629-10-michael.zaidman@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240210215147.77629-1-michael.zaidman@gmail.com> References: <20240210215147.77629-1-michael.zaidman@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790550677925079632 X-GMAIL-MSGID: 1790550677925079632 Waking up the ft260 device from power saving mode earlier reduces the probability of incoming data loss. Signed-off-by: Michael Zaidman --- drivers/hid/hid-ft260.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index ccd20f590720..6266e4f1100d 100644 --- a/drivers/hid/hid-ft260.c +++ b/drivers/hid/hid-ft260.c @@ -1285,8 +1285,6 @@ static int ft260_uart_change_speed(struct ft260_device *port, bool wakeup_workaraund = false; int ret; - ft260_uart_wakeup(port); - memset(&req, 0, sizeof(req)); req.report = FT260_SYSTEM_SETTINGS; @@ -1529,6 +1527,9 @@ static int ft260_uart_activate(struct tty_port *tport, struct tty_struct *tty) ft260_uart_change_speed(port, &tty->termios, NULL); clear_bit(TTY_IO_ERROR, &tty->flags); + /* Wake up the chip as early as possible to not miss incoming data */ + ft260_uart_wakeup(port); + if (port->reschedule_work) { mod_timer(&port->wakeup_timer, jiffies + msecs_to_jiffies(FT260_WAKEUP_NEEDED_AFTER_MS)); From patchwork Sat Feb 10 21:51:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Zaidman X-Patchwork-Id: 199305 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1668300dyd; Sat, 10 Feb 2024 13:56:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXLFlXrCerqe4+0e9SrOsYSDapQ35bL6GIAVbCU7USYSHnKYrT2XilSYm3MEDsO1SMYo3knVslXeOtoXysqIyPas0JzMw== X-Google-Smtp-Source: AGHT+IGqvPrnbFg//ZGigfw1QL1r0Bw4GpYjXQpMYf4CWXkEftHDZ69DMzjPt5E2v2PDvoO8elLm X-Received: by 2002:a05:620a:24d0:b0:785:ce6e:2893 with SMTP id m16-20020a05620a24d000b00785ce6e2893mr1015355qkn.12.1707602197439; Sat, 10 Feb 2024 13:56:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707602197; cv=pass; d=google.com; s=arc-20160816; b=dVRlKgQEFF45rHWEGLeZpu8XxMuTHV8W04RJZafwrdXnEr/kExtN+Mra5FdDWKKSJc TcuV/ssupS+e7xqxIuDYSnEHuAdRmDAIKQwaxRKah+nXeib4uQU83Erqw38s1R4D9VTF F1nXWxpqmqtSHa5EfcXirraV4dlHNSi/XJI0w3ROoW4QbUP9IWyWLgu8QQa5ZiDmusl5 NPIUj1+bajNejSjlcUZwb0tfzru9ce6fDuHs4mcpkv+sw01F18/9NGxpMH3nVSMx9enO LbORvW2jxdalNN11w3x9E3TVx5b1yLRpw0jnOPqJVbXE7IRtTN6CTo3vsnm7fnZ8dX3d inOQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=oCEBZkfO61YkhowePRQkJqIBYwM4+/L7NoDioaq1Xjk=; fh=Tk0kBfXtzmdir0Ppf9LEwHjU9Zq5tORJDp/08fHNIRQ=; b=vIRR7LaYI2XdeNiJTshCsFVxCdzmzys91169m2uoNQulqWDJuQ4Bh5MoeF3werfXVA 14RYBTgQySDYye2//zgLkEVG6ln1WqWPOZ/WhZuTSs0v89vRDKa3UKL+BrlPH6JtCWtv grOIPCmDVUd9i4RZ+DcHOEj9AdOUKs3uS5LW/FQnVyfagkhbDphegnQVF0wQ1cn6Poto VyIcCsHxekXwnDY8Nvd0tKtdwzcbgLt8JQJ4H9W9+3OV9y0D3YRl9u7ieOQV3RuYFju9 ArXZd5RlAmvw+KWN0KHe0dIa9LT44x2KPmsLyNdxyUO3gZgCdAv2y79imOeSxjnWgVc3 3r5w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=K95GaYks; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60557-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60557-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCWlX8dCL5lVqsHp0OT1fkSfqu5mGk0+5u5NApQ8//aBTlV6NY39v9SfltMaSn/tndzCZoHA5XOENSrlD7MBgPd6LufcAg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id az15-20020a05620a170f00b00783cd6583f7si2698383qkb.564.2024.02.10.13.56.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:56:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60557-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=K95GaYks; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60557-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60557-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 89B6E1C247A8 for ; Sat, 10 Feb 2024 21:56:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 66A7A6088D; Sat, 10 Feb 2024 21:53:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="K95GaYks" Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 25A8E605CD; Sat, 10 Feb 2024 21:53:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602011; cv=none; b=FbvPDI8cK5ognvBFYEHyJuMwOXh5Jy2FViBDl5s24bGphoqWKFeiq76CbAbqS9qloSbDFPgi0jMgjgrMN5X0lNvtI6rl6348JYcACcDnyZVDZc+vmJopx8mYMS4jhFlNNJTrtkO5EhSuRZTUWxYuuZJOwTb2/2I6ivZkntPAKLQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602011; c=relaxed/simple; bh=2HQBC1oCduA1pQkfyPQWKTxZnkT8froQM0NxJlNV7vQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HguZArN5U7T3Sdgtji2iqcdlfQxY6H1yYjzNiNDllfDjAGwcAVTMPxTj95q62i7Y7FYsEZy/zg7GBclKvdRsUTXIFpwIfrTQeGrptXMyaBxorB6ih4aOekHiExwuDYJrhemJT3qEYqOImHQzbziy279qaIjNQ1gUj+ydwfSAdGg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=K95GaYks; arc=none smtp.client-ip=209.85.208.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2d0ce22b5f3so22955021fa.1; Sat, 10 Feb 2024 13:53:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707602008; x=1708206808; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oCEBZkfO61YkhowePRQkJqIBYwM4+/L7NoDioaq1Xjk=; b=K95GaYksu40tCIzBWF+EsENOAXhkY9qU0IGPFFN+Vz57zzWfT8fJFVRsZfV4RPMnFn xuU9jkUvGVeVyh+KJcVCGZEuLAKmnKQFzJOL55iTZFy+XnkfUfNu/vdZr8Npt+2LJXik DndQOBQQORZNWNrw8WHDMfmYfvVBUqrSaZXPyz8PKpuzJlZ9miCfJhdgTv/QlToNiWVR TAwDLSJcPqNpWm06VUs3MmSs96wg4GuaTlRj8drhtQDuDMb6w4BZLhhY+LauYOiZwJhb XC+w95mvKxEXUg6dYlctFQRt/JV7M3uiDY8Ggl3BJnvGtZi6U870Ry8r2N/rm1k2/1+I Ne4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707602008; x=1708206808; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oCEBZkfO61YkhowePRQkJqIBYwM4+/L7NoDioaq1Xjk=; b=nxhXeMYEmx90RFKvwZvLvb4E9SCME8AsVvV/mSiNGJz+lvEN8SAAI9s8WcwTPpDMSA qeMWa1ewiP25WxvdeT0LoKAzUQiixqP/wYwWX5NBQYukEocFLdeyFEeK36PZE7gOFmyq 5b7WlsBq4InDNytyR8iitxXRCS+/VeYt8NuxBwgsrUizy92wQi+jZydh2DJ0ovO21oWZ /yygLYkHSL3zns0o6Dd8GT/mdZW3Kz1fOciFu7ggYK8LxUFJ7HDJZ+sb7uYIXTmS+L0Q KYp52tLORSjym1vX2Dp28KwP+1cLgxG8xeuqQ5Jv0E/GYbU5INeGo76sFII5unn6Njvm EHvg== X-Forwarded-Encrypted: i=1; AJvYcCVanm+PvCoeW4NRY81vsTZAqn1IjMU6jXDS1u4+6Rhg0H5AkFkQHnYORowdmNYAE4hTRX7Xb91bvRCn5/MNUIjl6N9URgjtNNE4xoB//GxypVWjc1RcoD/gJHgndcfhOJ8OaSmhk7Z3XSk= X-Gm-Message-State: AOJu0YyPJYZa0zsWzfw0+kUKIvX91rv2KdpIBIfVV5Wg2y2bvHs/ssZs 59uNVM90l22UspzEeAnBF8EDHmG0JvNiC50Oc3Cg2ppHvTHUxkQb X-Received: by 2002:a19:6501:0:b0:511:636f:ac29 with SMTP id z1-20020a196501000000b00511636fac29mr1426761lfb.64.1707602008134; Sat, 10 Feb 2024 13:53:28 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXK9kSfWuJsAjJtx34wlp/Sj2QLR8k0bLBY3mFY6YRkal3tGIOAusIHwEHuJ4b0DRjK/k8DiNiTwoXEQEKeNsrYxb4K6Qb17DznISY17hsFB2YrEXOpPlu46TsGxKj4DG88oiyyeywDqa1CfFcG3A9CcZ0czweZYKdXhtCfZHX8JqY6N0gZUG04HXfKa8jhly8HdBj42aSre7K4kDyErH2qOWWoapaN0DpMqWXJTZovgLrWGj/T9GmW89iInQSpxJipc7KbexFrXw9qtTQuK7R1/FxSGPzE8vLOY0VB369MNSnVQ8o54MnztpGct7H5cKEmBX7I4lwZokIjd+Ln/pf/LLilrlQX+VzoWanftkI5ypCDKKewZA== Received: from m2.. (89-139-223-180.bb.netvision.net.il. [89.139.223.180]) by smtp.googlemail.com with ESMTPSA id a7-20020a19ca07000000b0051189b53f93sm24005lfg.302.2024.02.10.13.53.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:53:27 -0800 (PST) From: Michael Zaidman To: chrysh@christina-quast.de, daniel.beer@igorinstitute.com, jikos@kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-serial@vger.kernel.org, ilpo.jarvinen@linux.intel.com, johan@kernel.org, gregkh@linuxfoundation.org, equinox@diac24.net, michael.zaidman@gmail.com Subject: [PATCH v1 10/19] hid-ft260: uart: do not configure baud rate twice Date: Sat, 10 Feb 2024 23:51:38 +0200 Message-Id: <20240210215147.77629-11-michael.zaidman@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240210215147.77629-1-michael.zaidman@gmail.com> References: <20240210215147.77629-1-michael.zaidman@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790550681678480851 X-GMAIL-MSGID: 1790550681678480851 The uart speed settings are configured twice per session: the old settings - by the ft260_uart_port_activate() and the new - by the ft260_uart_set_termios() routine. We do not need to configure the old settings per tty session since they have already been sent to the device in the probe and passed to the tty via termios in the ft260_driver_init. Removed their coonfiguration from the ft260_uart_port_activate routine. Signed-off-by: Michael Zaidman --- drivers/hid/hid-ft260.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index 6266e4f1100d..63839f02e9b5 100644 --- a/drivers/hid/hid-ft260.c +++ b/drivers/hid/hid-ft260.c @@ -1524,7 +1524,6 @@ static int ft260_uart_activate(struct tty_port *tport, struct tty_struct *tty) kfifo_reset(&port->xmit_fifo); spin_unlock(&port->write_lock); - ft260_uart_change_speed(port, &tty->termios, NULL); clear_bit(TTY_IO_ERROR, &tty->flags); /* Wake up the chip as early as possible to not miss incoming data */ From patchwork Sat Feb 10 21:51:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Zaidman X-Patchwork-Id: 199306 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1668323dyd; Sat, 10 Feb 2024 13:56:45 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVVOUz6IytL7ahJ5VJ0xqbdEHzXLlWTMtma9jz2L5/Q8p1OxU7FF6uXNUJKtz9a8lisOOlbsS+Tyz/lpv0RyLzvUiAzCg== X-Google-Smtp-Source: AGHT+IF8xu01UXRdmzrQh/8LSsFu0FXoUbAn1EaLMcy1WwPMFASITr/cd+29HVpT9MZKxnxWONHk X-Received: by 2002:a05:620a:55b5:b0:785:ce6e:28ab with SMTP id vr21-20020a05620a55b500b00785ce6e28abmr969910qkn.16.1707602205356; Sat, 10 Feb 2024 13:56:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707602205; cv=pass; d=google.com; s=arc-20160816; b=RdUIe/6ywoUGXjHrRCO0Ctqom8A84DZf95476dTXlIgAlkXdo45Dh6Ntr/QSZ6Nkuy mJSQ/3uvMyA4pPuC012iEa2wsz7S1Gt0Toom3IvCzPcdVCIO5Bh3RKvTzZWFLtICyBDx hfvI5CKRVeXK1Ax4YjavzIIY3tORgunpaqiCABdddZW3rXbyh0yCTHiNPCuuT0A1RgsX TXMG8D3hJXdbbh8ufvYuqpGDuz0VaBGaNM4/MUWMhOSzwTf/gRQ2JiY8bQatU3/+TY42 0z1FEeNaDqRWadLiMtvEz1gsfbie/1jtikgeW7TRQVm/tRbanC5eeV67bfySRB9uljSM 17lQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=CE/tMEMANhtdsJoNIgspcl6/nRhH557LKBYohiZkZ6M=; fh=uk0RYymb01xMyqCgi5BuAgBBvTRrRY3x/6NmEgMHATo=; b=QwtWxbTaJo1tadv4mdT0SkP9NS7+SVGZdphFZz94NrtxCbCqlf4vitcAyb4Bx+Atnm qXCgFjA+TpL4vlRITZDAkV4FSjJl9BPu/sh0OWULGsHG93DAfI044cLgHchSH1tpn/16 XzMGDfbvQYSoFiT3/kg9dYZv9DAcexgwgm/hzR4Z4WyLEUANYh1+miY1xl7pTUsPHw30 pQBJZLxYiiD5JQa0Z+PpgcGUVxqUQQXRlQ6InrZFZ95e7uvWXyEx/hJML//eX3JQA2ql iBRIDiXMN6Jgn2M0ZPhpgNcdKT8vhyv7DBVFWpraTLRumE+tzAtSEnjSVTJyyB1lo9r/ Mj8g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="VV/ZGUwd"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60558-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60558-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCU7jhhnbSBUmfRfOHLD9Dh17OEUqG+ihwJN2dHJF/WgxvKBORwd+OSMoTht6GPa20G5aH3vuZrJDRA6gkGOItH3nxvYhw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id z4-20020a05620a08c400b00785bdba8bc5si2509637qkz.668.2024.02.10.13.56.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:56:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60558-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="VV/ZGUwd"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60558-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60558-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 33D6E1C2300A for ; Sat, 10 Feb 2024 21:56:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0C0296089A; Sat, 10 Feb 2024 21:53:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VV/ZGUwd" Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C082660884; Sat, 10 Feb 2024 21:53:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602015; cv=none; b=NFgNgDDbhfX8lzedNIzD5wU8KMXlrDqJSsJld54Du/YGeMSO0mVg72xlsVNxx0OhoFa1wfb8m6tGMsEZNfyx/HYAmB1BV9Pk6GnuegPxJSrw+LJ0YET4u5YeArGM7hPDxu3q1ATen+zfAT6Wxa56Zdlie2JAaCx9vuMj8pet3gA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602015; c=relaxed/simple; bh=uZ/iEzHzCIhr+xNOOG6BX4XQZBvb2bh0UdKtK6p9C9Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=A4KwR/HcZkHYZ7SluVbHpAvkkTazo5+CO0xlKEk8ZsEpzgN5Eh+g6n9tQxwEU7GxErbvrzrl8A/sHYh6jzoU2AabVkHXtJpsuPCUVHOFqZG3aj679WOoeawtceA2R5QpNnAczd13lQMDJKGqOJ/+tHjV0UbL4XouHJlk8R+TPHk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VV/ZGUwd; arc=none smtp.client-ip=209.85.167.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-5116b2dbd16so1896389e87.1; Sat, 10 Feb 2024 13:53:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707602012; x=1708206812; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CE/tMEMANhtdsJoNIgspcl6/nRhH557LKBYohiZkZ6M=; b=VV/ZGUwdRZiQbR1RvL2EH/k2hiPaNhyjQ7W1WHPSDdyRfWePkUuk0YbwlD5ybLMuLk kc8rQzlCCuB058rPTXkZKTV7lxyi+o/Ob8iEskWQCSFOWVhNCjVPf52MWpANK3oPoWvH cBXCR5LVIHiaym6fjw6E6F1ACrjjl9R9RyWH49vrySZ0fMCjh/okvKgzLx9cMSjf4uP3 /qlSUD5tq8wL53uK5bF2S+inPr3xocs+vduOD8qN0kp8fVh/ft3dI8bvMWm9e8Iebshu gsBsEt3+/8W5vgFbSDDtC1vtwxV1I3aJBFk16IRPYppFNieMUsHL5i9pfDAcAuIcsTB3 D82Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707602012; x=1708206812; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CE/tMEMANhtdsJoNIgspcl6/nRhH557LKBYohiZkZ6M=; b=fRmTY0KnwmY596qwKe7dlwDv7OSyNII6URI7BXFcVv8RBBENf53k2Exm97BmePRHRe UBJzWzZTppga70wPydUuSJe2gnMTpC3epDCpBxXeYkMdtHsLvN7uztR4myjMzVh1F39u 4tpMR49QFW+9UZlU1/eF5+mFXtelkH8Sc2N6pCNbTIli9dc0sxZia5W42H/i5KuKA1ZR N0Ng0l5God3HqSHFTV/Q6Q65D1ALWkWMD9YiGwH1JHmdDQ0iktdzoznZjlhSj36Lbidk rrBQIz0l6LpSOLvFZ+INZAjFRQldIXru19VzKb5CuBfEeVCde4Lh9+1fF8yvN5JUsmtP qS9w== X-Forwarded-Encrypted: i=1; AJvYcCWb+nwvmtV4LIOVUnMID+HKwKfidZkdV+zsMPoBlAj1mSe4iA+v0xMhvAg6W6W1i7gJbiWdz8+xWMBzECyfvxIBEepQxuWRxx+Qy49lqjyk+VPl2P2PdHGpa3QgOgSWGBaisdCF3uyFjDQ= X-Gm-Message-State: AOJu0YziS/ri408HFcVJwB0ReUwO1ARv2MM1NFnlqkId1Ma63qGho+qJ CZZMxdoe06oIVIm+oYDPpqeoAcOB+ZzPYqBqYDxRCb9aHXHXE6IK X-Received: by 2002:a05:6512:7c:b0:511:889a:e3ef with SMTP id i28-20020a056512007c00b00511889ae3efmr96626lfo.5.1707602011842; Sat, 10 Feb 2024 13:53:31 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUZEqxMzhH+wqfPpTsjZqyH5h6GGyqVmixr1O7B/iLBtsEF+YAvIw12ixjWIiuXmjuH0/QuqJrZ3FkJeyChcylDHbQLSFiUutnNx6+k5JW+6Uu7RbNzl6PPsHcdeSj+2DlzsUdKlXph3xjW7SzQgdV9yS6lMmVMOCr77/07I4vpLrg4bvjQ/IHlrLpJoEL79qG1mZvz0KbSMjVcuPEILsooRZPs8ExRWVAV31yesXWukGG86K48Tvh7MkVShz113Vk/CSns5XNqoq6mueqJbcIY3NhA26ZmhWk9D5GMobBfZokHg7IwVRVIUSgkSrVJKRRcRTB+2JGqr8aW88cf/wyRRYcdtrnXDlj2NZ8MbtEzuxUTCRFcQw== Received: from m2.. (89-139-223-180.bb.netvision.net.il. [89.139.223.180]) by smtp.googlemail.com with ESMTPSA id a7-20020a19ca07000000b0051189b53f93sm24005lfg.302.2024.02.10.13.53.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:53:31 -0800 (PST) From: Michael Zaidman To: chrysh@christina-quast.de, daniel.beer@igorinstitute.com, jikos@kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-serial@vger.kernel.org, ilpo.jarvinen@linux.intel.com, johan@kernel.org, gregkh@linuxfoundation.org, equinox@diac24.net, michael.zaidman@gmail.com Subject: [PATCH v1 11/19] hid-ft260: uart: do not disable wakeup workaround twice Date: Sat, 10 Feb 2024 23:51:39 +0200 Message-Id: <20240210215147.77629-12-michael.zaidman@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240210215147.77629-1-michael.zaidman@gmail.com> References: <20240210215147.77629-1-michael.zaidman@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790550690289227407 X-GMAIL-MSGID: 1790550690289227407 The wakeup workaround is terminated twice: first in the ft260_uart_port_shutdown and then, in the ft260_uart_port_remove routine. We do not need to do it in the ft260_uart_port_remove routine since it's always called when the wakeup mechanism is inactive: 1. Upon the ft260_uart_probe failure. 2. Upon the device/driver removal. Signed-off-by: Michael Zaidman --- drivers/hid/hid-ft260.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index 63839f02e9b5..f8d4bf7e6c4f 100644 --- a/drivers/hid/hid-ft260.c +++ b/drivers/hid/hid-ft260.c @@ -1124,7 +1124,6 @@ static void ft260_uart_port_remove(struct ft260_device *port) spin_unlock(&port->write_lock); mutex_lock(&port->port.mutex); - ft260_uart_wakeup_workaraund_enable(port, false); tty_port_tty_hangup(&port->port, false); mutex_unlock(&port->port.mutex); From patchwork Sat Feb 10 21:51:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Zaidman X-Patchwork-Id: 199316 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1669517dyd; Sat, 10 Feb 2024 14:01:03 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUo6HK4OfFNH+iZJAKPajmGFf0JZJsgeNj78rKR6g73W6KZcakuIpqbVRSwTtGJOyeTduJbVVRaW5Av5A/6+Mrs9Oa3+Q== X-Google-Smtp-Source: AGHT+IHGoP7eNCUWX1k+kxoJrJaLRyCz2UiVwNGAAwCEOty4IV7MKWsdbjNWs/C1oILy0JNj6LwA X-Received: by 2002:a05:6358:ed07:b0:176:b2af:9bf2 with SMTP id hy7-20020a056358ed0700b00176b2af9bf2mr3906515rwb.15.1707602463682; Sat, 10 Feb 2024 14:01:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707602463; cv=pass; d=google.com; s=arc-20160816; b=jU/nZjBqLgC1+/mp5WT6eL+DSDPgS8XH8t+JgE3uY2ZstnccouH4464qn1WXHP4Ukj xBWiEdVdfts9xVPeWe7aaliLkp/0jHsjpjYzJEOtUU7b1+jPZg4iti1ykkb/eIRg0is5 g+yrv7a5OuJaKjj2jC0SWCkfaEUq/IjuOJQoSulJCYJTdE76K/WaqBdPMTBeb8vtkh3C X1vy5rYtaA/SAtoep4jHPNgU0qrfJ3Gf3T1vcsx1hRdL/1xJwCWup9T56MougfBxI7Z1 8i+LeXJVjf2jUkFgKJapJNzNtZ6rLM1pmq5sjnOmfICAxR/RQ3X5Ax5hIWzWniwjiO2u OUww== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=u+hI7qeo1D9gyYnUlkKG3fcFOY/MIqlDtpV0SLWt3F8=; fh=byeuC17FRFbf5DCeJLT4erjU2wrSYMn0EGgPpRxFaZ4=; b=HRS09zgamubyUkDXbij6QLOvEO3G4M6bTfV6rKIeeBFuaAeY/+vz2n7sv4fYXWEvz8 vUT6wEzckG4XycxzlzphySc0Lzm6bJTKSYh9FsgJGDQfcfMw0hGfd76rPFOpOM3Bq0nN g4xdmafieA1vDG0Bvc6k5N8UxC7hTZb4rf4Xa/h7NafHStBfQ0+cibNipslIKou9yxeJ qlzFXIerVDPy5gf2I22UFa+otARQw7uALi/aV+zCCTSDdrjgijjLuro8Un4IrGVSA9uq sC+Gn6Lcg+hhLrsch16vZaFA3Kd+rTi31mWo+C/K6sGyiOFtGnOTLyGCl2/oAbQ9E8QV bUVA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Z73ZevZk; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60559-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60559-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCXCge4MbFJ3ONtt1v9GuyGXwedgH9YC9sLtGx82kITXZHxCa0p/E32o5qqFhnEiK6/EU5K3YvD0e16abSR63t19QsCKKw== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id h7-20020a056a00170700b006e0523b2a4dsi2609475pfc.237.2024.02.10.14.01.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 14:01:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60559-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Z73ZevZk; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60559-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60559-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 8D2BFB2566C for ; Sat, 10 Feb 2024 21:56:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 94AFE60BAA; Sat, 10 Feb 2024 21:53:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Z73ZevZk" Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69CA76088F; Sat, 10 Feb 2024 21:53:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602018; cv=none; b=Vgyl4mJbsXde9782gZqudL1MTLumr4sc9TGESICQiaME83s7rltmpReYcxMEHMT0qXvuo4ddc0vsDYKLcMT0VIJ7KOA+NtT0bAJV1hYlQ9YJ7e6ubMKBssp5llbuCynF10YQ/0i9uIkp2ej0D04smi+Z1iOulWwRsxu6pZnhfII= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602018; c=relaxed/simple; bh=ySgqpJ/s17i6lGxYCSwWoimJrGRy6L5UY5mJ/EH+6yo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qEjM2ikzQ9O6H4f6SW2+Wxes7jevv5hkMgJ2tfNCDFOv4Czy6cBIzAz8mfPbP82SRC6s1084wDxhRNOHJZL/IZSMpKL8H2Ij9cC5K9a2es9m+sHdxXs7bBGm/UoCDCxxavbHGEWTZZfPR5ElAG/krHWj2TETs1RNlBQG3V9nNYA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Z73ZevZk; arc=none smtp.client-ip=209.85.167.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-5116588189aso3761049e87.1; Sat, 10 Feb 2024 13:53:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707602014; x=1708206814; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=u+hI7qeo1D9gyYnUlkKG3fcFOY/MIqlDtpV0SLWt3F8=; b=Z73ZevZkPnaY9etMA6tBndgTH5lFUNdnLEmltubNZw5GvYxhP+b0A4aYR04EiaRyn5 j1XcQAedmBCJfuxNRVM6kP6FsQO4ahlDeLpbiRHT6L0V+3pHgjL507UdKy2TqMaMQkiz jxthU+Thjew+X6xvfAEMpkNEON2xqlttskuVAgLeULxmBezbVWl/U6vAUHGs1cETls92 ucwXTl5Ocd3R0ouYkoAKAl7MVom5aenxGSE8rcaqMSJgbN+yAYuR/eQYK1d6w7tzqRMI owyN61+KdKJS0ICrjGzSwW7Z0/79+lhBSNtLrMYIm5Wu0YubxfNIIW1LFgb/+/JlZ2/E ancA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707602014; x=1708206814; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u+hI7qeo1D9gyYnUlkKG3fcFOY/MIqlDtpV0SLWt3F8=; b=AEdsS5u8YmygEbmdtZLHjs6HvJXCeeOqlic2m+i8WJZVsBB6XPNdQ7i+RqVcgGQ80f UqXrXdLZjQpuzp7i5Yu/vnhrXDNGmvVHtzL/CJWIWC7qpbpS33w7aob9e/4l7vzK5ArY LBBwil1q7ZThRdxj9sjLLaY3J47IFG6p+Obv2h6HJMItWH+eZDZvrwPbvb5mvqRjJPPN rjVBG/lGlE99pDnh/nneNFOmtVoe9e3IKk14am6J+wU0fSrrEgGefPyzkUCj887Pp9Zi FPTwXMvL1tAc+kz1xaoAhAxlGTD5bwa58986NNneYWYIAgFyrXPDMfEdWLKikU2+dcUN 1ILw== X-Forwarded-Encrypted: i=1; AJvYcCVx69Ej2nwoqiLD9fKZgGCNcE5Fe68552IwmZDKFzRirR8nKxS5p/Q4O5WIMwX7r1470hX2DW+OhRvCaz7BSkhysEdoJfMPrtW/S3f6iWbAHNBYGYqq5sZUVFhzsza6G4JLEVGxBCZQoPw= X-Gm-Message-State: AOJu0YyKa/fjECBsDfRMz5dUKMRrtkAxnklPMMmuL76bIwIliq/AJIdA Ars7hy/+GuSsSGNQVPKpzsMiyA3hHssYU8P+qB/pqOX/UiEjlLPh X-Received: by 2002:a05:6512:3ba6:b0:511:33d4:c99a with SMTP id g38-20020a0565123ba600b0051133d4c99amr2208570lfv.61.1707602014417; Sat, 10 Feb 2024 13:53:34 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCW43ztFfTUOkWc5NU3thkM0MOfULXb7jJ83SMO+SSeDMGpv3V3IZkY9SLxzB7a7HN7TM4c7+um2faE31oG7mSyztQ0Sby6B8qOVS+tcrW6HYYSMl9df0899uE43X+XfZ0hSl0qigdz6KDmHXMsxzUFw27nKZZrGf6YJNbbj+7E7g+m1zJ0XwIQDK2C3R01PlaGf9J3NcnoKEChiTc6VqAvxIum0wf/aQCbXMjt3Dq4qzpAIT1g1IHCIufJgJotH/iUOaJkimVBoZELDQiNso9wmhSWR3SNuWBYE4zmaCZKMmzMTyOgjs8+chZv6/sSNwjywYz0ek00r7h3cPtSyzMt5EodjPPURw80sgOggo07RssgAkeScUw== Received: from m2.. (89-139-223-180.bb.netvision.net.il. [89.139.223.180]) by smtp.googlemail.com with ESMTPSA id a7-20020a19ca07000000b0051189b53f93sm24005lfg.302.2024.02.10.13.53.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:53:34 -0800 (PST) From: Michael Zaidman To: chrysh@christina-quast.de, daniel.beer@igorinstitute.com, jikos@kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-serial@vger.kernel.org, ilpo.jarvinen@linux.intel.com, johan@kernel.org, gregkh@linuxfoundation.org, equinox@diac24.net, michael.zaidman@gmail.com Subject: [PATCH v1 12/19] hid-ft260: uart: use kfifo_avail for fifo write room check Date: Sat, 10 Feb 2024 23:51:40 +0200 Message-Id: <20240210215147.77629-13-michael.zaidman@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240210215147.77629-1-michael.zaidman@gmail.com> References: <20240210215147.77629-1-michael.zaidman@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790550960817798282 X-GMAIL-MSGID: 1790550960817798282 Replace uart fifo write room calculation with the kfifo_avail kernel API. Signed-off-by: Michael Zaidman --- drivers/hid/hid-ft260.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index f8d4bf7e6c4f..3d1a9ec88cb9 100644 --- a/drivers/hid/hid-ft260.c +++ b/drivers/hid/hid-ft260.c @@ -1264,7 +1264,7 @@ static unsigned int ft260_uart_write_room(struct tty_struct *tty) { struct ft260_device *port = tty->driver_data; - return FIFO_SIZE - kfifo_len(&port->xmit_fifo); + return kfifo_avail(&port->xmit_fifo); } static unsigned int ft260_uart_chars_in_buffer(struct tty_struct *tty) From patchwork Sat Feb 10 21:51:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Zaidman X-Patchwork-Id: 199307 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1668391dyd; Sat, 10 Feb 2024 13:57:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXQO27FYLT4bVx8KafV5iTNFqdsglOugxuNRQDz7jKH1djc3mG4uTbCiTEMnjIKQ8kFXZMbIsH0UeoBd2OL9+5WEP+MbQ== X-Google-Smtp-Source: AGHT+IF3HFjOAM8WoOUdgS3wFbr/A7SvANAw3rE6FLTwrRwIsqP0dMnnCaT0V5WnUX1kKfOkIrC/ X-Received: by 2002:a05:6512:ba0:b0:511:6f79:46e2 with SMTP id b32-20020a0565120ba000b005116f7946e2mr2517439lfv.64.1707602227083; Sat, 10 Feb 2024 13:57:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707602227; cv=pass; d=google.com; s=arc-20160816; b=iW3OS3ZGDbMvoMvSwGmHIvPupHHtCHW7ctixi5EFg0L6IfFdkgELJpFp5v800KHPhM tFOyCJvLbK5uTMTiLwBOFZ7p5iSJcLp9mq0S3Jq5GA3JysvClZhqhTbD6wtkk0yQhHT3 JgBlBCcmuo/2TcE0h6OkWetU2TnET+haRTeQdB0TsBWZTLqctqp00rws7M2ptX3j3bKw gPEP82UBVu4eCskPx8WQ1pf9wunOEr4Y8arE4M2tB3C4k+FNTCfuElA9rdkPBFYc1TYj 6g89LSfwihXEHenJE8zwmGPwJS704oGL/BmZeT/ZpccJ14KsPHd5xE8+o/88FPoww0BE OIhA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=9Fkky7a9eT7SBkGtnfLXUQcC5w2wTxfnvBE3rXTwzAA=; fh=0SZ0z0EH+zBPt1047112WAlr3I3RDuUdXGWQ7Ao39vA=; b=t8Xk6iBQPt8kHLVrUuYghX0L8o9atBeTQeuXIEoqj57K37ccZegEQt3v2MISCERDj2 k/R5unwlpBf6jVWu8wfnGElqGKEJGVb9rOIpZW9/d4aGqL0l4MUQVHkXGdTkLXunSeP0 xaolLRLtaoMJ/Gxz/blOB8+9rVfvUbnLVENo0MWFaJOBAxrjW5Y3dtVo05OFlVa/JG+3 g7+VvZZXuPQj/SEUYhJWKwFTURCXQg/XV/OZnraCDI5OP6+/uFX9ySOlOBnNGWMXNJCi dC7RIDKSjIOYawS5FYqb9Eo6QxUk4lroBzpw82C1TKf3ABwiOVgFadrrbLbeSdmM8l8V FqxA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=NoYi3Gv2; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60560-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60560-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCURqbXhVDq3IYfAC7q97nutc4RzG6xPWnaGbH37Ku/nUV/IQEwvoifFavvEzsPcH8iNYqo5ABg6noKTF8a6CrVZtLjFSQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id qf15-20020a1709077f0f00b00a37e76ccf87si2435034ejc.717.2024.02.10.13.57.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:57:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60560-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=NoYi3Gv2; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60560-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60560-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D7CD91F24A5D for ; Sat, 10 Feb 2024 21:57:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4A70B60DC8; Sat, 10 Feb 2024 21:53:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NoYi3Gv2" Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C285060884; Sat, 10 Feb 2024 21:53:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602020; cv=none; b=C+8VFLmLIyWSU0hIXnEjXX1/YrUg2jm+Ste2TOn5C6Q0v1TibD2AybLl4+t4W2lNaOOKHNh3aapAC2rQVED0v4/nghUai+fJj+kBzOzRmHoGwulv97qgykHr6CxEZBlmBnQY82cAdqtMNU4i/rIf+S/sGHi/uvCUpVOcDkefF7U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602020; c=relaxed/simple; bh=bxc8EJBTU97uaAgMzrUDFX/3ZhRiWUNfsRvqcbGs/6c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Rdic3ixZ/7C5ualGvZxnQkxP17nGMhRF8puwaHG9kRQEu2Ko+Y0BDZGNTG4U9xy++M2SPagdcdyBy3j+wwIcT5S9sYjFF77TtmC7UGLbxb5Cj+fS7uou2ASowjRgZEVlQDQLjFnvW6bHLtYdE4XvEWFjbTk9JGWMEeuv5THdQ0c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NoYi3Gv2; arc=none smtp.client-ip=209.85.167.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-5114b2b3b73so2465771e87.0; Sat, 10 Feb 2024 13:53:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707602017; x=1708206817; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9Fkky7a9eT7SBkGtnfLXUQcC5w2wTxfnvBE3rXTwzAA=; b=NoYi3Gv2+8slDlMv3RhL/qHd31BUlLKnVRzF+qv2auZpvD7lmwCvVUIv05HuT5SSK/ DElsuwHLJSV4OKK6H4auehMVXfNPDbblZSlrTinsTNDm+jxElpfAEQQnDl98FAgX8mEK 8lCcMg0AqTBqf4sJM8HecszL9/1NL8cTtOFEiQqEIz2jQ4PbKZwfjoCo+KrqeG4gRlBA 1jXUNElXaQaTAkxarKj2C1t6xcyOPJVmkM+CLdgbRO5zFN2SETjaxLdVty5+8o5JB1F9 jPpcWZ5/mSK411hw3LYJkLNo7zS1EHWUWGUBpXPNEGePQFNKT3IHxoNuBMqaHR9fvRHq 8vGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707602017; x=1708206817; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9Fkky7a9eT7SBkGtnfLXUQcC5w2wTxfnvBE3rXTwzAA=; b=hY/RhWEuWjRpQ1iwZ/343kpYidMVeTaiaBuluyi45BOAdIvfoThNY6B0dz7MPLiMhf U+qynUeq6FiWyvP6v6c+wzLzEM9Re005gNvO4d0ZZJJXw1ywA0OF9T5SwyquutE3QQIG 6lXiEtifpspja6Fed8R80RmgOmAiAB1YMnxtNClYKp202EhmixtY8lvJluQLDn9eBdwo EnzB5bBMNXH4jtEhBZ8JnBKLdtUAETE7zPwklKDo4sR726Xr8nJ3XTwahW1yRe5b7oMI NkT+boRooISU6eWDFkQy13a4G4Iv5nMXuIkKR5uIQXknaKDj1QddsRvlG3UsYI7qiStt iBpw== X-Forwarded-Encrypted: i=1; AJvYcCWlDUnsa9pK9pyz7Mr4d11xvyi4uwm+XO6tswwbZ03Z2Fsdhga3GkTY/3SU/U4TVaABLSOhvDH3AQjMbXkHkaAvOi0T9Mm2wQfSEJSupH8SEoTanNOm5/VXYI6mgxnNjWSQe2QVJ1RRbLo= X-Gm-Message-State: AOJu0YzHBPJWM5ta7d6P/b1cgnOAaJiz23dHIpu3x+3BS3jl4JAFtLkE 3fIBUZcXvKGzkugXLnyDrQXs7ejwD5v+jgZhWZWNQ5dLHmpjOdyP X-Received: by 2002:a05:6512:3994:b0:511:76e6:e0f9 with SMTP id j20-20020a056512399400b0051176e6e0f9mr2693656lfu.20.1707602016878; Sat, 10 Feb 2024 13:53:36 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVLG+/0Sw+CxnHF8MX7j3iHqX+zPcGBaAxanzd5wx681sDEwNPArqysdIikDA+56j+wQl8/Sp1Psjc4tku6NgNJXyPeK4odAhY/2KvLaM3D1JWWFH8hASgDdsRMwus1FgLFjXCr1uXkNKMTGvNsDMpqxRbvIoMGCv+p89+cVcECbc66j6cTgrfodOLjs0Jy90IZBE5JfiaXqwJpZ64TYXh2EVTAc0VmeB9MVGKIjACkQuGb6TjsToPO7k3xihSiHqWsyvaafyzDfdC+bP4WvoiuU/J3OITE0ShldqBjCYDfVIjDKPKi563wMRSZR8W4E4zkW23r5K8ojposWyFg9M6U281Qui9SteWaLVDWmLoly9Pch5SGGw== Received: from m2.. (89-139-223-180.bb.netvision.net.il. [89.139.223.180]) by smtp.googlemail.com with ESMTPSA id a7-20020a19ca07000000b0051189b53f93sm24005lfg.302.2024.02.10.13.53.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:53:36 -0800 (PST) From: Michael Zaidman To: chrysh@christina-quast.de, daniel.beer@igorinstitute.com, jikos@kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-serial@vger.kernel.org, ilpo.jarvinen@linux.intel.com, johan@kernel.org, gregkh@linuxfoundation.org, equinox@diac24.net, michael.zaidman@gmail.com Subject: [PATCH v1 13/19] hid-ft260: improve usb interface type detection logic Date: Sat, 10 Feb 2024 23:51:41 +0200 Message-Id: <20240210215147.77629-14-michael.zaidman@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240210215147.77629-1-michael.zaidman@gmail.com> References: <20240210215147.77629-1-michael.zaidman@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790550712821008848 X-GMAIL-MSGID: 1790550712821008848 This commit simplifies the ft260_get_interface_type routine by replacing the ft260_is_serial with iface_type and making use of its return value as it's in the mainline ft260 driver code. Signed-off-by: Michael Zaidman --- drivers/hid/hid-ft260.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index 3d1a9ec88cb9..9ecd91d173d2 100644 --- a/drivers/hid/hid-ft260.c +++ b/drivers/hid/hid-ft260.c @@ -309,7 +309,7 @@ struct ft260_device { struct i2c_adapter adap; struct hid_device *hdev; - bool ft260_is_serial; + int iface_type; struct list_head device_list; /* tty_port lifetime is equal to device lifetime */ @@ -889,28 +889,25 @@ static int ft260_get_interface_type(struct hid_device *hdev, struct ft260_device ft260_dbg("i2c_enable: 0x%02x\n", cfg.i2c_enable); ft260_dbg("uart_mode: 0x%02x\n", cfg.uart_mode); - dev->ft260_is_serial = false; dev->power_saving_en = cfg.power_saving_en; switch (cfg.chip_mode) { case FT260_MODE_ALL: case FT260_MODE_BOTH: - if (interface == 1) { + if (interface == 1) ret = FT260_IFACE_UART; - dev->ft260_is_serial = true; - } else { + else ret = FT260_IFACE_I2C; - } break; case FT260_MODE_UART: ret = FT260_IFACE_UART; - dev->ft260_is_serial = true; break; case FT260_MODE_I2C: ret = FT260_IFACE_I2C; break; } + dev->iface_type = ret; return ret; } @@ -1713,15 +1710,12 @@ static int ft260_probe(struct hid_device *hdev, const struct hid_device_id *id) mutex_init(&dev->lock); init_completion(&dev->wait); - if (!dev->ft260_is_serial) { + if (ret == FT260_IFACE_I2C) ret = ft260_i2c_probe(hdev, dev); - if (ret) - goto err_hid_close; - } else { + else ret = ft260_uart_probe(hdev, dev); - if (ret) - goto err_hid_close; - } + if (ret) + goto err_hid_close; return 0; @@ -1742,7 +1736,7 @@ static void ft260_remove(struct hid_device *hdev) if (!dev) return; - if (dev->ft260_is_serial) { + if (dev->iface_type == FT260_IFACE_UART) { // FIXME: cancel_work_sync(&dev->wakeup_work); tty_port_unregister_device(&dev->port, ft260_tty_driver, From patchwork Sat Feb 10 21:51:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Zaidman X-Patchwork-Id: 199308 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1668548dyd; Sat, 10 Feb 2024 13:57:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVabOpdsY3M0JkyIgVrFJSIwNPlfLzLJD5ImgNfoQ08CkRwpAIrrEvpgnHrlI5Oi7+UoEfmCmwnf+as6zwemB5W79u+cA== X-Google-Smtp-Source: AGHT+IEaS2o47ctWnEHfSZ4M3OuNWKIs+BPl2rImT3RJfRPLs0vXemU5gPsJ0n/9aO0oGsMrnYif X-Received: by 2002:a05:620a:6608:b0:785:d100:ae4 with SMTP id qf8-20020a05620a660800b00785d1000ae4mr130548qkn.72.1707602270932; Sat, 10 Feb 2024 13:57:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707602270; cv=pass; d=google.com; s=arc-20160816; b=THkqQaCyYNO4Brav6epmg4bRE0KfvMRcH2JEwplcUYt725JrSxgwMVFDRmAh+T4QKI SlrrQz0NtcR+eT2M5z+Dp64wgu/mxOOgiZz69IJUrv4CipaxKKRORW5J/uWzEILHABru dpJ1eR1eif7nN0dGLBkvjE3XeExKKfA9NiLJun6NP3I/Aky9tl7MzYoAlq9yaXbbCqA5 9CuEBY+3/nQTnj9FBoPho7dyR1UowlGhVHfSetbr0XO9DOGBQT+uBZz64DH6PSF2GXAS nxXtjZzomhVIAygOvkMZTQZLZsf696TNZ89hHjdZu8PaCYNu/HNqkkuq5CvxL+rRlQFz WM/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=1eIEXGPhrkeg0Pp1+p0C7tV+cMPOV+tqxXjLVVI0E5Y=; fh=zl2X4xOy5Ok0WNlBZ0uAeAO9kh/IfXlImXoOgVv4rY0=; b=ecYxLTfSnzd3sAJtG9zW46Uas4ia2LKzFuYV6jrHwJJGp7id9f5BboTUOOf05gxsJF oxjpByZIN295MxqzBW2exkb7EfK12tQfIfaD8Sw4ebvVoT9M3EWzMVnhAR4oN1bgg36l uSEiyfWGlyorAnI51h50DlrbmeKVeWzppxRQLf0cJg+c4SMosd+7JjmaH4r8YNH6FX2X Olnp4n2g46FSVajd1BRVYuwZRn2zMC70HBpa9jyOSL3GDZoUngPDzbn8p+LGiTxUYhr1 9a3f0swnVFQmlqshSOqFozgi0TqGh9o1TCBqkqSf1kwtR2gNFmPSAxlw2P1rdw/aWjP+ ajdQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=EUylk4x5; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60561-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60561-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCWvFQZV4LA9c+0p7d3YjAKXkkAlZ9bmls/xIQYwj1j73jQ1U9VBB0f0lvo/vUlpuJE8Ld2TnIp/h7qyPCQDt4by01KKjg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id j9-20020a05620a410900b00785ca729fb1si1667399qko.539.2024.02.10.13.57.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:57:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60561-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=EUylk4x5; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60561-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60561-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 938D81C20F2F for ; Sat, 10 Feb 2024 21:57:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9005A60ED9; Sat, 10 Feb 2024 21:53:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EUylk4x5" Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8893B60BBB; Sat, 10 Feb 2024 21:53:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602023; cv=none; b=cCfOM+KR8aXX9J+agykmOOhLYn2R5iGi7//mi5PKBht7iTvDRRL1gNCiEHLTTy28YifSijUmjQautxZbTwZ/dJ/ippxFuQMX8jvNRu6C/4A05WHm9JTgaQVBlqgmcBbP1pZOivXg0j9qFUvrs6jZaNQGSczbsLFSCF9hwLRLZ8g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602023; c=relaxed/simple; bh=cZVvMaKKvGT8H+94FmxDb3EJDNVeQNc3Rx6t6Z+hAow=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XMJGdo0TlDa/fRFBDVC7tvG40bISRNkvWyeWn93uviFrcuV7J8ZXhgapmqloF0dtHMm2yxMaNi4hEHWohjh1LsY4mL8ZeYgmcQdHc0sWZow6vUdp062W6+vctT7eojwr8b86Lqxyh9YdyCHgnqxid0hF4ytQLi5iJL6eTRP4V7Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EUylk4x5; arc=none smtp.client-ip=209.85.167.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-5114cd44f6aso2779353e87.1; Sat, 10 Feb 2024 13:53:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707602019; x=1708206819; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1eIEXGPhrkeg0Pp1+p0C7tV+cMPOV+tqxXjLVVI0E5Y=; b=EUylk4x54yptqEM81B2EHKlIeQ/OokY+2lvNHPekjN1CJzASYqpvn4bv4zKoCLSrNf UUQRhO/QBumd4OMJRhyq9rtn2zoIMZnc+a++epZaAfqqswgKYWoiaHvwtpVKGRvG2Peu vhShh6CrXBojbX4rBSFGEuz8w5dg8BHc4vqijOlkCo2o0kl1icEVO/1wgM73nYAfvzd1 nac7g7Aq8P16mXeqZsqRD92N1IdX2e6nZJsssCE3wBpU+tE5bmkC42ecV5eBqSEbpQ+r cSoUxp//NcKAiuWp2EkKIUeQhQRnwPyy3JA3iFOixdJCItdwIX0DagRg5FAd1qsZcMyH eolQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707602019; x=1708206819; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1eIEXGPhrkeg0Pp1+p0C7tV+cMPOV+tqxXjLVVI0E5Y=; b=A48u5n76Ja34p6suMSWc2woR4eeekMeL+vKY/sJv2rm0Hmmhwn0QV2xUqhZvN+xEpy x8SXt6ahmdZyu4kkDuYAtKyjBIfOrnxeyMt7qJJAX9qFTp1tZBmFZ2770LxlFuX1RaOO QfgQV3dK+EtKsyQSeFARFM2eEujEz8CPSSKWOeXLS1oFxlYHqg2hCg9HsEBw4L5bI2B0 MBULZEToiEbYY8lRl5339UL6ZqDYaWfbrS4+2qk+Q4F5pnikMXRMmSQg3PsJG7UETL0P p77ZaxH3kixwdgyw/g9+RfdW7nzAnm8cvijJwejcscKIxufQyzKyAHS+7oY/QQ/j2qQp d58w== X-Forwarded-Encrypted: i=1; AJvYcCWobNLrEHWvTABbY6RP40pKP7dTfB2oGTUFN7X0qwWTi7XXoMk/atm/IcqSxk+qlfmzJTxaVHDrCna1WWKfnq925M29E9mJQiTbaqttVYSsw4EUvXijHwTwdAz+SsRUNvZpADX7nTVX23o= X-Gm-Message-State: AOJu0YxzN3VYj2Wl42J2drd1tvI17oU4SHtBBNK/W4v4CIU09eqSk3yt gNANYcwjM15FEKGkDkW9RjXNVyHGnwRywfAEwFDdwdYfSa30SkVL X-Received: by 2002:a05:6512:3048:b0:511:676e:a491 with SMTP id b8-20020a056512304800b00511676ea491mr1972191lfb.18.1707602019319; Sat, 10 Feb 2024 13:53:39 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUvRi5uzJLSskOIko9QGOnZpuVNvIseaGO4QAfB6uKQF2/fKZHlXTjO6/kX/uGCMD9n1Yjs2JJaztKem7oDvv7ZkIUrcu8p5OsrhTAgB3SUzCfU4D5ucQIApVQLSrhN00YBHYE+TwM0kIVygeP5k6fht0Q+geUsWlWc4gBK9e63QE7aWJlmnXzLQwHArrpBLct1QJiYGQcFkVNAyHaW9KbVLHpiUHIrrm8vdpZjytPaSVtRNljSNtxfb5zi2iyckTbMRVJYBYYRNeMg6Bij/sA9WShQddB0t+umIx9PSOh28hHfWZfIC4/nUjric6zDVZw7+DYrK+0RQVmzPHo9K+i5BASt0i8FxvoDBT64CIVR7za5fzO0Uw== Received: from m2.. (89-139-223-180.bb.netvision.net.il. [89.139.223.180]) by smtp.googlemail.com with ESMTPSA id a7-20020a19ca07000000b0051189b53f93sm24005lfg.302.2024.02.10.13.53.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:53:39 -0800 (PST) From: Michael Zaidman To: chrysh@christina-quast.de, daniel.beer@igorinstitute.com, jikos@kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-serial@vger.kernel.org, ilpo.jarvinen@linux.intel.com, johan@kernel.org, gregkh@linuxfoundation.org, equinox@diac24.net, michael.zaidman@gmail.com Subject: [PATCH v1 14/19] hid-ft260: uart: cleanup and refactoring Date: Sat, 10 Feb 2024 23:51:42 +0200 Message-Id: <20240210215147.77629-15-michael.zaidman@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240210215147.77629-1-michael.zaidman@gmail.com> References: <20240210215147.77629-1-michael.zaidman@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790550759091049547 X-GMAIL-MSGID: 1790550759091049547 - Cleanup printouts and comments. - Refactor to adjust to the module's style. - Replace the kfifo_in_locked/kfifo_out_locked with kfifo_in_spinlocked/kfifo_out_spinlocked since the former may be dropped in the future. Signed-off-by: Michael Zaidman --- drivers/hid/hid-ft260.c | 148 ++++++++++++++++++---------------------- 1 file changed, 66 insertions(+), 82 deletions(-) diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index 9ecd91d173d2..1c113f735524 100644 --- a/drivers/hid/hid-ft260.c +++ b/drivers/hid/hid-ft260.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * hid-ft260.c - FTDI FT260 USB HID to I2C host bridge + * FTDI FT260 USB HID to I2C/UART host bridge * * Copyright (c) 2021, Michael Zaidman * @@ -18,11 +18,7 @@ #include #include #include -#include /* Needed for cpu_to_le16, le16_to_cpu */ - -#define UART_COUNT_MAX 4 /* Number of UARTs this driver can handle */ -#define FIFO_SIZE 256 -#define TTY_WAKEUP_WATERMARK (FIFO_SIZE / 2) +#include #ifdef DEBUG static int ft260_debug = 1; @@ -148,7 +144,7 @@ enum { FT260_FLAG_START_STOP_REPEATED = 0x07, }; -/* Return values for ft260_get_interface_type func */ +/* USB interface type values */ enum { FT260_IFACE_NONE, FT260_IFACE_I2C, @@ -250,18 +246,19 @@ struct ft260_input_report { } __packed; /* UART reports */ + struct ft260_uart_write_request_report { u8 report; /* FT260_UART_REPORT */ u8 length; /* data payload length */ u8 data[FT260_WR_UART_DATA_MAX]; /* data payload */ } __packed; -struct ft260_configure_uart_request { +struct ft260_configure_uart_request_report { u8 report; /* FT260_SYSTEM_SETTINGS */ u8 request; /* FT260_SET_UART_CONFIG */ u8 flow_ctrl; /* 0: OFF, 1: RTS_CTS, 2: DTR_DSR */ /* 3: XON_XOFF, 4: No flow ctrl */ - /* The baudrate field is unaligned: */ + /* The baudrate field is unaligned */ __le32 baudrate; /* little endian, 9600 = 0x2580, 19200 = 0x4B00 */ u8 data_bit; /* 7 or 8 */ u8 parity; /* 0: no parity, 1: odd, 2: even, 3: high, 4: low */ @@ -296,7 +293,11 @@ enum { FT260_CFG_BAUD_MAX = 12000000, }; -#define FT260_UART_EN_PW_SAVE_BAUD 4800 +#define FT260_UART_EN_PW_SAVE_BAUD (4800) + +#define UART_COUNT_MAX (4) /* Number of supported UARTs */ +#define XMIT_FIFO_SIZE (256) +#define TTY_WAKEUP_WATERMARK (XMIT_FIFO_SIZE / 2) static const struct hid_device_id ft260_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_FUTURE_TECHNOLOGY, @@ -308,23 +309,18 @@ MODULE_DEVICE_TABLE(hid, ft260_devices); struct ft260_device { struct i2c_adapter adap; struct hid_device *hdev; - int iface_type; struct list_head device_list; - - /* tty_port lifetime is equal to device lifetime */ struct tty_port port; + /* tty port index */ unsigned int index; struct kfifo xmit_fifo; - /* write_lock: lock to serialize access to xmit fifo */ - spinlock_t write_lock; + spinlock_t xmit_fifo_lock; struct uart_icount icount; - struct timer_list wakeup_timer; struct work_struct wakeup_work; bool reschedule_work; bool power_saving_en; - struct completion wait; struct mutex lock; u8 i2c_wr_buf[FT260_REPORT_MAX_LEN]; @@ -337,8 +333,7 @@ struct ft260_device { }; static int ft260_hid_feature_report_get(struct hid_device *hdev, - unsigned char report_id, u8 *data, - size_t len) + u8 report_id, u8 *data, size_t len) { u8 *buf; int ret; @@ -467,8 +462,6 @@ static int ft260_hid_output_report_check_status(struct ft260_device *dev, ret = ft260_hid_output_report(hdev, data, len); if (ret < 0) { - hid_dbg(hdev, "%s: failed to start transfer, ret %d\n", - __func__, ret); ft260_i2c_reset(hdev); return ret; } @@ -579,6 +572,8 @@ static int ft260_smbus_write(struct ft260_device *dev, u8 addr, u8 cmd, rep->report, addr, cmd, rep->length, len); ret = ft260_hid_output_report_check_status(dev, (u8 *)rep, len); + if (ret < 0) + hid_err(dev->hdev, "%s: failed with %d\n", __func__, ret); return ret; } @@ -682,8 +677,7 @@ static int ft260_i2c_write_read(struct ft260_device *dev, struct i2c_msg *msgs) else read_off = *msgs[0].buf; - ft260_dbg("%s: off %#x rlen %d wlen %d\n", __func__, - read_off, rd_len, wr_len); + ft260_dbg("off %#x rlen %d wlen %d\n", read_off, rd_len, wr_len); } ret = ft260_i2c_write(dev, addr, msgs[0].buf, wr_len, @@ -1051,9 +1045,6 @@ static const struct attribute_group ft260_attr_group = { } }; -/*** - * START Serial dev part - */ static DEFINE_MUTEX(ft260_uart_list_lock); static LIST_HEAD(ft260_uart_device_list); @@ -1065,7 +1056,7 @@ static void ft260_uart_wakeup_workaraund_enable(struct ft260_device *port, if (port->power_saving_en) { port->reschedule_work = enable; ft260_dbg("%s wakeup workaround", - enable ? "Activate" : "Deactivate"); + enable ? "activate" : "deactivate"); } } @@ -1085,8 +1076,8 @@ static int ft260_uart_add_port(struct ft260_device *port) int index = 0, ret = 0; struct ft260_device *dev; - spin_lock_init(&port->write_lock); - if (kfifo_alloc(&port->xmit_fifo, FIFO_SIZE, GFP_KERNEL)) + spin_lock_init(&port->xmit_fifo_lock); + if (kfifo_alloc(&port->xmit_fifo, XMIT_FIFO_SIZE, GFP_KERNEL)) return -ENOMEM; mutex_lock(&ft260_uart_list_lock); @@ -1116,9 +1107,9 @@ static void ft260_uart_port_remove(struct ft260_device *port) list_del(&port->device_list); mutex_unlock(&ft260_uart_list_lock); - spin_lock(&port->write_lock); + spin_lock(&port->xmit_fifo_lock); kfifo_free(&port->xmit_fifo); - spin_unlock(&port->write_lock); + spin_unlock(&port->xmit_fifo_lock); mutex_lock(&port->port.mutex); tty_port_tty_hangup(&port->port, false); @@ -1127,7 +1118,7 @@ static void ft260_uart_port_remove(struct ft260_device *port) ft260_uart_port_put(port); } -static struct ft260_device *ft260_uart_port_get(unsigned int index) +static struct ft260_device *ft260_uart_port_get(int index) { struct ft260_device *port; @@ -1191,20 +1182,18 @@ static int ft260_uart_transmit_chars(struct ft260_device *port) rep->report = FT260_UART_DATA_REPORT_ID(len); rep->length = len; - len = kfifo_out_locked(xmit, rep->data, len, &port->write_lock); + len = kfifo_out_spinlocked(xmit, rep->data, len, &port->xmit_fifo_lock); ret = ft260_hid_output_report(hdev, (u8 *)rep, len + sizeof(*rep)); - if (ret < 0) { - hid_err(hdev, "Failed to start transfer, ret %d\n", ret); + if (ret < 0) goto tty_out; - } data_len -= len; port->icount.tx += len; } while (data_len > 0); len = kfifo_len(xmit); - if ((FIFO_SIZE - len) > TTY_WAKEUP_WATERMARK) + if ((XMIT_FIFO_SIZE - len) > TTY_WAKEUP_WATERMARK) tty_wakeup(tty); ret = 0; @@ -1214,15 +1203,14 @@ static int ft260_uart_transmit_chars(struct ft260_device *port) return ret; } -static int ft260_uart_receive_chars(struct ft260_device *port, - u8 *data, u8 length) +static int ft260_uart_receive_chars(struct ft260_device *port, u8 *data, u8 length) { - struct hid_device *hdev = port->hdev; int ret; ret = tty_insert_flip_string(&port->port, data, length); if (ret != length) - hid_dbg(hdev, "%d char not inserted to flip buffer\n", length - ret); + ft260_dbg("%d char not inserted to flip buf\n", length - ret); + port->icount.rx += ret; if (ret) @@ -1231,27 +1219,25 @@ static int ft260_uart_receive_chars(struct ft260_device *port, return ret; } -static int ft260_uart_write(struct tty_struct *tty, const unsigned char *buf, - int count) +static int ft260_uart_write(struct tty_struct *tty, const u8 *buf, int cnt) { struct ft260_device *port = tty->driver_data; - struct hid_device *hdev = port->hdev; - int len, ret; + int len, ret, diff; - len = kfifo_in_locked(&port->xmit_fifo, buf, count, &port->write_lock); - ft260_dbg("count: %d, len: %d", count, len); + len = kfifo_in_spinlocked(&port->xmit_fifo, buf, cnt, &port->xmit_fifo_lock); + ft260_dbg("count: %d, len: %d", cnt, len); ret = ft260_uart_transmit_chars(port); if (ret < 0) { - hid_dbg(hdev, "Failed to transmit chars: %d\n", ret); + ft260_dbg("failed to transmit %d\n", ret); return 0; } ret = kfifo_len(&port->xmit_fifo); if (ret > 0) { - hid_dbg(hdev, "Failed to all kfifo data bytes\n"); - ft260_dbg("return: %d", len - ret); - return len - ret; + diff = len - ret; + ft260_dbg("failed to send %d out of %d bytes\n", diff, len); + return diff; } return len; @@ -1277,7 +1263,7 @@ static int ft260_uart_change_speed(struct ft260_device *port, { struct hid_device *hdev = port->hdev; unsigned int baud; - struct ft260_configure_uart_request req; + struct ft260_configure_uart_request_report req; bool wakeup_workaraund = false; int ret; @@ -1292,7 +1278,7 @@ static int ft260_uart_change_speed(struct ft260_device *port, break; case CS5: case CS6: - hid_err(hdev, "Invalid data bit size, setting to default (8 bit)\n"); + hid_err(hdev, "invalid data bit size, setting a default\n"); req.data_bit = FT260_CFG_DATA_BITS_8; termios->c_cflag &= ~CSIZE; termios->c_cflag |= CS8; @@ -1317,7 +1303,7 @@ static int ft260_uart_change_speed(struct ft260_device *port, if (baud == 0 || baud < FT260_CFG_BAUD_MIN || baud > FT260_CFG_BAUD_MAX) { struct tty_struct *tty = tty_port_tty_get(&port->port); - hid_err(hdev, "Invalid baud rate %d\n", baud); + hid_err(hdev, "invalid baud rate %d\n", baud); baud = 9600; tty_encode_baud_rate(tty, baud, baud); tty_kref_put(tty); @@ -1335,7 +1321,7 @@ static int ft260_uart_change_speed(struct ft260_device *port, else req.flow_ctrl = FT260_CFG_FLOW_CTRL_OFF; - ft260_dbg("Configured termios: flow control: %d, baudrate: %d, ", + ft260_dbg("configured termios: flow control: %d, baudrate: %d, ", req.flow_ctrl, baud); ft260_dbg("data_bit: %d, parity: %d, stop_bit: %d, breaking: %d\n", req.data_bit, req.parity, @@ -1346,7 +1332,7 @@ static int ft260_uart_change_speed(struct ft260_device *port, ret = ft260_hid_feature_report_set(hdev, (u8 *)&req, sizeof(req)); if (ret < 0) - hid_err(hdev, "ft260_hid_feature_report_set failed: %d\n", ret); + hid_err(hdev, "failed to change termios: %d\n", ret); return ret; } @@ -1396,8 +1382,8 @@ static int ft260_uart_proc_show(struct seq_file *m, void *v) { int i; - seq_printf(m, "ft260 info:1.0 driver%s%s revision:%s\n", - "", "", ""); + seq_printf(m, "ft260 info:1.0 driver%s%s revision:%s\n", "", "", ""); + for (i = 0; i < UART_COUNT_MAX; i++) { struct ft260_device *port = ft260_uart_port_get(i); @@ -1452,7 +1438,8 @@ static const struct tty_operations ft260_uart_ops = { .get_icount = ft260_uart_get_icount, }; -/* The FT260 has a "power saving mode" that causes the device to switch +/* + * The FT260 has a "power saving mode" that causes the device to switch * to a 30 kHz oscillator if there's no activity for 5 seconds. * Unfortunately, this mode can only be disabled by reprogramming * internal fuses, which requires an additional programming voltage. @@ -1476,16 +1463,14 @@ static void ft260_uart_start_wakeup(struct timer_list *t) static void ft260_uart_wakeup(struct ft260_device *dev) { - struct ft260_get_chip_version_report version; + struct ft260_get_chip_version_report ver; int ret; if (dev->reschedule_work) { ret = ft260_hid_feature_report_get(dev->hdev, FT260_CHIP_VERSION, - (u8 *)&version, sizeof(version)); + (u8 *)&ver, sizeof(ver)); if (ret < 0) - hid_err(dev->hdev, - "%s: failed to start transfer, ret %d\n", - __func__, ret); + hid_err(dev->hdev, "%s: failed with %d\n", __func__, ret); } } @@ -1497,7 +1482,7 @@ static void ft260_uart_do_wakeup(struct work_struct *work) ft260_uart_wakeup(dev); } -static void ft260_uart_shutdown(struct tty_port *tport) +static void ft260_uart_port_shutdown(struct tty_port *tport) { struct ft260_device *port = container_of(tport, struct ft260_device, port); @@ -1505,7 +1490,7 @@ static void ft260_uart_shutdown(struct tty_port *tport) ft260_uart_wakeup_workaraund_enable(port, false); } -static int ft260_uart_activate(struct tty_port *tport, struct tty_struct *tty) +static int ft260_uart_port_activate(struct tty_port *tport, struct tty_struct *tty) { struct ft260_device *port = container_of(tport, struct ft260_device, port); @@ -1516,9 +1501,9 @@ static int ft260_uart_activate(struct tty_port *tport, struct tty_struct *tty) */ set_bit(TTY_IO_ERROR, &tty->flags); - spin_lock(&port->write_lock); + spin_lock(&port->xmit_fifo_lock); kfifo_reset(&port->xmit_fifo); - spin_unlock(&port->write_lock); + spin_unlock(&port->xmit_fifo_lock); clear_bit(TTY_IO_ERROR, &tty->flags); @@ -1542,8 +1527,8 @@ static void ft260_uart_port_destroy(struct tty_port *tport) } static const struct tty_port_operations ft260_uart_port_ops = { - .shutdown = ft260_uart_shutdown, - .activate = ft260_uart_activate, + .shutdown = ft260_uart_port_shutdown, + .activate = ft260_uart_port_activate, .destruct = ft260_uart_port_destroy, }; @@ -1595,7 +1580,7 @@ static int ft260_i2c_probe(struct hid_device *hdev, struct ft260_device *dev) static int ft260_uart_probe(struct hid_device *hdev, struct ft260_device *dev) { - struct ft260_configure_uart_request req; + struct ft260_configure_uart_request_report req; int ret; struct device *devt; @@ -1623,10 +1608,10 @@ static int ft260_uart_probe(struct hid_device *hdev, struct ft260_device *dev) ret = PTR_ERR(devt); goto err_register_tty; } - hid_info(hdev, "Registering device /dev/%s%d\n", + hid_info(hdev, "registering device /dev/%s%d\n", ft260_tty_driver->name, dev->index); - /* Send Feature Report to Configure FT260 as UART 9600-8-N-1 */ + /* Configure UART to 9600n8 */ req.report = FT260_SYSTEM_SETTINGS; req.request = FT260_SET_UART_CONFIG; req.flow_ctrl = FT260_CFG_FLOW_CTRL_NONE; @@ -1638,8 +1623,7 @@ static int ft260_uart_probe(struct hid_device *hdev, struct ft260_device *dev) ret = ft260_hid_feature_report_set(hdev, (u8 *)&req, sizeof(req)); if (ret < 0) { - hid_err(hdev, "ft260_hid_feature_report_set failed: %d\n", - ret); + hid_err(hdev, "failed to configure uart: %d\n", ret); goto err_hid_report; } @@ -1660,9 +1644,9 @@ static int ft260_probe(struct hid_device *hdev, const struct hid_device_id *id) if (!hid_is_usb(hdev)) return -EINVAL; - - /* We cannot used devm_kzalloc here, because port has to survive until - * destroy function call + /* + * We cannot use devm_kzalloc here because the port has to survive + * until destroy function call. */ dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (!dev) { @@ -1742,7 +1726,7 @@ static void ft260_remove(struct hid_device *hdev) tty_port_unregister_device(&dev->port, ft260_tty_driver, dev->index); ft260_uart_port_remove(dev); - /* dev still needed, so we will free it in _destroy func */ + /* dev is still needed, so we will free it in _destroy func */ } else { sysfs_remove_group(&hdev->dev.kobj, &ft260_attr_group); i2c_del_adapter(&dev->adap); @@ -1781,7 +1765,7 @@ static int ft260_raw_event(struct hid_device *hdev, struct hid_report *report, return 0; } else if (xfer->length > FT260_RD_DATA_MAX) { - hid_err(hdev, "Received data too long (%d)\n", xfer->length); + hid_err(hdev, "received data too long (%d)\n", xfer->length); return -EBADR; } else if (xfer->report >= FT260_UART_REPORT_MIN && xfer->report <= FT260_UART_REPORT_MAX) { @@ -1830,7 +1814,7 @@ static int __init ft260_driver_init(void) goto err_reg_driver; } - ret = hid_register_driver(&(ft260_driver)); + ret = hid_register_driver(&ft260_driver); if (ret) { pr_err("hid_register_driver failed: %d\n", ret); goto err_reg_hid; @@ -1848,7 +1832,7 @@ static int __init ft260_driver_init(void) static void __exit ft260_driver_exit(void) { - hid_unregister_driver(&(ft260_driver)); + hid_unregister_driver(&ft260_driver); tty_unregister_driver(ft260_tty_driver); tty_driver_kref_put(ft260_tty_driver); } From patchwork Sat Feb 10 21:51:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Zaidman X-Patchwork-Id: 199317 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1669972dyd; Sat, 10 Feb 2024 14:02:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IFY0tN8RtQu2VyQs2YZqGroszYazmfIWxHKALHEBkhkLFn0Z5+toz7Mox0+QO6Rbjfon03v X-Received: by 2002:aa7:85c6:0:b0:6db:b355:892d with SMTP id z6-20020aa785c6000000b006dbb355892dmr3091969pfn.2.1707602532265; Sat, 10 Feb 2024 14:02:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707602532; cv=pass; d=google.com; s=arc-20160816; b=HDCNsh+TKMHu5m+psDN0mAhnSaSBSeJ4j1T2escy+fle7DOYZR9wrjIXLYga6QbsFb J3q16InxoDIjY+H2adqJDsDYF0nlmZjuMdCIAG7M6V0POHaAW5xfeiM23L2/63RFyzTB O0U1DAzgft8D4kkUWFBBfCQQUbEGJeUlVWuRGAI0+ab6uRtBkJTHjisNQ8QI6ftStjAs eO9XnQg34QZMYEsuICCr4e93H5teCEbVYv/7cOlGb4Tlsa8ZaWPp7X46gwf6/HWzd9oC 27S+sLl+Bw3/GGMLDdGFDFUx82ZCzKfE3Lm2bEbs3/HD06AJK59oRuwqRPYh1Cd4U2xS w1YA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=xZiCL02JzF0+cmAi1UQWcFqubmumV+rMpnfD27eX/H8=; fh=cyJDEH6H4yzCj/NyDrEsJWju4XrUKVSdEYuXxvYKQO4=; b=c+IPHbB8c5MayiPmL5Z6VD5MVo63fZxMIxQ6A6DPju3tPM4s5JXwjcI/ryop+9VZR3 51pJHfNMb3zufRjdMyvO54JADpFvg+ADLfkUegEyQMdotznXKRC+FSdsVm9OGSGIL/dd aa7TuFstwIoOFeXMW35GylvW3sgxa9id4MAk2EQ6WF8krviRQ7gZVBsez/H8T5H0Lyjt rJTAT6ZNgVKtksrW3zdBZtsAOC/GXie5HCM5qrbpDzlNSEZzrwv59czgE7BAGz2D4eG2 PKRa6g/l1UGQ6S1EhHmsiI+xZzi1hxOEbyczkI9DGj+56Khsru5tXdqEAck8ZOEV2nR7 S60w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="ZGQE/Anw"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60562-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60562-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCXEIIxAmJ0y6cpCM+m3en1cBn7bpMYyE22a82V5HufMFLOdZF3ewxfiJ8MQ8/53cBhZXSYlwOKYn+K90SXRA5pPn11sog== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id j20-20020a056a00175400b006e08197a06asi2532147pfc.8.2024.02.10.14.02.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 14:02:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60562-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="ZGQE/Anw"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60562-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60562-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 9C39FB25B64 for ; Sat, 10 Feb 2024 21:57:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7469060EC7; Sat, 10 Feb 2024 21:53:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZGQE/Anw" Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA12960DCD; Sat, 10 Feb 2024 21:53:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602025; cv=none; b=ASTR6zsZWfQu39HMkZS9xma+9vx5Kw0rnNYMUob+kaoijd1X8ZAIIY8lOS0PNa/NZF4CtYMYRjsBCdw3wXrifrpRCbsvzslJJGN1kZu0T9FuYisjBnRt6iUXS+sI5oE9HOwezwq6ltfLajAwDsVnXxKfFyhho6Waf8AwiVOdHXM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602025; c=relaxed/simple; bh=GNaoWdeQpKU9AVOEB3jYJkdbwqnSb7noVHcccptmsVw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kWWS69zmyR0UDg1iHJ5N7fFV8cWUnDGtpN6BnD/pVhBn1zEJREjBd1NYy0Ub8RHJS62ONqgVR+R8GjEPHFXkg2huzIvyK0BWtme1DHD/9j8rtW50FkTvk/g37h25GBn8Jjyo4wq5ZdZj6FBqTwTV43gFxqbVUBpJ73RPzYdq4eI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZGQE/Anw; arc=none smtp.client-ip=209.85.167.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-51185c33626so499793e87.0; Sat, 10 Feb 2024 13:53:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707602022; x=1708206822; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xZiCL02JzF0+cmAi1UQWcFqubmumV+rMpnfD27eX/H8=; b=ZGQE/AnwQnVmIRwy4HLdq+2Gnbt5EYWPPZjsi1DRfzVZT8uI6n4HxhhULcrfY/WSeO OVciLRksR9S5y51dS81yAdv9Bhc52LLop/ZC/S21ryDqkS6yzuX3odEBA6t1v7BfAdLP 5AZMO8TqU2MxqEm/xmgT4W3KfmT4ycmHb8kJ5PGNE25eM8ioKuAGbbsGFeQttFE0LIFN bt1JNhBT4s6k2g1Dc+BIONK/Gc+lrMA5bWquhJi/koa2qeDFHwL3OePQ16xbvAAWbnzz VaicZ2HFbeBbk2L0gpgrGoQ61Vvi9dbj3zTXQNGL9lPf3eARp9V67+r2t1rLppwL4NsH FyHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707602022; x=1708206822; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xZiCL02JzF0+cmAi1UQWcFqubmumV+rMpnfD27eX/H8=; b=ahlTM8h91bg4rOX2o3mqHsa9n7ry35IRMVjjafI7OxCug58HBTl398zGD/seNwAxeo d/dzJkLwDulo0QtabysYP/xjfjhB+4nOlvTk4w/M0ltoGJolh4DZahLY3MB9aFhXJ7A+ /1wpW7gm+v4Zwo7iZT6wnB7x4j1cnX3Zu8L6wD+wyeIzgwPHyi5iiArLyCsT+x4Jnq2L RiaGtD1TCVv2M4Ja3wITZ0p+smo4DVRmKro75pk6vMp6NCu3OYfJ30nEYbcWruZqQi7y +36u7YJcICoZgl9b/NlXuT1o4uxe/8jsC6MOb+5R1u2D7qqhbq3aoadRVuL1MJYndwe+ kK1w== X-Gm-Message-State: AOJu0YwGhvcw1ONWZ2XmMqe956pSsBs4+7bWUZoxzYaib/oPSIb4CE5a vBEa7Twc08KOIhBMezmJ+w+ibluTx/Wqa75ZIwC9JHILDK5//a+h X-Received: by 2002:a05:6512:3b96:b0:511:674d:88c5 with SMTP id g22-20020a0565123b9600b00511674d88c5mr2410949lfv.13.1707602021749; Sat, 10 Feb 2024 13:53:41 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVQrAe84oRhlYTBEbGuA4c/x3OkV5e1en9F9UQ1FnnwVa8jgdYkf5N/9d9Q4mrjrDJ7I1JMOtO/eeYKDHadMJw1JBueVTEVMxsT9vmnxn15RflgdR7+zYlaVZz4cQKRMvqBH54OVcr5awc2fJdP/dAQLnnzGSsuBtulGhRTlR3UfhPIhPMhGx+z2X6WV9QWSSKKmWfchmvM6jEzSwSEI/CS/MLhl9I9i/7oylM4at1yRXRc0qDbKiHDu/+u5fKpbMHKQVvCooIcPCqrNIxXhDGRmiGA6MVyGF8Z0DnRsJhjGYLRLfIyoSHT9Xb1pU0Mhc446yo9WJjTlJEmPYgNO/kQLgprlmkHyNoYrfhDNCyzRrl92mtmKA== Received: from m2.. (89-139-223-180.bb.netvision.net.il. [89.139.223.180]) by smtp.googlemail.com with ESMTPSA id a7-20020a19ca07000000b0051189b53f93sm24005lfg.302.2024.02.10.13.53.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:53:41 -0800 (PST) From: Michael Zaidman To: chrysh@christina-quast.de, daniel.beer@igorinstitute.com, jikos@kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-serial@vger.kernel.org, ilpo.jarvinen@linux.intel.com, johan@kernel.org, gregkh@linuxfoundation.org, equinox@diac24.net, michael.zaidman@gmail.com Subject: [PATCH v1 15/19] hid-ft260: uart: remove FIXME for wake-up workaround Date: Sat, 10 Feb 2024 23:51:43 +0200 Message-Id: <20240210215147.77629-16-michael.zaidman@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240210215147.77629-1-michael.zaidman@gmail.com> References: <20240210215147.77629-1-michael.zaidman@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790551032774172207 X-GMAIL-MSGID: 1790551032774172207 The FIXME is related to the wake-up workaround cancelation - do we need the reschedule_work flag alongside the cancel_work_sync usage? The teardown sequence is as described below: Upon tty session termination: ft260_uart_port_shutdown ft260_uart_wakeup_workaraund_enable: deactivate wakeup workaround t260_uart_cleanup ft260_uart_port_put On rmmod: ft260_remove cancel_work_sync ft260_uart_port_remove timer_delete_sync ft260_uart_port_put ft260_uart_port_destroy The ft260_uart_start_wakeup timer_work can occur after the cancel_work_sync returns, rescheduling the wakeup_work again. The reschedule_work flag set earlier at the ft260_uart_port_shutdown time prevents it. The alternative could be performing the timer_delete_sync first, preventing the wakeup_timer and wakeup_work from rescheduling, and then canceling the last wakeup_work by calling the cancel_work_sync. However, we still need the reschedule_work flag to enable or bypass the power saving mode according to the requested baud rate. Signed-off-by: Michael Zaidman --- drivers/hid/hid-ft260.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index 1c113f735524..52ccee83250e 100644 --- a/drivers/hid/hid-ft260.c +++ b/drivers/hid/hid-ft260.c @@ -1585,7 +1585,6 @@ static int ft260_uart_probe(struct hid_device *hdev, struct ft260_device *dev) struct device *devt; INIT_WORK(&dev->wakeup_work, ft260_uart_do_wakeup); - // FIXME: Do I need that if I have cancel_work_sync? // FIXME: are all kfifo access secured by lock? with irq or not? ft260_uart_wakeup_workaraund_enable(dev, true); /* Work not started at this point */ @@ -1721,7 +1720,6 @@ static void ft260_remove(struct hid_device *hdev) return; if (dev->iface_type == FT260_IFACE_UART) { - // FIXME: cancel_work_sync(&dev->wakeup_work); tty_port_unregister_device(&dev->port, ft260_tty_driver, dev->index); From patchwork Sat Feb 10 21:51:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Zaidman X-Patchwork-Id: 199309 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1668594dyd; Sat, 10 Feb 2024 13:58:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVo1CjPqncCwDPl9LlKZBtRKaXR3P9VZ7mjswxuVttY/xCa1NbDe6Evdc5YHvE0bEJ32VCuacEM9aF0e8d6nfXK6ny+7Q== X-Google-Smtp-Source: AGHT+IFHxcHzVV/ZiwhQ+RK/YjbhJ8M1JvfPn18juitAyz61Mq4vmmU4ffAkwEwIbuWIo4xVejaS X-Received: by 2002:a05:622a:58e:b0:42a:4b83:392b with SMTP id c14-20020a05622a058e00b0042a4b83392bmr4626307qtb.60.1707602286106; Sat, 10 Feb 2024 13:58:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707602286; cv=pass; d=google.com; s=arc-20160816; b=eiIEkvbY07nJ5GWt+87dakoxB6Q2jaBfD4X7YmnJJ/N/KUDd7ATD2DY9xvw/LrRolC BPO9pb/OTVoMhWK5AuOryVDoBfC5yUMYaLB0PiBWEW2k6Buy+qgeE2Tpmod+cl3DGQVg WZD1lEX1VuVaSHE3WcSrWEGxvHrgmZAGQHv8N4JKGY67AVZPz+ki++AvTBqC79iJGEk4 yaVlAzn1vznN5zSKE9o4ltn5BGoIC/appFqmNYu2UAsva1dygy/PD8bMwqg08t0C4Jib b+dGabptWa0/Qu/nwTlLxpsLYpEgXHBxqz42yV+dhz4tHERr01KbIwweIyaYUx62vnjr sTrw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=LxIWnn2EO/cc0iUSZCRrpP4DP3wiDSt99iawfQ/4DlA=; fh=7faxa0HwLHyPu0xcp7rTo/j/K8LkGMr+kWhnj+r4PPg=; b=r8jMbYD68i9mCt2ZN8r3jeQbWk1HPKL+iIo1EXUx4BvOXgHwOIgs0I/So+CvU4jW+6 oJ7jQ4Mkrm25uG1QMT+ZZa3hCMh+zJUSXFLKJ3LCSNrzqINsysDf6z6Ypql7CrB5KWId MyNilXTGSgkR4mudXGSa2SpKa9hS+VLCDE2Y7EY4as8xex49Z9YAkoRvoQ6ZV2HzU2YB uH4kjmp1XjNdu9tk8BB2TPvBdRuIen0y1FErP48ua05c0N6h0JLIfzCeq/54iKrmRlre fZ3603m3UmUzQ4CP6rhFrpQaBdktPfGYa3Mwr+ajFxWKRkOnPBo1JXXLaIFm1saUc8oU QKGg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LUKAxGRl; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60563-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60563-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCU2dXDdQV6c27CpK4ENGK3EBSPsXeTOp7Mizrewbc6ikngguvy0Eg/0x0SMlYqRVBJkQkC2a17srxNJ6mDifVfFXkXzkw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y14-20020a05622a004e00b0042c5d77cb8dsi4217238qtw.300.2024.02.10.13.58.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:58:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60563-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LUKAxGRl; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60563-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60563-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E22771C21022 for ; Sat, 10 Feb 2024 21:58:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 11641612C5; Sat, 10 Feb 2024 21:53:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LUKAxGRl" Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C62E6025A; Sat, 10 Feb 2024 21:53:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602028; cv=none; b=Bs+tmTdGJSg1YlLc+MviRmhjCv/YQGArTI7ict0DzdkYm66DAZUAQgyasH0fjorIRppYA3CHx/+l3SBwznETnsT7vxzx1h/x7B6CER7ZENyNfmTNJZLfxMT8rGC+snTj9kxGkR100e8zUDCrpC94nIXDzNUCDUBBKcl8fQ9nFb4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602028; c=relaxed/simple; bh=GKHPriFTGNHkJD6qCXBjTKuOyNY0TWh2kPZjPAtk1i8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=S83I6tiByRcUxGP46C8FDZjWK7BtgHrH25PFRWwlORxnvoVEDob8CUlVTPa1PRfAx+ZiqW2OG/AQH7DwJy3X0bWh1CFTyoUzAZuteo/dFq4EK2J7OBN2BxXqc/eylHiD7mMdDP+Xhi3lFtNbQMhQZDLpNycWzWVeCsATfIfb9Ek= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LUKAxGRl; arc=none smtp.client-ip=209.85.167.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-5114cd44f6aso2779411e87.1; Sat, 10 Feb 2024 13:53:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707602024; x=1708206824; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LxIWnn2EO/cc0iUSZCRrpP4DP3wiDSt99iawfQ/4DlA=; b=LUKAxGRlcTatqTM50SmhK5rpPcdPqY8VR7eJwSCZrAHjnaG7uw4WWZh7GVGY9dBcDD PwM9YLpfEPpnmyrer/wULhAka+6i5SYDejMI37Vc7vhyPKIvyqgFJl5ovEQy+vbHDP9b edIHxkkjSGtvrcIAqHbMRUD+TxYJ5mE5Uy8kcoBR3bCcna/hd1rhLQ0ampzotbt305lK jXFcM9Rsmzz/Z4AjZbn4q6wmn4ZOKfsBM3VKL7DngVPMXQHgWWqEKS2eo+nzCDpF2MVm o/ii+l7MpLhkAkXnBSSzcqCKhwKmr+GWERt0TUbVC+Ga+eRkCSS0WfRbMrm8Gw6MakQV tMaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707602024; x=1708206824; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LxIWnn2EO/cc0iUSZCRrpP4DP3wiDSt99iawfQ/4DlA=; b=Q3KDLMAcRZ4jFG7fwwxGTlMMpZuafHod/s1bJhDz+pBEGydcmJhqpotxAXYa+6mBrz viI6tvZf20KuKcXKFVcLzoQpYPojvfSslrPVq89aPqY6mfKeYEeT388oksbsKNDXYflG m+gHvLJertT8Nh/vtQMiJv1j9AMFsXtL3/kGSMEazVGtMBXyyh9wkWD+RM2S/hZURo+9 SseMx42tiyTMwydMRaI64X50GjSrhJS/NXJaq8cSrOavp5HNO7UprQslmgKw92FoF8Ez 2fz9Pr24arr2mMDf/e5pgyMIBNxajyDbM+SdbTlQuTnWmksaD9NWE9KvF0j8knqi4X7B r7Fw== X-Forwarded-Encrypted: i=1; AJvYcCVi3J1Kx/teE9CI6H65vfJGWYInVk/h0RL7zmC7njcvPwlHYAuHJwQkZB9GSuC6MhnsiV5YzM/lT1kuIvqZe9Xnzc+o8fE5DNbpDcyEy4/W7MFEUw8jWks7//rMgFVOk2ECPKI8q/IDdcU= X-Gm-Message-State: AOJu0YxNWI4O6Vlo4ouiHFj7ajE4KYA3athcv05tdDV4YdgKyLodqKDY PQXCY4rGOlaSyJDcB1FhoHwJKJYjcg92NuvLAPWp+Xs+4PPhCKp6zBSn+SgH7+A= X-Received: by 2002:a05:6512:2255:b0:511:48ab:2f9c with SMTP id i21-20020a056512225500b0051148ab2f9cmr2295109lfu.42.1707602024091; Sat, 10 Feb 2024 13:53:44 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCX/ukWofMNAchS0pigBsSdKuxqPNzk0OIcYvZbBmxn4m9ipLFgCMbrfNSB0mI7NyGEKZwrLEZT2MvQRjtYfpEVSWVzP9zb1moNulAW70qn6Vk0uR+NQu/xtQRGbLvfhth2fF5rdxgZ2k0SImIbTI4UMJ9b4vuQCCGXzAaTI39g8mplIXlW3y67Ft/NXXGSq+fXDp0pWSEJArmBmeYT1/ph864LBawPyXWFwgyZNLufNnRFVSZpvPCc1OnuWplSj2NclWGfBgv3Eh/H1kVTv9BYdjDLtMWvVS9w5Qp4SCxu9eINZtnDft8wdKk/vVqAOvtnFNeL6oOkGD31uliCnY1Om3+KC5DHDx/8cN2ozFa9JRdZcgSl8KQ== Received: from m2.. (89-139-223-180.bb.netvision.net.il. [89.139.223.180]) by smtp.googlemail.com with ESMTPSA id a7-20020a19ca07000000b0051189b53f93sm24005lfg.302.2024.02.10.13.53.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:53:43 -0800 (PST) From: Michael Zaidman To: chrysh@christina-quast.de, daniel.beer@igorinstitute.com, jikos@kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-serial@vger.kernel.org, ilpo.jarvinen@linux.intel.com, johan@kernel.org, gregkh@linuxfoundation.org, equinox@diac24.net, michael.zaidman@gmail.com Subject: [PATCH v1 16/19] hid-ft260: uart: suppress unhandled report 0xb1 dmesg Date: Sat, 10 Feb 2024 23:51:44 +0200 Message-Id: <20240210215147.77629-17-michael.zaidman@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240210215147.77629-1-michael.zaidman@gmail.com> References: <20240210215147.77629-1-michael.zaidman@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790550774984611791 X-GMAIL-MSGID: 1790550774984611791 Suppress the "unhandled report 0xb1" error since it's related to the UART DCD/RI function of the multifunctional GPIO pins status, which we do not use for serial console. The configuration of these pins is a part of the GPIO patch set. [ 5453.117113] ft260 0003:0403:6030.0008: unhandled report 0xb1 [ 6641.582307] ft260 0003:0403:6030.0008: unhandled report 0xb1 [13418.439085] ft260 0003:0403:6030.0008: unhandled report 0xb1 [14110.820786] ft260 0003:0403:6030.0008: unhandled report 0xb1 Signed-off-by: Michael Zaidman --- drivers/hid/hid-ft260.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index 52ccee83250e..d7eb00aeb669 100644 --- a/drivers/hid/hid-ft260.c +++ b/drivers/hid/hid-ft260.c @@ -1768,6 +1768,8 @@ static int ft260_raw_event(struct hid_device *hdev, struct hid_report *report, } else if (xfer->report >= FT260_UART_REPORT_MIN && xfer->report <= FT260_UART_REPORT_MAX) { return ft260_uart_receive_chars(dev, xfer->data, xfer->length); + } else if (xfer->report == FT260_UART_INTERRUPT_STATUS) { + return 0; } hid_err(hdev, "unhandled report %#02x\n", xfer->report); From patchwork Sat Feb 10 21:51:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Zaidman X-Patchwork-Id: 199310 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1668655dyd; Sat, 10 Feb 2024 13:58:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IGEOqJW0UuF53JN/x2MfJ4odmj5DjpwO4PQEpp08quZrVIyWvSWAZ6Dh2nQFPwfIQeij6DQ X-Received: by 2002:a17:906:3b56:b0:a37:8a2c:316a with SMTP id h22-20020a1709063b5600b00a378a2c316amr1827656ejf.45.1707602303298; Sat, 10 Feb 2024 13:58:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707602303; cv=pass; d=google.com; s=arc-20160816; b=bgsjs40vDU75Ivs2JGBc3n/lE6exGIyEDqPT99PzjgTPjWpFkYLOCtofAYEd00UB/O hLMLwNaalNnNPZzmi9ly0hEZrFQhSXl4f3RsvjwCEtY5mGZb/ZUG4/VlbK3nDKRVRwky ZdSIjzQmzHeJQ9YWHCOxjflvpKOBCyGoq33tieMK/tRa6KpLL0rRwZKYb4vxiBnnw7Q7 w6+IowycMWKBS5RgO7QLpfnu7Kedt7ak6mhEY/wMHnQdR6h1v2zsbHc6uoU4JOlJqPHx 1nLmYkQoQWRmpraxzkomcDorOyeTFFb8ft3NNktLdw65vCJKFdjLtl+64zJGfO9nh1bP wUaA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=wjAuDrVvrKWSGT9QwD0z4gCom14B7n2OsRrtSBnn7j4=; fh=Ra/GMZUFJV8y+OYgqAIUpkIsrrGxRvLzHV3aR3GyI2Y=; b=VEVNVNCcWMZcHlASx4Bw/MhgG4j6cXwGHnR2tQzOfgP7i4wT86SEMDqC7rqpbj7adu S68rXmWnZlOTfGYBrtXeX+HAMyNWPejvjWQXANbB40tEZiR/Pkt/xNa0xhuZmtjvpLL0 /nSZsrlAvUSZIQuScoF++tCiGXgJggnM+EOVyXVsaV1+enW26sW88kTJ2DACsS6hEs79 PapzLL44kUJklySGUZHd8wPC6MRy4FrUYvKTeNVMJT78AEvLgdgKKhk3jMI1+COU1UmV XjZseUzPtroUqfHqSZZuLnctmttJvYXddrBO4xCTChc6JxBGxLEJE+7XaqTh//MUT7+W OXSQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=iuEo6rKA; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60564-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60564-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCW6oYQN//i3WBbYF+q3CBw2g5wug/Mzdv82GiZ7nnJApZsnvbT4Qx++WLXKvVmbFrO6vJHDLX1eKq8CoZleQMxYBsV3Gw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id gt13-20020a170906f20d00b00a3c23db33a8si1102572ejb.376.2024.02.10.13.58.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:58:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60564-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=iuEo6rKA; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60564-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60564-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B67AB1F21500 for ; Sat, 10 Feb 2024 21:58:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0A357612D8; Sat, 10 Feb 2024 21:53:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iuEo6rKA" Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CE3460EC8; Sat, 10 Feb 2024 21:53:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602030; cv=none; b=Inb9CutVj3PoPbaUPTwBH1A8AHZag5BD/rwfuDs5JwyynL8drzPsEdYggXH4emkEqK3L0H2qXEUTOL9qYoJCofxE+lSEiSDFZjKc0tt1mOTfcTfy2DvyyeH7XjS0Dc88irCCnPltk50qLpOjoQg+m6+uihV8q0AS1V9OrMTujds= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602030; c=relaxed/simple; bh=6qkcHzfTU/XRV4Bz6RvhCN/NdCXvR92GNjpua2Ojrs0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NajN7CdcAju+EX6V9Xbg2ZE4uU0Ez0ml1mCUC5a8I0esW19JXul3+ZlSUUIwp4Q4vyEo5UBKytLgszYCmmq8iGcD/ocFUY2ZKU0SDQZRb1ik/ABboMa8/xeCoaJ0ZIQyp3yTCb6HQX6uGIiFxLLwEcFKprAH6Hspdasg8QK4JAM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=iuEo6rKA; arc=none smtp.client-ip=209.85.167.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-5116ec49365so2295569e87.3; Sat, 10 Feb 2024 13:53:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707602026; x=1708206826; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wjAuDrVvrKWSGT9QwD0z4gCom14B7n2OsRrtSBnn7j4=; b=iuEo6rKAf197gNALM8j1OBi+k0WM7TXnSSEb0U2BR3tqlqYgsMwORHi917DtYCu/L8 WNLrgFBUqQpGqf0DpIqf4jqejdIJ5DpFj7dFhkyZf7pAB8qB+9LLFxsXMa1M/aCZ/3aZ kbIZVWJs4MFwv2QdBcAWkXX/+anZ0EBxDo/OiAIBadFhnbV81BSdC97HhvoU1FaMq7NV N/3omvo9Ue8ttT8kqSUFWf1wNIcSSnOLIO7sBqM3ciAqMWnWSMoYZqn0YLcVREHKgRJs KhGFR+dIY7OOuE0qbUVUSMW/uUyILYio9sg5UvH2RTe9ZwNFyd9kkaqIk/dI6ahCDX7/ gv6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707602026; x=1708206826; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wjAuDrVvrKWSGT9QwD0z4gCom14B7n2OsRrtSBnn7j4=; b=EjNm+9qtLOxLi0Gsi6O6SBotDjOWUkmbqHgOER4aWMJHp4b+IhoIm7f2lgKpiqxpFY BnRJ2LB5zVC4nxUszpEvAV6LMJ29ohoN6D7gCyf8f5d3joj3SwX6IvObsP98MXG+vTuP vFEYDfBM0uZabsa61j8DToiTB2+4/2EV02aEvwslciWAn9NwKCDC7PX8uf/jCq3F6VsS yozawHdYwpvZ6bjxgumgjwhNkco9nPOKp1k/fskoWsKiYZPlpvAjw07Hpcy3K5HmEcbu CB2fUDfxoTHynYR3cHhDfFuSBM+wBcjCQRLddHTYzU825pboIN4ulG6yLDPVEP/5VfjT O5AA== X-Gm-Message-State: AOJu0YyclmqlWCYNgnsNaHsCjmZTzrG3TKjXt3trFVQDTLgsBYCIBbzv 78FhGhLdbDDfoKsEyXg3E7Kd5qPKl62hgcXDxP3EpgDd6fctAzgI X-Received: by 2002:ac2:4da4:0:b0:511:79ee:5f98 with SMTP id h4-20020ac24da4000000b0051179ee5f98mr1803335lfe.18.1707602026526; Sat, 10 Feb 2024 13:53:46 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVMxUjFQN8kLLBJFOD+xJkBq6Mqn2oPW7uUNxHYWcH65zJxGBRSqPNnEdeCvRj5eQnP6di1ea9tVhsbGsmZXI3qfQmKw6RZwMFNngFiFPu76Eb4ibI9djkr2pb36bvKiuyMCYu4s0R9tLswyQeuQc6R1KeYQgeO9Kpe8EF+79OKtfQxwUXKVbbtqrm7brhFmSDU4wnO/IDFp2so43xzlOVS2Nr3c81lR2jC7PbH2SQ3jOtmsv14NnJqXRPxO7cCCfsyVgkKiogy1gOWIRipEWEFxycfyMbKi0/eii+zZlafvsdihSb0VE8Y4thAP2lOQuuIUio0zaTzKrxt4hCeNUuefLGCr3+T+NjBZJGhwRg7T6zPHrN/Ow== Received: from m2.. (89-139-223-180.bb.netvision.net.il. [89.139.223.180]) by smtp.googlemail.com with ESMTPSA id a7-20020a19ca07000000b0051189b53f93sm24005lfg.302.2024.02.10.13.53.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:53:46 -0800 (PST) From: Michael Zaidman To: chrysh@christina-quast.de, daniel.beer@igorinstitute.com, jikos@kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-serial@vger.kernel.org, ilpo.jarvinen@linux.intel.com, johan@kernel.org, gregkh@linuxfoundation.org, equinox@diac24.net, michael.zaidman@gmail.com Subject: [PATCH v1 17/19] hid-ft260: uart: arm wake-up timer unconditionally on tty session start Date: Sat, 10 Feb 2024 23:51:45 +0200 Message-Id: <20240210215147.77629-18-michael.zaidman@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240210215147.77629-1-michael.zaidman@gmail.com> References: <20240210215147.77629-1-michael.zaidman@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790550792956197347 X-GMAIL-MSGID: 1790550792956197347 The previous session deactivated the wake-up workaround. The next session calls ft260_uart_port_activate while the wake-up workaround flag is yet deactivated. It is enabled later, conditionally, in the ft260_uart_change_speed. Thus, the timer is never armed again, and the device enters power-saving mode and misses the incoming data. Arming the wake-up timer unconditionally on the tty session start resolved the issue. Signed-off-by: Michael Zaidman --- drivers/hid/hid-ft260.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index d7eb00aeb669..7f3ef4f20075 100644 --- a/drivers/hid/hid-ft260.c +++ b/drivers/hid/hid-ft260.c @@ -1510,10 +1510,8 @@ static int ft260_uart_port_activate(struct tty_port *tport, struct tty_struct *t /* Wake up the chip as early as possible to not miss incoming data */ ft260_uart_wakeup(port); - if (port->reschedule_work) { - mod_timer(&port->wakeup_timer, jiffies + - msecs_to_jiffies(FT260_WAKEUP_NEEDED_AFTER_MS)); - } + mod_timer(&port->wakeup_timer, jiffies + + msecs_to_jiffies(FT260_WAKEUP_NEEDED_AFTER_MS)); return 0; } From patchwork Sat Feb 10 21:51:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Zaidman X-Patchwork-Id: 199311 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1668741dyd; Sat, 10 Feb 2024 13:58:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IEugb8+HFmKI/z5UWA/ymEriQii1nYLyw9ezkN2HJNiKypa5IPKSkUPuutdKzUtB8C/qe8w X-Received: by 2002:ac8:574b:0:b0:42c:52b:182b with SMTP id 11-20020ac8574b000000b0042c052b182bmr2986227qtx.5.1707602327581; Sat, 10 Feb 2024 13:58:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707602327; cv=pass; d=google.com; s=arc-20160816; b=KRYUif5WrKxWWkUzDZk3ORfeEmgVX4MhQRxlyfBgoKcHI/N2+rD4qRC7SqMSHVvRdC lrnkJXK0qR/UKuT6+l9kKsTsDzKu6tqEnNJbceOKOCYwDMiryF+DhOENMQpcG64iEXgC jnFo+TObXNd2xu/LDZll4pYxLwWJxA9mF+hMju3nLeX5+1NlubVleZPyK7J2mCSzcBAs 717Je+PIa1B9loo5R7hlkvxPBRbVooRlJnkANI/Vg+AkKCaQ/cJuPf0Zt6XBhUNofMBm hRMlQPsb6UlbWyXHfpoJhOq6w1k5diVceK8lbRVyNMnYH1f0vehn8q6Kj+A8Z8FXck0W Po3w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=dKAJSxOnHFuRcH0gpZtmvgzHWy46iRoqpq2kIsiN4WA=; fh=DMmiipIWIpLj9BwJvn9V5cUUlx893yPNoFcSCI5+XWg=; b=E08AI2tA4DOOZoYkGrI5kvlblqQNQQZT2cN53fkrdhmHrUNnYTbC8TJKDj/WHnDXRP JJ+ZBxnuhsR3SNQ/zyg38n0jEQRurNo5JCUlAX/iSbAg/b9HQ+aXMosXo0RtmsPvbjdx qL3ueGj9SeHP6ZYra2k0z0uwZIfiLn0BQKYfhmDWPq4Yo5OQlS6Fttdt7i/Ay2foCV1L 2CbL7Oq3dq+aem41RhzTZX3lmJsaOopj4kuOBh+Qb/NW0sbE4thPFWg84LvR07jWQsfR nzu4FdWR2VsYrs78bo8XMFT0XRTX472uf4QwBvDrfi09wCT23DVAuSABVx3jDFBgDA8R otGA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=GPEH+6Di; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60565-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60565-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCWxie/rMHd9cVac4NnnKEuKgwp/wxzXcXkgME/Q8auOc6mAieDH6ZODu5bDCPNptjqrYMkUZ8J69jo8ygLpAB7KmPvzpA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id o8-20020ac841c8000000b0042c61dee492si3062377qtm.192.2024.02.10.13.58.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:58:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60565-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=GPEH+6Di; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60565-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60565-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4415B1C21226 for ; Sat, 10 Feb 2024 21:58:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2406B61662; Sat, 10 Feb 2024 21:53:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GPEH+6Di" Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD789612C0; Sat, 10 Feb 2024 21:53:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602032; cv=none; b=jY+vH0zx734FS5RikuFzwsHPzNUZgXvrZdOOyiT1tXOECEwiW+UNM9n5buiai/sr7Edh+d50X6kCCVH40BGL7GXoGp1rFVCbQ7I9TmWd+uz65VL1e8Q62GM9VHudtH9YM0mVjSgYQyaO2+B5dgw1D1jRkmRVw0iuPLjYKUVr3S8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602032; c=relaxed/simple; bh=hxtieDaWSwkcjeIe/ZAb6AAFPHKxuZy5d5r6D0dbJgI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=iqbqhMFNjvJJW4nK6a2e23nvIRmg/ZjgoXvForZSH47KFmEPXKtCYUHtuJYDrVcAv+fNV8+LZ9P9T7Olub1oquO45u0F/zB9VQGAusx1oTJiL7U5h5sgGkWmkTE+IgfbdRmg+Ivp68snsEgOpPYv4YjOJ35u4Z+seQWzsnBYSP0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GPEH+6Di; arc=none smtp.client-ip=209.85.167.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-51182f8590bso698288e87.0; Sat, 10 Feb 2024 13:53:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707602029; x=1708206829; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dKAJSxOnHFuRcH0gpZtmvgzHWy46iRoqpq2kIsiN4WA=; b=GPEH+6DidKCPW2Hsxb4R6BMd17CMJ3oDVkccU0d+o4pGsVsHfclatJTtoxPjljl6GU be/cobs2oNsNdBgo3GE//YnuxzymvJmpS5xx+DhZXiXXCD0KeOMmIl3v98I/pPBi5NAf KDcKpdzmJZrUfLatYvKVmIXt0Rb16+YNawrgVQxkrQb1yOKXI1Fq8xmnWmDfEiOD2gip +8lXDPYPsFEeZoFaTC4rvwe+eLfOseMuHOufnqUp6BZc4jqIsO1COv6VpV++853JX5zf BoLVvbrDQMUkFhQ+hi7Ql0F7IbJhkQ0Rnns2XTWHVJiM7CzXVXQ9LywwVP7BF84z1JRI m5zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707602029; x=1708206829; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dKAJSxOnHFuRcH0gpZtmvgzHWy46iRoqpq2kIsiN4WA=; b=ux0urDEovqOHThgthMSIJUo2J3JwxtcCJdWmxgAt2+STp6vBo/V/zZ1Nuj/J628FMQ YEnMf1e5IZm2XacYYNG1zM89UNjbF3XaraanNQPvzt37M1Kan8JrQkj7GeaM+IcsT+ou xhc1mtSM6cqvOAhYM7Pi4VneBo6ohLslIKuvlNO8z9nLqAJ4K6rMaa1jJeqLhOKtY1Zy KAEVEcnH8DZcsdiqWN3K6GD45hrDonfZrIK6nI4QV9hxB4n1XFxrvg2yT7E3k06lL5zu 18IVLZAKHL6Xknaeocx0KD6YhsnfMw098u3xY0EdCbNy0ZteEhAtmQ84tgyejE+lnAAf i97Q== X-Gm-Message-State: AOJu0YwfE5a8lNxc0nFQf3tY9cxL1c0gsgPWU+r7+/D6mARi93I0R4TH qTaDJTiXmAmm7EZ5jieeN9axGxyjeHeSn+jpz2PQMgeXiUAHop3o X-Received: by 2002:a05:6512:3051:b0:511:4824:6718 with SMTP id b17-20020a056512305100b0051148246718mr2150014lfb.56.1707602028892; Sat, 10 Feb 2024 13:53:48 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXlWEmNRpDb/Z/PrK2WkQ2hjz/foxg7fPNtJ4S1guX/ueGYQMh+jJ5vYxNmMqIIQR0HfT7oWYrZV4zMLRwsTuXEbfXNO6yldCZP2XQmtRxVw8vy7D2TgqU7DW+NZS8kpYRuqBCL7/6WUeMNVRh8MWAoHDhrNQZHjiw27l+jS+Maoew8mm4Emha1kggHASA5Pur55Z1iAA70g48JgtmGhY3ZubgSbmfasfu/1R6UnwZxladHxFk3YW+69iGoxgGB8dNX2dWgH3MhoftUqoqUXnoLrZhCtoeOyI5pBzMc3aDpmZ8motgxgkj3uKLIheDrpx2BOGlebK0rNMgLAg7m+3r35PO3ua1z9qrwsLKHYtHFXUzSgqIrZg== Received: from m2.. (89-139-223-180.bb.netvision.net.il. [89.139.223.180]) by smtp.googlemail.com with ESMTPSA id a7-20020a19ca07000000b0051189b53f93sm24005lfg.302.2024.02.10.13.53.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:53:48 -0800 (PST) From: Michael Zaidman To: chrysh@christina-quast.de, daniel.beer@igorinstitute.com, jikos@kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-serial@vger.kernel.org, ilpo.jarvinen@linux.intel.com, johan@kernel.org, gregkh@linuxfoundation.org, equinox@diac24.net, michael.zaidman@gmail.com Subject: [PATCH v1 18/19] hid-ft260: uart: fix rx data loss after device reopening Date: Sat, 10 Feb 2024 23:51:46 +0200 Message-Id: <20240210215147.77629-19-michael.zaidman@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240210215147.77629-1-michael.zaidman@gmail.com> References: <20240210215147.77629-1-michael.zaidman@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790550818706582573 X-GMAIL-MSGID: 1790550818706582573 The port setting may remain intact after session termination. Then, when reopening the port without configuring the port setting, the wakeup mechanism is not activated, and UART Rx loses the data at speeds greater than 4800 bauds. To fix it, retrieve the baud rate from the device in the ft260_uart_port_activate to reactivate the wakeup workaround if needed. Example: 1. Configure the baud rate to 115200: $ sudo picocom -f n -p n -d 8 -b 115200 /dev/ttyFT0 2. Quit the picocom without resetting port setting by entering: C-a and C-q It deactivates the wakeup workaround: [31677.005464] ft260_uart_close: [31677.005466] ft260_uart_chars_in_buffer: [31677.005467] ft260_uart_port_shutdown: [31677.005468] ft260_uart_wakeup_workaraund_enable: deactivate wakeup workaround [31677.005476] ft260_uart_cleanup: [31677.005477] ft260_uart_port_put: 3. Reopen the ttyFT0 port, but do not configure it. The fix retrieves the port baud rate from the device, compares it against the threshold, and activates the wakeup mechanism when needed. $ sudo bash -c "cat < /dev/ttyFT0" [31693.304991] ft260_uart_port_get: [31693.304995] ft260_uart_install: [31693.305000] ft260_uart_open: [31693.305001] ft260_uart_port_activate: [31693.309842] ft260_uart_wakeup_workaraund_enable: activate wakeup workaround [31693.309847] ft260_uart_port_activate: configurd baudrate = 115200 [31698.132650] ft260_uart_start_wakeup: [31698.132809] ft260_uart_do_wakeup: [31698.132817] ft260_uart_wakeup: [31702.996905] ft260_uart_start_wakeup: [31702.996916] ft260_uart_do_wakeup: Signed-off-by: Michael Zaidman --- drivers/hid/hid-ft260.c | 56 ++++++++++++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 9 deletions(-) diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index 7f3ef4f20075..6b172bfa4f98 100644 --- a/drivers/hid/hid-ft260.c +++ b/drivers/hid/hid-ft260.c @@ -90,7 +90,7 @@ enum { FT260_I2C_REPORT_MAX = 0xDE, FT260_GPIO = 0xB0, FT260_UART_INTERRUPT_STATUS = 0xB1, - FT260_UART_STATUS = 0xE0, + FT260_UART_SETTINGS = 0xE0, FT260_UART_RI_DCD_STATUS = 0xE1, FT260_UART_REPORT_MIN = 0xF0, FT260_UART_REPORT_MAX = 0xFE, @@ -190,6 +190,18 @@ struct ft260_get_i2c_status_report { u8 reserved; } __packed; +struct ft260_get_uart_settings_report { + u8 report; /* FT260_UART_SETTINGS */ + u8 flow_ctrl; /* 0 - OFF; 1 - RTS_CTS, 2 - DTR_DSR, */ + /* 3 - XON_XOFF, 4 - No flow control */ + /* The baudrate field is unaligned */ + __le32 baudrate; /* little endian, 9600 = 0x2580, 19200 = 0x4B00 */ + u8 data_bit; /* 7 or 8 */ + u8 parity; /* 0: no parity, 1: odd, 2: even, 3: high, 4: low */ + u8 stop_bit; /* 0: one stop bit, 2: 2 stop bits */ + u8 breaking; /* 0: no break */ +} __packed; + /* Feature Out reports */ struct ft260_set_system_clock_report { @@ -1050,6 +1062,21 @@ static LIST_HEAD(ft260_uart_device_list); static void ft260_uart_wakeup(struct ft260_device *dev); +static int ft260_get_uart_settings(struct hid_device *hdev, + struct ft260_get_uart_settings_report *cfg) +{ + int ret; + int len = sizeof(struct ft260_get_uart_settings_report); + + ret = ft260_hid_feature_report_get(hdev, FT260_UART_SETTINGS, + (u8 *)cfg, len); + if (ret < 0) { + hid_err(hdev, "failed to retrieve uart settings\n"); + return ret; + } + return 0; +} + static void ft260_uart_wakeup_workaraund_enable(struct ft260_device *port, bool enable) { @@ -1492,13 +1519,11 @@ static void ft260_uart_port_shutdown(struct tty_port *tport) static int ft260_uart_port_activate(struct tty_port *tport, struct tty_struct *tty) { - struct ft260_device *port = - container_of(tport, struct ft260_device, port); + int ret; + int baudrate; + struct ft260_get_uart_settings_report cfg; + struct ft260_device *port = container_of(tport, struct ft260_device, port); - /* - * Set the TTY IO error marker - we will only clear this - * once we have successfully opened the port. - */ set_bit(TTY_IO_ERROR, &tty->flags); spin_lock(&port->xmit_fifo_lock); @@ -1507,8 +1532,21 @@ static int ft260_uart_port_activate(struct tty_port *tport, struct tty_struct *t clear_bit(TTY_IO_ERROR, &tty->flags); - /* Wake up the chip as early as possible to not miss incoming data */ - ft260_uart_wakeup(port); + /* + * The port setting may remain intact after session termination. + * Then, when reopening the port without configuring the port + * setting, we need to retrieve the baud rate from the device to + * reactivate the wakeup workaround if needed. + */ + ret = ft260_get_uart_settings(port->hdev, &cfg); + if (ret) + return ret; + + baudrate = get_unaligned_le32(&cfg.baudrate); + if (baudrate > FT260_UART_EN_PW_SAVE_BAUD) + ft260_uart_wakeup_workaraund_enable(port, true); + + ft260_dbg("configurd baudrate = %d", baudrate); mod_timer(&port->wakeup_timer, jiffies + msecs_to_jiffies(FT260_WAKEUP_NEEDED_AFTER_MS)); From patchwork Sat Feb 10 21:51:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Zaidman X-Patchwork-Id: 199312 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1668795dyd; Sat, 10 Feb 2024 13:58:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IE9uQ3emZz+v79mJAMuz+t/tGY2+rV7iA5zGX2DCsDFD1HGPdc4Kkv2fvp+dODDNABgzT8A X-Received: by 2002:a05:622a:1b8d:b0:42c:31cf:d6fd with SMTP id bp13-20020a05622a1b8d00b0042c31cfd6fdmr4074026qtb.6.1707602339069; Sat, 10 Feb 2024 13:58:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707602339; cv=pass; d=google.com; s=arc-20160816; b=wB5AtEVMWtmouozuoL+vsJ8WZVrsrtKGhptw+FZWLqGdpik0+vz/pRtaO6Blf8ss/d 622y+w2qYHAVN+uCeyg9nFgtuGbPThSTz4a46Pt0GDf4SFGc7RhCIRwsVafXouE0pIiG 2OXIPBPCJSErB6Ua5E3IwwMZE2FFkO7IBxMNI8gUEmsQ5S4+RnXUZJbO0QPXAcI3/1jc Fh1vpJgwhdW3/nMm/BCTo/CbY4F9XfLKT5xmfeDrcSITgaJYeMOve/7pybPw+MklWjU2 WiNAK2MZdLBiAzt4EGvbdGm1tnKj6dAktJK+Wk/CKUNuE70FlIde1EfQwFqx7gu+aRi2 LKLw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ocRkW8hKMfnTmReIZpRDWQim1hibbGos+/oExgJFVwc=; fh=qdj7qBldEuW5O7QzN2CcVbHvr478z2ViieOIAcFtfSQ=; b=k77u+k33IR5XdBgoKxX3bPta6S8EMhsmNQeczLRtn+8vVJ7JdIXHBWq7PSaIFwTR9j XSWJK+tAMpxYQXjQXgiJ6eOYz6U+jjQkekoaJRjNkeMONctH7bnr4vLV/7h7M81/zp9u 2Mgxo1aeQXYQTPi1gRqIcD+/qo5wfnzuh54uxyI7cGILzTh6H/BBtv/+eKs9E7FXYqu7 y4pCvfDtw6BYEASPlyk2/fisWHJ1X52Z7r3m03dhABwPYeyALWd858sSaYzrOH4jpaBN Xmjxs9oWfpMuoCmVp18ySPK+KqFJ+Slo+5FH0gj3XoqXdDFIG0ShqLyEzT8GhPstPXNZ OmRA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=d7e7IEk3; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60566-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60566-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCUhB4zHJmThB3FelUVsCSkQO6ypaugcpBTYbXD7qjsz+NGuhmeGO5mJSEaSLuINWc5ubNW1jvbqulh//JcK3WFeu+VsxA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id p24-20020ac87418000000b0042c58607bf2si544302qtq.214.2024.02.10.13.58.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:58:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60566-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=d7e7IEk3; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60566-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60566-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C954C1C212D5 for ; Sat, 10 Feb 2024 21:58:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E2F7961677; Sat, 10 Feb 2024 21:53:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="d7e7IEk3" Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E25F612DE; Sat, 10 Feb 2024 21:53:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602035; cv=none; b=Znxb+DjdF+5rvXDJWy129mha3DhnXcVWAoSiL+3AlBSrf6DDpzSZvEY+hs8T+1hBMv3uwjh72eN6bBtS558o7nqe0MRqOx8mN1oWSNteNsy1IMoyRNkSMhGyM59lPQ6du23d4GpEFm4cHGcet/eQpqgLXLOMm2IeY8XgPLucClc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707602035; c=relaxed/simple; bh=zEz90GX1NaC/1sawxLYuZ1ENoB1fBUSzM9OiDG4l96E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=k2edn0VN9/DAS4stB7NKgYCOaE2+vZEWp6IvQnSaEyd+9Dcyxuc7ssX85bLcBW4LtJ6xdGs9EfqR1R4gLr3Gt3Vh0Af79J9X+7khuFYWL4vB42+2se8wp1ZASdMWj84x8gy51d7DGeRo8SzLGyzL4uhpf0ZEFBbuwm5bmj3JvQQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=d7e7IEk3; arc=none smtp.client-ip=209.85.167.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-51185c33626so499863e87.0; Sat, 10 Feb 2024 13:53:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707602031; x=1708206831; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ocRkW8hKMfnTmReIZpRDWQim1hibbGos+/oExgJFVwc=; b=d7e7IEk3Tb6vTzzFHVcmcu257aEaj9D4htLnGdvJ8Wvj+hBaW6B9nkJCmB3fTJCblO bzPj9HRcH9AubPJePPEeP7Y+9U3OoCLBeCXnwIGOnMEBJusvHinJkuzpWtPT9FGkoJ+b UNaKz+Dxrv9eG6PxY7orFc7A/pK7qyemwGE+7W6lqGZTQdN/CpQOjD5F7Yryr8F2jTfi Dm6G9RfZqaUSMB/36n/UW2gCMNVDkmPIGrXUhRE6sm5YtgD751jrsBeUnW/iRjF7Es2q aHuMGi12kmp3araHl3x4fAv1rH/NpnPyjlJMVtfTFcn2GuonxzqU9MVEZizjLhhHxGb/ 8+Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707602031; x=1708206831; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ocRkW8hKMfnTmReIZpRDWQim1hibbGos+/oExgJFVwc=; b=rOP8u/VJSXvI0piH4EUz1kxlbGrFnIhtZkHQ+yVdnmLvM6kojtbK3F3KNAGtwja0NV OJFTs6mLEOzmjPu9nJt9xxLG6yGidVsrQwJsipSmhnM8eCYlSRtoVaRSQ3cbUtOMLI6i +Rt58JHXaCTVG9Dm9i8vchErYo4tPKMBgcJ1Gusm/dl6HbPjAO8jwaLmTpAxpFwHScRY Mbxi/VJfuOfZ3uS+kdkD7JywfW4uFXUXxU9n/hdxEYD1dgj6wWkSsXoRgDr0oeJINZgQ 4xs7m92oNaky6PbtZEZKdvU19gFjMYD7dz0eArB6YiGrCcTwUGPg/i2iPu0AzhfuXjP6 a81w== X-Gm-Message-State: AOJu0Yw7QuFym8jw2Uga5SovWUz9Rpcuc5QkvLu7YUxmXC0kk7cu/Khn I9poc4mRanaPiCvlPuw77FegyiYSfqoRLanCxkwvSxqdMgxCa2ag X-Received: by 2002:a05:6512:12c7:b0:511:483b:91c6 with SMTP id p7-20020a05651212c700b00511483b91c6mr2449033lfg.48.1707602031347; Sat, 10 Feb 2024 13:53:51 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVDCEPO8lOjIT51DzfX0Xk56jKN4j7BJTCDTbbgv/kjr9jS2Qb8UI5RVlegTY1z1aNzW5zhtij26w9ska0FnNIORTgrMFUhkdeU73HoaKq7E78ssCAL+TYVFwHZgiN2tkwDETrOtNfiZASzV5TsfqGlmnm1EkJAIjsHKpHCHEmFJSNTH3YJQTXaqVcFDZgmbiN8KAy/iJ0BBT20LsojD5/AOLKs6RjivygyScMKlIgadADWQc9bblL4g4K0DBj003uq/JH6n0S+JSJxlXYUQa4dd5haNHaAW6jh3o2LeAdv/ABrNbEKfIk2r0liYQ116ziFBB7QwyCAR28+Y/ui0jW3rBCijTBvcAh2S9dKS3uwn4FabEJMxQ== Received: from m2.. (89-139-223-180.bb.netvision.net.il. [89.139.223.180]) by smtp.googlemail.com with ESMTPSA id a7-20020a19ca07000000b0051189b53f93sm24005lfg.302.2024.02.10.13.53.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 13:53:51 -0800 (PST) From: Michael Zaidman To: chrysh@christina-quast.de, daniel.beer@igorinstitute.com, jikos@kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-serial@vger.kernel.org, ilpo.jarvinen@linux.intel.com, johan@kernel.org, gregkh@linuxfoundation.org, equinox@diac24.net, michael.zaidman@gmail.com Subject: [PATCH v1 19/19] hid-ft260: uart: improve write performance Date: Sat, 10 Feb 2024 23:51:47 +0200 Message-Id: <20240210215147.77629-20-michael.zaidman@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240210215147.77629-1-michael.zaidman@gmail.com> References: <20240210215147.77629-1-michael.zaidman@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790550830316347628 X-GMAIL-MSGID: 1790550830316347628 Tx performance with the current buffer size of 256 bytes is lower when the data length exceeds the xmit buf size. [134331.147978] ft260_uart_write: count: 288, len: 256 [134331.157945] ft260_uart_write: count: 32, len: 32 [134331.159977] ft260_uart_write: count: 288, len: 256 [134331.169990] ft260_uart_write: count: 32, len: 32 1. Increase the xmit buffer size to page size as used in the serial core and other tty drivers. 2. Remove the xmit buffer fulness against the watermark checking and the tty_wakeup calling in the ft260_uart_transmit_chars routine. This code is taken from other drivers, but other drivers may call the routine from the interrupt context. In our case, this condition is always True since xmit buffer filling and emptying are serialized and done synchronously. Tested with picocom ASCII file transfer by 288-byte chunks at 921600 bauds rate with above 20% performance improvement. Before: 2821.7 Kbytes transferred at 47367 CPS... Done. After: 2821.7 Kbytes transferred at 57788 CPS... Done. Signed-off-by: Michael Zaidman --- drivers/hid/hid-ft260.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c index 6b172bfa4f98..1188b8e09938 100644 --- a/drivers/hid/hid-ft260.c +++ b/drivers/hid/hid-ft260.c @@ -308,8 +308,7 @@ enum { #define FT260_UART_EN_PW_SAVE_BAUD (4800) #define UART_COUNT_MAX (4) /* Number of supported UARTs */ -#define XMIT_FIFO_SIZE (256) -#define TTY_WAKEUP_WATERMARK (XMIT_FIFO_SIZE / 2) +#define XMIT_FIFO_SIZE (PAGE_SIZE) static const struct hid_device_id ft260_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_FUTURE_TECHNOLOGY, @@ -1211,7 +1210,7 @@ static int ft260_uart_transmit_chars(struct ft260_device *port) len = kfifo_out_spinlocked(xmit, rep->data, len, &port->xmit_fifo_lock); - ret = ft260_hid_output_report(hdev, (u8 *)rep, len + sizeof(*rep)); + ret = ft260_hid_output_report(hdev, (u8 *)rep, len + 2); if (ret < 0) goto tty_out; @@ -1219,10 +1218,6 @@ static int ft260_uart_transmit_chars(struct ft260_device *port) port->icount.tx += len; } while (data_len > 0); - len = kfifo_len(xmit); - if ((XMIT_FIFO_SIZE - len) > TTY_WAKEUP_WATERMARK) - tty_wakeup(tty); - ret = 0; tty_out: @@ -1546,7 +1541,7 @@ static int ft260_uart_port_activate(struct tty_port *tport, struct tty_struct *t if (baudrate > FT260_UART_EN_PW_SAVE_BAUD) ft260_uart_wakeup_workaraund_enable(port, true); - ft260_dbg("configurd baudrate = %d", baudrate); + ft260_dbg("configured baudrate = %d", baudrate); mod_timer(&port->wakeup_timer, jiffies + msecs_to_jiffies(FT260_WAKEUP_NEEDED_AFTER_MS));