From patchwork Mon Aug 19 04:57:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13767882 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 24A62C3DA4A for ; Mon, 19 Aug 2024 05:00:01 +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=cjo9bqr1UtOoJLuXizHH4agDHMHJlsbeIYUVnrax5+8=; b=pyMIfAi1bmRajwBSQS1D/dDZzu Wu7B1dNQH7FjNYnu8zGBz8BjS2p5Mt7TXkMpp4JQ0kujtmADaKbuaApdSlLgWzis5JAG4eI1o6IXq KH0pQgXhwiMOf6Z/8pj6ZXqP00ityQPbY7z+aQ+ivsGfDW94T3vStgTzMEeG45jW7xD3IEswCnXPo 5ENKcrBfegOLKR6wTNB0dVsstoMIgRAWToUCli7aCOVtfxipW0dr3EJG4va9vB5XaVK9DQMmcNStA 6VHnmIXxMhuZ/TWJ9EHVIeXBeyJt1vTxEA/odRQ0FNyFGzfGvT25VRVVmZ5cCCzsRJgI/oYvnTT6D 4925UuNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sfuUe-00000000LsW-23iY; Mon, 19 Aug 2024 04:59:48 +0000 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sfuTM-00000000LVi-0N2e for linux-arm-kernel@lists.infradead.org; Mon, 19 Aug 2024 04:58:29 +0000 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-20227ba378eso8962725ad.0 for ; Sun, 18 Aug 2024 21:58:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724043507; x=1724648307; 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=cjo9bqr1UtOoJLuXizHH4agDHMHJlsbeIYUVnrax5+8=; b=Ws14vfqw+ion0EJtZGBDczvBsVGblrJEbKj5aKabA8hT6+CQ+u1uFWE7IdNMwx26Vg ohjYlLOdD6s2pNwwoqC/cXBAdradMB5OFr9/LTW2CElTODaNKJENn7T6HpQR4HyYal/A gNQeMH8/W+VSLwseArNswtb0lkTQ6R/+ryuADwFP38c09p//LSAFdGjb+p2J9AcJ6g37 7sHN0XxXTH85X0KNH3xCSfroL3IlFD9u67KTda0v0BTvb5cZFeQLvf53H51gEO3IxjO3 YYxFLWBO6xHimpn02mGJgrBzfTrTaxhdGiTc/1aQ50XiUWHOi541eMbl+UXADRmcFky2 NCWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724043507; x=1724648307; 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=cjo9bqr1UtOoJLuXizHH4agDHMHJlsbeIYUVnrax5+8=; b=V7ZB18K0oRxDyF52y13gsMRVx5yoQL2e/sTDGaLfuIJlb5b3khcQgsrKaOpnRoMI5u ZZtOBjpbwjfkZlrRf1+IptCKJ8MNjrHDT8imLb0cTusXuqiDQxUjIUOkSPhzvKz6xN+f TYbaNvZizpmHprfiSA33uXhHNqY3VELfKQIMNLwtqZYJNUAmlfBN2ixFV6Scej0bwIVG weZyssONFuxqlcXJ+AYN2XMsDmkO5jFSWkPIT38g1McAl/uXX0nmvl+nQ167zohEDjqN y6d/fVI/5oWHDg8Nz1lrvqvgQcWF9iP0iQmQkkdtriSBRuaryJ7FzHzJXW80gensyXiZ VBCA== X-Forwarded-Encrypted: i=1; AJvYcCXjgqxXFTzhlZ8gpaIEPwIUkZcap5oPhhuOok9wMBRA4NtngKidHGe3XcVyr0VKC0MHOmWJOlMehwhWQ5vvf+M/@lists.infradead.org X-Gm-Message-State: AOJu0YwglgWEGEw9F5w0cY+Qty3Jp8veKirh5M7G6qixTYFjsCgjmv8j cR04t3ZcjmJFRjNfGUuNOD3lU4UHjTI8oylpgtCEnJ/5nwkFekt2 X-Google-Smtp-Source: AGHT+IEgWjgzFxk/W9ikkgzvRwbFFaUk2esxhBqzuQvA+hd7no2/ruCI6LWlDXbaFRBGOsR6Bd85AQ== X-Received: by 2002:a17:902:f60f:b0:201:daee:6fae with SMTP id d9443c01a7336-20203f2c389mr139215625ad.48.1724043506539; Sun, 18 Aug 2024 21:58:26 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Aug 2024 21:58:26 -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 01/14] Input: samsung-keypad - switch to using devm_clk_get_prepared() Date: Sun, 18 Aug 2024 21:57:58 -0700 Message-ID: <20240819045813.2154642-2-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_215828_149714_2069825D X-CRM114-Status: GOOD ( 15.83 ) 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 Switch to using devm_clk_get_prepared() instead of combining devm_clk_get() with clk_prepare(), which simplifies the code and ensures that the clock is unprepared at the right time relative to releasing other managed resources. Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/samsung-keypad.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c index e212eff7687c..a5fac7de8b5d 100644 --- a/drivers/input/keyboard/samsung-keypad.c +++ b/drivers/input/keyboard/samsung-keypad.c @@ -361,18 +361,12 @@ static int samsung_keypad_probe(struct platform_device *pdev) if (!keypad->base) return -EBUSY; - keypad->clk = devm_clk_get(&pdev->dev, "keypad"); + keypad->clk = devm_clk_get_prepared(&pdev->dev, "keypad"); if (IS_ERR(keypad->clk)) { dev_err(&pdev->dev, "failed to get keypad clk\n"); return PTR_ERR(keypad->clk); } - error = clk_prepare(keypad->clk); - if (error) { - dev_err(&pdev->dev, "keypad clock prepare failed\n"); - return error; - } - keypad->input_dev = input_dev; keypad->pdev = pdev; keypad->row_shift = row_shift; @@ -399,7 +393,7 @@ static int samsung_keypad_probe(struct platform_device *pdev) keypad->keycodes, input_dev); if (error) { dev_err(&pdev->dev, "failed to build keymap\n"); - goto err_unprepare_clk; + return error; } input_set_capability(input_dev, EV_MSC, MSC_SCAN); @@ -411,7 +405,7 @@ static int samsung_keypad_probe(struct platform_device *pdev) keypad->irq = platform_get_irq(pdev, 0); if (keypad->irq < 0) { error = keypad->irq; - goto err_unprepare_clk; + return error; } error = devm_request_threaded_irq(&pdev->dev, keypad->irq, NULL, @@ -419,7 +413,7 @@ static int samsung_keypad_probe(struct platform_device *pdev) dev_name(&pdev->dev), keypad); if (error) { dev_err(&pdev->dev, "failed to register keypad interrupt\n"); - goto err_unprepare_clk; + return error; } device_init_wakeup(&pdev->dev, pdata->wakeup); @@ -439,20 +433,12 @@ static int samsung_keypad_probe(struct platform_device *pdev) err_disable_runtime_pm: pm_runtime_disable(&pdev->dev); -err_unprepare_clk: - clk_unprepare(keypad->clk); return error; } static void samsung_keypad_remove(struct platform_device *pdev) { - struct samsung_keypad *keypad = platform_get_drvdata(pdev); - pm_runtime_disable(&pdev->dev); - - input_unregister_device(keypad->input_dev); - - clk_unprepare(keypad->clk); } static int samsung_keypad_runtime_suspend(struct device *dev)