From patchwork Fri Aug 23 10:15:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13774921 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 DED20C52D7C for ; Fri, 23 Aug 2024 10:18:06 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LL8lrH4m1zu8jQzjHDxCkVbmtMdz/cav5HroEZBlyVs=; b=cVtqji6AtTqpplmCZ9yV+dNYt5 o3UzI6ae5sno8cm9OwrVgD3w1t1tzNLJvJl8eLTtuiG6pNHaFceITtcl/bCEYaTnavBJLIf8hr8Z5 UTscr+/6MIapBHz9HFmN+8S6/xI0ajk6pfRQL6dp+37poEnr0xQqEen99XQIt2AOCqNLSqs+p1TjE vQJmhiozTKNAxC2vTUjiFKRlFzr/mHAldy/srGI8qpDgJctYjQ6LpxUKLASFAFKXFDXV7D29B4YkS 4oTq0q0+JoBT+Avvy7vlptdfl957I9g2v3n0NSgAzxPkHs3GLq95C2jizAEzM9bWPVFmSZTq1vtdY 9UCB5tJw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shRMj-0000000GIUK-2tqM; Fri, 23 Aug 2024 10:17:57 +0000 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shRKz-0000000GHnp-1u0c for linux-arm-kernel@lists.infradead.org; Fri, 23 Aug 2024 10:16:10 +0000 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-a86696b29d8so12423566b.3 for ; Fri, 23 Aug 2024 03:16:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724408168; x=1725012968; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=LL8lrH4m1zu8jQzjHDxCkVbmtMdz/cav5HroEZBlyVs=; b=s7yHR9bkxOkn/N16coSCrb+3HvPct9nJcsXvZq1cs9fziJIkuZ8UZY+ACjMWPLSFOc 4rlEysegCO0B2vqOaI/AD9ovxCFUbXV7Nx4pavwbAEgN/ybaE3DSYwl2rKKJ35NjRrqh 18yZk09rexp4He2870ICC/3TiyEtQ3btXnPWbUgEOrb1/nIYzxMByGXI+DhFIfKQ7iSa FkG0/e/Tn+A6Sy1L6O/05jkG+XJhjGlRp7/OyC2ym98vgL6ajQqIq4M9HN9WbS5/xne1 33+tIPNRWMEKAPSx4OGqLqwPY/kKGzMVtHoqQ4X9VbmyBKTjlEs6celj+VR+k5AV4OrZ GMJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724408168; x=1725012968; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LL8lrH4m1zu8jQzjHDxCkVbmtMdz/cav5HroEZBlyVs=; b=G3Hlu0UJflRupToSURfACfWMtLNgXROkMWNzt/F1TotmsQ/Srz1q5khF58K7jhdY0R TSTPk2301Gf1VQnCsLxy2gKMQJV7XpdnGMwdPgcbJ3YmxH7NIIVdyKJeYtYqBm+d18VF dLrOCoGQFuDXYrJTJvNOvA19LFLA4vFMA+plPZvnnt1Ho1XSJhh+JPTJvUgK8Ypi+sLA ssV+6uufizW1+yjcv02mhJkrbWVPN3zLmE/msn9YOYoiNbkPDvO76ZGQUT/nIkGReur9 yV7v6Vgs3twa8WWa5p7cCHCsuQJ6oCVe52wrEl1qmoVSJywwakNqfcTzI2V7JKrEASsE dhHg== X-Forwarded-Encrypted: i=1; AJvYcCVLByJFQ02mmYR5dhU0qlrX0xWiWecIaMrb/oPLxaTpKI17DsX7Qaays8Ei+Omnj7uhs1vpZbqPO48/l3NweRD0@lists.infradead.org X-Gm-Message-State: AOJu0Yy8PT/zMQhC6NWleS5u3bpBRG9nrplPvoTv7FRrxw7OdsDcp9j4 qiJRDlWORoobEecmIbcWhlx8zr74h/5rYmt/W6ZYDa7tYlVhdOJZKTCNVVg24ls= X-Google-Smtp-Source: AGHT+IGpZrdXtuPVCcQwhIvIg5Gw3qd8+DVV59c115ma/5r72tOpjy+Z8GPBzffzBb1Nt11PqlAWTg== X-Received: by 2002:a17:907:7e95:b0:a80:a294:f8a with SMTP id a640c23a62f3a-a86a516134dmr78367066b.1.1724408167575; Fri, 23 Aug 2024 03:16:07 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a868f2a1df5sm237912166b.68.2024.08.23.03.16.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 03:16:07 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 23 Aug 2024 12:15:56 +0200 Subject: [PATCH 1/7] memory: emif: drop unused 'irq_state' member MIME-Version: 1.0 Message-Id: <20240823-b4-cleanup-h-guard-v1-1-01668915bd55@linaro.org> References: <20240823-b4-cleanup-h-guard-v1-0-01668915bd55@linaro.org> In-Reply-To: <20240823-b4-cleanup-h-guard-v1-0-01668915bd55@linaro.org> To: Santosh Shilimkar , Krzysztof Kozlowski , Roger Quadros , Tony Lindgren , Vladimir Zapolskiy , Miquel Raynal , Michal Simek Cc: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=608; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=LtVfsUrkXvrpIrQ9RY7ofd8SPZNPe5l+WNIEpOclJW8=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmyGFeW1M44IyaAdN7DLEIjIFH+IOVjqjv+CZGH CteVueXlu+JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZshhXgAKCRDBN2bmhouD 1yNmD/0baNim+hSwFmuf5i67uJCDBqNTmfRLqjw3IiXAtxprRD9OIHTOUNWewIxpDKOW2T0fUkF BI70RMp8aE61rnmDenkEnr0rs++uDEmfbAc57plGITtw8W1vkscwjMpkPNbRyJCZDIdZZTCuQLJ gTDsSuI0psahI86kXZov1XJf+BCjnY5bFLoiGqzgnx/+hnM66gEBroFbZ6TCCQ0LS+73Y8t9S7X 52NeItgsVFGuFGKozMb4xBPk79pFerDotzNhQrtHKePgxKPJLsRLEZt+VOt21egL4sTxL2jv6Nv aN6qoIQI2V1uXC+IPVjn3BlXEkCi5G1/fDzq6/hiKEC6Jb7youNNcMhA/8gNCD+O6zVCOabX+Ab QBz6cb6Fb1CysHtTGZ7RNISe+uu9B4OmxQde1sW1gjB5Fq+QtuWEPJfMsH0ZcmpQIGvyPBO7NL2 kgUo+qPxlfM9rRtqHeNxV6tT00CNQjx/Ju73fVontHAEufbDCYycooO5HLpyCFhG3Cnx3cJdz4M OJpxz3kUxIMmGEFw4nzyYq0imW7Vi05VIdscaw9diXPkyjzjY+C/xKbQ3q+c4wb4uUrWv0/k38v pXxFFjwg6xdKx1PbWm4Sd15uz198MDoxjFvtsYZ9WUXOOQ71/GFcW7+CjqI+aNeKIoo6DOQ5kTy RbwH5RnPsLmRMHg== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240823_031609_536405_447CBFBC X-CRM114-Status: GOOD ( 10.46 ) 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 Driver does not use 'emif_data.irq_state'. Signed-off-by: Krzysztof Kozlowski --- drivers/memory/emif.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c index 974ed641473e..b32f3a8f9d71 100644 --- a/drivers/memory/emif.c +++ b/drivers/memory/emif.c @@ -57,7 +57,6 @@ struct emif_data { u8 temperature_level; u8 lpmode; struct list_head node; - unsigned long irq_state; void __iomem *base; struct device *dev; struct emif_regs *regs_cache[EMIF_MAX_NUM_FREQUENCIES]; From patchwork Fri Aug 23 10:15:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13774922 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 28A5AC531DC for ; Fri, 23 Aug 2024 10:18:54 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bIb+FksMIOJ64Q0IsP/5G/5OpyiFmNxQ3nT5nVYnW8k=; b=gfsw7hx11zu5bHHmCUOiRY2qvn 64Y2Iw/SzfeScBlTzvMBHGbe309XItfmJx75kVQx0ouka09JEOCP17m6/O85Nj4rj8dhcwOYtihMt Xwt1ZMp6A+lsncZRDW7Az4UGflagSAURxE9rwmh3eECg5Cwyqxfp7EYazOiTb2aAHav0AFklWM+9F cuv0b33ObotdsFDaT73HcLMOO7Dj8LagrHteTe9J6lvnbObXoe0tCtz2qWlrY+eT1+STlW9SAGY/d 3sTWo9nQR2djRZ6t1JOb7veDqdUfhB7FCvkSvPWQ9kNWnrr7us5uJfGKMgE/UxAKihiCHC0oF3/f+ M2bu4ljg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shRNS-0000000GIiw-2ZHg; Fri, 23 Aug 2024 10:18:42 +0000 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shRL1-0000000GHoM-1Up8 for linux-arm-kernel@lists.infradead.org; Fri, 23 Aug 2024 10:16:12 +0000 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-53345fe848eso374593e87.2 for ; Fri, 23 Aug 2024 03:16:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724408169; x=1725012969; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=bIb+FksMIOJ64Q0IsP/5G/5OpyiFmNxQ3nT5nVYnW8k=; b=URqQ07B1rB6rGffMm5wMEWilbNCx7q3DW7bYFDeEZL7HXlnRh+6NIuJfeCczQ6833T KZVLunGswRiaomUIVfzDF5w3wRctnGVILsbJ+PYkHMU1T4bQXjJVsIq7Y2p4mAIspBBC erqd4p9g5j4Rgs7BdBQN5+SZyEE5+VYTm4RC2iUhY8RS2B7fE9aPaxzdx31bhVNqy+oA bE7gteHovcMheQViYoN1My3SHmHd5hV48AItOfdFQSPgkpJLowciY2kCbBd81/4wAbQB iuaVVO1c587vTy2kVEX+7j3WjrL3JwxhK26YXAewiR11bIB16i00k7Mw/sI+hKg6gW5m wsdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724408169; x=1725012969; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bIb+FksMIOJ64Q0IsP/5G/5OpyiFmNxQ3nT5nVYnW8k=; b=sJFxyvxD+lQ460/wxJ+mgudPYFbCLbONtavGqS1DRYQg5C/V1JnrDyuNVUZFeWsu8+ lURcRDchjL19tlarbzthhyoRvO/90Nna8DR2x2lNXoZu010zQpp0Vu+35+wuJ+xd0qKN VgjEZZ2dHWBcM76GRJx5ddqKGj54Dw1dpB3uGVnYwcHghwEU/4jzpbQ3NHmZih9X5jvz cUcWPlwTyu/twuBzEa1ott4kwgWWJHsVRVQlAYXHyiEzYlarSi1kIUzlRApwJqpMUOg7 Ch2p9+CwnuHMq3d8t6xE+3ocppWGnq82pA69Pfo754CGScD8AlTlAhGVpbsFaQ7TJv4l JtGw== X-Forwarded-Encrypted: i=1; AJvYcCWBSOmX5IX4sI0Z/1gLICsrZ9PBIp0K/YLGKTBGHOz3Moe6Qn5p90zzFfjvx8PkL6TnV3Hb8k/aW+G2Va4oaZGO@lists.infradead.org X-Gm-Message-State: AOJu0YyMf0mQgvB+WwrYe+DPHgWx9XQnTopPct+GJ5jbEEjMVvxxjKUr YMGk6JFs0U2p0dUOE/7cLuL0QFnkC1VgBEncDJCdCwDovrgAr/2DfSCGFQV55ec= X-Google-Smtp-Source: AGHT+IH2YdNwdbaIsW8x6JwUanSC2De/vmujuXIf/3MDm8QVZfLk7aokO3B6+oX3QzZfH0fhdLKHPg== X-Received: by 2002:a05:6512:23aa:b0:52f:c438:883c with SMTP id 2adb3069b0e04-5343876c643mr720470e87.1.1724408169146; Fri, 23 Aug 2024 03:16:09 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a868f2a1df5sm237912166b.68.2024.08.23.03.16.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 03:16:08 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 23 Aug 2024 12:15:57 +0200 Subject: [PATCH 2/7] memory: emif: simplify locking with guard() MIME-Version: 1.0 Message-Id: <20240823-b4-cleanup-h-guard-v1-2-01668915bd55@linaro.org> References: <20240823-b4-cleanup-h-guard-v1-0-01668915bd55@linaro.org> In-Reply-To: <20240823-b4-cleanup-h-guard-v1-0-01668915bd55@linaro.org> To: Santosh Shilimkar , Krzysztof Kozlowski , Roger Quadros , Tony Lindgren , Vladimir Zapolskiy , Miquel Raynal , Michal Simek Cc: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=3034; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=dKvvXGp0G4rwTm+4rjJKl33390X+DCmUn8vg4x43GxU=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmyGFfrOD+/wW6Zo3iZXagedAsbyR4cF12jI3eS JPVjmdbm1uJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZshhXwAKCRDBN2bmhouD 11m6D/9n+H35P6ofeRJrA+nm522gpFEX5Eu7CMZi6f2sqzh+NqNhlZtFnclpnvwRGqagON9oSuR Y96OyUBnFBxMSfCmZRcrIfLch4iAFvRylrfFRV76JV5PDmUZSYKzKB0qfhFYjHrgN2buG9pC/bi 8i1N3h0X3QC0FBQ6YH3F7QHUgw7bN4/yylZkg0RIzz73pE4laH/Ue9yqBz7TqycgCamg+3NVfzB /R0x4qx8lnVE7kim5XODG+opwaJEqEFz7BP9Qv3PnrEIliml5EbBy7UbjgQGyZczd4RJgcoyNfw Eb345jjdaUPW4kAsN7Wkr+Fycxk2GWyOVJOhWU9Nm9YZlq1Xfgb3CxLymwYUIxcZbHZ3wupzjJT 0u4TgWe8y5dqx9ckkyWQdscun3CpXJ9IFn+aQidrHrX8j7lTwMBkzBAILGSM0U+KCCr7Yr2qQRJ iHo2kNPB93ds0C77lDSseIV5tcSs8wOzf4yTO1z1UFVK069j/2paS/n8YNX9fKt1qnPD9SfLpfY QlToLO+SLJGVGFsQYAhGuzqsDeuUX4TaqFvRgtyyZ1eYRUL6K2ADzBZRVPJmSzV8fiNjUrIcJZC O/iAkNEmtjQlYT7uuioAbBNleCl95X4GFK+alDrlRvo8YaIskbUU2a+YEk1sQMEkdsw2ohC+eqW m8iSd0+g4exq3eg== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240823_031611_448805_6F61447F X-CRM114-Status: GOOD ( 16.93 ) 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 Simplify error handling (less gotos) over locks with guard(). The driver used file-scope variable 'irq_state' for storing IRQ state with spin_lock_irqsave, so move it into respective local scopes. This should be equivalent, but more readable (less global variables). Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron --- Not tested on hardware, although I don't think that moving 'irq_state' scope would affect anything. --- drivers/memory/emif.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c index b32f3a8f9d71..99eb7d1baa5f 100644 --- a/drivers/memory/emif.c +++ b/drivers/memory/emif.c @@ -7,6 +7,7 @@ * Aneesh V * Santosh Shilimkar */ +#include #include #include #include @@ -68,7 +69,6 @@ struct emif_data { static struct emif_data *emif1; static DEFINE_SPINLOCK(emif_lock); -static unsigned long irq_state; static LIST_HEAD(device_list); static void do_emif_regdump_show(struct seq_file *s, struct emif_data *emif, @@ -522,18 +522,18 @@ static void setup_temperature_sensitive_regs(struct emif_data *emif, static irqreturn_t handle_temp_alert(void __iomem *base, struct emif_data *emif) { u32 old_temp_level; - irqreturn_t ret = IRQ_HANDLED; + irqreturn_t ret; struct emif_custom_configs *custom_configs; - spin_lock_irqsave(&emif_lock, irq_state); + guard(spinlock_irqsave)(&emif_lock); old_temp_level = emif->temperature_level; get_temperature_level(emif); if (unlikely(emif->temperature_level == old_temp_level)) { - goto out; + return IRQ_HANDLED; } else if (!emif->curr_regs) { dev_err(emif->dev, "temperature alert before registers are calculated, not de-rating timings\n"); - goto out; + return IRQ_HANDLED; } custom_configs = emif->plat_data->custom_configs; @@ -553,8 +553,7 @@ static irqreturn_t handle_temp_alert(void __iomem *base, struct emif_data *emif) * from thread context */ emif->temperature_level = SDRAM_TEMP_VERY_HIGH_SHUTDOWN; - ret = IRQ_WAKE_THREAD; - goto out; + return IRQ_WAKE_THREAD; } } @@ -570,10 +569,9 @@ static irqreturn_t handle_temp_alert(void __iomem *base, struct emif_data *emif) /* Temperature is going up - handle immediately */ setup_temperature_sensitive_regs(emif, emif->curr_regs); do_freq_update(); + ret = IRQ_HANDLED; } -out: - spin_unlock_irqrestore(&emif_lock, irq_state); return ret; } @@ -616,6 +614,7 @@ static irqreturn_t emif_interrupt_handler(int irq, void *dev_id) static irqreturn_t emif_threaded_isr(int irq, void *dev_id) { struct emif_data *emif = dev_id; + unsigned long irq_state; if (emif->temperature_level == SDRAM_TEMP_VERY_HIGH_SHUTDOWN) { dev_emerg(emif->dev, "SDRAM temperature exceeds operating limit.. Needs shut down!!!\n"); From patchwork Fri Aug 23 10:15:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13774923 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 C19CFC531DC for ; Fri, 23 Aug 2024 10:19:37 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=st6dBA4B9Nv1zPtX9T/2rfu/snV3K8fE/9qGZsxtuyY=; b=Ogu5NHsH7NS+trARTFFvuxZkn6 3Ak8HOrWNmmL5IP/BoOLzdvxmpyPvctmPGm7ETeiu0KFU3y3cI1Ob0GV7uh14w9J5zsODH4VEQ9iO Xq3jdfj45ZV/iUJgjieSSWqw9UGTR4jsfkSlaNo/YNG5DVskfn/gNKv1ezrDr1IyR874fmaxnKf2m aW/bMBreiR6VikMlcpRbMJaWrC1auRRKj+jKnjdPSnZ9Omdf8CjkV/BZQGg8tuFclX0jBE0qSOq7q 5lGD70FmiRbVd8fkEYPeTPA6RcjVwzBMxQbbANzJFS0CR4LwWPz/RzHP8rsXCN94vg4Cxmwpcdjkc 6ZD7dCcQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shROC-0000000GIvH-29PY; Fri, 23 Aug 2024 10:19:28 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shRL2-0000000GHp5-1n6p for linux-arm-kernel@lists.infradead.org; Fri, 23 Aug 2024 10:16:13 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-428e09ee91eso2187115e9.3 for ; Fri, 23 Aug 2024 03:16:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724408170; x=1725012970; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=st6dBA4B9Nv1zPtX9T/2rfu/snV3K8fE/9qGZsxtuyY=; b=bXBNccoICLQepXVHRuurt1KGJqWB3vvAEccplze0SUyICU2DarZWoP71y1bdRzt1gH yrJ08p+xK+vKU6jJfgu6PTRSzmJtyzSxx8nWfZUqAThULN4SCDZuXlKA+D4ZMaFmmBq+ yBkohhcAMG7vqlXRmaGeJjN+x04lYsDW8DjyphmzjlYcq3Qa9/vdUCdS4pq4LLMzLc28 BilJJ6fO+Pfs+A9xEBILGF25SL/MsV2EaE7uX9kteX4Wrdrt9WeRWyV2PjjlIidjF7zL +pm81WwbO1+Vj85WIVSidUgU+yoGxECaCW89y7fCegtPbCuf0jtKWYJRZooxQRX6JgnR Y6Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724408170; x=1725012970; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=st6dBA4B9Nv1zPtX9T/2rfu/snV3K8fE/9qGZsxtuyY=; b=Shkm5Q0eHF30UVoNaO3BL1t28JAPOUm9rI7S541bhfb5jG7XCECb1WXQXTpydcRTsa vQ7iu2URYccOrv7+9yNbESfqzt6r/a/gW4qXsp8s7Pth5cBS3ugVIdTEmCDxhv4gtOKf xZap39sli0fj+/ZT7Pslde0Diz/l4h6Eg+9uCfYkA8wW5ajoCjODRvxcFRPaicwcQMvJ CrU0EEnjcCzSABqi8YNx5KtEEE7G0L6Y6zLP6EoscecclK0BFA3CAbcsWVifTybi9Njg a79VcPIILzycx50AhfcRlgKJ2xWHUNwEezl0U8Nexi2dgc9k0eUXS5nEggNye7BQ/vAh C9GA== X-Forwarded-Encrypted: i=1; AJvYcCUYg+RmU1PvZYapufZxNvUbHuYocN6jfvAOMUjHoekuEfg9bEwz57MUL/YpNNNdEdiet+WlQlu3cW5fZBAo+N4e@lists.infradead.org X-Gm-Message-State: AOJu0YzGctelHf3Qdeyvn7sFZR8SQ1/SaoE1GrKIwJmQvrLKHCHaPObo ZmxgcXWS6iWxLzjSMIBc96Pze1SyWe5zuVAZV7vVUUtvRpkAhAZwCypfDe58EPfkUWUXWolodwT Y X-Google-Smtp-Source: AGHT+IHh+J5equdBgJ4usKEKsDj7Qu7AiwgUQ/PKWo7hs5cHZCzKxrqsYJ8/hj1kRnLZzBypj0LIRA== X-Received: by 2002:a5d:64cc:0:b0:366:eb60:bcf2 with SMTP id ffacd0b85a97d-3731185bd1cmr541652f8f.4.1724408170571; Fri, 23 Aug 2024 03:16:10 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a868f2a1df5sm237912166b.68.2024.08.23.03.16.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 03:16:10 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 23 Aug 2024 12:15:58 +0200 Subject: [PATCH 3/7] memory: omap-gpmc: simplify locking with guard() MIME-Version: 1.0 Message-Id: <20240823-b4-cleanup-h-guard-v1-3-01668915bd55@linaro.org> References: <20240823-b4-cleanup-h-guard-v1-0-01668915bd55@linaro.org> In-Reply-To: <20240823-b4-cleanup-h-guard-v1-0-01668915bd55@linaro.org> To: Santosh Shilimkar , Krzysztof Kozlowski , Roger Quadros , Tony Lindgren , Vladimir Zapolskiy , Miquel Raynal , Michal Simek Cc: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2384; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=c3EBYma5kTUA/zOkUfd/wHDJYd2x1OE5BHWso7TEYUU=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmyGFgGrbj7x0yA560ueSSqqbWUdMCZ0SabmhuE ym90ud3QVCJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZshhYAAKCRDBN2bmhouD 12IOD/9vL/BYpE4yYF+b/K4kXxcWaYRXgrsbhNWRg8XaVfPIallsAQsvyKUqWN6t518a1OLo3b4 sn+hB2hXu7k9fg9FpOuCZehdoyMlkh2YuTIEXXIaxkenyb0u+pRzSaEcYgMJPGz72RkYlvK2I2v gERCuH1mD0G8KfBVSw1rCNMMtcpv5pOzbS1lFBIFLKCLssCwGCze2vpMhQlsSLKyvWEEroUqqv7 oz1hkNFujKVJEroViUTY3wnR0QAoR4Td2Uw0Pqc1sSvW6xLBFqp254JVqa9/cdTyEH4tTgQtanz T1jYRgOK3LuLs11JAveVcE4eaYM6M/hyoKgjj4YlFoaa7wdHpjYkCXhmLUiz+Q/fOb9ccZ16W02 ZZMUPeD/w+wqYHRFAabYbiHztb3l6CYiM3S5KkDR4+XpgzoxSAMxFG8Ps99oqasdJd2rohlJxA/ iPYIzJauth0VYLZzeNX6vTL5njvNWh37M++OXEv6bby67HJlhAGw4x2ZVNQyO5KsNq8TuBImT9o eijwwReaEd/XELR2g//Ai5o7jd/Cdfe4PEQc3DrdzIU3anUzRmIE3gE2kQsTn0RjeQ8BCLYWwVy VW6KvoTVgVf9msP1Zv8rL4XEu2NpYSICA5MFQXps7GgewmpcUxeWw7kgbfMpC+7NtuinXO1beS/ MyWW70f2i9MKLEg== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240823_031612_501960_0DBB563F X-CRM114-Status: GOOD ( 15.47 ) 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 Simplify error handling (less gotos) over locks with guard(). Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron --- drivers/memory/omap-gpmc.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c index 80d038884207..c8a0d82f9c27 100644 --- a/drivers/memory/omap-gpmc.c +++ b/drivers/memory/omap-gpmc.c @@ -9,6 +9,7 @@ * Copyright (C) 2009 Texas Instruments * Added OMAP4 support - Santosh Shilimkar */ +#include #include #include #include @@ -989,18 +990,18 @@ int gpmc_cs_request(int cs, unsigned long size, unsigned long *base) if (size > (1 << GPMC_SECTION_SHIFT)) return -ENOMEM; - spin_lock(&gpmc_mem_lock); - if (gpmc_cs_reserved(cs)) { - r = -EBUSY; - goto out; - } + guard(spinlock)(&gpmc_mem_lock); + + if (gpmc_cs_reserved(cs)) + return -EBUSY; + if (gpmc_cs_mem_enabled(cs)) r = adjust_resource(res, res->start & ~(size - 1), size); if (r < 0) r = allocate_resource(&gpmc_mem_root, res, size, 0, ~0, size, NULL, NULL); if (r < 0) - goto out; + return r; /* Disable CS while changing base address and size mask */ gpmc_cs_disable_mem(cs); @@ -1008,16 +1009,15 @@ int gpmc_cs_request(int cs, unsigned long size, unsigned long *base) r = gpmc_cs_set_memconf(cs, res->start, resource_size(res)); if (r < 0) { release_resource(res); - goto out; + return r; } /* Enable CS */ gpmc_cs_enable_mem(cs); *base = res->start; gpmc_cs_set_reserved(cs, 1); -out: - spin_unlock(&gpmc_mem_lock); - return r; + + return 0; } EXPORT_SYMBOL(gpmc_cs_request); @@ -1026,10 +1026,9 @@ void gpmc_cs_free(int cs) struct gpmc_cs_data *gpmc; struct resource *res; - spin_lock(&gpmc_mem_lock); + guard(spinlock)(&gpmc_mem_lock); if (cs >= gpmc_cs_num || cs < 0 || !gpmc_cs_reserved(cs)) { WARN(1, "Trying to free non-reserved GPMC CS%d\n", cs); - spin_unlock(&gpmc_mem_lock); return; } gpmc = &gpmc_cs[cs]; @@ -1039,7 +1038,6 @@ void gpmc_cs_free(int cs) if (res->flags) release_resource(res); gpmc_cs_set_reserved(cs, 0); - spin_unlock(&gpmc_mem_lock); } EXPORT_SYMBOL(gpmc_cs_free); From patchwork Fri Aug 23 10:15:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13774924 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 91D2AC52D7C for ; Fri, 23 Aug 2024 10:20:26 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=N7t5hccTkDQZVo5vU52s+pXfo+StB90U/RzqpPMyIi8=; b=WjTBCRuDKbRLECAY3OY+vHXI5v FHAVdinn634qr/1Qx49HBWOFAOFSYxMlQvi4uGjoGlzGohJ7MKpdeAejKxXOzR5hj+kHlqXVym4Xj vmRrP/XYy9XbBRDmg2IjSfCaVOpdMjsacwqz9JEEJwvpBpdenB+rID4DsKBkrbvlTA4EAtNzq6kej Uy07of8tCwPXqDhZ1F4rTQYXLp+tvx3AucUBx5MjfIdZit+Kz/+BjxfWnSYHquyxh0qopYtVp6Nka a9MM56cAL2zciBEQeD5MVNayKPzMJUuz7lQBM+RbBbQ05o5EEn2L7nYCF+Bkb3RcX0Xo+5vm4xnhc DBGUhCZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shROw-0000000GJBU-0AkD; Fri, 23 Aug 2024 10:20:14 +0000 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shRL4-0000000GHq9-1sQg for linux-arm-kernel@lists.infradead.org; Fri, 23 Aug 2024 10:16:16 +0000 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-a86753ac89bso10311466b.0 for ; Fri, 23 Aug 2024 03:16:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724408172; x=1725012972; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=N7t5hccTkDQZVo5vU52s+pXfo+StB90U/RzqpPMyIi8=; b=SjyHCTdjqiW3/PQWSxEpBkKX+MmbyWGfdZxDm7w6u/P3SyJVs26PcKvaawfXTXd7ep J+JDvZeMbdOkVp3HLQWZ0Y9v4tm9sgkki+3NP3fqKlLo2PvNl1A/1A8/9D971UfehKve sLfZkjIRmlQvrweii7s8IpgxO2/12XqZhaibdURi0U3xVXEVpc3LtDdqSEJM8gqir3oE efMkWr/97hkpXcakBOZpv9jLkA+naCKO9lVI9dhVob4bwkhBAY6m66Gu/5yXbdJJS8Co s928h2hbE0tIAzeD+m+5MXvR9aetLLF1CCbz+1uEfQhpcSZbHAXTVOrpjJIKshc0eDQe sC2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724408172; x=1725012972; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N7t5hccTkDQZVo5vU52s+pXfo+StB90U/RzqpPMyIi8=; b=URrI4zEN8Md+eNR93RRwA3kc9o0OMSGsg6hXInxONq799uOaWH1cu+vDjg9vG0mHSp UGZj2PWy+pEGJm+GdQGo16VTqoh/P+aKAy7YCb44HWjLdp5SGYngOsVeaMLuMQae/aiG VIyrBg/M0OQlmC/hxndkbDlwVIYbuBcReB1gqWr7YPWtr4CBsnLdbeZ7oJRJHFwUTC7E TzfRNiRVY4MsTE3W+OBOj7+wava2kJB033lblrMbw89cUTiHlnRV+w8lkfwrKOnlTTb3 tsnhaBPBu1jSCSzTbCdrVBcEuxkIU+U1IB4WoVgOC0I660hq07yBMKZc4s2cxY2bvSCe X/Bg== X-Forwarded-Encrypted: i=1; AJvYcCUo1Q+VSsuEWTnzB8WE2SxKXIHYTlg2QHhPBtWwdTxJ25QctjCZI4QTglyOqdM0rMn9xXdTajfAlkqmwZxRJ0qd@lists.infradead.org X-Gm-Message-State: AOJu0YxUH+3JGjbaWbqAGkwcgTRktNkWXP8/gmdlA1AfcDY7wijSPmfh ELpE+0MOigQZWpjoQLRZl3SzN7Qqk9IJrcOJlPR5yGPro8bInv3v4Ph33QgSV7I= X-Google-Smtp-Source: AGHT+IFlkL5s7rmHHgYZMRB1BLvikyDv99I8y83akU4jvf5DqV38Aa2gkHT1IB1hClppKtMqNTmTRA== X-Received: by 2002:a17:907:2d07:b0:a7a:ab8a:38b with SMTP id a640c23a62f3a-a86a54b66aemr78280566b.7.1724408172034; Fri, 23 Aug 2024 03:16:12 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a868f2a1df5sm237912166b.68.2024.08.23.03.16.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 03:16:11 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 23 Aug 2024 12:15:59 +0200 Subject: [PATCH 4/7] memory: pl172: simplify with dev_err_probe() MIME-Version: 1.0 Message-Id: <20240823-b4-cleanup-h-guard-v1-4-01668915bd55@linaro.org> References: <20240823-b4-cleanup-h-guard-v1-0-01668915bd55@linaro.org> In-Reply-To: <20240823-b4-cleanup-h-guard-v1-0-01668915bd55@linaro.org> To: Santosh Shilimkar , Krzysztof Kozlowski , Roger Quadros , Tony Lindgren , Vladimir Zapolskiy , Miquel Raynal , Michal Simek Cc: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=898; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=IlZEpsC5zLoI1hcyp/Rq4r/SZxK68xgrN7mWoEs36F4=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmyGFh/t4Skn3nDrz6/5TT4P0rYPwiS3a/epBSf tzcKzaA2ZGJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZshhYQAKCRDBN2bmhouD 1+xjD/4ruvUAwsgXVGQc0suOEQkGhBJDCb2yPwHptmIN2/Cz6v83MTq62MWytE7rdN2phWy9O3f 56yiu1nANYWS2NWDWO0kosm/uUjEqkMGqtyWK/pnQejkUhHMa4rQ/myL9xx+HZW2K3Bh2SBDgZ4 6ZLwIlHfAB+fzB0X83HHUe2/aotZPqNrnysD9mIh1EM+nHlTPLNoJoNKc/uo29G6m8kTrPLKxb3 4ToplKvocyNwTPLYUwT02C0KUtbB4+d67+xx4nnPm2ubzPHbPKnZnS+jbuwKER2b9fIS8ZbeUoj WX+UYhccc7ySZNT482TECCo2+TluRj3/4f5ICmM5nxGQURDdJzq1x9lD198O2PaLdE/FiARsnAr wNC7qaAzZAhAoVmnNPRgCwEjVKu5yIgB5OzGNR7vlx9DNUoF/IlGWo5jMIGFFj3yUaxhIogBX0J A3nJPQTAKEtc+2u15w3TROpLzcw3tVqexUTmSFeR91i0uFz0P2KJUpNFRWWBAkCp3AxGjbK/zXd 4FmSICD+VMNMNlwqhQzeBvd03X74EDItoXYvmul61L5I7l0xuE+toFTcEqCRosdTG3A252FL2h2 ZY84cfqj/xdyvUssSD/4su/wROzfVx5QHgVWPUclmNz+/5zVaNC0wF3+DUE0HOQsmv0NQf0lX5/ 7CE8apeWgpQcD2Q== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240823_031614_528027_A72C2D9A X-CRM114-Status: GOOD ( 11.13 ) 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 Use dev_err_probe() to avoid dmesg flood on actual defer. This makes the code also simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron Reviewed-by: Vladimir Zapolskiy --- drivers/memory/pl172.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/memory/pl172.c b/drivers/memory/pl172.c index 9eb8cc7de494..390012401f64 100644 --- a/drivers/memory/pl172.c +++ b/drivers/memory/pl172.c @@ -217,10 +217,9 @@ static int pl172_probe(struct amba_device *adev, const struct amba_id *id) return -ENOMEM; pl172->clk = devm_clk_get(dev, "mpmcclk"); - if (IS_ERR(pl172->clk)) { - dev_err(dev, "no mpmcclk provided clock\n"); - return PTR_ERR(pl172->clk); - } + if (IS_ERR(pl172->clk)) + return dev_err_probe(dev, PTR_ERR(pl172->clk), + "no mpmcclk provided clock\n"); ret = clk_prepare_enable(pl172->clk); if (ret) { From patchwork Fri Aug 23 10:16:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13774925 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 3BB76C531DC for ; Fri, 23 Aug 2024 10:21:11 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=G7t3y5+/zYw1uRCizz7bvbUmiS1vcdmMCZnETRzZwr0=; b=FsNcphld+gcWbuUSi0xHI3Rbrh ZuCFAlqAMlv8uuaBsNLetsk0U9gTGR++6bIsZJnfODowmEIJzgzM29UK74TzOrLTx351ziSME10Xj 7nX0Yjn9bhhYbgb5XHnYTy/UZtqqqMWaeGO9LbYzat4jwe3Gw3gtlVaw8kmvFe1G63TiM/i3q9ZiL wG9Hdi/HmnldCsfX55tz9cwwzVBxqpd7WtHJJ5nAxr8dUuchpCE7djs8b+7/OJXOIygKktLyxceur Ip3dmycfahQQgxc14tuoD12vWACmZguP+LkdQu47CubApV5ACnHFRcdpbuUorE661zNEjHrnJfIc/ 71DT+ziA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shRPi-0000000GJUB-2lP3; Fri, 23 Aug 2024 10:21:02 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shRL5-0000000GHqo-23EZ for linux-arm-kernel@lists.infradead.org; Fri, 23 Aug 2024 10:16:17 +0000 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a866966ffceso7789166b.2 for ; Fri, 23 Aug 2024 03:16:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724408174; x=1725012974; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=G7t3y5+/zYw1uRCizz7bvbUmiS1vcdmMCZnETRzZwr0=; b=xYoqpntwuMOMlfSIfAvLqb+cPs2CQQTac6rbLiEMEbzCNnG7GTUx+Al7kNUNThauEw G8hNHgi3ZAiMJ24mdVYqsHEIkb0lmWCCmCglR2WyhfyU1YZLEbUbwRNRoNzu2MZS30IU r8zj1cDHL1R1fLwuaQhAjAGVOr60gOBuVMIFgNuv6FcGefR41fpb/hQdgho8kckomqIQ sWZasdmLCW9rSmtIYQPTIpzZ+Gh3D2p7SwMLZlWLTR7k5EiGgLcu137LaSjY2tu9TprU +J4qk+Ms9MEVHjj0XbbO5psHm7zJk1gFURNmy4k88+pXzT6Ye55M9V06EEz+T/knf/YG UiTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724408174; x=1725012974; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G7t3y5+/zYw1uRCizz7bvbUmiS1vcdmMCZnETRzZwr0=; b=vL77e2jlD3p8QZ/qpzZmUsIkpZpgOC8JrbPgQnJZpacuULmcT81m1w7FoA1waRLEVh DCVWIPKHsJ3aiaejuSZGRNhCP9Kw7kdM1sy4o7GxlEmFkLnogiFvz+u+tzUALC5rj4Jr mhjlLX3NcpRWsKj3lPVQ4pIyYk0hdBLxUWyA/ACaVjsFmh8nEfUFQ3+Yk6P/b6/F6ZAz tijdFgc7rkT3OtNwScqDUpyNFCF+/I85+mLGOQjrP76QhM+k1QW2knlpjL+HSOIpy7Fj fUQvdRxSv7C4a3sGiRpH9/cWbv2KeNMOgoKDsHqT/YB4H3Fz2XXX/m2LQ/fENzd1PtnT INsw== X-Forwarded-Encrypted: i=1; AJvYcCVSHQsOObilKqCXFepgPGvYVGQowP0nB2y/kEzeYjiCJbcqNOM01WS9vDRHalXERvqjIUpNd1F/YZnMA4DIv4UL@lists.infradead.org X-Gm-Message-State: AOJu0YyzB5fEqt92oorIyjvf2KyvqFoRkAMjZoVhwe9pQpq2T+oPYG/L 3P3XmidwyoOtJ4phkEwVWFSd/hpOl8ovX/CcSevZKpO5lkwVO3EfzNxYyPXaJ2w= X-Google-Smtp-Source: AGHT+IFfy+OGNSeG7SJwkUpL7Mu8EF/PyhzdcUVTDpOXbF/eS35DAJqbkG6gabVNuzT1c5TAzBjNFg== X-Received: by 2002:a17:907:7f2a:b0:a83:a86a:549a with SMTP id a640c23a62f3a-a86a5185ae4mr70199966b.1.1724408173829; Fri, 23 Aug 2024 03:16:13 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a868f2a1df5sm237912166b.68.2024.08.23.03.16.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 03:16:12 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 23 Aug 2024 12:16:00 +0200 Subject: [PATCH 5/7] memory: pl172: simplify with devm_clk_get_enabled() MIME-Version: 1.0 Message-Id: <20240823-b4-cleanup-h-guard-v1-5-01668915bd55@linaro.org> References: <20240823-b4-cleanup-h-guard-v1-0-01668915bd55@linaro.org> In-Reply-To: <20240823-b4-cleanup-h-guard-v1-0-01668915bd55@linaro.org> To: Santosh Shilimkar , Krzysztof Kozlowski , Roger Quadros , Tony Lindgren , Vladimir Zapolskiy , Miquel Raynal , Michal Simek Cc: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1959; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=ZwCto+Ttph4EufVXEro/gEKUqJQirV37As8vR+9RWpU=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmyGFiSXY1vA0zswAcRg937hXMqwpJ4t2399ap6 Zc17P/RQWiJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZshhYgAKCRDBN2bmhouD 17p1EACCnXOOL7qiPpF1BVtDZJyarNwyghSByLJr+OShMsFmzfL5fqK3GScCm0Bj5tf5tFbpbQ5 4DJJ1trhs+rjYKho1Euf2qMyByMQviKQz7374W4xt5N/ovZJ+Fg9sOhE1mO+En6Hvna0dmajS/c oiu4h3guIuqxSo6dpFkaHPOhgpZbEb3Dtfd3iAx9PuxXu4mijxyh/YGo0Y2A1YKcvyE6DUOvk9M jJa54LPKp7VRceGAFUBCGQj1cm9CQrQaMW4nO+kb99NfInXzV14s3UOvQwucjesIiDJUpSVMkO/ Psn2QKZBU9tWM8MLWMm8C9u293iSX+xawdxcNKFbI/OQjBpq8H+DfVviF8tK5MYL3SPgYyEMEE9 86s2CghofhJi17lfZOairekgkW5n0bAEY3Zmg3EjZhaNeev73dDZVaWuKZfEwuH3BFppKfdjuOu nETH6p8zg3F/8eCvi1KLZNVcb3dhzw2AfFmlbhmkpKAFE5nwO8opG2o8k7gjNAgxUq/HDW9wbb7 h2aPwn5RP7JFlkphz5esizu/oNSCTe7oK41p5khXYS9v1azXwXO+DgGQYYsIBuGn2gnjAWvsos9 x4EDWmHau7gceYlm6H87WjiER4YPR9KTS+u84BmTDWnYnRgCnMR9dJcbzYSt/BY9Oj3Z26zNX6a IbxrCHk2x5zf8AQ== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240823_031615_579651_E0BA8D54 X-CRM114-Status: GOOD ( 12.63 ) 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 Use devm_clk_get_enabled() to drop clock prepare/unprepare parts and make code simpler. Change to dev_err_probe() in handling clk_get_rate() error to make it even simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron Reviewed-by: Vladimir Zapolskiy --- drivers/memory/pl172.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/drivers/memory/pl172.c b/drivers/memory/pl172.c index 390012401f64..db5fbee34077 100644 --- a/drivers/memory/pl172.c +++ b/drivers/memory/pl172.c @@ -216,28 +216,20 @@ static int pl172_probe(struct amba_device *adev, const struct amba_id *id) if (!pl172) return -ENOMEM; - pl172->clk = devm_clk_get(dev, "mpmcclk"); + pl172->clk = devm_clk_get_enabled(dev, "mpmcclk"); if (IS_ERR(pl172->clk)) return dev_err_probe(dev, PTR_ERR(pl172->clk), "no mpmcclk provided clock\n"); - ret = clk_prepare_enable(pl172->clk); - if (ret) { - dev_err(dev, "unable to mpmcclk enable clock\n"); - return ret; - } - pl172->rate = clk_get_rate(pl172->clk) / MSEC_PER_SEC; - if (!pl172->rate) { - dev_err(dev, "unable to get mpmcclk clock rate\n"); - ret = -EINVAL; - goto err_clk_enable; - } + if (!pl172->rate) + return dev_err_probe(dev, -EINVAL, + "unable to get mpmcclk clock rate\n"); ret = amba_request_regions(adev, NULL); if (ret) { dev_err(dev, "unable to request AMBA regions\n"); - goto err_clk_enable; + return ret; } pl172->base = devm_ioremap(dev, adev->res.start, @@ -267,16 +259,11 @@ static int pl172_probe(struct amba_device *adev, const struct amba_id *id) err_no_ioremap: amba_release_regions(adev); -err_clk_enable: - clk_disable_unprepare(pl172->clk); return ret; } static void pl172_remove(struct amba_device *adev) { - struct pl172_data *pl172 = amba_get_drvdata(adev); - - clk_disable_unprepare(pl172->clk); amba_release_regions(adev); } From patchwork Fri Aug 23 10:16:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13774926 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 E2D55C52D7C for ; Fri, 23 Aug 2024 10:21:58 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6ocnpO172IW4JkslgO+O3WIS3ymQVVnJA1Ye00Cp2Ow=; b=y0e+gSJwsM1DYdAd0ioocneGOg wSbBW8YfL+1lIjxDa+HMDTIlu3wDeEb2si6JzEPI8/GVQ6NtwNBDSfXf2kL0eeu3Po3eDVhxXkL4k jCxbODF7r9awesiq7sy/24poDTX8tMLWZJZm6fBnDiBi3EHlAp/wjuBrAi89p60YOLtS9oLgTK+4L z8PBgSb7NY0OY61qcAG8gLM5m59OlDS26JiZXgbgWRegVOCQG8YoGjFHFtgjfjU6o7SHl73o6J6la uAPvas4AMxOeyFuEIt/DrN1dIIX52AqbXq/giaFGBgTA/HjJv6uH5ubkjYhY+9VVgEHM8yxoZ78Wa j/FFX3rQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shRQR-0000000GJfF-2aZp; Fri, 23 Aug 2024 10:21:47 +0000 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shRL7-0000000GHrf-36cE for linux-arm-kernel@lists.infradead.org; Fri, 23 Aug 2024 10:16:19 +0000 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a8629ddffbaso15917966b.1 for ; Fri, 23 Aug 2024 03:16:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724408175; x=1725012975; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=6ocnpO172IW4JkslgO+O3WIS3ymQVVnJA1Ye00Cp2Ow=; b=jP8PwiVfS1goeZeA1w8Ws/FlpOrhifDF82Cs1FEwdlmHyq+7YK8L+9K5ibJGczqvga 5TxGYXCxJMZHda453cHm+xEojFoOcslTWnsFLtjVRW5/NCw7DQ2Py+Pl6Iyfki7ASN8N hmKw10nWDESkBSeSK/O9DM4lYhlKY4WtHA+wETJV6VWC7jhXt6pInWqA3GTvQvf49OAi pgHtDpOLUVuYBzCDx4a/LZfgkMyMFCKcOJ85O3xiNhy4PlaFmrFBNXvLsJVEv7+WlDvX C3reeHdWb3ysaDarKeIEPMCQmjyeYoe8xYevxCNrGzxrigQRGqN4X1VTt4+e5i05QvdL 3jEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724408175; x=1725012975; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6ocnpO172IW4JkslgO+O3WIS3ymQVVnJA1Ye00Cp2Ow=; b=Mqt13JqHGddfY4egut+UyKXMkVVAuzoNugvfOf2F5CGYtKLlVV82MRfn4t3F8no7I+ 6yY7poRUIpmv0ypinbDM5UW2OfhhMm00VPmQqmbK9T1N9+QTkvpTl5OpzgSaFwJnauOH 8PDrUNKXzCGRWPQal2Kxipk9d7SwDJyUuXmC7ZODHkpPV8ZVf+ALgYhhE2BBDXY4IuIE hWqHmmNFtDyRITnj0MhDEscl/X6/IztJkMi5o7pJujevChbSQjpAbtujfOSKZmx10CZf KRUXiXk5T5sZkQvhOv7O1XjtcxujY+b9HYLWM5eRJ7gbvrRcQkoYrbHD75xzEHPKQklN LR6Q== X-Forwarded-Encrypted: i=1; AJvYcCWf2+nLKM4fJQhQxEk6sRsvF0BuKp6MwhT4YXnQ0zona6m3uuXnNMjIJzQcQBUrK6pODz5o5MAylpvS4gzjm8Pf@lists.infradead.org X-Gm-Message-State: AOJu0Yy9xfDjciHs4N3wkY9amPRjblN96xbCdZOkan0EcWI0i+Rdc1ak BMYdhPVyR67SlYwGUb7fUukb1Z5LbSdYNGu8p5csouLFTTalLUh+CcWGuakoZyk= X-Google-Smtp-Source: AGHT+IGhkuSvyXebvL/B71M5+A63nJsMJdmc8ImauUTYMsBp/MtDZmt5w/H9Ro753NCVBIDUlhKVLQ== X-Received: by 2002:a17:907:7d91:b0:a86:7179:849e with SMTP id a640c23a62f3a-a86a4eb104dmr69259766b.0.1724408175415; Fri, 23 Aug 2024 03:16:15 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a868f2a1df5sm237912166b.68.2024.08.23.03.16.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 03:16:14 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 23 Aug 2024 12:16:01 +0200 Subject: [PATCH 6/7] memory: pl353-smc: simplify with dev_err_probe() MIME-Version: 1.0 Message-Id: <20240823-b4-cleanup-h-guard-v1-6-01668915bd55@linaro.org> References: <20240823-b4-cleanup-h-guard-v1-0-01668915bd55@linaro.org> In-Reply-To: <20240823-b4-cleanup-h-guard-v1-0-01668915bd55@linaro.org> To: Santosh Shilimkar , Krzysztof Kozlowski , Roger Quadros , Tony Lindgren , Vladimir Zapolskiy , Miquel Raynal , Michal Simek Cc: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1309; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=Hq4cb2PCysHDymYKqh8l8D8U4p6NzM2SO2TX8TxhsYs=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmyGFiWcy8eseMGER1brKDO7pSSLOJFVrVR1xx9 NnAdZE/YlSJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZshhYgAKCRDBN2bmhouD 1wMAD/sGNlt5XqYNkHukE/5wRvv6uvT6Yob8h69eYgWUlllNP8Rr2rkissabZKtE5pxvqSJcDFK Jhs71OE9WYilg1k3JcV+fw5eayzmMK5WhS3bqL6hALGB1E9I2VPvxSulJQltKJSfhwNj8IdHX0n n1tUx4nz2wmT1Rq0j4kuS2AxiaytBfsSND1OAnGGnVEX4gwswxexllh+G0OWdwq/jKCTlNoj3HN eYmJSwq6cKnHRPQcdsffDw+6XvlCoJQLbBIS68phq+fxjUc8rgohmKMw8pjuXTFjzA5ayy0lR0W Y64DtnGHAYFHIXiaVFyUkFe6WzY4o1BXNuBRFUeIhSnLFXBVHYj0iqiIG48d8mQ9Cdvc9hVTio6 IBLXlzdodYtquWpmD4QI6pW9MSU+s4snGTIBcyfMg+uyPCSzYDW+yvyaLu3MpqJG0dvWRp2JcBY Qnli8Q4PhCMnSjf00zbqFc9Ej2S6plMQEjjrRpZmaP3WLPZ9pEXumSUkYZxS6SHICj13GffWMLc mO+SpPGLNf96jDf5UYkExVGrv2sBd7QvvXjpVZn/zxLjomdS1wiKJwtzSw2PmyBBW020JPeUHFG SjjV/B6zCmS6doppXqv4r0QI/zCChezl9j+0c4rOUnptlaCdoQf+J7qh0lE/R4oAMZzzjIzp52N pLa9e925jT+tHyg== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240823_031617_843632_B45129B0 X-CRM114-Status: GOOD ( 11.18 ) 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 Use dev_err_probe() to avoid dmesg flood on actual defer. This makes the code also simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Miquel Raynal Reviewed-by: Jonathan Cameron --- drivers/memory/pl353-smc.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/memory/pl353-smc.c b/drivers/memory/pl353-smc.c index 56e51737c81f..c75b99e49970 100644 --- a/drivers/memory/pl353-smc.c +++ b/drivers/memory/pl353-smc.c @@ -82,16 +82,14 @@ static int pl353_smc_probe(struct amba_device *adev, const struct amba_id *id) return -ENOMEM; pl353_smc->aclk = devm_clk_get(&adev->dev, "apb_pclk"); - if (IS_ERR(pl353_smc->aclk)) { - dev_err(&adev->dev, "aclk clock not found.\n"); - return PTR_ERR(pl353_smc->aclk); - } + if (IS_ERR(pl353_smc->aclk)) + return dev_err_probe(&adev->dev, PTR_ERR(pl353_smc->aclk), + "aclk clock not found.\n"); pl353_smc->memclk = devm_clk_get(&adev->dev, "memclk"); - if (IS_ERR(pl353_smc->memclk)) { - dev_err(&adev->dev, "memclk clock not found.\n"); - return PTR_ERR(pl353_smc->memclk); - } + if (IS_ERR(pl353_smc->memclk)) + return dev_err_probe(&adev->dev, PTR_ERR(pl353_smc->memclk), + "memclk clock not found.\n"); err = clk_prepare_enable(pl353_smc->aclk); if (err) { From patchwork Fri Aug 23 10:16:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13774927 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 B8EBBC531DC for ; Fri, 23 Aug 2024 10:22:42 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=//v24CLcxs0qSfzK2bPZZmIP6fFeIOA2pMo9LKSVIsg=; b=LItuqv0ZNAdZxdX33521V6a4Px LeOIEy1Ra+pFWOJXxyE972Vt80drqss+vdpsCToVYD7hrKnuVoWH0gR7D8VXihwPn6+EVKo1NdiAa /OnKTuy9THyRLHvXP/Qwvgu5v2eaUWjq7fULooesy691+MydmEi14Qr+NblSbTqiuWpfCrj8dV7BI 3GeFGD9UHYY8oTdbmuL/OcSlDQFSVvnqPC0u9bTYljshBoq7BY5NKphWUf7bkCy0wcjNdbXhe9LA8 /g7caJyj4G0m4cqhiVnREmdv9XEdlV5YNB2IUOxA9htuZ87tlZBKOCk9/sqENxjrSzPkekc08Bw8p 3LpNrpKQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shRRB-0000000GJok-2D0o; Fri, 23 Aug 2024 10:22:33 +0000 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shRL9-0000000GHso-0GUq for linux-arm-kernel@lists.infradead.org; Fri, 23 Aug 2024 10:16:20 +0000 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-428098e2b3bso1730005e9.3 for ; Fri, 23 Aug 2024 03:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724408177; x=1725012977; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=//v24CLcxs0qSfzK2bPZZmIP6fFeIOA2pMo9LKSVIsg=; b=apSwkxi2dLamA1fz4zOBL5wkjGnBmM31Z1DSD5T4JmD025L0JdG1NJCkTGUoYffcJ5 8JfkYcmRQnZj5g09FTnrHWATqrylxfz32A7WtBfZGKqVKK5b0gwP8RP1+I+299bbUjy9 D9Y5d3/qf1iLXuIYZT+2wMv7czzYocwiCPXfF7Xso10R6AyCnrKc8gzL/IKErjmOpyDY Xr7XkIvGnIHlMf/sYWulJQveN6DFT0D+n8nxs5N6T2j+8o+hOmkdDMKPOuC7GUNf2hVH fwapgyhca497wpOd/fuViEaSJ5apCNBjzUfue7Jlaj3QYO9cyg6EdwM2o731BQk10jDJ IXUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724408177; x=1725012977; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=//v24CLcxs0qSfzK2bPZZmIP6fFeIOA2pMo9LKSVIsg=; b=TXACXP5YE8C/GoVYdppoVBDQAWa/D/LQwsg8DWutq40x9Akd5+/3BFOE87GoDZ1qEX C/6ZrZE870omx7yCZ+6tQdr4jvhuRA7ky0rbpq4k2TqxJqm7VskMnVLOQVTFhcsql6KR 5Fvwbrc+2X9nnx5KqXm0bw75BZEn1bamqKN6tdw4uKnj9jaQu2/7mZhoKBJZN1ejbFur W5tLBa7qDYZacczSdjA8fFR8SXfegPzC3S6Tt9CHszN1zXRsEpgRSIAfh2P1kTh82p1N jQn6atiBaKfMW7UCQrDKs4w+g2G3Tvs4PjV4knmLwKWaIwW8/gyj7Pr9WhHrfnVhQ0o7 zSFQ== X-Forwarded-Encrypted: i=1; AJvYcCWNmsp7FrV0lIwbTzDQqklb8g7qkWEcsXWNSbA3CZC44Y/1/7CJKYWRljZC4M/f0FSldxlXfURDBhnj91aZb3Hj@lists.infradead.org X-Gm-Message-State: AOJu0YwqxKJGp5TPzg8mVMyKX0d3LyJVpOabkVYawOV63TUAzT12SwWf dxwxIWTx5KjPNPsDzowWmrOjQCPuMQD1e7rDZCTujdlmcjXSiwkKOTIdBZbzzmg= X-Google-Smtp-Source: AGHT+IEC6RfNPvhzvFChx+wCtL+7NMrFiz5Gjl+zdt8NnzFVqnC/TNmP4WTfKFQxtLPYaUDtOz4fJA== X-Received: by 2002:a5d:6daf:0:b0:362:4aac:8697 with SMTP id ffacd0b85a97d-373117c3298mr702517f8f.0.1724408176834; Fri, 23 Aug 2024 03:16:16 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a868f2a1df5sm237912166b.68.2024.08.23.03.16.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 03:16:16 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 23 Aug 2024 12:16:02 +0200 Subject: [PATCH 7/7] memory: pl353-smc: simplify with devm_clk_get_enabled() MIME-Version: 1.0 Message-Id: <20240823-b4-cleanup-h-guard-v1-7-01668915bd55@linaro.org> References: <20240823-b4-cleanup-h-guard-v1-0-01668915bd55@linaro.org> In-Reply-To: <20240823-b4-cleanup-h-guard-v1-0-01668915bd55@linaro.org> To: Santosh Shilimkar , Krzysztof Kozlowski , Roger Quadros , Tony Lindgren , Vladimir Zapolskiy , Miquel Raynal , Michal Simek Cc: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2747; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=GtxnoHO8CDfRvCPOOhVqBA6bOVSvOhWRpFVjrz6fU/I=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmyGFjgn/NfXowD8Y2kzEYUQzr0VM8d7MwS+Jki D+A6EsuqsWJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZshhYwAKCRDBN2bmhouD 153DD/9dC6+1LakyDECRNCZMvG3KWYdsCy+n8ZppZCS0zMMtN4jEXj9i2yumR/zBd9WdLuvHhOq /cm9avULIqRDGb0k854F3mtC8f1KuhUDM7Ma8n7lLRza+ASd1KvMu2vTKSoO/d1elYTCUf36dPQ xWAAbzDlBwaWIaesn1fgIgOtrMKc7gbsUV6VpruCUo5WQBqdrHoPh0UN4xn+5RW6kZHUjKLUkPI 2I2CGb5WVBq0PbE16Orjfv0X2uzpKwvQ13SluKHRnB0uIAJTZu+CgLvqn32uGmWiOJeDn/sPCNs XlNjNwkBJyMSMA7iik1Gwlo0qGCJRdRMQRkPGsXwv181roFFG6TV6RQjwGg2qESiqCdEKOCSsKw XpCtXuPCLLh62bG2+8KHJsrZOWXHv6E8CT2Tr1+Cq7DRXv/jOme9d0x0WwMmPoWnDhy57zxWj7P mSwwXQFSp+w+bR6v1R45CGzSLT+tYIZgkuEiUNUWPCd0hCug5lFdwR9FL9FRvzF9aoGtDKtrIsW i+hmvWYH9Z4fsIYKWp9CGlcDVV1ai4g/c9Li1UM8KnW7PyWCwoSbDEUVQPxadKXSSYWOJfwKTkF ukW/jFfNt3bdu6bJWXMXObgMuGb7nHsCbpRI2pDlRwzDQ4KP48wbJF2jYw+irTjCvRTfCsmGKMp ApJ+aySaq1AUYKA== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240823_031619_140900_3235AF6C X-CRM114-Status: GOOD ( 13.62 ) 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 Use devm_clk_get_enabled() to drop clock prepare/unprepare parts and make code simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Miquel Raynal Reviewed-by: Jonathan Cameron --- drivers/memory/pl353-smc.c | 36 +++--------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) diff --git a/drivers/memory/pl353-smc.c b/drivers/memory/pl353-smc.c index c75b99e49970..994c7a792e34 100644 --- a/drivers/memory/pl353-smc.c +++ b/drivers/memory/pl353-smc.c @@ -75,34 +75,21 @@ static int pl353_smc_probe(struct amba_device *adev, const struct amba_id *id) const struct of_device_id *match = NULL; struct pl353_smc_data *pl353_smc; struct device_node *child; - int err; pl353_smc = devm_kzalloc(&adev->dev, sizeof(*pl353_smc), GFP_KERNEL); if (!pl353_smc) return -ENOMEM; - pl353_smc->aclk = devm_clk_get(&adev->dev, "apb_pclk"); + pl353_smc->aclk = devm_clk_get_enabled(&adev->dev, "apb_pclk"); if (IS_ERR(pl353_smc->aclk)) return dev_err_probe(&adev->dev, PTR_ERR(pl353_smc->aclk), "aclk clock not found.\n"); - pl353_smc->memclk = devm_clk_get(&adev->dev, "memclk"); + pl353_smc->memclk = devm_clk_get_enabled(&adev->dev, "memclk"); if (IS_ERR(pl353_smc->memclk)) return dev_err_probe(&adev->dev, PTR_ERR(pl353_smc->memclk), "memclk clock not found.\n"); - err = clk_prepare_enable(pl353_smc->aclk); - if (err) { - dev_err(&adev->dev, "Unable to enable AXI clock.\n"); - return err; - } - - err = clk_prepare_enable(pl353_smc->memclk); - if (err) { - dev_err(&adev->dev, "Unable to enable memory clock.\n"); - goto disable_axi_clk; - } - amba_set_drvdata(adev, pl353_smc); /* Find compatible children. Only a single child is supported */ @@ -115,30 +102,14 @@ static int pl353_smc_probe(struct amba_device *adev, const struct amba_id *id) break; } if (!match) { - err = -ENODEV; dev_err(&adev->dev, "no matching children\n"); - goto disable_mem_clk; + return -ENODEV; } of_platform_device_create(child, NULL, &adev->dev); of_node_put(child); return 0; - -disable_mem_clk: - clk_disable_unprepare(pl353_smc->memclk); -disable_axi_clk: - clk_disable_unprepare(pl353_smc->aclk); - - return err; -} - -static void pl353_smc_remove(struct amba_device *adev) -{ - struct pl353_smc_data *pl353_smc = amba_get_drvdata(adev); - - clk_disable_unprepare(pl353_smc->memclk); - clk_disable_unprepare(pl353_smc->aclk); } static const struct amba_id pl353_ids[] = { @@ -157,7 +128,6 @@ static struct amba_driver pl353_smc_driver = { }, .id_table = pl353_ids, .probe = pl353_smc_probe, - .remove = pl353_smc_remove, }; module_amba_driver(pl353_smc_driver);