From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58D912566E8; Thu, 17 Apr 2025 18:04:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744913047; cv=none; b=XgsCwUaLcKvd0KGs03mSrNcPj3d/nOS2mxr4wv0YFAc7f0tQRjvuqThDG+3TSU43qXGFqbYNgOKz/HwOG3fsMgSG3epoXvL9SDgQnxJdyZa84j/Pp/nyGFz0Ws85DGI3Gk9AxsFdWSn7weZLcL2zw8jHRb1KSPeLUlawRK1i+dI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744913047; c=relaxed/simple; bh=laOR+mHhtYlH+9WSK6wioK4oZjq9550ztWU1j4Tgaiw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fUYQ9iyX/4FK0wnnCO9WQXyCp+254Jpea/uoG7LMbs3AvLXfWCbhQIskSwWs76miHh7ycDspYHDzq5J0rQlWGUaQlU7eSPJh7CzqztqlbXIe7yITW7oYu3y9Yx/3CB1H1VBrYBSwElu8WGq468th0OsuzU2g5IQyUWdGhkH9gp4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=hSFh6kKK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="hSFh6kKK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C679C4CEE4; Thu, 17 Apr 2025 18:04:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744913046; bh=laOR+mHhtYlH+9WSK6wioK4oZjq9550ztWU1j4Tgaiw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hSFh6kKKJLpEseF8NSUInQcWb6dNk4LvWME5qUX9RXSO5olizNZx3QS+5M3ZY14/d O49Lgz+QdTnBzOfdEwHOz3otpRLyWC8Z3u/oNk0SCvcbnI24zbiqqUDuzzhApNH3aO r368fkJJtO0dSXzmtUK1liBZyvYNm0JwtecOXI6s= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Tomasz=20Paku=C5=82a?= , Jiri Kosina , Sasha Levin Subject: [PATCH 6.14 210/449] HID: pidff: Support device error response from PID_BLOCK_LOAD Date: Thu, 17 Apr 2025 19:48:18 +0200 Message-ID: <20250417175126.428664634@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250417175117.964400335@linuxfoundation.org> References: <20250417175117.964400335@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tomasz Pakuła [ Upstream commit 9d4174dc4a234408d91fd83725e1899766cd1731 ] If an error happens on the device, the driver will no longer fall into the trap of reading this status 60 times before it decides that this reply won't change to success/memory full. Greatly reduces communication overhead during device error situation. Signed-off-by: Tomasz Pakuła Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/usbhid/hid-pidff.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c index e2508a4d754d3..d5734cbf745d1 100644 --- a/drivers/hid/usbhid/hid-pidff.c +++ b/drivers/hid/usbhid/hid-pidff.c @@ -138,7 +138,8 @@ static const u8 pidff_effect_types[] = { #define PID_BLOCK_LOAD_SUCCESS 0 #define PID_BLOCK_LOAD_FULL 1 -static const u8 pidff_block_load_status[] = { 0x8c, 0x8d }; +#define PID_BLOCK_LOAD_ERROR 2 +static const u8 pidff_block_load_status[] = { 0x8c, 0x8d, 0x8e}; #define PID_EFFECT_START 0 #define PID_EFFECT_STOP 1 @@ -666,6 +667,11 @@ static int pidff_request_effect_upload(struct pidff_device *pidff, int efnum) pidff->block_load[PID_RAM_POOL_AVAILABLE].value[0] : -1); return -ENOSPC; } + if (pidff->block_load_status->value[0] == + pidff->status_id[PID_BLOCK_LOAD_ERROR]) { + hid_dbg(pidff->hid, "device error during effect creation\n"); + return -EREMOTEIO; + } } hid_err(pidff->hid, "pid_block_load failed 60 times\n"); return -EIO; -- 2.39.5