From patchwork Mon Aug 19 04:58:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13767901 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BE5A5C3DA4A for ; Mon, 19 Aug 2024 05:02:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lNWm/LHzPulP7AbD+r4Ifgq3N7WHw34TpzWbrByhISE=; b=cfcwpouU9uG+jSp4GEPwb+sOHW 4o2nmeMYUvblqbNB6y175YK/+SjjRzYm7Bytoo8tMIOyZYTvE7iJ6ANMekSy0rsLyhr1wlCoIhIsJ esd8CL2ZuJrzHtGHxksI/OZv+cfv1QALWq19U8mvUgmarkNSmU3Ry8BCNyX/2PHrrUz0hfFmJ9zF4 dncV2sWo/GhrN+/ibJ3Pgb0GRe/DuMKSbw3zw4tdeUI9jKI+sRSPK++rU2xJkiza4BgG6D+rT8Oz9 ihYz7efO5/mP+5/ZzkoH6Fn5nIHhEBvYxC/il3Pg4JF3ta3U+88oFNsXCm1hrG7NSinzDtA8oaVLQ mzPFL2Aw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sfuXG-00000000Mg9-3oev; Mon, 19 Aug 2024 05:02:31 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sfuTQ-00000000LXG-3K95 for linux-arm-kernel@lists.infradead.org; Mon, 19 Aug 2024 04:58:34 +0000 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-201fbd0d7c2so22032595ad.0 for ; Sun, 18 Aug 2024 21:58:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724043512; x=1724648312; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lNWm/LHzPulP7AbD+r4Ifgq3N7WHw34TpzWbrByhISE=; b=EGfUFt6bpVrk430mZYjBgAVgdfnrcbQcbRawEia4X9H+bNKah2cSh7li1BF9nWSJJj aoGCUFrKk+bQJVEVrpiPjRAOBBNAqo3IxuOcbmZakmuVbV1T5fiW/GGv2J4BW4UchQOP uDU1i+7eIK34chh9uPkP/ysp/HuWsKxg979+Wzo8P9bojhfX5o1nF5TK327VLGfMYz+O 8BUKGipFy3oqblDNW/V1JqAF6Lvf3t5aSQaONETkH9BLdYlH4AgUNFcl3xDcVcIZu/lX 6aFWHohVSt+OqxXnMGr/Q/WAVJepnK/AiKbucxPhbKxlpfmt0VlA5CJdxd3sYPkwhMDg ukIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724043512; x=1724648312; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lNWm/LHzPulP7AbD+r4Ifgq3N7WHw34TpzWbrByhISE=; b=JriGSs6V3P69pmHWjBg84zmnI8s9ea4A+/Vr1e92v/ppGIIysa0+WYJGOJNCNdG/tI iXNlYz6XgSZzG4OTWWlCvZIU+lsWDhFinCgdCNEAeXPnwtVHBeVtpFKIvSKSB8iPMdNg lQkSRO2AhsBqvOs2Co1fm/uMCRGoPANdhUKh0le0ePsXumFEP2XNfUQYNU7sfeKyc96w QO8WriKeevtSoMd1jp99s6gICR6L6vAHtW38Tcd5IfeKRb/5RXiKMdRwxpL11spQHt3P bkVrZu4KXW6YYsGUKFcldLSnF6J09m5ozpY1T+Xc5IYY/ENoy6jCz3QaEdqxY8+7frjn Rjgw== X-Forwarded-Encrypted: i=1; AJvYcCVQO3qowGrowgIDRA1gGjKTrY9SBWGAJ7ySuySiLJpDghlw40rKchQC0VLo6dWJ4v47CJPpVM2smDYhGeSTdcsM4S2WFP0r5KzBwuGNf3aJT3apV2U= X-Gm-Message-State: AOJu0Yzd63iOezPB49VRu+xO2shXUvjcTFf3pwJTtfp/l5PU13uCbOkv gsmY6kVAeTcXJafrTzJiY+CRO+6CB4Dyd89YUaieLp46w5sUB232 X-Google-Smtp-Source: AGHT+IF+5xTqa6T/wiF74i1cJmY0LmEvr8qfMTP1VOfYfjLyAhlqt4pH3GHhaxtukOfpWaiyJZ9e4A== X-Received: by 2002:a17:903:946:b0:202:232b:2dd8 with SMTP id d9443c01a7336-202232b3046mr32707215ad.55.1724043511647; Sun, 18 Aug 2024 21:58:31 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:4eb5:4500:6efc:6c24]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-202068497b4sm43483445ad.269.2024.08.18.21.58.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Aug 2024 21:58:31 -0700 (PDT) From: Dmitry Torokhov To: Arnd Bergmann , Mark Brown , Krzysztof Kozlowski Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, patches@opensource.cirrus.com Subject: [PATCH 05/14] Input: samsung-keypad - use devm to disable runtime PM Date: Sun, 18 Aug 2024 21:58:02 -0700 Message-ID: <20240819045813.2154642-6-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.184.g6999bdac58-goog In-Reply-To: <20240819045813.2154642-1-dmitry.torokhov@gmail.com> References: <20240819045813.2154642-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240818_215832_849663_02E4A486 X-CRM114-Status: GOOD ( 17.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org To make sure that runtime PM is disabled at the right time relative to all other devm-managed resources use devm_add_action_or_reset() to register a handler that will disable it. Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/samsung-keypad.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c index 7adcd2657bca..924327de4d8f 100644 --- a/drivers/input/keyboard/samsung-keypad.c +++ b/drivers/input/keyboard/samsung-keypad.c @@ -310,6 +310,13 @@ samsung_keypad_parse_dt(struct device *dev) } #endif +static void samsung_disable_runtime_pm(void *data) +{ + struct samsung_keypad *keypad = data; + + pm_runtime_disable(&keypad->pdev->dev); +} + static int samsung_keypad_probe(struct platform_device *pdev) { const struct samsung_keypad_platdata *pdata; @@ -420,11 +427,16 @@ static int samsung_keypad_probe(struct platform_device *pdev) device_init_wakeup(&pdev->dev, pdata->wakeup); platform_set_drvdata(pdev, keypad); + pm_runtime_enable(&pdev->dev); + error = devm_add_action_or_reset(&pdev->dev, samsung_disable_runtime_pm, + keypad); + if (error) + return error; error = input_register_device(keypad->input_dev); if (error) - goto err_disable_runtime_pm; + return error; if (pdev->dev.of_node) { devm_kfree(&pdev->dev, (void *)pdata->keymap_data->keymap); @@ -432,15 +444,6 @@ static int samsung_keypad_probe(struct platform_device *pdev) devm_kfree(&pdev->dev, (void *)pdata); } return 0; - -err_disable_runtime_pm: - pm_runtime_disable(&pdev->dev); - return error; -} - -static void samsung_keypad_remove(struct platform_device *pdev) -{ - pm_runtime_disable(&pdev->dev); } static int samsung_keypad_runtime_suspend(struct device *dev) @@ -575,7 +578,6 @@ MODULE_DEVICE_TABLE(platform, samsung_keypad_driver_ids); static struct platform_driver samsung_keypad_driver = { .probe = samsung_keypad_probe, - .remove_new = samsung_keypad_remove, .driver = { .name = "samsung-keypad", .of_match_table = of_match_ptr(samsung_keypad_dt_match),