Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp206058rdg; Thu, 12 Oct 2023 03:24:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG5VR7YpD5jDUsWtd54YcvlWmZHMpGS/ptSj2ZBrla2Qt8jvYA0rmN3YmyxaqkdqXyK8E2Q X-Received: by 2002:a17:902:e749:b0:1c5:e00f:2 with SMTP id p9-20020a170902e74900b001c5e00f0002mr28919567plf.28.1697106270742; 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=dZhEUdoZrQja1zTCmh/4sVU5uYJhOwZFV+wHcCxKhq2gacetj4uzDWYgd4aMjK/6sM 3uZ6NMGD8zj/ntTKcVmJPy6jQM60lY1MHDXwYg4O1aDpZS/4yBdvr0yYr7hrdb94yNgo XKwzgnHRwsWKngvT4St1fvpjVq4zwD6aGkptBDpBoPrPedpqDb2iNdJVzrPxJhi9H9Go C6Er9ZfT5Iq7DJlXnKKQ7lfFazUNPbBw6/y93OGkf3Glo8IKnOYiL4jv+wu+RnUV0Awp PqKcT1DigaSr4t9QBlOFMhmSKfEj83oSE3x2PF5UYcVTL2U6+wNtwh8+z31Z53ykL/Qh CmkQ== 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 Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id u12-20020a170902e5cc00b001c9d690baa4si2068567plf.532.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 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 12ADC81A4FE9; Thu, 12 Oct 2023 03:24:27 -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 S1377791AbjJLKYG (ORCPT + 99 others); Thu, 12 Oct 2023 06:24:06 -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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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:27 -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/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, -- 2.42.0