From patchwork Thu Oct 12 10:23:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 151908 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1118087vqb; Thu, 12 Oct 2023 03:24:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEKT5DHsSwAQXWJBc21eb/Q3rKEoJ2+KRjKgYahHK2fWZhYmAVI6YDtxe9gNo0fprb1ed4m X-Received: by 2002:a17:902:e5c1:b0:1c3:6d97:e897 with SMTP id u1-20020a170902e5c100b001c36d97e897mr26580001plf.5.1697106282985; Thu, 12 Oct 2023 03:24:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697106282; cv=none; d=google.com; s=arc-20160816; b=h6qNOMymQg3bdWU+J9+yktj+og+NxtLXSeFELfghsENQQBg5EvTp4EpnbE0Sq7rFts x3+jhnmYVvQIsXBt/MuH0vgOcZ9gSFVsy0rqGOxoxfP8MQ5bnoDngvQsZo4gub0GQq9H zvqNxK+SjgrqsuyJ6h92fFCe57pm3VQ8TWRCSMu8RlFJjZk491x79ebGBDUdPxaPm33B h9MEh05r6YEiLfsmYm08iVqJYfAPbHaP3G0lJg0UfX/nqJU592ewyKSngp01OlnF+hST CINKBy6E5h9S8jao8y2JmLDdd0vS3iGutwaONMUhwX/J/YZXWOvR43MPKcBWHAh/PQjC HYhQ== 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=N91HDW84wyihKKOst7mAkJTSURWMo/HOEyfaJglaoUE=; fh=xUtS4Ye9bvz4mnbfL9bwsYffunq5fde5WqM/qGGhhDQ=; b=WB6dibYYgDT0KLmS509farqGmwWWayB4pxrIYRxKHpwPZEZPOqc7GEnP4JLp1aD9mx Ff8LsaILIzJ1TLSeScreBgv82vG3MDsHCmwdfayV49WiArHaGRoTe4hoC83XGXyYX5Dc HyIGMvjEveLDo3riR5OV22Ex7akK5SxDByOSLf0No7VWyEKxqVKHf0X8+wM4m1BV3kLn 5p/NUH45B5P7cEUg4KI0VyOXlyB636WVoRL5v8x2DpKKmJ7QWTdDSxosRdt05spAF8dv zvi5Xri523xasXaE1aZDxdPqdVe0CKXkyH7wGiG9fbBxpEuzpOc7ba6I7fzymL2uaFuI Z/5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=rE7peiHE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id u8-20020a170903124800b001c20db2510asi2068750plh.53.2023.10.12.03.24.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 03:24:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=rE7peiHE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id B001D81A4FE6; Thu, 12 Oct 2023 03:24:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377801AbjJLKYH (ORCPT + 19 others); Thu, 12 Oct 2023 06:24:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347120AbjJLKXw (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 C9505D7; 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=alxO7xFWraA3HKM6WF41cUbPDoefLV3zZhv5I90E+pg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=rE7peiHE79iPAIiKLaF0z/949FLJ/Zy4UCL+cNac8N6NcqZdKIxFaw0cJlnM1gWTR j15Ej4Uyo85TUj4naLqIYbTrz5witbF5s+X8Vm7IZyT3Bz8felUWwe/mTjExTs+YRO v07pzvJbFfHJnc1RJ2Krkqf5EZQ4cQ+4XtYmwD/0= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 12 Oct 2023 12:23:39 +0200 Subject: [PATCH 2/4] HID: usbhid: remove #ifdef CONFIG_PM MIME-Version: 1.0 Message-Id: <20231012-hid-pm_ptr-v1-2-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=1539; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=alxO7xFWraA3HKM6WF41cUbPDoefLV3zZhv5I90E+pg=; b=QZGILVOJ+QPVXAY6Zni77eIF0Yi697+rGGIobSGwqD/pkwi/PhoZXOeEfnzUUGYNGtyCSDWc+ uIpEsguUtBWBcXXSKwecJem0jyUsiScgV+6RI3orm8tGu70OZQf7tqH 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 pete.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 (pete.vger.email [0.0.0.0]); Thu, 12 Oct 2023 03:24:40 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779544917432295318 X-GMAIL-MSGID: 1779544917432295318 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/usbhid/hid-core.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 257dd73e37bf..a90ed2ceae84 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -1562,7 +1562,6 @@ static int hid_post_reset(struct usb_interface *intf) return 0; } -#ifdef CONFIG_PM static int hid_resume_common(struct hid_device *hid, bool driver_suspended) { int status = 0; @@ -1654,8 +1653,6 @@ static int hid_reset_resume(struct usb_interface *intf) return status; } -#endif /* CONFIG_PM */ - static const struct usb_device_id hid_usb_ids[] = { { .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS, .bInterfaceClass = USB_INTERFACE_CLASS_HID }, @@ -1668,11 +1665,9 @@ static struct usb_driver hid_driver = { .name = "usbhid", .probe = usbhid_probe, .disconnect = usbhid_disconnect, -#ifdef CONFIG_PM - .suspend = hid_suspend, - .resume = hid_resume, - .reset_resume = hid_reset_resume, -#endif + .suspend = pm_ptr(hid_suspend), + .resume = pm_ptr(hid_resume), + .reset_resume = pm_ptr(hid_reset_resume), .pre_reset = hid_pre_reset, .post_reset = hid_post_reset, .id_table = hid_usb_ids,