Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp206059rdg; Thu, 12 Oct 2023 03:24:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEP2uFNb/6V+P84eUzuH3VaoTJsIg0CW4FrTKTIVT3Vl0Z9WH5HXy9li6qyyVuOR56SB7Wk X-Received: by 2002:a17:902:690a:b0:1b8:94e9:e7cb with SMTP id j10-20020a170902690a00b001b894e9e7cbmr19434869plk.21.1697106270967; Thu, 12 Oct 2023 03:24:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697106270; cv=none; d=google.com; s=arc-20160816; b=KjtGVuJTFfiKi3ccAX3xXnXjRizznNu5gwYcKHzCEUUZRNELqAhsPjOJzHsbEvuf0o xiLqX6fR/uYm3Yl1okoCF8gLIb8/8enZ0fHfRxjMA+SL1eOsGqU2q1NeIZMd6OhFpOvG QW3T9IkvkoV9HJb3jNHkOHNLwxXitB7ADWd1MVyCBjkGYgYjCvWmss5go5qJPHWoyvCC 2d/Mb9eJfsVCl+H8QnaF0yLmdzP/3VK6UbBE+CG4pp+RTDOKEzOfi2WMdmyldZgWDwpi Hm0M83Pvul8UqDUH7mSYnDpMBtmVH6k8jM9PMEiR/qyHyh36YfAZRxqeq25OHqEH+7dQ B+vw== 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=VSuoJrReoYVfVeUtVRZnFW+kG/xLu5QHvu/L5FYjwyU=; fh=xUtS4Ye9bvz4mnbfL9bwsYffunq5fde5WqM/qGGhhDQ=; b=0HxmzTChusYlA3l49iw8RXhQFRNmG6FZM/vlqzfTuScV4P1GQrH/FOdz7pP6vF3XhR wO1Qr/IvOD9rhmdoKhkE8cuy/CIv7m0kP1JG5ObwmeIcnuLjWal825Fg78cON7SMIYvy BTdYAoxDXsgWp1VU0ZDnqVGpQcQmHeGYteDMfY3fPXEjfzkhKSNl3CKiE/mQ8ir17gvz 8vDNNFgYfLHL/k143dfx0flUG1/OzboSGzyEnQblvFBrwt0JRSRC0ntBayCWETQ28x7e 1/FCxoXIHT6ucaYAuvEzcE385DkmaZN+aqIReTb8FJ2P19Tbkp6L6onN2RsDJGbksOf+ qVnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=oWroPJNT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id u9-20020a17090341c900b001c5fea1bd8asi2089703ple.567.2023.10.12.03.24.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 03:24:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=oWroPJNT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id A11DD822C628; Thu, 12 Oct 2023 03:24:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377993AbjJLKYP (ORCPT + 99 others); Thu, 12 Oct 2023 06:24:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347133AbjJLKXw (ORCPT ); Thu, 12 Oct 2023 06:23:52 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC586D8; Thu, 12 Oct 2023 03:23:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1697106227; bh=5SDzzt7XMUNLkvBvYEQuCiuGLibIrAFTowagRCe9Ajs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=oWroPJNTMC8gtNsmULdL/9mutmcnqCq14qB3jD6uP8AeUqfk55rqGzOP+tshfTy+G UoacmJ39q0qb5cpMrvr+HqrDDuJmqA0DV3JpdrwnoVCNNqnoSW5eK3gBAzmirhKuZv qm3W1ENvyB5QtWZ4EppYfkq64C8rRifigulx8JR0= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 12 Oct 2023 12:23:41 +0200 Subject: [PATCH 4/4] HID: rmi: remove #ifdef CONFIG_PM MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20231012-hid-pm_ptr-v1-4-0a71531ca93b@weissschuh.net> References: <20231012-hid-pm_ptr-v1-0-0a71531ca93b@weissschuh.net> In-Reply-To: <20231012-hid-pm_ptr-v1-0-0a71531ca93b@weissschuh.net> To: Jiri Kosina , Benjamin Tissoires Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1697106227; l=1495; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=5SDzzt7XMUNLkvBvYEQuCiuGLibIrAFTowagRCe9Ajs=; b=M2Rn5UBq5P/gACg74ZfSclny/wCeyqbwxYn0CkHIk8fyb5HNmVZAcKUVOI7MrfDzNO2ubN77k UYptybFID/7BMvOT6sF2m4865QwQnEePXz3yrgm89ADgYFLSrkHFqGq X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 12 Oct 2023 03:24:28 -0700 (PDT) Through the usage of pm_ptr() the CONFIG_PM-dependent code will always be compiled, protecting against bitrot. The linker will then garbage-collect the unused function avoiding any overhead. Signed-off-by: Thomas Weißschuh --- drivers/hid/hid-rmi.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c index 84e7ba5314d3..d4af17fdba46 100644 --- a/drivers/hid/hid-rmi.c +++ b/drivers/hid/hid-rmi.c @@ -436,7 +436,6 @@ static void rmi_report(struct hid_device *hid, struct hid_report *report) input_sync(field->hidinput->input); } -#ifdef CONFIG_PM static int rmi_suspend(struct hid_device *hdev, pm_message_t message) { struct rmi_data *data = hid_get_drvdata(hdev); @@ -483,7 +482,6 @@ static int rmi_post_resume(struct hid_device *hdev) hid_hw_close(hdev); return ret; } -#endif /* CONFIG_PM */ static int rmi_hid_reset(struct rmi_transport_dev *xport, u16 reset_addr) { @@ -774,11 +772,9 @@ static struct hid_driver rmi_driver = { .report = rmi_report, .input_mapping = rmi_input_mapping, .input_configured = rmi_input_configured, -#ifdef CONFIG_PM - .suspend = rmi_suspend, - .resume = rmi_post_resume, - .reset_resume = rmi_post_resume, -#endif + .suspend = pm_ptr(rmi_suspend), + .resume = pm_ptr(rmi_post_resume), + .reset_resume = pm_ptr(rmi_post_resume), }; module_hid_driver(rmi_driver); -- 2.42.0