From patchwork Mon Apr 3 09:48:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asahi Lina X-Patchwork-Id: 78466 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2180285vqo; Mon, 3 Apr 2023 02:55:16 -0700 (PDT) X-Google-Smtp-Source: AKy350aVXqmw/wyGokb9BJZyd4vMA1mxBxkXHNHe2jRHnhqlfyaeLqtMg5Gx3V2u0YDjka6tqCI8 X-Received: by 2002:aa7:c659:0:b0:502:4c82:6cc0 with SMTP id z25-20020aa7c659000000b005024c826cc0mr19383124edr.40.1680515716592; Mon, 03 Apr 2023 02:55:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680515716; cv=none; d=google.com; s=arc-20160816; b=uCl62tCgq+4uJRx73BZN1la8aSM3Yo7EHQjoHVlGb8H8jTk4SbJqpxqvsdSrneYFAo kpQn0v1uSeUMgffJm8S+BIUfQBRMaNGUqEUHZ7W7KKiuX49hwQ5P3QkQZhvC++DsXw3I ixvif1KsAxd0sfyO4eI4k+zzEAjiDdK1tJxBiDyRMt3jt1Fjy3CeViiHBuBtSSFUHmrk QnIWWewzX83r31sI3UdQLd4CB7w7s+fevinXLRYhzdth4rj86hTQ4obfgHg+WEqldgKD xEShkLQxBIXMY1J+sq27jlJMf1GyLJwke5KZm6oM6/w2+RlKaAXkzJr5g4edBlr8uDmG ykHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=TiOJeTV/0Pm412P8KO/uDS0YqLhdwxZCyjRZIAmHMNk=; b=TbFS36ndak1+xQ2mnnPKo0BB8GLHViJS+cFF0ZbscLN8ChQjotac3Q93m7nMZGGVrx TT7eWDVNsIEbuiMUxZkuZRJyBmhjY8E7COLmYFS8h+LCw/cwWwB7P8kTkSFI/9TdEQ0G qPFVrvuvhecH08Q5/9p3Uaml60d9bKRqhEMtIskFzscHCbIXnrRvUtuAbFib1wYYySCp 85YeutJQtBcmrViUaCZTH1MkGDaYYD42I3Mt/GAKhWGmmcZO9FBIy+X8ZKz3uk3LSJMC 1CmqjRvOQO/WTFkuxebQdNq86o13j5wddO9sR3XrhAu7SFmSs6YJO976XIln7MgwWYbw 8q4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@asahilina.net header.s=default header.b=P4AuYska; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=asahilina.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz19-20020a1709077d9300b00948c320fbd9si554725ejc.1020.2023.04.03.02.54.52; Mon, 03 Apr 2023 02:55:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@asahilina.net header.s=default header.b=P4AuYska; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=asahilina.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232340AbjDCJtU (ORCPT + 99 others); Mon, 3 Apr 2023 05:49:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232203AbjDCJs4 (ORCPT ); Mon, 3 Apr 2023 05:48:56 -0400 Received: from mail.marcansoft.com (marcansoft.com [212.63.210.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3028E4C35; Mon, 3 Apr 2023 02:48:25 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: linasend@asahilina.net) by mail.marcansoft.com (Postfix) with ESMTPSA id 3F5D64212E; Mon, 3 Apr 2023 09:48:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=asahilina.net; s=default; t=1680515303; bh=rLpv9N/MuJdWjBDskv5c1QhUT6HdCop84/bSBVygqeY=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=P4AuYska6w6taph8lKaPQjWDuQWv0/U++vpi25iK/tGHl8+k0ScMPJqDtHS5w6OQk Y2xSwFeE/ppJ2dUMq76+75ztihktpRfMi3K237uiyULMRjw8ExgQcJS0zufJOJhc1N 2cfoKzUAHdaYYIdx9toL8ZCHGBRIepXZOLBqNQx0lvWVShgnbxuo7g38eLCrsLX/Qd V+vCxcq/cYAcI3uHvIn5bWoonkMEPLaLwf8v1W+8zp9z5cQMFzvOLHIHyS80xGG8ji Tgt0QDpqEghlsRV8qCI4xraips5EJFpKKFxzKG8SB4+5Ndg0RTXwZROWQmZkBQJhhD oF3vJZNDPOOng== From: Asahi Lina Date: Mon, 03 Apr 2023 18:48:10 +0900 Subject: [PATCH v3 1/6] rust: error: Rename to_kernel_errno() -> to_errno() MIME-Version: 1.0 Message-Id: <20230224-rust-error-v3-1-03779bddc02b@asahilina.net> References: <20230224-rust-error-v3-0-03779bddc02b@asahilina.net> In-Reply-To: <20230224-rust-error-v3-0-03779bddc02b@asahilina.net> To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Sven Van Asbroeck Cc: Fox Chen , Martin Rodriguez Reboredo , Andreas Hindborg , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, asahi@lists.linux.dev, Asahi Lina X-Mailer: b4 0.12.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1680515295; l=1299; i=lina@asahilina.net; s=20230221; h=from:subject:message-id; bh=rLpv9N/MuJdWjBDskv5c1QhUT6HdCop84/bSBVygqeY=; b=9nrnwa52xgS4clQ3rmGPD/khl8o3VTE2q12KEAtx4dfi0zZ9q7qGssXBpVKJN5iqp/2XvrYZ9 b0oMHm+OeghAiE5VWRiit7j0+M5na4OVUQKEkLB5eUGHUddgfgIFxJd X-Developer-Key: i=lina@asahilina.net; a=ed25519; pk=Qn8jZuOtR1m5GaiDfTrAoQ4NE1XoYVZ/wmt5YtXWFC4= X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762148447735002167?= X-GMAIL-MSGID: =?utf-8?q?1762148447735002167?= This is kernel code, so specifying "kernel" is redundant. Let's simplify things and just call it to_errno(). Reviewed-by: Gary Guo Reviewed-by: Martin Rodriguez Reboredo Signed-off-by: Asahi Lina --- rust/kernel/error.rs | 2 +- rust/macros/module.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/kernel/error.rs b/rust/kernel/error.rs index 5b9751d7ff1d..35894fa35efe 100644 --- a/rust/kernel/error.rs +++ b/rust/kernel/error.rs @@ -73,7 +73,7 @@ pub struct Error(core::ffi::c_int); impl Error { /// Returns the kernel error code. - pub fn to_kernel_errno(self) -> core::ffi::c_int { + pub fn to_errno(self) -> core::ffi::c_int { self.0 } } diff --git a/rust/macros/module.rs b/rust/macros/module.rs index a7e363c2b044..143336543866 100644 --- a/rust/macros/module.rs +++ b/rust/macros/module.rs @@ -258,7 +258,7 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream { return 0; }} Err(e) => {{ - return e.to_kernel_errno(); + return e.to_errno(); }} }} }}