From patchwork Sat Jan 14 17:16:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13102043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEED5C6379F for ; Sat, 14 Jan 2023 17:02:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230049AbjANRCy (ORCPT ); Sat, 14 Jan 2023 12:02:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230272AbjANRCw (ORCPT ); Sat, 14 Jan 2023 12:02:52 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D10DA5EE for ; Sat, 14 Jan 2023 09:02:51 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A229860B4D for ; Sat, 14 Jan 2023 17:02:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2897C433A8; Sat, 14 Jan 2023 17:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673715769; bh=J2eGQ+i+Wwkxy7k8KnXhn+ekie7fem7YIseq7P9xy5E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uQpu1dQZW1PyDK9OIXWetSl4tBkkUdSowGSpPmKaJ/sjTjbJRfJKnTd/niH5KVNZ9 KhylvZv0Bv6WzBeXN9Lg/ysSM8HsaWhcRekXPHpSzNZwdKPdAX7sUgxYfd4M4dFHxt YqYoGMBOH4DwxRQTBPmO90aN6mcSUDYQBjZXOhXsjmno7SAPBcdyPMUYEZabhgOdO8 E1OSTWZAz63Iduatd2rObtSioShigd1GKx1jiSFXEJyShFgVJ6Hmp8z7muCVlguGXo HrcFjF1jzsNygryHTXTUsBV+6aO5gQ8UHeL34Li4+xy2lly5DUnAxkPQ0+Gl1fwwb2 4tVRxRN4siDFw== From: Jonathan Cameron To: linux-input@vger.kernel.org, Dmitry Torokhov Cc: jic23@kernel.org, Jonathan Cameron Subject: [PATCH 01/16] Input: cyapa - switch to SYSTEM_SLEEP/RUNTIME_PM_OPS() and pm_ptr() Date: Sat, 14 Jan 2023 17:16:05 +0000 Message-Id: <20230114171620.42891-2-jic23@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230114171620.42891-1-jic23@kernel.org> References: <20230114171620.42891-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Jonathan Cameron SET_SYSTEM_SLEEP_PM_OPS() and SET_RUNTIME_PM_OPS() are deprecated as they require explicit protection against unused function warnings. The new combination of pm_ptr() and SYSTEM_SLEEP_PM_OPS()/ RUNTIME_PM_OPS() allows the compiler to see the functions, thus suppressing the warning, but still allowing the unused code to be removed. Thus also drop the __maybe_unused markings. Signed-off-by: Jonathan Cameron --- drivers/input/mouse/cyapa.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c index 7e88a6ec7989..dd7b0d70d791 100644 --- a/drivers/input/mouse/cyapa.c +++ b/drivers/input/mouse/cyapa.c @@ -1349,7 +1349,7 @@ static int cyapa_probe(struct i2c_client *client) return 0; } -static int __maybe_unused cyapa_suspend(struct device *dev) +static int cyapa_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct cyapa *cyapa = i2c_get_clientdata(client); @@ -1397,7 +1397,7 @@ static int __maybe_unused cyapa_suspend(struct device *dev) return 0; } -static int __maybe_unused cyapa_resume(struct device *dev) +static int cyapa_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct cyapa *cyapa = i2c_get_clientdata(client); @@ -1424,7 +1424,7 @@ static int __maybe_unused cyapa_resume(struct device *dev) return 0; } -static int __maybe_unused cyapa_runtime_suspend(struct device *dev) +static int cyapa_runtime_suspend(struct device *dev) { struct cyapa *cyapa = dev_get_drvdata(dev); int error; @@ -1439,7 +1439,7 @@ static int __maybe_unused cyapa_runtime_suspend(struct device *dev) return 0; } -static int __maybe_unused cyapa_runtime_resume(struct device *dev) +static int cyapa_runtime_resume(struct device *dev) { struct cyapa *cyapa = dev_get_drvdata(dev); int error; @@ -1453,8 +1453,8 @@ static int __maybe_unused cyapa_runtime_resume(struct device *dev) } static const struct dev_pm_ops cyapa_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(cyapa_suspend, cyapa_resume) - SET_RUNTIME_PM_OPS(cyapa_runtime_suspend, cyapa_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(cyapa_suspend, cyapa_resume) + RUNTIME_PM_OPS(cyapa_runtime_suspend, cyapa_runtime_resume, NULL) }; static const struct i2c_device_id cyapa_id_table[] = { @@ -1484,7 +1484,7 @@ MODULE_DEVICE_TABLE(of, cyapa_of_match); static struct i2c_driver cyapa_driver = { .driver = { .name = "cyapa", - .pm = &cyapa_pm_ops, + .pm = pm_ptr(&cyapa_pm_ops), .acpi_match_table = ACPI_PTR(cyapa_acpi_id), .of_match_table = of_match_ptr(cyapa_of_match), }, From patchwork Sat Jan 14 17:16:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13102044 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F3ADC3DA78 for ; Sat, 14 Jan 2023 17:02:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230015AbjANRCz (ORCPT ); Sat, 14 Jan 2023 12:02:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230287AbjANRCx (ORCPT ); Sat, 14 Jan 2023 12:02:53 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7583CB75B for ; Sat, 14 Jan 2023 09:02:52 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 08CA760BC1 for ; Sat, 14 Jan 2023 17:02:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A830C433F0; Sat, 14 Jan 2023 17:02:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673715771; bh=d1taWlWOF2XOLFoS18UoFOWFJ/+qK+Xewe9jIvYV040=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sgWAHLrvP+98nfQuRFG8BpQpuQofRftg3kxmuQ8i6Ah/247L7oNHL0Uob4RnqBsWB 5oz3BUSF9kzXBNws3w4pKZ+eMS/ZEoHPw4JadVB/p2/8iGoCGHCgZhEhwBYuOslgiX teResmAnGX9OSb5kml8FghdQyk7SWFoYqcUu/1ELCtxZ8x6bw1DP8dzcb1ByyM/q6Z vhsOW+7VW6scsinz+Jjg4JSx1qW7vbB0iVYIHENRX/ghdL9E4dW/u2Re4MeW98SQ2M MIMbuXSzTp68dsL6+gpmhAc+vgp1k3Sg59cq5RqOZqJ44YRCTKW3owFTiN5eU12dzG voCfY0HX6pA3w== From: Jonathan Cameron To: linux-input@vger.kernel.org, Dmitry Torokhov Cc: jic23@kernel.org, Jonathan Cameron , Hans de Goede Subject: [PATCH 02/16] Input: axp20x-pek - switch to SYSTEM_SLEEP_PM_OPS() and pm_sleep_ptr() Date: Sat, 14 Jan 2023 17:16:06 +0000 Message-Id: <20230114171620.42891-3-jic23@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230114171620.42891-1-jic23@kernel.org> References: <20230114171620.42891-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Jonathan Cameron SET_SYSTEM_SLEEP_PM_OPS() is deprecated as it requires explicit protection against unused function warnings. The new combination of pm_sleep_ptr() and SYSTEM_SLEEP_PM_OPS() allows the compiler to see the functions, thus suppressing the warning, but still allowing the unused code to be removed. Thus also drop the __maybe_unused markings. Here the additional .resume_noirq callback is protected with pm_sleep_ptr(). This isn't strictly necessary but is done for consistency with the other callbacks. Signed-off-by: Jonathan Cameron Cc: Hans de Goede --- drivers/input/misc/axp20x-pek.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c index 04da7916eb70..4581606a28d6 100644 --- a/drivers/input/misc/axp20x-pek.c +++ b/drivers/input/misc/axp20x-pek.c @@ -336,7 +336,7 @@ static int axp20x_pek_probe(struct platform_device *pdev) return 0; } -static int __maybe_unused axp20x_pek_suspend(struct device *dev) +static int axp20x_pek_suspend(struct device *dev) { struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev); @@ -355,7 +355,7 @@ static int __maybe_unused axp20x_pek_suspend(struct device *dev) return 0; } -static int __maybe_unused axp20x_pek_resume(struct device *dev) +static int axp20x_pek_resume(struct device *dev) { struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev); @@ -389,10 +389,8 @@ static int __maybe_unused axp20x_pek_resume_noirq(struct device *dev) } static const struct dev_pm_ops axp20x_pek_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(axp20x_pek_suspend, axp20x_pek_resume) -#ifdef CONFIG_PM_SLEEP - .resume_noirq = axp20x_pek_resume_noirq, -#endif + SYSTEM_SLEEP_PM_OPS(axp20x_pek_suspend, axp20x_pek_resume) + .resume_noirq = pm_sleep_ptr(axp20x_pek_resume_noirq), }; static const struct platform_device_id axp_pek_id_match[] = { @@ -413,7 +411,7 @@ static struct platform_driver axp20x_pek_driver = { .id_table = axp_pek_id_match, .driver = { .name = "axp20x-pek", - .pm = &axp20x_pek_pm_ops, + .pm = pm_sleep_ptr(&axp20x_pek_pm_ops), .dev_groups = axp20x_groups, }, }; From patchwork Sat Jan 14 17:16:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13102045 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53224C3DA78 for ; Sat, 14 Jan 2023 17:03:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230287AbjANRC7 (ORCPT ); Sat, 14 Jan 2023 12:02:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230292AbjANRC5 (ORCPT ); Sat, 14 Jan 2023 12:02:57 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B836DB776 for ; Sat, 14 Jan 2023 09:02:55 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 376B3B80A07 for ; Sat, 14 Jan 2023 17:02:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1FD9C433EF; Sat, 14 Jan 2023 17:02:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673715772; bh=dykHAaWG+KSvPCrUvb7Dm/B3XnIPq5JU0vuHaOcNvo4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hnYsY/flp0PuuBu79BsjEUrknUegqN6pdDMzrAi3RnngoswwxJynmP2aV07szyDzU TvXMEQYHJSRNxfOADur4FZN8QL2ZMHK0Fua/hrV2M6CYVCdD2OyTcya10xl/p/wTNs 5eM5ZaMdozOZHPBlYOccp964aQ44RJdlpuNN8jfVivC1F7Pi/Hd47RvWrEz3lm5dp0 lUjFK/I7W2GvFsjWIWH0c7qR1B0iKgsgc617b8Ff5NoVU9Fx8jhbkrm3Gj9C4+B2Pe M+ucve3kH4d4M1m0ui+YYLKqC4ncpOww0K95QmlX/5vYWidCehTF5YAbwiogxMrQeq 9M1a711CuPblQ== From: Jonathan Cameron To: linux-input@vger.kernel.org, Dmitry Torokhov Cc: jic23@kernel.org, Jonathan Cameron Subject: [PATCH 03/16] Input: samsung-keypad - switch to pm_ptr() and SYSTEM_SLEEP/RUNTIME_PM_OPS() Date: Sat, 14 Jan 2023 17:16:07 +0000 Message-Id: <20230114171620.42891-4-jic23@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230114171620.42891-1-jic23@kernel.org> References: <20230114171620.42891-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Jonathan Cameron The SET_ variants are deprecated as they require explicit protection against unused function warnings. The new combination of pm_ptr() and SYSTEM_SLEEP/RUNTIME_DEV_PM_OPS() allow the compiler to see the functions, thus suppressing the warning, but still allowing the unused code to be removed. Thus also drop the #ifdef guards. Signed-off-by: Jonathan Cameron --- drivers/input/keyboard/samsung-keypad.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c index df0258dcf89e..09e883ea1352 100644 --- a/drivers/input/keyboard/samsung-keypad.c +++ b/drivers/input/keyboard/samsung-keypad.c @@ -458,7 +458,6 @@ static int samsung_keypad_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM static int samsung_keypad_runtime_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); @@ -503,9 +502,7 @@ static int samsung_keypad_runtime_resume(struct device *dev) return 0; } -#endif -#ifdef CONFIG_PM_SLEEP static void samsung_keypad_toggle_wakeup(struct samsung_keypad *keypad, bool enable) { @@ -563,12 +560,11 @@ static int samsung_keypad_resume(struct device *dev) return 0; } -#endif static const struct dev_pm_ops samsung_keypad_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(samsung_keypad_suspend, samsung_keypad_resume) - SET_RUNTIME_PM_OPS(samsung_keypad_runtime_suspend, - samsung_keypad_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(samsung_keypad_suspend, samsung_keypad_resume) + RUNTIME_PM_OPS(samsung_keypad_runtime_suspend, + samsung_keypad_runtime_resume, NULL) }; #ifdef CONFIG_OF @@ -598,7 +594,7 @@ static struct platform_driver samsung_keypad_driver = { .driver = { .name = "samsung-keypad", .of_match_table = of_match_ptr(samsung_keypad_dt_match), - .pm = &samsung_keypad_pm_ops, + .pm = pm_ptr(&samsung_keypad_pm_ops), }, .id_table = samsung_keypad_driver_ids, }; From patchwork Sat Jan 14 17:16:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13102046 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AFBDC46467 for ; Sat, 14 Jan 2023 17:03:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230272AbjANRDA (ORCPT ); Sat, 14 Jan 2023 12:03:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230265AbjANRC6 (ORCPT ); Sat, 14 Jan 2023 12:02:58 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 909DFA5D8 for ; Sat, 14 Jan 2023 09:02:57 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E6623B808C2 for ; Sat, 14 Jan 2023 17:02:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E6C7C433D2; Sat, 14 Jan 2023 17:02:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673715774; bh=sCMLoY0TZl0mA3CTDTauBhZyEf4eqEFuiC41HUSHGgY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ubrC/Q49ITWH5ScYRm3rbD5zeJY5iYXPr/5bzET1mTObp5dj9JtrBtGYlQ6S4Fz+o pExLNIldgIpQ5kTxR6yhu5oky9H2Ye4pj194P5m3VRbehljxPnVT9jc9C2COm3MImt 95Xrv6DRASviCYPEdV737ZXe5kfwTEq0wXo8i1dfq/lnhiEJ1QxqqmxuqyCPH7d6mE 8Hza1K0esOyJwkc0YerpK6XOSJoQBY6kdVIlzYsdL9JLKXaW5IXJK+zLZZNRaEQSuE zayHNgfjhoC938QdK/tN+AD9CyT3Ot6WdsalEWYOHMLm99lVQvNJ3Ms3kvf1PdgERd cx9LQpkt67MIA== From: Jonathan Cameron To: linux-input@vger.kernel.org, Dmitry Torokhov Cc: jic23@kernel.org, Jonathan Cameron , Caleb Connolly , Andi Shyti Subject: [PATCH 04/16] Input: s6sy761 - switch to SYSTEM_SLEEP_/RUNTIME_PM_OPS() and pm_ptr() Date: Sat, 14 Jan 2023 17:16:08 +0000 Message-Id: <20230114171620.42891-5-jic23@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230114171620.42891-1-jic23@kernel.org> References: <20230114171620.42891-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Jonathan Cameron SET_SYSTEM_SLEEP_PM_OPS() and SET_RUNTIME_PM_OPS() are deprecated as they require explicit protection against unused function warnings. The new combination of pm_ptr() and SYSTEM_SLEEP_PM_OPS()/ RUNTIME_PM_OPS() allows the compiler to see the functions, thus suppressing the warning, but still allowing the unused code to be removed. Thus also drop the __maybe_unused markings. Signed-off-by: Jonathan Cameron Cc: Caleb Connolly Cc: Andi Shyti Tested-by: Caleb Connolly # oneplus-guacamole --- drivers/input/touchscreen/s6sy761.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/input/touchscreen/s6sy761.c b/drivers/input/touchscreen/s6sy761.c index cc417c03aaca..371cf4848ad5 100644 --- a/drivers/input/touchscreen/s6sy761.c +++ b/drivers/input/touchscreen/s6sy761.c @@ -479,7 +479,7 @@ static void s6sy761_remove(struct i2c_client *client) pm_runtime_disable(&client->dev); } -static int __maybe_unused s6sy761_runtime_suspend(struct device *dev) +static int s6sy761_runtime_suspend(struct device *dev) { struct s6sy761_data *sdata = dev_get_drvdata(dev); @@ -487,7 +487,7 @@ static int __maybe_unused s6sy761_runtime_suspend(struct device *dev) S6SY761_APPLICATION_MODE, S6SY761_APP_SLEEP); } -static int __maybe_unused s6sy761_runtime_resume(struct device *dev) +static int s6sy761_runtime_resume(struct device *dev) { struct s6sy761_data *sdata = dev_get_drvdata(dev); @@ -495,7 +495,7 @@ static int __maybe_unused s6sy761_runtime_resume(struct device *dev) S6SY761_APPLICATION_MODE, S6SY761_APP_NORMAL); } -static int __maybe_unused s6sy761_suspend(struct device *dev) +static int s6sy761_suspend(struct device *dev) { struct s6sy761_data *sdata = dev_get_drvdata(dev); @@ -504,7 +504,7 @@ static int __maybe_unused s6sy761_suspend(struct device *dev) return 0; } -static int __maybe_unused s6sy761_resume(struct device *dev) +static int s6sy761_resume(struct device *dev) { struct s6sy761_data *sdata = dev_get_drvdata(dev); @@ -514,9 +514,8 @@ static int __maybe_unused s6sy761_resume(struct device *dev) } static const struct dev_pm_ops s6sy761_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(s6sy761_suspend, s6sy761_resume) - SET_RUNTIME_PM_OPS(s6sy761_runtime_suspend, - s6sy761_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(s6sy761_suspend, s6sy761_resume) + RUNTIME_PM_OPS(s6sy761_runtime_suspend, s6sy761_runtime_resume, NULL) }; #ifdef CONFIG_OF @@ -537,7 +536,7 @@ static struct i2c_driver s6sy761_driver = { .driver = { .name = S6SY761_DEV_NAME, .of_match_table = of_match_ptr(s6sy761_of_match), - .pm = &s6sy761_pm_ops, + .pm = pm_ptr(&s6sy761_pm_ops), }, .probe_new = s6sy761_probe, .remove = s6sy761_remove, From patchwork Sat Jan 14 17:16:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13102048 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7794BC6379F for ; Sat, 14 Jan 2023 17:03:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230265AbjANRDB (ORCPT ); Sat, 14 Jan 2023 12:03:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229566AbjANRC6 (ORCPT ); Sat, 14 Jan 2023 12:02:58 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90ABFA5E7 for ; Sat, 14 Jan 2023 09:02:57 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CCA7660C01 for ; Sat, 14 Jan 2023 17:02:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD577C433F1; Sat, 14 Jan 2023 17:02:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673715776; bh=nlMdMd2y95nj+GZ/gHWmoFqd9EX1t22cq2MbuMZ/G7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ceXMsYhyjxEztwVmRhkcE0RQbHQc7KkBa1llJqIoWcDduEqRgPj/qUKaVjgr+Kpz/ y+qxDCFTVewr2ubuIiXWK12nQX4AbCHwAS0Ey7sfxydV6zTn3BuXHqs1N5/D5dhrSb 5vPMtab6UCw4lo7Pi7oqVq6I+468ydIQvQFmH6R9rEU10koKlGJkQ4Ec+hRIC3wTAV tdSjVogfN8nDsYH+MfLuDvg1kSWiurRwKbdL62DGNYWiJKIb0X36vomYFJRROYBKQd Tr7ummUwRbnibHKYwXHM9T/AE1vdPXD73ib/CgPKKGnqYSicflFNALR0P2Bbp33k/b 6QX7aiCfM1Hmw== From: Jonathan Cameron To: linux-input@vger.kernel.org, Dmitry Torokhov Cc: jic23@kernel.org, Jonathan Cameron , Matthias Schiffer , Lyude Paul , Andrew Duggan Subject: [PATCH 05/16] Input: rmi4 - switch to SYSTEM_SLEEP/RUNTIME_PM_OPS() and pm_ptr() Date: Sat, 14 Jan 2023 17:16:09 +0000 Message-Id: <20230114171620.42891-6-jic23@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230114171620.42891-1-jic23@kernel.org> References: <20230114171620.42891-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Jonathan Cameron SET_SYSTEM_SLEEP_PM_OPS() and SET_RUNTIME_PM_OPS() are deprecated as they requires explicit protection against unused function warnings. The new combination of pm_ptr() and SYSTEM_SLEEP_PM_OPS() / RUNTIME_PM_OPS() allows the compiler to see the functions, thus suppressing the warning, but still allowing the unused code to be removed. Thus also drop the #ifdef guards. Whilst all 3 sets of callbacks are similar, there are small differences that make it challenging to use a single pm_dev_ops structure - hence leave the duplication as it stands. Signed-off-by: Jonathan Cameron Cc: Matthias Schiffer Cc: Lyude Paul Cc: Andrew Duggan --- drivers/input/rmi4/rmi_i2c.c | 11 +++-------- drivers/input/rmi4/rmi_smbus.c | 15 +++++++-------- drivers/input/rmi4/rmi_spi.c | 11 +++-------- 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/drivers/input/rmi4/rmi_i2c.c b/drivers/input/rmi4/rmi_i2c.c index f2b75c6d3224..d69569ce8d8d 100644 --- a/drivers/input/rmi4/rmi_i2c.c +++ b/drivers/input/rmi4/rmi_i2c.c @@ -287,7 +287,6 @@ static int rmi_i2c_probe(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP static int rmi_i2c_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -323,9 +322,7 @@ static int rmi_i2c_resume(struct device *dev) return ret; } -#endif -#ifdef CONFIG_PM static int rmi_i2c_runtime_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -361,12 +358,10 @@ static int rmi_i2c_runtime_resume(struct device *dev) return 0; } -#endif static const struct dev_pm_ops rmi_i2c_pm = { - SET_SYSTEM_SLEEP_PM_OPS(rmi_i2c_suspend, rmi_i2c_resume) - SET_RUNTIME_PM_OPS(rmi_i2c_runtime_suspend, rmi_i2c_runtime_resume, - NULL) + SYSTEM_SLEEP_PM_OPS(rmi_i2c_suspend, rmi_i2c_resume) + RUNTIME_PM_OPS(rmi_i2c_runtime_suspend, rmi_i2c_runtime_resume, NULL) }; static const struct i2c_device_id rmi_id[] = { @@ -378,7 +373,7 @@ MODULE_DEVICE_TABLE(i2c, rmi_id); static struct i2c_driver rmi_i2c_driver = { .driver = { .name = "rmi4_i2c", - .pm = &rmi_i2c_pm, + .pm = pm_ptr(&rmi_i2c_pm), .of_match_table = of_match_ptr(rmi_i2c_of_match), }, .id_table = rmi_id, diff --git a/drivers/input/rmi4/rmi_smbus.c b/drivers/input/rmi4/rmi_smbus.c index 8a9ee2bd7402..4bf0e1df6a4a 100644 --- a/drivers/input/rmi4/rmi_smbus.c +++ b/drivers/input/rmi4/rmi_smbus.c @@ -344,7 +344,7 @@ static void rmi_smb_remove(struct i2c_client *client) rmi_unregister_transport_device(&rmi_smb->xport); } -static int __maybe_unused rmi_smb_suspend(struct device *dev) +static int rmi_smb_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client); @@ -357,7 +357,7 @@ static int __maybe_unused rmi_smb_suspend(struct device *dev) return ret; } -static int __maybe_unused rmi_smb_runtime_suspend(struct device *dev) +static int rmi_smb_runtime_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client); @@ -370,7 +370,7 @@ static int __maybe_unused rmi_smb_runtime_suspend(struct device *dev) return ret; } -static int __maybe_unused rmi_smb_resume(struct device *dev) +static int rmi_smb_resume(struct device *dev) { struct i2c_client *client = container_of(dev, struct i2c_client, dev); struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client); @@ -388,7 +388,7 @@ static int __maybe_unused rmi_smb_resume(struct device *dev) return 0; } -static int __maybe_unused rmi_smb_runtime_resume(struct device *dev) +static int rmi_smb_runtime_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client); @@ -402,9 +402,8 @@ static int __maybe_unused rmi_smb_runtime_resume(struct device *dev) } static const struct dev_pm_ops rmi_smb_pm = { - SET_SYSTEM_SLEEP_PM_OPS(rmi_smb_suspend, rmi_smb_resume) - SET_RUNTIME_PM_OPS(rmi_smb_runtime_suspend, rmi_smb_runtime_resume, - NULL) + SYSTEM_SLEEP_PM_OPS(rmi_smb_suspend, rmi_smb_resume) + RUNTIME_PM_OPS(rmi_smb_runtime_suspend, rmi_smb_runtime_resume, NULL) }; static const struct i2c_device_id rmi_id[] = { @@ -416,7 +415,7 @@ MODULE_DEVICE_TABLE(i2c, rmi_id); static struct i2c_driver rmi_smb_driver = { .driver = { .name = "rmi4_smbus", - .pm = &rmi_smb_pm, + .pm = pm_ptr(&rmi_smb_pm), }, .id_table = rmi_id, .probe_new = rmi_smb_probe, diff --git a/drivers/input/rmi4/rmi_spi.c b/drivers/input/rmi4/rmi_spi.c index c82edda66b23..c5c5e7f3401e 100644 --- a/drivers/input/rmi4/rmi_spi.c +++ b/drivers/input/rmi4/rmi_spi.c @@ -447,7 +447,6 @@ static int rmi_spi_probe(struct spi_device *spi) return 0; } -#ifdef CONFIG_PM_SLEEP static int rmi_spi_suspend(struct device *dev) { struct spi_device *spi = to_spi_device(dev); @@ -473,9 +472,7 @@ static int rmi_spi_resume(struct device *dev) return ret; } -#endif -#ifdef CONFIG_PM static int rmi_spi_runtime_suspend(struct device *dev) { struct spi_device *spi = to_spi_device(dev); @@ -501,12 +498,10 @@ static int rmi_spi_runtime_resume(struct device *dev) return 0; } -#endif static const struct dev_pm_ops rmi_spi_pm = { - SET_SYSTEM_SLEEP_PM_OPS(rmi_spi_suspend, rmi_spi_resume) - SET_RUNTIME_PM_OPS(rmi_spi_runtime_suspend, rmi_spi_runtime_resume, - NULL) + SYSTEM_SLEEP_PM_OPS(rmi_spi_suspend, rmi_spi_resume) + RUNTIME_PM_OPS(rmi_spi_runtime_suspend, rmi_spi_runtime_resume, NULL) }; static const struct spi_device_id rmi_id[] = { @@ -518,7 +513,7 @@ MODULE_DEVICE_TABLE(spi, rmi_id); static struct spi_driver rmi_spi_driver = { .driver = { .name = "rmi4_spi", - .pm = &rmi_spi_pm, + .pm = pm_ptr(&rmi_spi_pm), .of_match_table = of_match_ptr(rmi_spi_of_match), }, .id_table = rmi_id, From patchwork Sat Jan 14 17:16:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13102047 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACDDBC67871 for ; Sat, 14 Jan 2023 17:03:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229566AbjANRDC (ORCPT ); Sat, 14 Jan 2023 12:03:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230295AbjANRC7 (ORCPT ); Sat, 14 Jan 2023 12:02:59 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B91EBB777 for ; Sat, 14 Jan 2023 09:02:58 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 49CC860BC1 for ; Sat, 14 Jan 2023 17:02:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DF6DC433F0; Sat, 14 Jan 2023 17:02:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673715777; bh=WmulUa00nVBFtJzNq66tmRXEyQB2Lu/VtCKKfiisxaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LZX9lPzwd1SPD1gjIqO+VdUQ29yowdrwi/zygoqdtdtH4BGoioVWeSaz708KpCYtP XfuCFc+BlhhRQNS7XJlDb9kNa8h8v4uChE1/r1vZKavxH7bXD+74ZCe9hIIBFqhWvy 3vYXcDrB/UEsPnPgNSMFpvq4w6ZOn4CH/zbZfztZTU3gW77jKJPUBtToIzRMcCEwT1 JHS/Rejua8imUtNJzYQdfE7Y95yB+2GLsW5K5yU5TkjGVBMRtuPR2X5JCXueu1CmIr usN2tFLkg9RZndvWQHMK2Z7vE6l94hlalS/6iwEsbSJoMCcSY0AnZ7yVDI1isuZ7Ok fZHlvkcfaoBhA== From: Jonathan Cameron To: linux-input@vger.kernel.org, Dmitry Torokhov Cc: jic23@kernel.org, Jonathan Cameron , Andi Shyti Subject: [PATCH 06/16] Input: stmfts - switch to SYSTEM_SLEEP_/RUNTIME_PM_OPS() and pm_ptr() Date: Sat, 14 Jan 2023 17:16:10 +0000 Message-Id: <20230114171620.42891-7-jic23@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230114171620.42891-1-jic23@kernel.org> References: <20230114171620.42891-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Jonathan Cameron SET_SYSTEM_SLEEP_PM_OPS() and SET_RUNTIME_PM_OPS() are deprecated as they require explicit protection against unused function warnings. The new combination of pm_ptr() and SYSTEM_SLEEP_PM_OPS()/ RUNTIME_PM_OPS() allows the compiler to see the functions, thus suppressing the warning, but still allowing the unused code to be removed. Thus also drop the __maybe_unused markings. Signed-off-by: Jonathan Cameron Cc: Andi Shyti --- drivers/input/touchscreen/stmfts.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/input/touchscreen/stmfts.c b/drivers/input/touchscreen/stmfts.c index d092e89d40e8..fdbf5e68943c 100644 --- a/drivers/input/touchscreen/stmfts.c +++ b/drivers/input/touchscreen/stmfts.c @@ -742,7 +742,7 @@ static void stmfts_remove(struct i2c_client *client) pm_runtime_disable(&client->dev); } -static int __maybe_unused stmfts_runtime_suspend(struct device *dev) +static int stmfts_runtime_suspend(struct device *dev) { struct stmfts_data *sdata = dev_get_drvdata(dev); int ret; @@ -754,7 +754,7 @@ static int __maybe_unused stmfts_runtime_suspend(struct device *dev) return ret; } -static int __maybe_unused stmfts_runtime_resume(struct device *dev) +static int stmfts_runtime_resume(struct device *dev) { struct stmfts_data *sdata = dev_get_drvdata(dev); int ret; @@ -766,7 +766,7 @@ static int __maybe_unused stmfts_runtime_resume(struct device *dev) return ret; } -static int __maybe_unused stmfts_suspend(struct device *dev) +static int stmfts_suspend(struct device *dev) { struct stmfts_data *sdata = dev_get_drvdata(dev); @@ -775,7 +775,7 @@ static int __maybe_unused stmfts_suspend(struct device *dev) return 0; } -static int __maybe_unused stmfts_resume(struct device *dev) +static int stmfts_resume(struct device *dev) { struct stmfts_data *sdata = dev_get_drvdata(dev); @@ -783,8 +783,8 @@ static int __maybe_unused stmfts_resume(struct device *dev) } static const struct dev_pm_ops stmfts_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(stmfts_suspend, stmfts_resume) - SET_RUNTIME_PM_OPS(stmfts_runtime_suspend, stmfts_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(stmfts_suspend, stmfts_resume) + RUNTIME_PM_OPS(stmfts_runtime_suspend, stmfts_runtime_resume, NULL) }; #ifdef CONFIG_OF @@ -805,7 +805,7 @@ static struct i2c_driver stmfts_driver = { .driver = { .name = STMFTS_DEV_NAME, .of_match_table = of_match_ptr(stmfts_of_match), - .pm = &stmfts_pm_ops, + .pm = pm_ptr(&stmfts_pm_ops), .probe_type = PROBE_PREFER_ASYNCHRONOUS, }, .probe_new = stmfts_probe, From patchwork Sat Jan 14 17:16:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13102049 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FB7CC3DA78 for ; Sat, 14 Jan 2023 17:03:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230288AbjANRDE (ORCPT ); Sat, 14 Jan 2023 12:03:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229955AbjANRDC (ORCPT ); Sat, 14 Jan 2023 12:03:02 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A1A4B747 for ; Sat, 14 Jan 2023 09:03:00 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C563760C01 for ; Sat, 14 Jan 2023 17:02:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22CA0C433F2; Sat, 14 Jan 2023 17:02:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673715779; bh=bNlQp06hTROH1cUdwcVPA4Q2JKZPVOwmwfOIX8AT6es=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F7Fuf4G7QCyolbj9c+6q483CHVcIj35Mm/CGChHpPm8MaCyUWDdweNZSsqsc+bD2d kgfeFMOJhXXwA0ZTqN1MI1i6WJNO7Z7W4kqo4EP6uu+nIplGujXBgDQqiu7dsywzc7 nMbMcpKH4EXh+/i1mwug8ZyiluhPd/Uqx2BhI8XuSxAKsA1WuX/ojwDeURw64LkGOi lklh83LOlXPzZ8ZUnV22R0cgwwUZt+M+346BDfK88U+s9gobE9HztApNMx1F03jhxI /ADhy8kpLsBN7aUGynF4H5jDLUlCJY/PK2vMqgn8clG6OmD3zn9wIVFzfIF7Xi9BZN 0BF58V3jvaM9g== From: Jonathan Cameron To: linux-input@vger.kernel.org, Dmitry Torokhov Cc: jic23@kernel.org, Jonathan Cameron , Michael Hennerich Subject: [PATCH 07/16] Input: ad714x - unify dev_pm_ops using EXPORT_SIMPLE_DEV_PM_OPS() Date: Sat, 14 Jan 2023 17:16:11 +0000 Message-Id: <20230114171620.42891-8-jic23@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230114171620.42891-1-jic23@kernel.org> References: <20230114171620.42891-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Jonathan Cameron The I2C and SPI PM callbacks were identical (though wrapped in some bouncing out to the bus specific container of the struct device and then back again to get the drvdata). As such rather than just moving these to SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() take the opportunity to unify the struct dev_pm_ops and use the new EXPORT_SIMPLE_DEV_PM_OPS() macro so that we can drop the unused suspend and resume callbacks as well as the structure if !CONFIG_PM_SLEEP without needing to mark the callbacks __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Michael Hennerich --- drivers/input/misc/ad714x-i2c.c | 14 +------------- drivers/input/misc/ad714x-spi.c | 14 +------------- drivers/input/misc/ad714x.c | 12 ++++++------ drivers/input/misc/ad714x.h | 4 ++-- 4 files changed, 10 insertions(+), 34 deletions(-) diff --git a/drivers/input/misc/ad714x-i2c.c b/drivers/input/misc/ad714x-i2c.c index 5ef518a50e63..d8e39f4a57ac 100644 --- a/drivers/input/misc/ad714x-i2c.c +++ b/drivers/input/misc/ad714x-i2c.c @@ -12,18 +12,6 @@ #include #include "ad714x.h" -static int __maybe_unused ad714x_i2c_suspend(struct device *dev) -{ - return ad714x_disable(i2c_get_clientdata(to_i2c_client(dev))); -} - -static int __maybe_unused ad714x_i2c_resume(struct device *dev) -{ - return ad714x_enable(i2c_get_clientdata(to_i2c_client(dev))); -} - -static SIMPLE_DEV_PM_OPS(ad714x_i2c_pm, ad714x_i2c_suspend, ad714x_i2c_resume); - static int ad714x_i2c_write(struct ad714x_chip *chip, unsigned short reg, unsigned short data) { @@ -96,7 +84,7 @@ MODULE_DEVICE_TABLE(i2c, ad714x_id); static struct i2c_driver ad714x_i2c_driver = { .driver = { .name = "ad714x_captouch", - .pm = &ad714x_i2c_pm, + .pm = pm_sleep_ptr(&ad714x_pm), }, .probe_new = ad714x_i2c_probe, .id_table = ad714x_id, diff --git a/drivers/input/misc/ad714x-spi.c b/drivers/input/misc/ad714x-spi.c index 7d3bf434620f..eb13b4cd6594 100644 --- a/drivers/input/misc/ad714x-spi.c +++ b/drivers/input/misc/ad714x-spi.c @@ -15,18 +15,6 @@ #define AD714x_SPI_CMD_PREFIX 0xE000 /* bits 15:11 */ #define AD714x_SPI_READ BIT(10) -static int __maybe_unused ad714x_spi_suspend(struct device *dev) -{ - return ad714x_disable(spi_get_drvdata(to_spi_device(dev))); -} - -static int __maybe_unused ad714x_spi_resume(struct device *dev) -{ - return ad714x_enable(spi_get_drvdata(to_spi_device(dev))); -} - -static SIMPLE_DEV_PM_OPS(ad714x_spi_pm, ad714x_spi_suspend, ad714x_spi_resume); - static int ad714x_spi_read(struct ad714x_chip *chip, unsigned short reg, unsigned short *data, size_t len) { @@ -103,7 +91,7 @@ static int ad714x_spi_probe(struct spi_device *spi) static struct spi_driver ad714x_spi_driver = { .driver = { .name = "ad714x_captouch", - .pm = &ad714x_spi_pm, + .pm = pm_sleep_ptr(&ad714x_pm), }, .probe = ad714x_spi_probe, }; diff --git a/drivers/input/misc/ad714x.c b/drivers/input/misc/ad714x.c index 43132d98feda..1acd8429c56c 100644 --- a/drivers/input/misc/ad714x.c +++ b/drivers/input/misc/ad714x.c @@ -1162,9 +1162,9 @@ struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq, } EXPORT_SYMBOL(ad714x_probe); -#ifdef CONFIG_PM -int ad714x_disable(struct ad714x_chip *ad714x) +static int ad714x_suspend(struct device *dev) { + struct ad714x_chip *ad714x = dev_get_drvdata(dev); unsigned short data; dev_dbg(ad714x->dev, "%s enter\n", __func__); @@ -1178,10 +1178,10 @@ int ad714x_disable(struct ad714x_chip *ad714x) return 0; } -EXPORT_SYMBOL(ad714x_disable); -int ad714x_enable(struct ad714x_chip *ad714x) +static int ad714x_resume(struct device *dev) { + struct ad714x_chip *ad714x = dev_get_drvdata(dev); dev_dbg(ad714x->dev, "%s enter\n", __func__); mutex_lock(&ad714x->mutex); @@ -1201,8 +1201,8 @@ int ad714x_enable(struct ad714x_chip *ad714x) return 0; } -EXPORT_SYMBOL(ad714x_enable); -#endif + +EXPORT_SIMPLE_DEV_PM_OPS(ad714x_pm, ad714x_suspend, ad714x_resume); MODULE_DESCRIPTION("Analog Devices AD714X Capacitance Touch Sensor Driver"); MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); diff --git a/drivers/input/misc/ad714x.h b/drivers/input/misc/ad714x.h index af847b5f0d0e..dafa12325f27 100644 --- a/drivers/input/misc/ad714x.h +++ b/drivers/input/misc/ad714x.h @@ -8,6 +8,7 @@ #ifndef _AD714X_H_ #define _AD714X_H_ +#include #include #define STAGE_NUM 12 @@ -45,8 +46,7 @@ struct ad714x_chip { }; -int ad714x_disable(struct ad714x_chip *ad714x); -int ad714x_enable(struct ad714x_chip *ad714x); +extern const struct dev_pm_ops ad714x_pm; struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq, ad714x_read_t read, ad714x_write_t write); From patchwork Sat Jan 14 17:16:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13102050 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08E3BC46467 for ; Sat, 14 Jan 2023 17:03:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229955AbjANRDF (ORCPT ); Sat, 14 Jan 2023 12:03:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230295AbjANRDC (ORCPT ); Sat, 14 Jan 2023 12:03:02 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEC9BA5F6 for ; Sat, 14 Jan 2023 09:03:01 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4851860BC1 for ; Sat, 14 Jan 2023 17:03:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99D63C433F0; Sat, 14 Jan 2023 17:02:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673715780; bh=9BXRU0waUXDp0h00YlnZwRoEBTBIWCwMc5/JkMuxn+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fhbTfA7+gAEGJPQXoiJWL3moKSaa3TNGRq9KNMe+24zONxBzP3XIVh11+llpweVpP LWgYBo9ZtwFA0pNxLExFRTYnTGkyFsK3IDr4wwcT3VfZiXiY6rZzWoqieROPcKZ2i0 0/v6kVxUHBTQ59VQH5kUZimrAO/IjVH4+HQT1GFn3tFvhyupmE3oHhLTy1Um/I9MoH ODNCn5hYvbcKEvtb3bcZ1tLoxmoEm7eyQy6d07LVxM+K2WVLNYz9fItUXGSo8pqxdH G2Un2kcpI/cX53W3ZMXJBjs8GhGr22uSYwfTWL9ZjiIMY0GR5mBduoOyIPAwTvXgB2 cotZXCMHTpKrg== From: Jonathan Cameron To: linux-input@vger.kernel.org, Dmitry Torokhov Cc: jic23@kernel.org, Jonathan Cameron , Michael Hennerich Subject: [PATCH 08/16] Input: adxl34x - unify dev_pm_ops using EXPORT_SIMPLE_DEV_PM_OPS() Date: Sat, 14 Jan 2023 17:16:12 +0000 Message-Id: <20230114171620.42891-9-jic23@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230114171620.42891-1-jic23@kernel.org> References: <20230114171620.42891-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Jonathan Cameron The I2C and SPI PM callbacks were identical (though wrapped in some bouncing out to the bus specific container of the struct device and then back again to get the drvdata). As such rather than just moving these to SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() take the opportunity to unify the struct dev_pm_ops and use the new EXPORT_SIMPLE_DEV_PM_OPS() macro so that we can drop the unused suspend and resume callbacks as well as the structure if !CONFIG_PM_SLEEP without needing to mark the callbacks __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Michael Hennerich --- drivers/input/misc/adxl34x-i2c.c | 25 +------------------------ drivers/input/misc/adxl34x-spi.c | 25 +------------------------ drivers/input/misc/adxl34x.c | 16 ++++++++++++---- drivers/input/misc/adxl34x.h | 4 ++-- 4 files changed, 16 insertions(+), 54 deletions(-) diff --git a/drivers/input/misc/adxl34x-i2c.c b/drivers/input/misc/adxl34x-i2c.c index a8ceea36d80a..1c75d98c85a7 100644 --- a/drivers/input/misc/adxl34x-i2c.c +++ b/drivers/input/misc/adxl34x-i2c.c @@ -105,29 +105,6 @@ static void adxl34x_i2c_remove(struct i2c_client *client) adxl34x_remove(ac); } -static int __maybe_unused adxl34x_i2c_suspend(struct device *dev) -{ - struct i2c_client *client = to_i2c_client(dev); - struct adxl34x *ac = i2c_get_clientdata(client); - - adxl34x_suspend(ac); - - return 0; -} - -static int __maybe_unused adxl34x_i2c_resume(struct device *dev) -{ - struct i2c_client *client = to_i2c_client(dev); - struct adxl34x *ac = i2c_get_clientdata(client); - - adxl34x_resume(ac); - - return 0; -} - -static SIMPLE_DEV_PM_OPS(adxl34x_i2c_pm, adxl34x_i2c_suspend, - adxl34x_i2c_resume); - static const struct i2c_device_id adxl34x_id[] = { { "adxl34x", 0 }, { } @@ -155,7 +132,7 @@ MODULE_DEVICE_TABLE(of, adxl34x_of_id); static struct i2c_driver adxl34x_driver = { .driver = { .name = "adxl34x", - .pm = &adxl34x_i2c_pm, + .pm = pm_sleep_ptr(&adxl34x_pm), .of_match_table = adxl34x_of_id, }, .probe_new = adxl34x_i2c_probe, diff --git a/drivers/input/misc/adxl34x-spi.c b/drivers/input/misc/adxl34x-spi.c index 91e44d4c66f7..f1094a8ccdd5 100644 --- a/drivers/input/misc/adxl34x-spi.c +++ b/drivers/input/misc/adxl34x-spi.c @@ -94,33 +94,10 @@ static void adxl34x_spi_remove(struct spi_device *spi) adxl34x_remove(ac); } -static int __maybe_unused adxl34x_spi_suspend(struct device *dev) -{ - struct spi_device *spi = to_spi_device(dev); - struct adxl34x *ac = spi_get_drvdata(spi); - - adxl34x_suspend(ac); - - return 0; -} - -static int __maybe_unused adxl34x_spi_resume(struct device *dev) -{ - struct spi_device *spi = to_spi_device(dev); - struct adxl34x *ac = spi_get_drvdata(spi); - - adxl34x_resume(ac); - - return 0; -} - -static SIMPLE_DEV_PM_OPS(adxl34x_spi_pm, adxl34x_spi_suspend, - adxl34x_spi_resume); - static struct spi_driver adxl34x_driver = { .driver = { .name = "adxl34x", - .pm = &adxl34x_spi_pm, + .pm = pm_sleep_ptr(&adxl34x_pm), }, .probe = adxl34x_spi_probe, .remove = adxl34x_spi_remove, diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c index a4af314392a9..eecca671b588 100644 --- a/drivers/input/misc/adxl34x.c +++ b/drivers/input/misc/adxl34x.c @@ -412,8 +412,10 @@ static void __adxl34x_enable(struct adxl34x *ac) AC_WRITE(ac, POWER_CTL, ac->pdata.power_mode | PCTL_MEASURE); } -void adxl34x_suspend(struct adxl34x *ac) +static int adxl34x_suspend(struct device *dev) { + struct adxl34x *ac = dev_get_drvdata(dev); + mutex_lock(&ac->mutex); if (!ac->suspended && !ac->disabled && ac->opened) @@ -422,11 +424,14 @@ void adxl34x_suspend(struct adxl34x *ac) ac->suspended = true; mutex_unlock(&ac->mutex); + + return 0; } -EXPORT_SYMBOL_GPL(adxl34x_suspend); -void adxl34x_resume(struct adxl34x *ac) +static int adxl34x_resume(struct device *dev) { + struct adxl34x *ac = dev_get_drvdata(dev); + mutex_lock(&ac->mutex); if (ac->suspended && !ac->disabled && ac->opened) @@ -435,8 +440,9 @@ void adxl34x_resume(struct adxl34x *ac) ac->suspended = false; mutex_unlock(&ac->mutex); + + return 0; } -EXPORT_SYMBOL_GPL(adxl34x_resume); static ssize_t adxl34x_disable_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -906,6 +912,8 @@ void adxl34x_remove(struct adxl34x *ac) } EXPORT_SYMBOL_GPL(adxl34x_remove); +EXPORT_GPL_SIMPLE_DEV_PM_OPS(adxl34x_pm, adxl34x_suspend, adxl34x_resume); + MODULE_AUTHOR("Michael Hennerich "); MODULE_DESCRIPTION("ADXL345/346 Three-Axis Digital Accelerometer Driver"); MODULE_LICENSE("GPL"); diff --git a/drivers/input/misc/adxl34x.h b/drivers/input/misc/adxl34x.h index febf85270fff..f9272a2e7a96 100644 --- a/drivers/input/misc/adxl34x.h +++ b/drivers/input/misc/adxl34x.h @@ -20,11 +20,11 @@ struct adxl34x_bus_ops { int (*write)(struct device *, unsigned char, unsigned char); }; -void adxl34x_suspend(struct adxl34x *ac); -void adxl34x_resume(struct adxl34x *ac); struct adxl34x *adxl34x_probe(struct device *dev, int irq, bool fifo_delay_default, const struct adxl34x_bus_ops *bops); void adxl34x_remove(struct adxl34x *ac); +extern const struct dev_pm_ops adxl34x_pm; + #endif From patchwork Sat Jan 14 17:16:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13102051 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 607FEC6379F for ; Sat, 14 Jan 2023 17:03:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230222AbjANRDF (ORCPT ); Sat, 14 Jan 2023 12:03:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230293AbjANRDE (ORCPT ); Sat, 14 Jan 2023 12:03:04 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 776F759FF for ; Sat, 14 Jan 2023 09:03:03 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9422860B4D for ; Sat, 14 Jan 2023 17:03:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E084C433F1; Sat, 14 Jan 2023 17:03:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673715782; bh=tCNbAL2O2w27urcWXdqc91kTvXnsbGcqyuiClUxiYLo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HqAw+HpUPb68mMnft+Z3ZM97yFoADng1wo/8U8eXbx+P2u7HNRg+WE3jg74wFaesi 7dO4gxq8peDBpQ35LlrLzSXFcUmw/mfmtZmOoo8vGeQZchuCENVripyhW8yNduFdiA huw7agDsfZPVmhqcTEejnpZK2OBqGRTYS3qXhqaOIVijL7D/TyX9jL/6GdusvSonqB xcbB6VnoUJGqR6e3jx9do3+b6FFDEaIu9VNjvatlzs3+1io9JsfUuKcqIXkMvwKXfE B77KEkniLc+i26infceqaIP4/2tJVVXxESZQtEnITd0mhIuww8Emgz+QWMcgOSLCNT N/5MY70YQLaHg== From: Jonathan Cameron To: linux-input@vger.kernel.org, Dmitry Torokhov Cc: jic23@kernel.org, Jonathan Cameron Subject: [PATCH 09/16] Input: tsc200x - use EXPORT_GPL_SIMPLE_DEV_PM_OPS() Date: Sat, 14 Jan 2023 17:16:13 +0000 Message-Id: <20230114171620.42891-10-jic23@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230114171620.42891-1-jic23@kernel.org> References: <20230114171620.42891-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Jonathan Cameron SIMPLE_DEV_PM_OPS() is deprecated as it requires explicit protection against unused function warnings. The new combination of pm_sleep_ptr() and EXPORT_GPL_SIMPLE_DEV_PM_OPS() allows the compiler to see the functions, thus suppressing the warning, but still allowing the unused code to be removed. Thus also drop the __maybe_unused markings. This function also removes the need for separate EXPORT_SYMBOL_GPL() Signed-off-by: Jonathan Cameron --- drivers/input/touchscreen/tsc2004.c | 2 +- drivers/input/touchscreen/tsc2005.c | 2 +- drivers/input/touchscreen/tsc200x-core.c | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/input/touchscreen/tsc2004.c b/drivers/input/touchscreen/tsc2004.c index 575768b587bb..45f39eb20638 100644 --- a/drivers/input/touchscreen/tsc2004.c +++ b/drivers/input/touchscreen/tsc2004.c @@ -65,7 +65,7 @@ static struct i2c_driver tsc2004_driver = { .driver = { .name = "tsc2004", .of_match_table = of_match_ptr(tsc2004_of_match), - .pm = &tsc200x_pm_ops, + .pm = pm_sleep_ptr(&tsc200x_pm_ops), }, .id_table = tsc2004_idtable, .probe_new = tsc2004_probe, diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c index 555dfe98b3c4..b6dfbcfc8c19 100644 --- a/drivers/input/touchscreen/tsc2005.c +++ b/drivers/input/touchscreen/tsc2005.c @@ -81,7 +81,7 @@ static struct spi_driver tsc2005_driver = { .driver = { .name = "tsc2005", .of_match_table = of_match_ptr(tsc2005_of_match), - .pm = &tsc200x_pm_ops, + .pm = pm_sleep_ptr(&tsc200x_pm_ops), }, .probe = tsc2005_probe, .remove = tsc2005_remove, diff --git a/drivers/input/touchscreen/tsc200x-core.c b/drivers/input/touchscreen/tsc200x-core.c index 72c7258b93a5..b799f26fcf8f 100644 --- a/drivers/input/touchscreen/tsc200x-core.c +++ b/drivers/input/touchscreen/tsc200x-core.c @@ -588,7 +588,7 @@ void tsc200x_remove(struct device *dev) } EXPORT_SYMBOL_GPL(tsc200x_remove); -static int __maybe_unused tsc200x_suspend(struct device *dev) +static int tsc200x_suspend(struct device *dev) { struct tsc200x *ts = dev_get_drvdata(dev); @@ -604,7 +604,7 @@ static int __maybe_unused tsc200x_suspend(struct device *dev) return 0; } -static int __maybe_unused tsc200x_resume(struct device *dev) +static int tsc200x_resume(struct device *dev) { struct tsc200x *ts = dev_get_drvdata(dev); @@ -620,8 +620,7 @@ static int __maybe_unused tsc200x_resume(struct device *dev) return 0; } -SIMPLE_DEV_PM_OPS(tsc200x_pm_ops, tsc200x_suspend, tsc200x_resume); -EXPORT_SYMBOL_GPL(tsc200x_pm_ops); +EXPORT_GPL_SIMPLE_DEV_PM_OPS(tsc200x_pm_ops, tsc200x_suspend, tsc200x_resume); MODULE_AUTHOR("Lauri Leukkunen "); MODULE_DESCRIPTION("TSC200x Touchscreen Driver Core"); From patchwork Sat Jan 14 17:16:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13102052 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1D7EC46467 for ; Sat, 14 Jan 2023 17:03:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230284AbjANRDI (ORCPT ); Sat, 14 Jan 2023 12:03:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230292AbjANRDG (ORCPT ); Sat, 14 Jan 2023 12:03:06 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 628F6A5F0 for ; Sat, 14 Jan 2023 09:03:04 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E679C60BF9 for ; Sat, 14 Jan 2023 17:03:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D44AC433F2; Sat, 14 Jan 2023 17:03:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673715783; bh=8YXSQ9ESVBWSwK3z/En15WH8uLTOqxGy1o5BJU3aBBk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OPOLo/okUpaezBeE4MWb4yLRdREHZMgdKF+hj8BuYFW457GAY/tG7zhRHJVWeo+iY 62bnqG9nFQy1Wh0Oezqfjr1FfxlZ38ZhFI2xWGjZFyMFjegbL+ka1nJY+jojVCroIn hUwLKzn+RM6xTOvt68+9JLNCVDkvvyNSlaPVoeU5UhJGrnImHSrCplTCcTAJ7KJ78p nECO+lMegy9/7Lmy1qMYR5Yzdl5GoQ4KWp0VFyKHBii5Uhd1Qj3KB3PsiVBWn6t7R5 eRactElOZXHy21lKqBpvr7LVx+fY5Bdi12am/W+0R8wZso/nmm4dVKsKe2aWQ0FSuQ RImKKkXGpEgqQ== From: Jonathan Cameron To: linux-input@vger.kernel.org, Dmitry Torokhov Cc: jic23@kernel.org, Jonathan Cameron Subject: [PATCH 10/16] Input: cyttsp4 - use EXPORT_GPL_RUNTIME_DEV_PM_OPS() Date: Sat, 14 Jan 2023 17:16:14 +0000 Message-Id: <20230114171620.42891-11-jic23@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230114171620.42891-1-jic23@kernel.org> References: <20230114171620.42891-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Jonathan Cameron SET_SYSTEM_SLEEP_PM_OPS() and RUNTIME_PM_OPS() are deprecated as they requires explicit protection against unused function warnings. The new combination of pm_ptr() EXPORT_GPL_RUNTIME_DEV_PM_OPS() allows the compiler to see the functions, thus suppressing the warning, but still allowing the unused code to be removed. Thus also drop the #ifdef guards. Note that we are replacing an unconditional call to the suspend and resume functions for sleep use cases with one via pm_runtime_force_suspend() / pm_runtime_force_resume() that only do anything to the device if we are not already in the appropriate runtime suspended state. Signed-off-by: Jonathan Cameron --- I 'think' this should be fine in that it can only reduce the number of unnecessary suspends. If anyone can test that would be great. --- drivers/input/touchscreen/cyttsp4_core.c | 9 ++------- drivers/input/touchscreen/cyttsp4_i2c.c | 2 +- drivers/input/touchscreen/cyttsp4_spi.c | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c index dccbcb942fe5..0cd6f626adec 100644 --- a/drivers/input/touchscreen/cyttsp4_core.c +++ b/drivers/input/touchscreen/cyttsp4_core.c @@ -1744,7 +1744,6 @@ static void cyttsp4_free_si_ptrs(struct cyttsp4 *cd) kfree(si->btn_rec_data); } -#ifdef CONFIG_PM static int cyttsp4_core_sleep(struct cyttsp4 *cd) { int rc; @@ -1877,13 +1876,9 @@ static int cyttsp4_core_resume(struct device *dev) return 0; } -#endif -const struct dev_pm_ops cyttsp4_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(cyttsp4_core_suspend, cyttsp4_core_resume) - SET_RUNTIME_PM_OPS(cyttsp4_core_suspend, cyttsp4_core_resume, NULL) -}; -EXPORT_SYMBOL_GPL(cyttsp4_pm_ops); +EXPORT_GPL_RUNTIME_DEV_PM_OPS(cyttsp4_pm_ops, + cyttsp4_core_suspend, cyttsp4_core_resume, NULL); static int cyttsp4_mt_open(struct input_dev *input) { diff --git a/drivers/input/touchscreen/cyttsp4_i2c.c b/drivers/input/touchscreen/cyttsp4_i2c.c index c260bab0c62c..ec7a4779f3fb 100644 --- a/drivers/input/touchscreen/cyttsp4_i2c.c +++ b/drivers/input/touchscreen/cyttsp4_i2c.c @@ -58,7 +58,7 @@ MODULE_DEVICE_TABLE(i2c, cyttsp4_i2c_id); static struct i2c_driver cyttsp4_i2c_driver = { .driver = { .name = CYTTSP4_I2C_NAME, - .pm = &cyttsp4_pm_ops, + .pm = pm_ptr(&cyttsp4_pm_ops), }, .probe_new = cyttsp4_i2c_probe, .remove = cyttsp4_i2c_remove, diff --git a/drivers/input/touchscreen/cyttsp4_spi.c b/drivers/input/touchscreen/cyttsp4_spi.c index 5d7db84f2749..944fbbe9113e 100644 --- a/drivers/input/touchscreen/cyttsp4_spi.c +++ b/drivers/input/touchscreen/cyttsp4_spi.c @@ -173,7 +173,7 @@ static void cyttsp4_spi_remove(struct spi_device *spi) static struct spi_driver cyttsp4_spi_driver = { .driver = { .name = CYTTSP4_SPI_NAME, - .pm = &cyttsp4_pm_ops, + .pm = pm_ptr(&cyttsp4_pm_ops), }, .probe = cyttsp4_spi_probe, .remove = cyttsp4_spi_remove, From patchwork Sat Jan 14 17:16:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13102053 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06427C3DA78 for ; Sat, 14 Jan 2023 17:03:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230304AbjANRDI (ORCPT ); Sat, 14 Jan 2023 12:03:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230306AbjANRDH (ORCPT ); Sat, 14 Jan 2023 12:03:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1600B752 for ; Sat, 14 Jan 2023 09:03:05 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8F47560B4D for ; Sat, 14 Jan 2023 17:03:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC913C433D2; Sat, 14 Jan 2023 17:03:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673715785; bh=Vuuw9Xo3u+9CCXmC4HeHz2ij6y6biOpNLxCkJlE7I18=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f13hC9NfrwarCmcvIPE3ueYk7+5TG+puAQPomblQ0RY2aB4VMHVU8TC/0QvSVEtCp yngULn0OInGq3E+iXvnexI1EyrEc1DsXM1HAL7CWoMF2CuSGlrUMC4DEY+3Wugd9Gf qPEBl3rqXuGV8iuK1mZJyUhyjN5eQtvEi2F65w5G+/JkrXnP9BGFzNRABvXwGFirz1 66FJ643jhyP5cJi2yDKxNU/R4T2GF1hni414uZ8OQsjIX7l+3fhIeZNgcjnYjTh6YC bo1zimxqfxvNM6VuaIenn1zyrSkQ/ZyzQDhNO5GLqtV6nrUJkmUUMAbEilL6A78qt3 sv0rdE0eyxpHQ== From: Jonathan Cameron To: linux-input@vger.kernel.org, Dmitry Torokhov Cc: jic23@kernel.org, Jonathan Cameron , Javier Martinez Canillas , Linus Walleij Subject: [PATCH 11/16] Input: cyttsp - use EXPORT_GPL_SIMPLE_DEV_PM_OPS() Date: Sat, 14 Jan 2023 17:16:15 +0000 Message-Id: <20230114171620.42891-12-jic23@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230114171620.42891-1-jic23@kernel.org> References: <20230114171620.42891-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Jonathan Cameron SIMPLE_DEV_PM_OPS() is deprecated as it requires explicit protection against unused function warnings. The new combination of pm_sleep_ptr() and EXPORT_GPL_SIMPLE_DEV_PMU_OPS() allows the compiler to see the functions, thus suppressing the warning, but still allowing the unused code to be removed. Thus also drop the __maybe_unused markings. It also rolls in the EXPORT_SYMBOL() so that we only export it if CONFIG_PM_SLEEP. Signed-off-by: Jonathan Cameron Cc: Javier Martinez Canillas Cc: Linus Walleij --- drivers/input/touchscreen/cyttsp_core.c | 7 +++---- drivers/input/touchscreen/cyttsp_i2c.c | 2 +- drivers/input/touchscreen/cyttsp_spi.c | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/input/touchscreen/cyttsp_core.c b/drivers/input/touchscreen/cyttsp_core.c index 1dbd849c9613..132ed5786e84 100644 --- a/drivers/input/touchscreen/cyttsp_core.c +++ b/drivers/input/touchscreen/cyttsp_core.c @@ -491,7 +491,7 @@ static int cyttsp_disable(struct cyttsp *ts) return 0; } -static int __maybe_unused cyttsp_suspend(struct device *dev) +static int cyttsp_suspend(struct device *dev) { struct cyttsp *ts = dev_get_drvdata(dev); int retval = 0; @@ -509,7 +509,7 @@ static int __maybe_unused cyttsp_suspend(struct device *dev) return retval; } -static int __maybe_unused cyttsp_resume(struct device *dev) +static int cyttsp_resume(struct device *dev) { struct cyttsp *ts = dev_get_drvdata(dev); @@ -525,8 +525,7 @@ static int __maybe_unused cyttsp_resume(struct device *dev) return 0; } -SIMPLE_DEV_PM_OPS(cyttsp_pm_ops, cyttsp_suspend, cyttsp_resume); -EXPORT_SYMBOL_GPL(cyttsp_pm_ops); +EXPORT_GPL_SIMPLE_DEV_PM_OPS(cyttsp_pm_ops, cyttsp_suspend, cyttsp_resume); static int cyttsp_open(struct input_dev *dev) { diff --git a/drivers/input/touchscreen/cyttsp_i2c.c b/drivers/input/touchscreen/cyttsp_i2c.c index 0155a1626adf..3f91cb43ec82 100644 --- a/drivers/input/touchscreen/cyttsp_i2c.c +++ b/drivers/input/touchscreen/cyttsp_i2c.c @@ -63,7 +63,7 @@ MODULE_DEVICE_TABLE(of, cyttsp_of_i2c_match); static struct i2c_driver cyttsp_i2c_driver = { .driver = { .name = CY_I2C_NAME, - .pm = &cyttsp_pm_ops, + .pm = pm_sleep_ptr(&cyttsp_pm_ops), .of_match_table = cyttsp_of_i2c_match, }, .probe_new = cyttsp_i2c_probe, diff --git a/drivers/input/touchscreen/cyttsp_spi.c b/drivers/input/touchscreen/cyttsp_spi.c index 30c6fbf86a86..ada17f2dadf3 100644 --- a/drivers/input/touchscreen/cyttsp_spi.c +++ b/drivers/input/touchscreen/cyttsp_spi.c @@ -172,7 +172,7 @@ MODULE_DEVICE_TABLE(of, cyttsp_of_spi_match); static struct spi_driver cyttsp_spi_driver = { .driver = { .name = CY_SPI_NAME, - .pm = &cyttsp_pm_ops, + .pm = pm_sleep_ptr(&cyttsp_pm_ops), .of_match_table = cyttsp_of_spi_match, }, .probe = cyttsp_spi_probe, From patchwork Sat Jan 14 17:16:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13102054 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C096EC6379F for ; Sat, 14 Jan 2023 17:03:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230293AbjANRDK (ORCPT ); Sat, 14 Jan 2023 12:03:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230311AbjANRDJ (ORCPT ); Sat, 14 Jan 2023 12:03:09 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55150A5F2 for ; Sat, 14 Jan 2023 09:03:07 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E5F8B60C01 for ; Sat, 14 Jan 2023 17:03:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66D13C433F0; Sat, 14 Jan 2023 17:03:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673715786; bh=wI6BTPk4E4tB5BRh5Aw4uOihjadUKrEtfrtL2v1kpPA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mUOylq3kbpfYYl7qUoiCh7oXKohH9xVzJwLqO99VEijNE6rz/wsdVBGTXYqh4gC5v 3zbFuGi27fOFHwPeBv9O6WvAFX0HThHLQZ+1T+dlui8WMVUaj+9+WdnS3jXNfCC2SP whPWRweuJrVfVOnt9GKJgakuVwPCzx5Wrpqva+HhB88HQjz65MR+5ZKhWC1wHKmFa8 dIXnlhQk7NlgzEHg0LIsmlX1QUCGQS/OQrouZJ1oDuSs0dmgpVm95DcgAz1Ckmrugs g2EXPkbBj2R7iSPSH9A04ojIflJVh+Eg0/6uXxA7n6IR8gWEhlZ3bS72kv5JbJWf3U ogbguMCfpI9ag== From: Jonathan Cameron To: linux-input@vger.kernel.org, Dmitry Torokhov Cc: jic23@kernel.org, Jonathan Cameron Subject: [PATCH 12/16] Input: applespi - use pm_sleep_ptr() and SYSTEM_SLEEP_PM_OPS() Date: Sat, 14 Jan 2023 17:16:16 +0000 Message-Id: <20230114171620.42891-13-jic23@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230114171620.42891-1-jic23@kernel.org> References: <20230114171620.42891-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Jonathan Cameron SET_SYSTEM_SLEEP_PM_OPS() is deprecated as it requires explicit protection against unused function warnings. The new combination of pm_sleep_ptr() and SYSTEM_SLEEP_PM_OPS() allows the compiler to see the functions, thus suppressing the warning, but still allowing the unused code to be removed. Thus also drop the __maybe_unused markings. In this case we also have a .poweroff_late() callback. Whilst not strictly necessary, to future proof against relaxation of the protection of the main driver.pm = pm_sleep_ptr() protect this pointer with pm_sleep_ptr() as would be done if the LATE_SYSTEM_SLEEP_PM_OPS() macro were used to set it. Signed-off-by: Jonathan Cameron --- drivers/input/keyboard/applespi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/input/keyboard/applespi.c b/drivers/input/keyboard/applespi.c index 91a9810f6980..cf25177b4830 100644 --- a/drivers/input/keyboard/applespi.c +++ b/drivers/input/keyboard/applespi.c @@ -1876,7 +1876,7 @@ static int applespi_poweroff_late(struct device *dev) return 0; } -static int __maybe_unused applespi_suspend(struct device *dev) +static int applespi_suspend(struct device *dev) { struct spi_device *spi = to_spi_device(dev); struct applespi_data *applespi = spi_get_drvdata(spi); @@ -1903,7 +1903,7 @@ static int __maybe_unused applespi_suspend(struct device *dev) return 0; } -static int __maybe_unused applespi_resume(struct device *dev) +static int applespi_resume(struct device *dev) { struct spi_device *spi = to_spi_device(dev); struct applespi_data *applespi = spi_get_drvdata(spi); @@ -1947,15 +1947,15 @@ static const struct acpi_device_id applespi_acpi_match[] = { MODULE_DEVICE_TABLE(acpi, applespi_acpi_match); static const struct dev_pm_ops applespi_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(applespi_suspend, applespi_resume) - .poweroff_late = applespi_poweroff_late, + SYSTEM_SLEEP_PM_OPS(applespi_suspend, applespi_resume) + .poweroff_late = pm_sleep_ptr(applespi_poweroff_late), }; static struct spi_driver applespi_driver = { .driver = { .name = "applespi", .acpi_match_table = applespi_acpi_match, - .pm = &applespi_pm_ops, + .pm = pm_sleep_ptr(&applespi_pm_ops), }, .probe = applespi_probe, .remove = applespi_remove, From patchwork Sat Jan 14 17:16:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13102055 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAE70C3DA78 for ; Sat, 14 Jan 2023 17:03:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230297AbjANRDL (ORCPT ); Sat, 14 Jan 2023 12:03:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230315AbjANRDJ (ORCPT ); Sat, 14 Jan 2023 12:03:09 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DEF4B741 for ; Sat, 14 Jan 2023 09:03:08 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3E78160C03 for ; Sat, 14 Jan 2023 17:03:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B75DCC433EF; Sat, 14 Jan 2023 17:03:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673715787; bh=LmQpRaIX07iuTjVXIPfr7oOuAVUNJPzsLf954XZ+HVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jh7zqAU9gVwIY6vzYIGQ6QCZF8sQN0IdfUeJd4e2dNXs45t7dxtKIFPzLJjnEiLYz SqpHrP0Z4yYhr9HW0NcYGp2Ygn+fA/Z8OvJyFbuExPot1++et+tK+ej/wVTerCceaj eXhOzkJTzSW+3R5lC27IWl626PVFevrH1UyX6b/Ad9uCl4TZCHVh/2mLSgkso5RFv2 6EmzXP91JmSRTLbhEzrqI9E1vO6JN8GBjKA/wNouieZQuc1g4K8LORxxeVPRkP8VHF N6XoGgAmZf3x0LXb3E2oXBsAb6PHU9QMe/FwLopXUfwaqK0I5/0OgD07Pu9+l/zRdv i3m9ctBOvbTkg== From: Jonathan Cameron To: linux-input@vger.kernel.org, Dmitry Torokhov Cc: jic23@kernel.org, Jonathan Cameron Subject: [PATCH 13/16] Input: omap4-keyad - use pm_ptr() and RUNTIME_DEV_PM_OPS() Date: Sat, 14 Jan 2023 17:16:17 +0000 Message-Id: <20230114171620.42891-14-jic23@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230114171620.42891-1-jic23@kernel.org> References: <20230114171620.42891-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Jonathan Cameron SET_RUNTIME_DEV_PM_OPS() is deprecated as it requires explicit protection against unused function warnings. The new combination of pm_ptr() and RUNTIME_DEV_PM_OPS() allows the compiler to see the functions, thus suppressing the warning, but still allowing the unused code to be removed. Thus also drop the __maybe_unused markings. Note that DEFINE_RUNTIME_DEV_PM_OPS() is not used because that adds additional callbacks for suspend and resume and would need testing. Signed-off-by: Jonathan Cameron --- drivers/input/keyboard/omap4-keypad.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c index ee9d04a3f0d5..4426120398b0 100644 --- a/drivers/input/keyboard/omap4-keypad.c +++ b/drivers/input/keyboard/omap4-keypad.c @@ -310,7 +310,7 @@ static int omap4_keypad_check_revision(struct device *dev, * Interrupt may not happen for key-up events. We must clear stuck * key-up events after the keyboard hardware has auto-idled. */ -static int __maybe_unused omap4_keypad_runtime_suspend(struct device *dev) +static int omap4_keypad_runtime_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct omap4_keypad *keypad_data = platform_get_drvdata(pdev); @@ -328,7 +328,7 @@ static int __maybe_unused omap4_keypad_runtime_suspend(struct device *dev) } static const struct dev_pm_ops omap4_keypad_pm_ops = { - SET_RUNTIME_PM_OPS(omap4_keypad_runtime_suspend, NULL, NULL) + RUNTIME_PM_OPS(omap4_keypad_runtime_suspend, NULL, NULL) }; static void omap4_disable_pm(void *d) @@ -488,7 +488,7 @@ static struct platform_driver omap4_keypad_driver = { .driver = { .name = "omap4-keypad", .of_match_table = omap_keypad_dt_match, - .pm = &omap4_keypad_pm_ops, + .pm = pm_ptr(&omap4_keypad_pm_ops), }, }; module_platform_driver(omap4_keypad_driver); From patchwork Sat Jan 14 17:16:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13102056 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A15F6C46467 for ; Sat, 14 Jan 2023 17:03:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230267AbjANRDM (ORCPT ); Sat, 14 Jan 2023 12:03:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230295AbjANRDK (ORCPT ); Sat, 14 Jan 2023 12:03:10 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3142AB750 for ; Sat, 14 Jan 2023 09:03:10 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9017760BC1 for ; Sat, 14 Jan 2023 17:03:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12541C43392; Sat, 14 Jan 2023 17:03:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673715789; bh=8MWA74o7i6QEFtXjv1ic0ouMom0PTXjvt90h1UTO5/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dxOGgDdiat1w6hiZlSvFY8jlazu57VmTi92TtuDVTfyaHd//1c3Dr1rqPFkAQ5sl3 32GaDgl9/8dv1z/2s8iqrg+SRdo7ZjkfQcYjQ5F+0p6L8tCKgTlhsr7NfojRzgo1om 0xqhhYqUglUfa+8k1ugkwVn3KFvhyC0HbtYhyiNPVJ4nbVjxRUzo24lCKPJ4smiU34 L6OSYkKQBX4Jcx3NAXuqN5psTyJnvOKUCW52Okbdth5umeBf9zzWIe8vyp1n1ryKwG MfB7ITqOnvMEU93T5xWczf7inPlA6r7YicYENKafIGvnykPwLmIvZb7zky0/ZkLicD J8qypBAreG3Sw== From: Jonathan Cameron To: linux-input@vger.kernel.org, Dmitry Torokhov Cc: jic23@kernel.org, Jonathan Cameron Subject: [PATCH 14/16] Input: Use pm_sleep_ptr() to avoid need for ifdef CONFIG_PM_SLEEP Date: Sat, 14 Jan 2023 17:16:18 +0000 Message-Id: <20230114171620.42891-15-jic23@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230114171620.42891-1-jic23@kernel.org> References: <20230114171620.42891-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Jonathan Cameron As the new pm_sleep_ptr() macro lets the compiler see the code, but then remove it if !CONFIG_PM_SLEEP it can be used to avoid the need for #ifdef guards. Use that in the input core to simplify the code a little. Note pm_sleep_ptr() has not been applied to each callback in the ops structure because the pm_sleep_ptr() at the usage site is sufficient. Signed-off-by: Jonathan Cameron --- drivers/input/input.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/input/input.c b/drivers/input/input.c index ca2e3dd7188b..9fdb22db2ca4 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -1828,7 +1829,6 @@ static int input_uninhibit_device(struct input_dev *dev) return ret; } -#ifdef CONFIG_PM_SLEEP static int input_dev_suspend(struct device *dev) { struct input_dev *input_dev = to_input_dev(dev); @@ -1903,15 +1903,12 @@ static const struct dev_pm_ops input_dev_pm_ops = { .poweroff = input_dev_poweroff, .restore = input_dev_resume, }; -#endif /* CONFIG_PM */ static const struct device_type input_dev_type = { .groups = input_dev_attr_groups, .release = input_dev_release, .uevent = input_dev_uevent, -#ifdef CONFIG_PM_SLEEP - .pm = &input_dev_pm_ops, -#endif + .pm = pm_sleep_ptr(&input_dev_pm_ops), }; static char *input_devnode(const struct device *dev, umode_t *mode) From patchwork Sat Jan 14 17:16:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13102057 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 212F3C6379F for ; Sat, 14 Jan 2023 17:03:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230295AbjANRDP (ORCPT ); Sat, 14 Jan 2023 12:03:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230234AbjANRDO (ORCPT ); Sat, 14 Jan 2023 12:03:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FBFAA5F8 for ; Sat, 14 Jan 2023 09:03:13 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B8572B808C2 for ; Sat, 14 Jan 2023 17:03:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 631F5C433EF; Sat, 14 Jan 2023 17:03:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673715790; bh=NjxMr2BSrLQyoYZ3Vd27E3CVhskIRyThLT7OGShFHS8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jhfqi5ae1G63MMVtkGLNdY9LIx/Tbtg7E2FPi7GcQ2m3p0+16/NPomCKz+XsWTNRV bGx0xFQNwO3R41fDWJbq9RTjhiWwjRUExpy6InGLpDsLyJxPJImXHQpMXtUmQCvsfy wt0JvJuJ1Q/B5qiPy2YZu3x3VIZv99GM8KMS/KDUxtOtV+eHCCHkfC21H7zpfg0jO1 sDUf4xBQNNxPTbR0FLd1q+5OItQLtqx+BXNp+kpuCR5V3bPUvD8reOzAGMQsEqyq3r MgP5F9FmcK7uXskSi+T/csM5djrn7CeeLwcBgXKUyGqv5W0oEnI/dlvbwBtdf5quZM Q0Cv0ne2qDyDA== From: Jonathan Cameron To: linux-input@vger.kernel.org, Dmitry Torokhov Cc: jic23@kernel.org, Jonathan Cameron Subject: [PATCH 15/16] Input: cma3000 - use pm_sleep_ptr() to allow removal of ifdef CONFIG_PM guards Date: Sat, 14 Jan 2023 17:16:19 +0000 Message-Id: <20230114171620.42891-16-jic23@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230114171620.42891-1-jic23@kernel.org> References: <20230114171620.42891-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Jonathan Cameron As the guards only apply to suspend and resume, #ifdef CONFIG_PM_SLEEP would have been a tighter protection. As pm_sleep_ptr() lets the compiler see the protected ops structure and callbacks but also lets the compiler remove it as unused code if !CONFIG_PM_SLEEP this allows the #ifdef guards to be removed, slightly simplifying the resulting code. Signed-off-by: Jonathan Cameron --- It seems likely that DEFINE_SIMPLE_DEV_PM_OPS() would work here but I'd prefer not to make that change unless someone can confirm that the extra callbacks registered will have no unwanted side effects in this driver. --- drivers/input/misc/cma3000_d0x_i2c.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/input/misc/cma3000_d0x_i2c.c b/drivers/input/misc/cma3000_d0x_i2c.c index 75442c1230b1..136eb3715870 100644 --- a/drivers/input/misc/cma3000_d0x_i2c.c +++ b/drivers/input/misc/cma3000_d0x_i2c.c @@ -64,7 +64,6 @@ static void cma3000_i2c_remove(struct i2c_client *client) cma3000_exit(data); } -#ifdef CONFIG_PM static int cma3000_i2c_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -89,7 +88,6 @@ static const struct dev_pm_ops cma3000_i2c_pm_ops = { .suspend = cma3000_i2c_suspend, .resume = cma3000_i2c_resume, }; -#endif static const struct i2c_device_id cma3000_i2c_id[] = { { "cma3000_d01", 0 }, @@ -104,9 +102,7 @@ static struct i2c_driver cma3000_i2c_driver = { .id_table = cma3000_i2c_id, .driver = { .name = "cma3000_i2c_accl", -#ifdef CONFIG_PM - .pm = &cma3000_i2c_pm_ops, -#endif + .pm = pm_sleep_ptr(&cma3000_i2c_pm_ops), }, }; From patchwork Sat Jan 14 17:16:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13102058 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B479C3DA78 for ; Sat, 14 Jan 2023 17:03:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230306AbjANRDR (ORCPT ); Sat, 14 Jan 2023 12:03:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230285AbjANRDP (ORCPT ); Sat, 14 Jan 2023 12:03:15 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7344830DB for ; Sat, 14 Jan 2023 09:03:14 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2E14BB80938 for ; Sat, 14 Jan 2023 17:03:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3391C433D2; Sat, 14 Jan 2023 17:03:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673715791; bh=KxjPv6ueFUfWu6l2frfr+Nr23nCmoR9EN/JPsNdBiww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S0wbv4HJFFNB+tm2FjXDQ+KOKzKWAhNJYTUm81wAbMh0Rrz9vu6bnAyM8ugbS/L1Q ynaVSBitzJ/5aKwBnUS57qs57UnPSqPSUyY7PKUHRd4xOPfjm0vtFFWNqa9dvYtrb6 chvcuULMHT41f3Do83h0eTNyhRhxpy2+hfr5sRKsC+o0rp/yEw531yaktr+jVyILRB +TYwsS2yjN8Zd7Oh1oN8CTO0lFmpMc/MFR4y8nKHdPNj6Qljs88892/bjnL8VuuAmz F+Nm8oxxbKPLquSy6Ja3YgUuwvRoHn5KBiYvh8drVeHq85xt3veeOnqPNSpDJCxMJq 8Z3pqzrVMV2kQ== From: Jonathan Cameron To: linux-input@vger.kernel.org, Dmitry Torokhov Cc: jic23@kernel.org, Jonathan Cameron Subject: [PATCH 16/16] Input: wistron_btns - use pm_sleep_ptr() to allow removal of ifdef CONFIG_PM guards Date: Sat, 14 Jan 2023 17:16:20 +0000 Message-Id: <20230114171620.42891-17-jic23@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230114171620.42891-1-jic23@kernel.org> References: <20230114171620.42891-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Jonathan Cameron As the guards only apply to suspend and resume, #ifdef CONFIG_PM_SLEEP would have been a tighter protection. As pm_sleep_ptr() lets the compiler see the protected ops structure and callbacks but also lets the compiler remove it as unused code if !CONFIG_PM_SLEEP this allows the #ifdef guards to be removed, slightly simplifying the resulting code. Signed-off-by: Jonathan Cameron --- It seems likely that DEFINE_SIMPLE_DEV_PM_OPS() would work here but I'd prefer not to make that change unless someone can confirm that the extra callbacks registered will have no unwanted side effects in this driver. --- drivers/input/misc/wistron_btns.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c index 80dfd72a02d3..111cb70cde46 100644 --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c @@ -1295,7 +1295,6 @@ static int wistron_remove(struct platform_device *dev) return 0; } -#ifdef CONFIG_PM static int wistron_suspend(struct device *dev) { if (have_wifi) @@ -1330,14 +1329,11 @@ static const struct dev_pm_ops wistron_pm_ops = { .poweroff = wistron_suspend, .restore = wistron_resume, }; -#endif static struct platform_driver wistron_driver = { .driver = { .name = "wistron-bios", -#ifdef CONFIG_PM - .pm = &wistron_pm_ops, -#endif + .pm = pm_sleep_ptr(&wistron_pm_ops), }, .probe = wistron_probe, .remove = wistron_remove,