From patchwork Thu Nov 9 18:54:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuan-Wei Chiu X-Patchwork-Id: 13451639 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (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 B50AE36AE6 for ; Thu, 9 Nov 2023 18:54:56 +0000 (UTC) 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aMk++PBt" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-6bbfb8f7ac4so292114b3a.0 for ; Thu, 09 Nov 2023 10:54:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699556096; x=1700160896; darn=lists.linux.dev; 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=gOp+xpHlmwwJHpuAsntREKGWWkLs/V8YPmUbdNBBy0c=; b=aMk++PBtX5LP0TEowDxrdHmsR87MRXiQpQ0vBnoydrehWiWr7bYzatICNF6UlIXI8i rWHZWT8DdrpneutOsAQQxprxjur3Y3CHri9or8cre1NITxBMmAjJZysVPVEGVkiSHnrr 2OxUqHCSiEVCg90MqdyGxGQWNmX06M6CsL5y3RNbOlbjJNpR70Lm7egeN49ll07H4scU PEtDakpELoZUNJ5AyOZkoDvK6U0hhbWMDLVC7lm/AH97HYid08pnu0d8xEugcEy37kRt DDKGeES/BDnkr4/vzV543P+0KISzNSN0n547wVWFb2lmWLakNAB7nhzzKQf8DxI5HQ4u MdnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699556096; x=1700160896; 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=gOp+xpHlmwwJHpuAsntREKGWWkLs/V8YPmUbdNBBy0c=; b=okWsZ1Q1ywcN0v2ovKZs0zLTGkTpeTIGXw/g0QRSehcGe1YKYj6rTNBv8toEAhhKMP NeQT1XH/bkzwaJ5Ew7AzSQUOLT0ZUCcHUV1qnqIPsGj/JTi4wdKwdli6MR0bUyojtzxb mw8Z92o4GTfWWqz7+x97dezwA0Xh/UjJmJmBLPQQrp62AmQ6YbAeIgLWwQP3LtbGoBSr J3nC/bumKdjjTR5JTa3flYt8s4e5T+OdimidCuz2V+0NosFgBsCUSB/TJqbtvKPLDoY6 PH7NcT3xGh9njEkGWmx8ueaffkywC/0O0tbfJyuHAlw8nqSl8lez1k1VUlgbQ+g5HxPH oyUg== X-Gm-Message-State: AOJu0Ywr0v6UJPq6zEQ+4jUgDMiFC6oaG2ET3O0lkork6ixPOeCWSE2B 5icjAPU+sdwTa6duQknh9+E= X-Google-Smtp-Source: AGHT+IE+IJZS1sqYktLsiPaL1df4ka4ANEDD9qXqEAzn3MA5xqXj0C0RPxKP+lsVDxfLH5oDuT8zSg== X-Received: by 2002:a05:6a20:4304:b0:16e:26fd:7c02 with SMTP id h4-20020a056a20430400b0016e26fd7c02mr6287408pzk.2.1699556096014; Thu, 09 Nov 2023 10:54:56 -0800 (PST) Received: from localhost.localdomain ([140.116.154.65]) by smtp.gmail.com with ESMTPSA id w19-20020a170902d71300b001c61921d4d2sm3821837ply.302.2023.11.09.10.54.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 10:54:55 -0800 (PST) From: Kuan-Wei Chiu To: bleung@chromium.org, tzungbi@kernel.org Cc: groeck@chromium.org, chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, Kuan-Wei Chiu Subject: [PATCH 1/7] platform/chrome: Fix typo 'preceeds' in comment Date: Fri, 10 Nov 2023 02:54:33 +0800 Message-Id: <20231109185439.1535962-2-visitorckw@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231109185439.1535962-1-visitorckw@gmail.com> References: <20231109185439.1535962-1-visitorckw@gmail.com> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Replace 'preceeds' with 'precedes' in the comment. Signed-off-by: Kuan-Wei Chiu --- drivers/platform/chrome/cros_ec_sensorhub_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_ec_sensorhub_ring.c b/drivers/platform/chrome/cros_ec_sensorhub_ring.c index 71948dade0e2..568bbb64a389 100644 --- a/drivers/platform/chrome/cros_ec_sensorhub_ring.c +++ b/drivers/platform/chrome/cros_ec_sensorhub_ring.c @@ -511,7 +511,7 @@ cros_ec_sensor_ring_process_event(struct cros_ec_sensorhub *sensorhub, * ringbuffer. * * This is the new spreading code, assumes every sample's timestamp - * preceeds the sample. Run if tight_timestamps == true. + * precedes the sample. Run if tight_timestamps == true. * * Sometimes the EC receives only one interrupt (hence timestamp) for * a batch of samples. Only the first sample will have the correct From patchwork Thu Nov 9 18:54:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuan-Wei Chiu X-Patchwork-Id: 13451640 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 8EFD136AFB for ; Thu, 9 Nov 2023 18:55:00 +0000 (UTC) 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GDrDDpOm" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1cc41afd376so1916035ad.1 for ; Thu, 09 Nov 2023 10:55:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699556100; x=1700160900; darn=lists.linux.dev; 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=oc8XKB87wQbvVWG32n2t+Y4HWDVG4F2xfYYjT2VaS4U=; b=GDrDDpOmpSMdMJ9EVCjg71cVQ8DKoLTmArm7pGBPc+HxVLIKQuSnOvD4HVKrAjYG4w wAPcCjbgcn7w96ZpiwW25Rsp3/A64Bqrc80tMmE5b6IaBtaPkRKNw+9QtcZiVXkZM22w AqFP+eP2GxE9a5ReMZhDTC2D5UCHlGeGhw8ohpnBR5YwpWtK3/+I6DPhnZitT6SBtgHb LezyZr7ZYSLHtwtQrSuVEMeeoNHur6zxmY6Qeg0N1J7aNpj4qniG3oh8VwB5D+sZ3VKi 24DBrVNPraCMy5hObH3XnZVVGUQCNRpDrVbj7BijPxI6uO04R2rWT1fkHyUv7Hn6+J3L r2/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699556100; x=1700160900; 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=oc8XKB87wQbvVWG32n2t+Y4HWDVG4F2xfYYjT2VaS4U=; b=jzxdBY0PKAE8De2PAXRjTUsonJIjiEO+rSjLthKVffoC6CSNu7l7cp276ZMLEMc2fW gs2cODb2q1T8gWLLp/DGMmXck+PW8Y6vKZl9Jsi5uQgjBPSiy1ezekjAWOlXKQyTNdcG VC58/7E4QSnTAqUIDLLt3Fw0u3R+UkJaQ2pmukys3pUs8TwsrH4n7XU7992WZCbZzTrV 6zgalpcRgCg6Inl3AkmkEfiPqhwWfvGwwxydR2/LM4P6Lyv2DfZX/GOE6eLrX+kEmJq1 iddBK88YuMm0Yk33P9hFjUyyIAaocfNrm98ERsd0HMSD5exIejfTaap1cH0KNAEBIhki LL/Q== X-Gm-Message-State: AOJu0YwFrrgT3WgtlP3FVOfG+cKAltQL27FW/tkXOExuBGhp93DlzoXX 2ptJOdUCG4toFoktZ6zTtfE= X-Google-Smtp-Source: AGHT+IEpztjQzljXdJINa8TiA3AV4M8Z9qXo4fdBCG4xuIsFgmcJhHYl+Z7UYu0PyuQnE8wyfFehig== X-Received: by 2002:a17:903:2281:b0:1cc:2b68:40ec with SMTP id b1-20020a170903228100b001cc2b6840ecmr6475275plh.4.1699556099887; Thu, 09 Nov 2023 10:54:59 -0800 (PST) Received: from localhost.localdomain ([140.116.154.65]) by smtp.gmail.com with ESMTPSA id w19-20020a170902d71300b001c61921d4d2sm3821837ply.302.2023.11.09.10.54.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 10:54:59 -0800 (PST) From: Kuan-Wei Chiu To: bleung@chromium.org, tzungbi@kernel.org Cc: groeck@chromium.org, chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, Kuan-Wei Chiu Subject: [PATCH 2/7] platform/chrome: Fix typo 'perod' in comment Date: Fri, 10 Nov 2023 02:54:34 +0800 Message-Id: <20231109185439.1535962-3-visitorckw@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231109185439.1535962-1-visitorckw@gmail.com> References: <20231109185439.1535962-1-visitorckw@gmail.com> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Replace 'porod' with 'period' in the comment. Signed-off-by: Kuan-Wei Chiu --- drivers/platform/chrome/cros_ec_sensorhub_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_ec_sensorhub_ring.c b/drivers/platform/chrome/cros_ec_sensorhub_ring.c index 568bbb64a389..ee1c3124d31a 100644 --- a/drivers/platform/chrome/cros_ec_sensorhub_ring.c +++ b/drivers/platform/chrome/cros_ec_sensorhub_ring.c @@ -701,7 +701,7 @@ cros_ec_sensor_ring_spread_add(struct cros_ec_sensorhub *sensorhub, * last_out --> * * - * We spread time for the samples using perod p = (current - TS1)/4. + * We spread time for the samples using period p = (current - TS1)/4. * between TS1 and TS2: [TS1+p/4, TS1+2p/4, TS1+3p/4, current_timestamp]. * */ From patchwork Thu Nov 9 18:54:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuan-Wei Chiu X-Patchwork-Id: 13451641 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (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 0883CD2ED for ; Thu, 9 Nov 2023 18:55:03 +0000 (UTC) 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MpKcbjS3" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-6bcdfcde944so290216b3a.1 for ; Thu, 09 Nov 2023 10:55:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699556103; x=1700160903; darn=lists.linux.dev; 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=/asJ9Dj+3Cx6KmENE4+zs0bPzpX4pHWbGWWiop9m2C8=; b=MpKcbjS3emrsN05eGyAnS5ZrXvqGtTfDOTU2AIDnSMBC5sZs9MsBFcYBJ1j/omOAuy ngo4xivisk8FXxFsSGAMGIF/4njPyEqkN7SFOHU5z0mxQylR8ZkseETguD0PGcyVIux/ gf3yiMMc+c8gP3yJL5zOE/P6YKPp3rr4qLmWyCGmnzs8XHbvMvBGUQ170Sz5bfwV4dLJ QGHqGHzyiIRfjLJaAJ4m8+Ipy0dQRriweQliw0niVnLcsWy5G8d16ZXaAC/DHtQGy129 gDRcFfBBYEshkFZ4X6mFZ3NgI8dm8ysZ0WZRdYLrScKC3MskOXRItsTqnGmuAugA2j2P WeAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699556103; x=1700160903; 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=/asJ9Dj+3Cx6KmENE4+zs0bPzpX4pHWbGWWiop9m2C8=; b=l7pO0nBqxA1GKnzDg6HTaHMP980GC/O6Z2KGjVX4djM8BHADJt1Mk9I12nst1zRb7u NU0+efP6dJg1Mx6yfNIzqnc8vL8tPPLNAyWaNACQ/5m5TBbO6yx8hNiUqYVC8aX9N47d SMqmDlTxTDYuMJyHgWPGgTM38j2ZK/LKF7GYIBf50NnyuoyJdlO7BPFCBT2P20ttOgss /szMY4ZX3w+EwIRTAXD4m9xnwysGIt+ASQaaaBv38Tjz6eL0gRbx2mAt+IRqLNk0BKkE pLqz8ZDYjLt3M2Y/80kpZC98xiEvhPDUlyjTEmRHMBdlQ+FrGSlcK4i62+txgaq2Z09V 6HRw== X-Gm-Message-State: AOJu0YxDof4Py55dcPj9hx01oUDzwIDM+WmYR8rCiXccnn/+uxJw9Fnb msG5NC5Nwj5w6s/CBDA47NE= X-Google-Smtp-Source: AGHT+IEBJK90gDyvFSF15Zd7y9xNPqkhfxe80VneNX35DCeNzc+cf8p1xhimbg9FPPlfKaG3sC+8mA== X-Received: by 2002:a05:6a21:329b:b0:133:6e3d:68cd with SMTP id yt27-20020a056a21329b00b001336e3d68cdmr7081305pzb.3.1699556103276; Thu, 09 Nov 2023 10:55:03 -0800 (PST) Received: from localhost.localdomain ([140.116.154.65]) by smtp.gmail.com with ESMTPSA id w19-20020a170902d71300b001c61921d4d2sm3821837ply.302.2023.11.09.10.55.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 10:55:02 -0800 (PST) From: Kuan-Wei Chiu To: bleung@chromium.org, tzungbi@kernel.org Cc: groeck@chromium.org, chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, Kuan-Wei Chiu Subject: [PATCH 3/7] platform/chrome: Fix typo 'noone' in comment Date: Fri, 10 Nov 2023 02:54:35 +0800 Message-Id: <20231109185439.1535962-4-visitorckw@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231109185439.1535962-1-visitorckw@gmail.com> References: <20231109185439.1535962-1-visitorckw@gmail.com> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Replace 'noone' with 'no one' in the comment. Signed-off-by: Kuan-Wei Chiu --- drivers/platform/chrome/cros_ec_sensorhub_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_ec_sensorhub_ring.c b/drivers/platform/chrome/cros_ec_sensorhub_ring.c index ee1c3124d31a..85764e62cbe4 100644 --- a/drivers/platform/chrome/cros_ec_sensorhub_ring.c +++ b/drivers/platform/chrome/cros_ec_sensorhub_ring.c @@ -103,7 +103,7 @@ EXPORT_SYMBOL_GPL(cros_ec_sensorhub_unregister_push_data); * @sensorhub: Sensor Hub object * @on: true when events are requested. * - * To be called before sleeping or when noone is listening. + * To be called before sleeping or when no one is listening. * Return: 0 on success, or an error when we can not communicate with the EC. * */ From patchwork Thu Nov 9 18:54:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuan-Wei Chiu X-Patchwork-Id: 13451642 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 4A235D2ED for ; Thu, 9 Nov 2023 18:55:07 +0000 (UTC) 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cWblSsI0" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1ca85ff26afso2564255ad.1 for ; Thu, 09 Nov 2023 10:55:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699556107; x=1700160907; darn=lists.linux.dev; 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=PRi+qAy0bRoafy49vwIjB8vcVV09afunArSCgU/jH/8=; b=cWblSsI05tDOMypX8xc1WVNcFcYPSAC7D3nTWdbC+1jZb/Ihvsn/kHaavWKw8gs147 xN/ElTPi/CfWdh4eyxzgXPDcjfLlUL5IJSwPCFeNFGGZ5GsIBiQ+cuUFwCcOJFWpt3bK 4tdTXRbsWWExy6zZlneiX8Os5w/nv2DeOtXelShrQ985VAkb+3OvCZoh3L7ymC0JYzZL B79TDj5bLyJaoF5be0zjFUOAGhxkUzDnmh462fxhXiEM6mh/nbTX8HY6Fu2cz7VZGCc4 mcf/AUmCRMmXPwDunjQ5dYR4xNdbDLLbks7ZH5ndTguowIPVdgzgiMOVCGw5ur30CQmm ET6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699556107; x=1700160907; 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=PRi+qAy0bRoafy49vwIjB8vcVV09afunArSCgU/jH/8=; b=h3vG75N8cuGqebYz9lTnwKn+18fdxbslRaUX6P2sA1iGLcYzqA2YcySrneNheAQBUV oz/SjCEvi4nRJc0LBbzPcItTjgwoOc7rgUCPpI0DCjmkvX4ynZ4c0uBor5X8s5Mxv+vp jwFkVnVPykQK94071vmlthIdYNR2Bbpt5xIk7EtQNel27TqCtNsx+1eSRjcvMrzR9Xxc Nt+09GOU1HhVqmM1dn9sSZN+HBo7k4cM2dNFwcYBK59UECqW81VMF7WJWljK/u4tRc8/ peMdulMayE4W/8rsR6pH9/w9IY0c0g+EBHFIAwivlJsemVH2XjTYOLEkfvZW+3U07o06 ONoA== X-Gm-Message-State: AOJu0YzcMT+nJ5jKEwagjze3NEJigPwhyNHrM/CEDUcXk2amhr0iU0p3 SA8++UzBGQ3oGvtYV26PIWY= X-Google-Smtp-Source: AGHT+IEjlXJkC2bw7tWXPOMaDfWHKiPmPN5r1CPOZIEmM6XpA/df2WMR8wr6JLELmvE8T9Bj+So2cQ== X-Received: by 2002:a17:902:c943:b0:1c7:5581:f9c with SMTP id i3-20020a170902c94300b001c755810f9cmr6369730pla.0.1699556106845; Thu, 09 Nov 2023 10:55:06 -0800 (PST) Received: from localhost.localdomain ([140.116.154.65]) by smtp.gmail.com with ESMTPSA id w19-20020a170902d71300b001c61921d4d2sm3821837ply.302.2023.11.09.10.55.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 10:55:06 -0800 (PST) From: Kuan-Wei Chiu To: bleung@chromium.org, tzungbi@kernel.org Cc: groeck@chromium.org, chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, Kuan-Wei Chiu Subject: [PATCH 4/7] platform/chrome: Fix typo 'lantency' in comment Date: Fri, 10 Nov 2023 02:54:36 +0800 Message-Id: <20231109185439.1535962-5-visitorckw@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231109185439.1535962-1-visitorckw@gmail.com> References: <20231109185439.1535962-1-visitorckw@gmail.com> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Replace 'lantency' with 'latency' in the comment. Signed-off-by: Kuan-Wei Chiu --- drivers/platform/chrome/cros_ec_sensorhub_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_ec_sensorhub_ring.c b/drivers/platform/chrome/cros_ec_sensorhub_ring.c index 85764e62cbe4..92faf701b8f0 100644 --- a/drivers/platform/chrome/cros_ec_sensorhub_ring.c +++ b/drivers/platform/chrome/cros_ec_sensorhub_ring.c @@ -176,7 +176,7 @@ static s64 cros_ec_sensor_ring_median(s64 *array, size_t length) * While a and b are recorded at accurate times (due to the EC real time * nature); c is pretty untrustworthy, even though it's recorded the * first thing in ec_irq_handler(). There is a very good change we'll get - * added lantency due to: + * added latency due to: * other irqs * ddrfreq * cpuidle From patchwork Thu Nov 9 18:54:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuan-Wei Chiu X-Patchwork-Id: 13451643 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 35028524D for ; Thu, 9 Nov 2023 18:55:11 +0000 (UTC) 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bryYdOoZ" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1cc28719cb0so2562765ad.0 for ; Thu, 09 Nov 2023 10:55:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699556110; x=1700160910; darn=lists.linux.dev; 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=g73QTqa4YTCeJuDnfMTOW8eVS9xm1gIdRDmG7TjF/yc=; b=bryYdOoZhDQfitMYO51PaxD7XtCDovgL8QFyvc99srVCpnycFfsfwf3GXtyDU3riFn yxJd6gM7XwuWJO+IDUdCKWSbcrqVPJmsLmSdDXG8Jt+e9jgk7dBagsq/L1v6G1nKAyR4 kGFzrQmKFeOnt/aCEjsdkCUlGBzMYykbSsrpBjN3vtrLwfr+bodMEy3qhyAiK5yHUnoQ RrsoTLv4WTP9rsV7PTU94ks0bb7EZG9lIa9lXxcxnS3b5GWIP1sbiPSIy7K2HCwLDVe4 j6wuWpFi1/8sMbAY6Lvi87yC29GfjKlv2H+Mj0PfMlfY+WrzkmuinGR+fgF9zQHuWz/L Wfnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699556110; x=1700160910; 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=g73QTqa4YTCeJuDnfMTOW8eVS9xm1gIdRDmG7TjF/yc=; b=QTNcI4ZBVkO3AIuHdFpdyxQa+ZznoAd2GO9CuUCjZzqFHQZ0XxjI6abFl8hhXVSfcX HIyYyHIOjT8nfSh70z3hQX/aJSCo1Rq+JYvOH78QcZQ3mVija275HP5A/Y7Qtgj5CKe0 gMqI9P5IPxvoX0RUgWZhFjeT4opxO9lhd441ABQyYHsk1tn+/3OAxTis0C6yxjUYtxgd jgk4jCsEBGJSBc2UOjuFw7kz6Tk5vJGD0VKaYH/FFrn/p6NVQ0aPVCgRVRP9LNB40XUL mA3dLMpY40aHh3oZk/FTI7dAABe/DUiJ79DlpoL3ve0zhEvRVRC3v0x2sbrbw6Bo1GQi lOPw== X-Gm-Message-State: AOJu0Yx2XjaYKVvK/1uQX49XNYLUpFGz6EO+G/iH4C6sRXoTavc3/aMx 3bM6fhumsqEewz8/Zvqat2Q= X-Google-Smtp-Source: AGHT+IFxZxc4RDzX6HRIMX0zhVB50kMciGdcCmsIWNygaa4MSMM4LrRdrVRhjg7PMLTFpkHhpXk5eQ== X-Received: by 2002:a17:902:c943:b0:1c7:5581:f9c with SMTP id i3-20020a170902c94300b001c755810f9cmr6369880pla.0.1699556110547; Thu, 09 Nov 2023 10:55:10 -0800 (PST) Received: from localhost.localdomain ([140.116.154.65]) by smtp.gmail.com with ESMTPSA id w19-20020a170902d71300b001c61921d4d2sm3821837ply.302.2023.11.09.10.55.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 10:55:10 -0800 (PST) From: Kuan-Wei Chiu To: bleung@chromium.org, tzungbi@kernel.org Cc: groeck@chromium.org, chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, Kuan-Wei Chiu Subject: [PATCH 5/7] platform/chrome: Fix typo 'kifo' in commet Date: Fri, 10 Nov 2023 02:54:37 +0800 Message-Id: <20231109185439.1535962-6-visitorckw@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231109185439.1535962-1-visitorckw@gmail.com> References: <20231109185439.1535962-1-visitorckw@gmail.com> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Replace 'kifo' with 'kfifo' in the comment. Signed-off-by: Kuan-Wei Chiu --- drivers/platform/chrome/cros_ec_sensorhub_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_ec_sensorhub_ring.c b/drivers/platform/chrome/cros_ec_sensorhub_ring.c index 92faf701b8f0..6c2aa2651e5f 100644 --- a/drivers/platform/chrome/cros_ec_sensorhub_ring.c +++ b/drivers/platform/chrome/cros_ec_sensorhub_ring.c @@ -595,7 +595,7 @@ cros_ec_sensor_ring_spread_add(struct cros_ec_sensorhub *sensorhub, } else { /* * Push first sample in the batch to the, - * kifo, it's guaranteed to be correct, the + * kfifo, it's guaranteed to be correct, the * rest will follow later on. */ sample_idx = 1; From patchwork Thu Nov 9 18:54:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuan-Wei Chiu X-Patchwork-Id: 13451644 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 E861B19456 for ; Thu, 9 Nov 2023 18:55:15 +0000 (UTC) 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QTecOB7t" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1cc41afd376so1916475ad.1 for ; Thu, 09 Nov 2023 10:55:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699556115; x=1700160915; darn=lists.linux.dev; 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=kg9I4ZaIj7Cn80AZ+YJatc/DGTkLCa1gLvsiD/shfvU=; b=QTecOB7tlpQu8af1Rz3ssYzsCj0WZ1witdAiGpU2Jv1CzTeNxWYxKD9QKN0pQcdm6b 3P+IZul2ZdWgWfuj5/CJkg1OwofF9ZjY4P+FDjEITowZ5VGf02mhc8eu4lY9RI69qIK2 zR2o3UuRNN8mQOAqaxHpGoPuPaN2c26S6TwX3nVjpIOIF8iJGEshs+0h+qLARJz/VSXa 48G06Oo2W/HEv+OR6dFs1mbLwN5ECHQZ/5TFXqmgGdHBjaotKWk2wY3Lu4RH5GgBGXr2 GgIrVfMk/idJIDI4h6iE0TZD1nsD36wxKv8LikR8aj4J4bludmPbATzfXPzvTBIn6JJX Xx9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699556115; x=1700160915; 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=kg9I4ZaIj7Cn80AZ+YJatc/DGTkLCa1gLvsiD/shfvU=; b=IvYY7qzrVj+Gst5Cdg+8ktuCbnXSlWgmR9jeQbk8cxga0v+Ku4cqr8Yk2RDP3rkgdx HUxKOuFAK6mFeguB8NKHBdyLGbuUJyjYsZvzWMisBILa1JRlpTNU/fALtwsJWI5LvwYS WDMVbEAqVwN+QrYRo84gQeYENl4pkVcAFfZuAgv74TOYLKmarAtDWCX5Zg5S7Y5ypQD5 nSoLC1YJm9j2NbBgCtFo1SFB77PVE885sJ/J+IVLzW4y7c+CEuTLcXhqAqum0PUREJi5 CWLG3QA4xm2827kQxwRKktCtdcdN7cUpV2ooXwe/vr/qBRbnx+Tx8YxvRv5bPab2BLol LX1A== X-Gm-Message-State: AOJu0Yzw2AHFsuI7LqmkpJ4ekbE0Wg6vDtH454XFxbro69UxCgZtil/F /3zAjG1a5FFNA5AehbmYlwI= X-Google-Smtp-Source: AGHT+IEtW1oaVYd/An5rg2FaDM6Q0s0wAl5Pr2VY0eMfJkPWNQqJ1LUHlgMkwIfQk4Ow5hwMKO0bCg== X-Received: by 2002:a17:902:ce8c:b0:1cc:3e45:ac1e with SMTP id f12-20020a170902ce8c00b001cc3e45ac1emr6334586plg.6.1699556115257; Thu, 09 Nov 2023 10:55:15 -0800 (PST) Received: from localhost.localdomain ([140.116.154.65]) by smtp.gmail.com with ESMTPSA id w19-20020a170902d71300b001c61921d4d2sm3821837ply.302.2023.11.09.10.55.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 10:55:14 -0800 (PST) From: Kuan-Wei Chiu To: bleung@chromium.org, tzungbi@kernel.org Cc: groeck@chromium.org, chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, Kuan-Wei Chiu Subject: [PATCH 6/7] platform/chrome: Fix typo 'change' in comment Date: Fri, 10 Nov 2023 02:54:38 +0800 Message-Id: <20231109185439.1535962-7-visitorckw@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231109185439.1535962-1-visitorckw@gmail.com> References: <20231109185439.1535962-1-visitorckw@gmail.com> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Replace 'change' with 'chance' in the comment. Signed-off-by: Kuan-Wei Chiu --- drivers/platform/chrome/cros_ec_sensorhub_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_ec_sensorhub_ring.c b/drivers/platform/chrome/cros_ec_sensorhub_ring.c index 6c2aa2651e5f..9e17f7483ca0 100644 --- a/drivers/platform/chrome/cros_ec_sensorhub_ring.c +++ b/drivers/platform/chrome/cros_ec_sensorhub_ring.c @@ -175,7 +175,7 @@ static s64 cros_ec_sensor_ring_median(s64 *array, size_t length) * * While a and b are recorded at accurate times (due to the EC real time * nature); c is pretty untrustworthy, even though it's recorded the - * first thing in ec_irq_handler(). There is a very good change we'll get + * first thing in ec_irq_handler(). There is a very good chance we'll get * added latency due to: * other irqs * ddrfreq From patchwork Thu Nov 9 18:54:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuan-Wei Chiu X-Patchwork-Id: 13451645 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (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 8E7FD208C6 for ; Thu, 9 Nov 2023 18:55:19 +0000 (UTC) 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CT2AuGH5" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1cc2b8deb23so2248365ad.1 for ; Thu, 09 Nov 2023 10:55:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699556119; x=1700160919; darn=lists.linux.dev; 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=1F+zsKAZ6psJ2Y0k9zWx71Sew29B0knPhWsJIJOxq3o=; b=CT2AuGH5J3HTHRZu1NV2ZAEcqhhDciona2jECsoX1gu8FSut54YedGQzCCYk1Me9zW OKNKJJ6fIISiDzIIQN9RcynikJVrPJl9z/i9SJC/0I35EdgcdmGPUA0vqZpsoIEhQVi7 e/j6e0ReLLpOU4nDMb9jXZBd2fNcCpfhYOqr7CS7av9MdrVTP/eIrJZffO80RZr1H9N7 jfn8iSXN+Yj36lcyi6IhZeITF36VL2LhD6bPlqft76XaJbesgndQfDJDz2Z5zh+1WgZP fktF5YlajAU/jAPDlwrNXAYtwJfnkHBzGwkoxzZ0Aovo57cUqS+gO1oyNmoJ3OliB6Cv 7+8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699556119; x=1700160919; 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=1F+zsKAZ6psJ2Y0k9zWx71Sew29B0knPhWsJIJOxq3o=; b=Y99/yRn9/IEWWYFYjurWLGtwwlYiVpj8xEaxLfLEppUDynnBnYc9GaMEtjlrunjctJ tQf7NY64k6TjjOsdaA0pPKCbadNKlHPvBCbMTadLjB8NuUYTLIicZh7IuAF1YjE5+KY2 wyx3MzqAwy8EvyDAQSrqps7OdeoUl1YqdW9kjNJz+hMwGlQ4Ljg5IF+sRF07tv2QjWex yH8uyk2iDHi/M4B50xW7h23oebGFqknu7AEFarDrbENNXPDfJZod+pIfuaJlu7oh/BGC MS6uOTMGZjYWowQfUNuVVrerCy8kBUoZ7CJ7FE6QS2vOSrleJffv1aE6tm5OO/wBo4sP pRjw== X-Gm-Message-State: AOJu0YyPtX214ETcANw11OfUboKLq70kNs0z683pnKAi+xWZpGtv++JC UhMORUUzH9M3Dl8prnuknw0= X-Google-Smtp-Source: AGHT+IHq3DPWkkVhxoXkHb0d97mTfbvuE+JfpLRcZwmkaEMx/WorUBpsxL7/EBbJgr1HmsufXxjk0Q== X-Received: by 2002:a17:903:2349:b0:1cc:3c2c:fa1a with SMTP id c9-20020a170903234900b001cc3c2cfa1amr6422376plh.4.1699556118862; Thu, 09 Nov 2023 10:55:18 -0800 (PST) Received: from localhost.localdomain ([140.116.154.65]) by smtp.gmail.com with ESMTPSA id w19-20020a170902d71300b001c61921d4d2sm3821837ply.302.2023.11.09.10.55.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 10:55:18 -0800 (PST) From: Kuan-Wei Chiu To: bleung@chromium.org, tzungbi@kernel.org Cc: groeck@chromium.org, chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, Kuan-Wei Chiu Subject: [PATCH 7/7] platform/chrome: Implement quickselect for median calculation Date: Fri, 10 Nov 2023 02:54:39 +0800 Message-Id: <20231109185439.1535962-8-visitorckw@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231109185439.1535962-1-visitorckw@gmail.com> References: <20231109185439.1535962-1-visitorckw@gmail.com> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The cros_ec_sensor_ring_median function currently uses an inefficient sorting algorithm (> O(n)) to find the median of an array. This patch replaces the sorting approach with the quickselect algorithm, which achieves an average time complexity of O(n). The algorithm employs the median-of-three rule to select the pivot, mitigating worst-case scenarios and reducing the expected number of necessary comparisons. This strategy enhances the algorithm's efficiency and ensures a more balanced partitioning. In the worst case, the runtime of quickselect could regress to O(n^2). To address this, alternative algorithms like median-of-medians that can guarantee O(n) even in the worst case. However, due to higher overhead and increased complexity, quickselect remains a pragmatic choice for our use case. Signed-off-by: Kuan-Wei Chiu --- .../platform/chrome/cros_ec_sensorhub_ring.c | 71 ++++++++++++++----- 1 file changed, 54 insertions(+), 17 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_sensorhub_ring.c b/drivers/platform/chrome/cros_ec_sensorhub_ring.c index 9e17f7483ca0..4ac718be38b0 100644 --- a/drivers/platform/chrome/cros_ec_sensorhub_ring.c +++ b/drivers/platform/chrome/cros_ec_sensorhub_ring.c @@ -133,33 +133,70 @@ int cros_ec_sensorhub_ring_fifo_enable(struct cros_ec_sensorhub *sensorhub, return ret; } -static int cros_ec_sensor_ring_median_cmp(const void *pv1, const void *pv2) +static void cros_ec_sensor_ring_median_swap(s64 *a, s64 *b) { - s64 v1 = *(s64 *)pv1; - s64 v2 = *(s64 *)pv2; - - if (v1 > v2) - return 1; - else if (v1 < v2) - return -1; - else - return 0; + s64 tmp = *a; + *a = *b; + *b = tmp; } /* * cros_ec_sensor_ring_median: Gets median of an array of numbers * - * For now it's implemented using an inefficient > O(n) sort then return - * the middle element. A more optimal method would be something like - * quickselect, but given that n = 64 we can probably live with it in the - * name of clarity. + * It's implemented using the quickselect algorithm, which achieves an + * average time complexity of O(n) the middle element. In the worst case, + * the runtime of quickselect could regress to O(n^2). To mitigate this, + * algorithms like median-of-medians exist, which can guarantee O(n) even + * in the worst case. However, these algorithms come with a higher + * overhead and are more complex to implement, making quickselect a + * pragmatic choice for our use case. * - * Warning: the input array gets modified (sorted)! + * Warning: the input array gets modified! */ static s64 cros_ec_sensor_ring_median(s64 *array, size_t length) { - sort(array, length, sizeof(s64), cros_ec_sensor_ring_median_cmp, NULL); - return array[length / 2]; + const int k = length / 2; + int lo = 0; + int hi = length - 1; + + while (lo <= hi) { + int mid = lo + (hi - lo) / 2; + int pivot, pivot_index; + int i = lo - 1; + + /* We employ the median-of-three rule to choose the pivot, mitigating + * worst-case scenarios such as already sorted arrays and aiming to reduce + * the expected number of necessary comparisons. This strategy enhances the + * algorithm's performance and ensures a more balanced partitioning. + */ + if (array[lo] > array[mid]) + cros_ec_sensor_ring_median_swap(&array[lo], + &array[mid]); + if (array[lo] > array[hi]) + cros_ec_sensor_ring_median_swap(&array[lo], &array[hi]); + if (array[mid] < array[hi]) + cros_ec_sensor_ring_median_swap(&array[mid], + &array[hi]); + + pivot = array[hi]; + + for (int j = lo; j < hi; j++) + if (array[j] < pivot) + cros_ec_sensor_ring_median_swap(&array[++i], + &array[j]); + + cros_ec_sensor_ring_median_swap(&array[i + 1], &array[hi]); + pivot_index = i + 1; + if (pivot_index == k) + return array[pivot_index]; + if (pivot_index > k) + hi = pivot_index - 1; + else + lo = pivot_index + 1; + } + + /* Should never reach here. */ + return -1; } /*