From nobody Tue Nov 26 08:58:03 2024 Received: from out-175.mta1.migadu.com (out-175.mta1.migadu.com [95.215.58.175]) (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 BF9CF38FB0 for ; Sat, 19 Oct 2024 08:41:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729327281; cv=none; b=iVLpbJJv1ziBojT9V/m9FLW2Wo+FWKgtL4niMXCmQctx0irPnR04x85M9HhlPh3H+BTWOaIqJrrALIDsAUVCFf7LG3OM3WmWp4rKT4hhhdtfMFDf+3wws+9qQIuldfzzudnPW536ZOcQoyUAMvpIqafd05n/hTFRspvAZj0HzL8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729327281; c=relaxed/simple; bh=er4PjG88WtdHMGxq4I2UcqzhmfHX2ibGY4X4NDNYNyc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dr0d/0Z8QUUXhjcYso32ddyblxoBM5Q/u/FD5IV7HJjd4KKvUguEvs0IVWO4Jm/CmCJ8+dGl9F1dJPbCaKtvTTT6+Q3fE6iU9imF5qhNMH1fAFMl+jArMM+QMowjmVgij5isSjakog8426yar2UZmnXVl90LB7sHZJ8/5EiP/cM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wiredspace.de; spf=pass smtp.mailfrom=wiredspace.de; dkim=pass (1024-bit key) header.d=wiredspace.de header.i=@wiredspace.de header.b=elMYD0Ul; arc=none smtp.client-ip=95.215.58.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wiredspace.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wiredspace.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wiredspace.de header.i=@wiredspace.de header.b="elMYD0Ul" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wiredspace.de; s=key1; t=1729327276; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5h88aRCX075gQyacCBN//xbLtbJ+w9Ld3N3jt4xAwmA=; b=elMYD0Ulyk0Ph6cf+QJs8Gb5ybPcrTxhHxPtJxdXOERuk4TzCZt85jgcGI02gA2eO9rnOy ZHaIxZmXqamLRy7xXhUt7Lshwb/1UyddIaGj4f2TcPOnvqV/yRTERoMxf0nMjD0nMOQsuV SQuTBf4WV/+Rs8eQnQtC5HIELNW9QOU= From: =?UTF-8?q?Thomas=20B=C3=B6hler?= To: Miguel Ojeda , Alex Gaynor , Jocelyn Falempe Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , rust-for-linux@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Thomas=20B=C3=B6hler?= Subject: [PATCH v2 1/7] drm/panic: avoid reimplementing Iterator::find Date: Sat, 19 Oct 2024 10:22:46 +0200 Message-ID: <20241019084048.22336-2-witcher@wiredspace.de> In-Reply-To: <20241019084048.22336-1-witcher@wiredspace.de> References: <20241019084048.22336-1-witcher@wiredspace.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Rust's standard library's `std::iter::Iterator` trait provides a function `find` that finds the first element that satisfies a predicate. The function `Version::from_segments` is doing the same thing but is implementing the same logic itself. Clippy complains about this in the `manual_find` lint: error: manual implementation of `Iterator::find` --> drivers/gpu/drm/drm_panic_qr.rs:212:9 | 212 | / for v in (1..=3D40).map(|k| Version(k)) { 213 | | if v.max_data() * 8 >=3D segments.iter().map(|s| s.= total_size_bits(v)).sum() { 214 | | return Some(v); 215 | | } 216 | | } 217 | | None | |____________^ help: replace with an iterator: `(1..=3D40).map(|k= | Version(k)).find(|&v| v.max_data() * 8 >=3D segments.iter().map(|s| s.tot= al_size_bits(v)).sum())` | =3D help: for further information visit https://rust-lang.github.io= /rust-clippy/master/index.html#manual_find =3D note: `-D clippy::manual-find` implied by `-D warnings` =3D help: to override `-D warnings` add `#[allow(clippy::manual_fin= d)]` Use `Iterator::find` instead to make the intention clearer. Fixes: cb5164ac43d0 ("drm/panic: Add a QR code panic screen") Reported-by: Miguel Ojeda Link: https://github.com/Rust-for-Linux/linux/issues/1123 Signed-off-by: Thomas B=C3=B6hler Reviewed-by: Jocelyn Falempe --- drivers/gpu/drm/drm_panic_qr.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_panic_qr.rs b/drivers/gpu/drm/drm_panic_qr= .rs index 1ef56cb07dfb..76decf49e678 100644 --- a/drivers/gpu/drm/drm_panic_qr.rs +++ b/drivers/gpu/drm/drm_panic_qr.rs @@ -209,12 +209,9 @@ impl Version { /// Returns the smallest QR version than can hold these segments. fn from_segments(segments: &[&Segment<'_>]) -> Option { - for v in (1..=3D40).map(|k| Version(k)) { - if v.max_data() * 8 >=3D segments.iter().map(|s| s.total_size_= bits(v)).sum() { - return Some(v); - } - } - None + (1..=3D40) + .map(Version) + .find(|&v| v.max_data() * 8 >=3D segments.iter().map(|s| s.tot= al_size_bits(v)).sum()) } =20 fn width(&self) -> u8 { --=20 2.46.2 From nobody Tue Nov 26 08:58:03 2024 Received: from out-186.mta0.migadu.com (out-186.mta0.migadu.com [91.218.175.186]) (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 BCEA01DE88C for ; Sat, 19 Oct 2024 08:41:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.186 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729327285; cv=none; b=mExlVJSboNMNVawkzGbmkQLI3+k715JVnAJcRnCJR3S4D2jtWAyfP5owJb4X7zkBWr67h6FnS8bVGgYTcxgIGefw0iJJRnsKDdECUemk4ba1PuHGntEctyhOnY7U+L8FtslNmVdjAIu7f+qhBbiB9di5Bf1YKkJFMkp6zYmWifE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729327285; c=relaxed/simple; bh=jFvbfoF4vUgK+eUQ3fW6irvU22g1V0ojLeWPPl9urpg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lOWx4SCL2g9tlMKwnYsqVn2avynzibxr6JPT3HYJNpYShiNM9rVrVhEaSnbBmypsD1GnE46v11ZYzB6y/NyI+w/nkQC25T9L3mzNSxalfAwKH5/LK1uKyo1e9KCIOvAgOBIvTZY5VaYnigWBiX21r/g7BmhYbs6Z5Q5yXLos0g8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wiredspace.de; spf=pass smtp.mailfrom=wiredspace.de; dkim=pass (1024-bit key) header.d=wiredspace.de header.i=@wiredspace.de header.b=m0y1ce7n; arc=none smtp.client-ip=91.218.175.186 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wiredspace.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wiredspace.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wiredspace.de header.i=@wiredspace.de header.b="m0y1ce7n" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wiredspace.de; s=key1; t=1729327281; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GZJoXg9fLkkYOrnCoSAzjaA03NEPR/GiNSjvi3pIFiM=; b=m0y1ce7npY1kLNzuEMuldTSJ2g1cJbw7j8g1T/IWzM40vyfb2lt05ZEj7D4up5xZ7Ucmgo Be/F6InlFhpOxY4IwAlrfrSjGUt3SLvt9b/LLYkyxzpqUFYKflJgmBx4mFWpvuGHF5Ib1r O65tDXZs70ajyQjSzSi/WSRh15Azk8U= From: =?UTF-8?q?Thomas=20B=C3=B6hler?= To: Miguel Ojeda , Alex Gaynor , Jocelyn Falempe Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , rust-for-linux@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Thomas=20B=C3=B6hler?= Subject: [PATCH v2 2/7] drm/panic: remove unnecessary borrow in alignment_pattern Date: Sat, 19 Oct 2024 10:22:47 +0200 Message-ID: <20241019084048.22336-3-witcher@wiredspace.de> In-Reply-To: <20241019084048.22336-1-witcher@wiredspace.de> References: <20241019084048.22336-1-witcher@wiredspace.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT The function `alignment_pattern` returns a static reference to a `u8` slice. The borrow of the returned element in `ALIGNMENT_PATTERNS` is already a reference as defined in the array definition above so this borrow is unnecessary and removed by the compiler. Clippy notes this in `needless_borrow`: error: this expression creates a reference which is immediately derefer= enced by the compiler --> drivers/gpu/drm/drm_panic_qr.rs:245:9 | 245 | &ALIGNMENT_PATTERNS[self.0 - 1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `AL= IGNMENT_PATTERNS[self.0 - 1]` | =3D help: for further information visit https://rust-lang.github.io= /rust-clippy/master/index.html#needless_borrow =3D note: `-D clippy::needless-borrow` implied by `-D warnings` =3D help: to override `-D warnings` add `#[allow(clippy::needless_b= orrow)]` Remove the unnecessary borrow. Fixes: cb5164ac43d0 ("drm/panic: Add a QR code panic screen") Reported-by: Miguel Ojeda Link: https://github.com/Rust-for-Linux/linux/issues/1123 Signed-off-by: Thomas B=C3=B6hler Reviewed-by: Jocelyn Falempe --- drivers/gpu/drm/drm_panic_qr.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_panic_qr.rs b/drivers/gpu/drm/drm_panic_qr= .rs index 76decf49e678..7adfaa3d6222 100644 --- a/drivers/gpu/drm/drm_panic_qr.rs +++ b/drivers/gpu/drm/drm_panic_qr.rs @@ -239,7 +239,7 @@ fn g1_blk_size(&self) -> usize { } =20 fn alignment_pattern(&self) -> &'static [u8] { - &ALIGNMENT_PATTERNS[self.0 - 1] + ALIGNMENT_PATTERNS[self.0 - 1] } =20 fn poly(&self) -> &'static [u8] { --=20 2.46.2 From nobody Tue Nov 26 08:58:03 2024 Received: from out-174.mta0.migadu.com (out-174.mta0.migadu.com [91.218.175.174]) (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 E54071DF964 for ; Sat, 19 Oct 2024 08:41:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729327289; cv=none; b=f8ynry5KnTRV9lrDh9R9OjQo7RR8uHqYa+KjYFg+GPYqTTONnr6KOhSZHEryDjIT2bYQ1ERlEZGByAnYR2QX0Wpaxi8/wnGqqXIf2IRDBTvXLD0DLy63u2CmMLMxUIBFHNGnkssRzOCYbv656giYOvO8n6/SUikklzqO5aK0fQI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729327289; c=relaxed/simple; bh=xP6psgp3z1V+o06XpNvgK8OnqzkvRz5weBneZzXJmg8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=N2Acb6sX6p65UHxAcewyJIBTY1gPi7YHJHKkyKlAZ5C6s6AvRRiSvhwcVLSfJdqYE1EdpIah3h4NrrAA4V1LuCOu05cTJ/vgLpBhzE4vE6F+dCWQHqTkyJS0Wpyo7YBwxsQAi7Xa5MNr7W7fNTbtf2QSfU02nJUNmY+MlCfSfms= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wiredspace.de; spf=pass smtp.mailfrom=wiredspace.de; dkim=pass (1024-bit key) header.d=wiredspace.de header.i=@wiredspace.de header.b=PiPe7bTK; arc=none smtp.client-ip=91.218.175.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wiredspace.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wiredspace.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wiredspace.de header.i=@wiredspace.de header.b="PiPe7bTK" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wiredspace.de; s=key1; t=1729327283; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MvE6s92/wC5cLsJQ+TrZaR3ILrSklzHNRSWsRlnX0mQ=; b=PiPe7bTKQQ/os25ThxXPVymZKUjOYfTSoE/TAMcRdn1qGhVjuC1ZLz48w1tOzcg73HFMei GPX1yoAiP1LuNoj2R/jorwat42x1mK9KY+WDvvkqvTP5zzRdmYG/DBH8YvD0nXy/pLnVVX DRdHGNRMI5CGFEioyInfJ8QuYMRJkYA= From: =?UTF-8?q?Thomas=20B=C3=B6hler?= To: Miguel Ojeda , Alex Gaynor , Jocelyn Falempe Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , rust-for-linux@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Thomas=20B=C3=B6hler?= Subject: [PATCH v2 3/7] drm/panic: prefer eliding lifetimes Date: Sat, 19 Oct 2024 10:22:48 +0200 Message-ID: <20241019084048.22336-4-witcher@wiredspace.de> In-Reply-To: <20241019084048.22336-1-witcher@wiredspace.de> References: <20241019084048.22336-1-witcher@wiredspace.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Eliding lifetimes when possible instead of specifying them directly is both shorter and easier to read. Clippy notes this in the `needless_lifetimes` lint: error: the following explicit lifetimes could be elided: 'b --> drivers/gpu/drm/drm_panic_qr.rs:479:16 | 479 | fn new<'a, 'b>(segments: &[&Segment<'b>], data: &'a mut [u8])= -> Option> { | ^^ ^^ | =3D help: for further information visit https://rust-lang.github.io= /rust-clippy/master/index.html#needless_lifetimes =3D note: `-D clippy::needless-lifetimes` implied by `-D warnings` =3D help: to override `-D warnings` add `#[allow(clippy::needless_l= ifetimes)]` help: elide the lifetimes | 479 - fn new<'a, 'b>(segments: &[&Segment<'b>], data: &'a mut [u8])= -> Option> { 479 + fn new<'a>(segments: &[&Segment<'_>], data: &'a mut [u8]) -> = Option> { | Remove the explicit lifetime annotation in favour of an elided lifetime. Fixes: cb5164ac43d0 ("drm/panic: Add a QR code panic screen") Reported-by: Miguel Ojeda Link: https://github.com/Rust-for-Linux/linux/issues/1123 Signed-off-by: Thomas B=C3=B6hler Reviewed-by: Jocelyn Falempe --- drivers/gpu/drm/drm_panic_qr.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_panic_qr.rs b/drivers/gpu/drm/drm_panic_qr= .rs index 7adfaa3d6222..767a8eb0acec 100644 --- a/drivers/gpu/drm/drm_panic_qr.rs +++ b/drivers/gpu/drm/drm_panic_qr.rs @@ -476,7 +476,7 @@ struct EncodedMsg<'a> { /// Data to be put in the QR code, with correct segment encoding, padding,= and /// Error Code Correction. impl EncodedMsg<'_> { - fn new<'a, 'b>(segments: &[&Segment<'b>], data: &'a mut [u8]) -> Optio= n> { + fn new<'a>(segments: &[&Segment<'_>], data: &'a mut [u8]) -> Option> { let version =3D Version::from_segments(segments)?; let ec_size =3D version.ec_size(); let g1_blocks =3D version.g1_blocks(); --=20 2.46.2 From nobody Tue Nov 26 08:58:03 2024 Received: from out-186.mta1.migadu.com (out-186.mta1.migadu.com [95.215.58.186]) (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 3A4931DFD9B for ; Sat, 19 Oct 2024 08:41:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.186 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729327291; cv=none; b=Pa3UAxjdphtsOiGFBfwamY4Uy8Y4/bVWIheyEgaUFd/XSmgkyg7HWFpnRPsdCLM8M8bhcRQMxwjEfpBPK+Aq1HYdXSybeqAh51NIuPlCAQiuLmR6tdMjwb7Oxyjk10s7lU1q+hymPGbR4RAJXfe+H20WaEC6nF4eOlxS9SorVns= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729327291; c=relaxed/simple; bh=hhbKGgbf2Xmmk5Ik1B2C60xNzsRKeJyw8A+sdB4gx/M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Mnaz3SQs0LQhf0d9xOz4IwFnGz5eRenDqLZRwxcDQspq4zNDC9i0Yax+VKn5vtRh4YZIg2ltHliU5N/aTm7Szlo1fhOfagv2Ak6eqKrtveC9Wm96aA26OzXAtHUgkl1BFgYaPozMSoXjTUqNGxwzbyiNURYtD3LKZzdGtJu4iqo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wiredspace.de; spf=pass smtp.mailfrom=wiredspace.de; dkim=pass (1024-bit key) header.d=wiredspace.de header.i=@wiredspace.de header.b=Np+ElLQm; arc=none smtp.client-ip=95.215.58.186 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wiredspace.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wiredspace.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wiredspace.de header.i=@wiredspace.de header.b="Np+ElLQm" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wiredspace.de; s=key1; t=1729327287; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UcoYIeWWNAi9ug08MQq6ed4qFK1ZI4BerEYzzWdcCJw=; b=Np+ElLQmAAvrIxzY61DKitE4r4ooVJKSRZD/ytXkimlAsBZEjbMTzmtj1moszstacEdy4q O/20j8kfZDEf2QG+5WBdH+lYyqhZrZLzHw4DBEI0aB1WZLgHGZmgNYz/CIGFbzd6tb7wHu 38M9XSswZMLs0rJh4WOdWXNHBdx4+fs= From: =?UTF-8?q?Thomas=20B=C3=B6hler?= To: Miguel Ojeda , Alex Gaynor , Jocelyn Falempe Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , rust-for-linux@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Thomas=20B=C3=B6hler?= Subject: [PATCH v2 4/7] drm/panic: remove redundant field when assigning value Date: Sat, 19 Oct 2024 10:22:49 +0200 Message-ID: <20241019084048.22336-5-witcher@wiredspace.de> In-Reply-To: <20241019084048.22336-1-witcher@wiredspace.de> References: <20241019084048.22336-1-witcher@wiredspace.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Rust allows initializing fields of a struct without specifying the attribute that is assigned if the variable has the same name. In this instance this is done for all other attributes of the struct except for `data`. Remove the redundant `data` in the assignment to be consistent. Fixes: cb5164ac43d0 ("drm/panic: Add a QR code panic screen") Reported-by: Miguel Ojeda Link: https://github.com/Rust-for-Linux/linux/issues/1123 Signed-off-by: Thomas B=C3=B6hler Reviewed-by: Jocelyn Falempe --- drivers/gpu/drm/drm_panic_qr.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_panic_qr.rs b/drivers/gpu/drm/drm_panic_qr= .rs index 767a8eb0acec..5b2386a515fa 100644 --- a/drivers/gpu/drm/drm_panic_qr.rs +++ b/drivers/gpu/drm/drm_panic_qr.rs @@ -489,7 +489,7 @@ fn new<'a>(segments: &[&Segment<'_>], data: &'a mut [u8= ]) -> Option; Sat, 19 Oct 2024 08:41:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729327293; cv=none; b=BcYtDi3l8es1l8TdNitlsLaHmFjtEBhQkFXiAfvoGmPlTX6tHJz5+KSPF00vwnEIPjs6B8XI2BHnaKq4u2w5UgxQzhcT//Pg275AvawNcjkv1zPi9APD7K4HltHB1YfMiMCR9efMkJj97US/wBJKXojIQMiyt5E/wich8bjTBpw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729327293; c=relaxed/simple; bh=FdZGL3TUN1+9A4uGfIiXR1Sq/tjCCI8qWbE31y09qPU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ppbAIina7meyh+U9Dldpo7BbU5nP5u4tUmvC2qvv1btRRlFG5vpuBF2t401taDioZnH0Cy5p8b5Vt64CpsK6vPuuGbOw8omYd8BX/poStKGklql7RJvX2x2WFjuIEa0zMzs3Q1pB14FpB7fBKFBjJhd8kdUPWV7qmeUQfHEVRoE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wiredspace.de; spf=pass smtp.mailfrom=wiredspace.de; dkim=pass (1024-bit key) header.d=wiredspace.de header.i=@wiredspace.de header.b=ZWZY5S6X; arc=none smtp.client-ip=91.218.175.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wiredspace.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wiredspace.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wiredspace.de header.i=@wiredspace.de header.b="ZWZY5S6X" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wiredspace.de; s=key1; t=1729327289; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KlaPX7c91DzUEtQUWFgG6dPxHB9a7LWLFKVDaWQe3BQ=; b=ZWZY5S6X1TE8qJMvrVbE5TbHr8v548I7F0KyOtN9jh+8qIfAoboP+5+h5GO0zIbc07NKUu ju155gNT2gTZn3dIn0+gGhSDkANGJmtm77dKCm0snHb2jec8siWJNB/4D39wHFxx4xqyBW Az5vjYuIN8dxytv3DgZcDfVoZNtKxQY= From: =?UTF-8?q?Thomas=20B=C3=B6hler?= To: Miguel Ojeda , Alex Gaynor , Jocelyn Falempe Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , rust-for-linux@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Thomas=20B=C3=B6hler?= Subject: [PATCH v2 5/7] drm/panic: correctly indent continuation of line in list item Date: Sat, 19 Oct 2024 10:22:50 +0200 Message-ID: <20241019084048.22336-6-witcher@wiredspace.de> In-Reply-To: <20241019084048.22336-1-witcher@wiredspace.de> References: <20241019084048.22336-1-witcher@wiredspace.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT It is common practice in Rust to indent the next line the same amount of space as the previous one if both belong to the same list item. Clippy checks for this with the lint `doc_lazy_continuation`. error: doc list item without indentation --> drivers/gpu/drm/drm_panic_qr.rs:979:5 | 979 | /// conversion to numeric segments. | ^ | =3D help: if this is supposed to be its own paragraph, add a blank line =3D help: for further information visit https://rust-lang.github.io/rus= t-clippy/master/index.html#doc_lazy_continuation =3D note: `-D clippy::doc-lazy-continuation` implied by `-D warnings` =3D help: to override `-D warnings` add `#[allow(clippy::doc_lazy_conti= nuation)]` help: indent this line | 979 | /// conversion to numeric segments. | ++ Indent the offending line by 2 more spaces to remove this Clippy error. Fixes: cb5164ac43d0 ("drm/panic: Add a QR code panic screen") Reported-by: Miguel Ojeda Link: https://github.com/Rust-for-Linux/linux/issues/1123 Signed-off-by: Thomas B=C3=B6hler Reviewed-by: Jocelyn Falempe --- drivers/gpu/drm/drm_panic_qr.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_panic_qr.rs b/drivers/gpu/drm/drm_panic_qr= .rs index 5b2386a515fa..58c46f366f76 100644 --- a/drivers/gpu/drm/drm_panic_qr.rs +++ b/drivers/gpu/drm/drm_panic_qr.rs @@ -976,7 +976,7 @@ fn draw_all(&mut self, data: impl Iterator= ) { /// * `url_len`: Length of the URL. /// /// * If `url_len` > 0, remove the 2 segments header/length and also count= the -/// conversion to numeric segments. +/// conversion to numeric segments. /// * If `url_len` =3D 0, only removes 3 bytes for 1 binary segment. #[no_mangle] pub extern "C" fn drm_panic_qr_max_data_size(version: u8, url_len: usize) = -> usize { --=20 2.46.2 From nobody Tue Nov 26 08:58:03 2024 Received: from out-176.mta1.migadu.com (out-176.mta1.migadu.com [95.215.58.176]) (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 5EDC31DFE10 for ; Sat, 19 Oct 2024 08:41:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729327296; cv=none; b=rf0oKUehUruzIO/GauUKhpiZeCNRtTbqusN2h6AJBe4XMpunMCBrF3aU928w/Tez0uXkDwaRyr1E2BJWQFYodDgO0RNGjTfHaAcyL4diIYQzq2YOsRzQG3l8H5z3pRyVzXahD0nTAyMPNjxLjokS8+7mxlGBTEE7229QcTxGEd0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729327296; c=relaxed/simple; bh=eRkewpVRWn3VOWbswg3ulxg5hPlL0OIkfPL+78ofKZE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=maQvwre/ZlQCatZbertVdWakiX/yDPmWAbmR6VRbGLwmY1fkcr9xdCcRo62vZGW46k58ncItFjbDJrMhSsqiyAHFFFynUAHcETJwnR07htSwRyUy8W7ZSTUsdUWc0IG8eUpcxdWP0980dOLxe5exWH2DnQIRITQYo8U6qxgJpTo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wiredspace.de; spf=pass smtp.mailfrom=wiredspace.de; dkim=pass (1024-bit key) header.d=wiredspace.de header.i=@wiredspace.de header.b=ieXOYAvM; arc=none smtp.client-ip=95.215.58.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wiredspace.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wiredspace.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wiredspace.de header.i=@wiredspace.de header.b="ieXOYAvM" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wiredspace.de; s=key1; t=1729327292; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+9nI9DyyvUkPvZXIQqw1VWeyaPfPWQnX8HfjjMPK6kA=; b=ieXOYAvMze+hHfzOiaKM/Qf6sExVXqPkebY4wyG2IM1wVLuyo/HL/AwZ4ohyHD7jv8vbt9 nhCLRaBGyTvC86IH4vbarsD0KOyH+xpXTfMD43FOul7OK0dYwZhAB+aE/IAyAykzVqI6PU QlbC2pA4+muS7HpPmjl4wfnkIhOtEOY= From: =?UTF-8?q?Thomas=20B=C3=B6hler?= To: Miguel Ojeda , Alex Gaynor , Jocelyn Falempe Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , rust-for-linux@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Thomas=20B=C3=B6hler?= Subject: [PATCH v2 6/7] drm/panic: allow verbose boolean for clarity Date: Sat, 19 Oct 2024 10:22:51 +0200 Message-ID: <20241019084048.22336-7-witcher@wiredspace.de> In-Reply-To: <20241019084048.22336-1-witcher@wiredspace.de> References: <20241019084048.22336-1-witcher@wiredspace.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Clippy complains about a non-minimal boolean expression with `nonminimal_bool`: error: this boolean expression can be simplified --> drivers/gpu/drm/drm_panic_qr.rs:722:9 | 722 | (x < 8 && y < 8) || (x < 8 && y >=3D end) || (x >=3D end = && y < 8) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | =3D help: for further information visit https://rust-lang.github.io= /rust-clippy/master/index.html#nonminimal_bool =3D note: `-D clippy::nonminimal-bool` implied by `-D warnings` =3D help: to override `-D warnings` add `#[allow(clippy::nonminimal= _bool)]` help: try | 722 | !(x >=3D 8 || y >=3D 8 && y < end) || (x >=3D end && y < = 8) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 722 | (y >=3D end || y < 8) && x < 8 || (x >=3D end && y < 8) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ While this can be useful in a lot of cases, it isn't here because the line expresses clearly what the intention is. Simplifying the expression means losing clarity, so opt-out of this lint for the offending line. Fixes: cb5164ac43d0 ("drm/panic: Add a QR code panic screen") Reported-by: Miguel Ojeda Closes: https://github.com/Rust-for-Linux/linux/issues/1123 Signed-off-by: Thomas B=C3=B6hler Reviewed-by: Jocelyn Falempe --- v1 -> v2: turn the introduced explicit "return" statement into a block drivers/gpu/drm/drm_panic_qr.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_panic_qr.rs b/drivers/gpu/drm/drm_panic_qr= .rs index 58c46f366f76..2d4e367f0fcd 100644 --- a/drivers/gpu/drm/drm_panic_qr.rs +++ b/drivers/gpu/drm/drm_panic_qr.rs @@ -719,7 +719,10 @@ fn draw_finders(&mut self) { =20 fn is_finder(&self, x: u8, y: u8) -> bool { let end =3D self.width - 8; - (x < 8 && y < 8) || (x < 8 && y >=3D end) || (x >=3D end && y < 8) + #[expect(clippy::nonminimal_bool)] + { + (x < 8 && y < 8) || (x < 8 && y >=3D end) || (x >=3D end && y = < 8) + } } =20 // Alignment pattern: 5x5 squares in a grid. --=20 2.46.2 From nobody Tue Nov 26 08:58:03 2024 Received: from out-177.mta1.migadu.com (out-177.mta1.migadu.com [95.215.58.177]) (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 414461DEFC6 for ; Sat, 19 Oct 2024 08:41:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729327300; cv=none; b=J1S5hWpgveMDAYB1JsIu+3q4Y+JT7XRi/ansJf3FXJdidaIrHGrb11HF1rNucCzuaX5AEYoxkn2e5z8mVyMCHl05DdXkEv+sfbstSirUIhIiDSv2X4RErv/ttg5ddLdgkP7jfe7g/7nagZjYpQxYTNLqxLkutR6LOVeoKf3iHkc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729327300; c=relaxed/simple; bh=vCVEaM2j7TK3dG+7dUCGHxCyhTMKpvmEKALVb+Ca8No=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ScSEa7BqFnCcd9ZvIeNWLKc+AsIktG5MdMzthJjnwj8N1TLvg58G+EOqNTvnPkzVfM4BUnsWEQfME4UP9EXeMLHwNpeJgh/Z7umuD5Z8g42/P54TMj8BloBQqrWgWQF6KsFHVOWccBo9Em4HPpy6N/IN3eQXkxtfwm3IkpMUz4g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wiredspace.de; spf=pass smtp.mailfrom=wiredspace.de; dkim=pass (1024-bit key) header.d=wiredspace.de header.i=@wiredspace.de header.b=Kvfm+hiT; arc=none smtp.client-ip=95.215.58.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wiredspace.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wiredspace.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wiredspace.de header.i=@wiredspace.de header.b="Kvfm+hiT" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wiredspace.de; s=key1; t=1729327296; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=agn0+hQD08F841t4QY/P0Zr6g22Zhtf7LMnklweDjms=; b=Kvfm+hiTsQ3pcAMuEr450e9s29CFWzIUrS/dJ7oE6i4oN9vKCc2Ybk7zcVpdEovUK8kOgl xYnKd5e3dWmO7WRFc2dd60Sqvl7Cq+iqP6Rbnlu85fjBjbJqDb/xNdju1aiQMXZdodfSTj JDe1fza3mc81f6Z5Q5aZfWSE8I/CRIE= From: =?UTF-8?q?Thomas=20B=C3=B6hler?= To: Miguel Ojeda , Alex Gaynor , Jocelyn Falempe Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , rust-for-linux@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Thomas=20B=C3=B6hler?= Subject: [PATCH v2 7/7] drm/panic: allow verbose version check Date: Sat, 19 Oct 2024 10:22:52 +0200 Message-ID: <20241019084048.22336-8-witcher@wiredspace.de> In-Reply-To: <20241019084048.22336-1-witcher@wiredspace.de> References: <20241019084048.22336-1-witcher@wiredspace.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Clippy warns about a reimplementation of `RangeInclusive::contains`: error: manual `!RangeInclusive::contains` implementation --> drivers/gpu/drm/drm_panic_qr.rs:986:8 | 986 | if version < 1 || version > 40 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `!(1..=3D40).contai= ns(&version)` | =3D help: for further information visit https://rust-lang.github.io= /rust-clippy/master/index.html#manual_range_contains =3D note: `-D clippy::manual-range-contains` implied by `-D warning= s` =3D help: to override `-D warnings` add `#[allow(clippy::manual_ran= ge_contains)]` Ignore this and keep the current implementation as that makes it easier to read. Fixes: cb5164ac43d0 ("drm/panic: Add a QR code panic screen") Reported-by: Miguel Ojeda Link: https://github.com/Rust-for-Linux/linux/issues/1123 Signed-off-by: Thomas B=C3=B6hler Reviewed-by: Jocelyn Falempe --- drivers/gpu/drm/drm_panic_qr.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/drm_panic_qr.rs b/drivers/gpu/drm/drm_panic_qr= .rs index 2d4e367f0fcd..09500cddc009 100644 --- a/drivers/gpu/drm/drm_panic_qr.rs +++ b/drivers/gpu/drm/drm_panic_qr.rs @@ -983,6 +983,7 @@ fn draw_all(&mut self, data: impl Iterator= ) { /// * If `url_len` =3D 0, only removes 3 bytes for 1 binary segment. #[no_mangle] pub extern "C" fn drm_panic_qr_max_data_size(version: u8, url_len: usize) = -> usize { + #[expect(clippy::manual_range_contains)] if version < 1 || version > 40 { return 0; } --=20 2.46.2