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: 822342 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A47537144 for ; Fri, 23 Aug 2024 10:16:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724408170; cv=none; b=ZHmYJURokEyNfVa6zy29Wb66VSeF3EusEosqViOVkjJEJVvTdpU/vW9QyHJyLM8HW0zS68oPFkCOnlYryKNHMCqjN4QoPO+uDOQphQCW+mVexMBeyJb27vrmFBWWGW+nqC6afvT8q4bfEYXtP1mFT1tgHn7lF40JrG5d9i3djX4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724408170; c=relaxed/simple; bh=LtVfsUrkXvrpIrQ9RY7ofd8SPZNPe5l+WNIEpOclJW8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=e+EkYVb5IhIsdcbsk/JS2zCSXv6jO895UPRiF6kJgHz4w4JLfWN2gupzqmbFnvngs0OZKNU/F1sqjwgbBBtX2IAeXleuHUiqlrILOlpB0YEdaoueEa1HOdbGeO8NWVy/i5ovACoNF6uVAWR/7/N3SKNX3Nhy9UOrMHq9V1RdSGM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=K/a0jPm1; arc=none smtp.client-ip=209.85.218.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="K/a0jPm1" Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a868ec0d239so12964766b.2 for ; Fri, 23 Aug 2024 03:16:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724408168; x=1725012968; darn=vger.kernel.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=K/a0jPm1lAb2W92lShBuUHweqnu55ZjNYvEK7poxfGEugLMAGScMWNMO5/AvYVOFVS ZDbBiVL9ltenX++J+zE8KjWmwLCfOrUy/uYSV79FsryUJMtFY2jq5pJbmZjtdag68ZHs 8otUyoWxMnJoG2lGMhlhg4CVjwYwEv4Ih+7hbAmfoQG0QKN20Jz/Y19JiZA1YeB1xGgc gafWQXC1zeVIiofXrF6HLPeXRqcq6sJFoLETrkIjRXzHk2tmGSEd5lVbHx6uDMZRVHr8 rAie5TTK6v4h48OsxZV1dqKdvsqLwntCYmzdGvMu9sVvyteBZhp8v0MG0n6on1/vzqd6 W5XQ== 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=aPTPAipbUXvWgmYZ7tah6lQsTs69yIBoHBAitcp07rSpazl+66UrFVYlTxV0KQ39XV o92zHmXyRSoYaikckDpgo6IXCSCVX4K4px71IERWFKIDGXXOi8vbD9bhY8uQI6uccQaS YcVNfmbCGfHa7j5TN1X4lzMCIr9aMqAx+bcWFN6dRviSkhu83bV6zBDCADHa/UankDP+ 3K3BQXcb96jqehZptvN2Tof/5OsaEZ7K5TON6RbLoX7K+i576TDTbuvn8IYLkuxCvmvm ZNysm6ZP4CJpyohXWGufejZuCTamTN+Fak7/L1/kOC8JHoL0jeGUotq99nxZ0CqfkgjS plgQ== X-Forwarded-Encrypted: i=1; AJvYcCX+z4qEeDb1vRi+/Bwb3wF9LbPh/kanIv/tfNf4g0oI95u05YjhPYW+Xa8QCNL1fyQfC/xtSZ3CVx9g@vger.kernel.org X-Gm-Message-State: AOJu0Yw1asMzk16bI8Hn1KerGceUEcR0a4hQM0xjxEYhBb7cXuFH0m2Z b7Wl4w1l/eEpVqwYryUNDtCGXir3XndkZivJMHNbGX05uVJJQXGNaty+67Hfyks= 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 Precedence: bulk X-Mailing-List: linux-omap@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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: 822041 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36E89187338 for ; Fri, 23 Aug 2024 10:16:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724408173; cv=none; b=AsfeB8fosWaVwjH5BRHz3dB2oxgN2TEXmU1ChJYPC6SNkEBPd2ASDoybhP/UsOtNKlprFlvJ9o+Wld3BJKJRfJSR8/AZrxz4hBU6bHS1+Bgu4agD9IKO81p1JiUg+oRl2T2RvBO+xDDO3ocdakFKOWWSitDigvYXjGEF0ioYFSI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724408173; c=relaxed/simple; bh=dKvvXGp0G4rwTm+4rjJKl33390X+DCmUn8vg4x43GxU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=X3sgnrO30jos0s3wfFzbPTND06hwzj0jzuHJyR0t6ugVavm5TzLSjf9feGka1UwN7n/H6EYtBmXoGwsRsr0SDZEdTUadY6XCilbslbJ8qCjtlVKZaJ3lvypMtJJ+urf5EUxbqz8rT3hShnqG41fha5yG1rgkIP/DFmsCO9QzM04= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=b6E4pCgQ; arc=none smtp.client-ip=209.85.167.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="b6E4pCgQ" Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-53347a8a28eso307094e87.3 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=vger.kernel.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=b6E4pCgQpIryJ+uRWTMkOAIm655dAoW04uLx7Y2bkTxbzXrint952fwn24JCd7jCs4 csDdBbitklCbR3nqKSS1+hUV4LE79UygNj0/XOsyRKrKFAf4gHRzXM81fX91mIrGzOUu 9dl8CQZUtYd8YgegCOGewll9MIdB2NpC3fa24tPFeotKmTVyN+ebq3y2NnVY5c65HF8+ Vfdam1XhAQBqnxsJ1qBMsWXbGRKksO2btXpNe9vW1SqV5lXE0FVLE7m0hOyLsBt3q2VO NtzYIKEGfp6+wxR0x9VAuVFO1MSue9qFeMQ0dlyWNRpG+E+Uw3I8jz9feZ7uhBNOjL5q Ctlg== 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=FEEx1D8pSxmWdPg3F2g3iRqs/xlju1Cc7xNO74jiGJ2roVwhC6cLCj06c/sH419woU SH8N2f56JYBjeo6UKHvYMlbW9X4OFYpaaRQDuWcE20XieyLHANZSvlDrNmW5FXDCT0jz PHxrADCLCkrD+74myAtt0DoxvT60CJivrYJZgZ1YlRdGoZ4tecYZ2P6cmdwBPCsOGnEn 9/6GvNjWzWa4rFPX5r6M/fGfVpvChuNbSlThMsM7EDBxwV34ioLAOCswtiN5+JmnCvti 0J6sVfoFVVBA14jAgQ3vFyUjSu1yBDxD6UgcX9hQx0/9/0MgD2CnQETJiwBDp1qsm2VL NjTw== X-Forwarded-Encrypted: i=1; AJvYcCXz5GGsD6rx8miGAFtM7WYoy+wPzRMCnZs64I9qGI6PkclidQd++RzLHsagK2irQiP68ogNrwicKXU1@vger.kernel.org X-Gm-Message-State: AOJu0YyZwGqXNlIuA1uLZ5W/0dNZIPf8g49jgVRtDGoNPtVSfuHTj/yc U8BBZNgC7FAYgnOp27tYNztowwh27HzI0s4sY2GQIi46CQPv3Q/cIRhY3lGA9ww= 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() Precedence: bulk X-Mailing-List: linux-omap@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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 --- 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: 822341 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41FD4187543 for ; Fri, 23 Aug 2024 10:16:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724408174; cv=none; b=QtPj6Nm6M2EQVmt7UxYpvoTwgP/f1LXCPJCLb5oaPk0nDpSsWXengM5PZBOgPxXwt0EqbPhEbk/bFWmKQ2JrNam+kv/NPyrSRif3PbkYycFdchlPEgR9IHC8yx26cMVzufBs6DvHdZzMCVrp+IY2jX1o8WmJhSM536anh0yUTMY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724408174; c=relaxed/simple; bh=c3EBYma5kTUA/zOkUfd/wHDJYd2x1OE5BHWso7TEYUU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SOiC6xa3aduaZieCYE7lDrryOtqHGsDE2vjvTcD91z/LCJnVK+ZetLNgJ0ivENdaz8DuqOg+IgdaZpQcOalkUlREGVGARCF7XO4Rp0mEkCAx6MujleBsFQa6P+BTxRMCdbUU6L2HhRFFVziZm7hh75baqd+BJbiMd0fMmEmswJM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=YRjikzsL; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="YRjikzsL" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4290075c7e1so2214915e9.0 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=vger.kernel.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=YRjikzsL4dgJBjyLeXnpVRcsiMRRrAdVUd4EcATsv6dKan5ELzRSPk44kYbDQa6y5o nO3NbdWYn/stJqtkN82AnVFApEWXy+iebgZJB2Xm0CTbvBqFDyW6xNxX5kGgmySgFs4J zzDqCibWqyhfMOwAQ5N4lyDT1/m886sIVQledSuNY4ppZqHAEvoGItIjBoqk+KJQWYUM 4hQYnZLyhiwq8SjMnE0R/GOWRCwoS016JRAtzi2IdiA0MPIV1EcqJ6/sqbD/X3Unm9vR hT4kFEaqRJ29b8heSZAK9IvXr5Otxu1GONM7zuDNEOEtwxO9RZJLaf1IL7CmHPsNYZOJ tngw== 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=rKeGWkp2pPEFk6N0hSCTQKRNhnC0GZQEas1zcp5meNhxvtw4kaF3hbwy3X+pTQ0RHS 0tI+bdXYyjPrOZPOKbq/Y16bSan6zHiM989Dd+qKZP8P0YOSNv4+Wlqdmlx874ydpUNS Femb1aw32IAqkJTTgnx7Hy7Niytnq5zegky6jBI2wNkn8/QfelZcPfZj/Q3HK4BhGDaM tzUdk3Pu47CljW1mXiR+tNSqXaoZlMCtMZOp0s1S2DwxVmmKjeGsXV7EkemLvUDQPIbw Dg+K+lr639VcifDE1dyspZtQjgxkTVDUgQYGaXdc0Qk7ZmAgwkX8df2GehnQ5Z1AZMNw KQCQ== X-Forwarded-Encrypted: i=1; AJvYcCVH2o7fISDnP1O0WIdmmTC3SvpC2QUxsMLEPVKWJiada19mE5Fk19tf7raQRCG/vzr3I6s4U0E1khC4@vger.kernel.org X-Gm-Message-State: AOJu0Yx2aNtcAjT7rw2y8aWvVDItk9RLILW8Pib/NVQkkAriZ7LbU6kQ c6lqNoD/P6VE9SxABL/x5iYLWCjd+MKGGVM6WcMcAUOeEgzz7M8d8NBsQ01eOU0= 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() Precedence: bulk X-Mailing-List: linux-omap@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 Simplify error handling (less gotos) over locks with guard(). Signed-off-by: Krzysztof Kozlowski --- 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: 822040 Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF211188584 for ; Fri, 23 Aug 2024 10:16:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724408175; cv=none; b=LcPnRWLwWdr4CAwmo1mFeRssLSk+ynpTDlD80zrBathiZuU2oU6wcvC5IrsoELCeiEmNz288BsSvKbvdADmmRF9jcb0TJM7mJ1YwLoVBAYjavLrueIxg52mTWPi0TLHVnklYSozprGQbfyt0kB/4t2bSLgQqMVHNGjS1kU2R+VM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724408175; c=relaxed/simple; bh=IlZEpsC5zLoI1hcyp/Rq4r/SZxK68xgrN7mWoEs36F4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=c0WVITrtlHolxM/ELTwKOm784vMVmmqjD+MPBLnJrQHXo2mRnVytNWUuFVeEuGZJxCpSkOIzUca/31msqDWB9KtT2LUq4FxYV0Llnz7QHDhdD7fAKdaF5HBZE7CrwDW+9zsTq7zAIY9mP4PfgQbVTdHdOx/MKrBx22xLelDj9eY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=lmvqonSO; arc=none smtp.client-ip=209.85.218.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="lmvqonSO" Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-a868b4d67c6so12240666b.1 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=vger.kernel.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=lmvqonSOzJiLZ0xeswHBSr4v8vSVhBf+5IfrvBkew0ziCFeewkR6An/6rR8pAnLQPu 4pBtwgUCFQOa8Y4gryQHj1qjfTG4UcMhRV+F5LQ9oCaMECYudOuzcLlNV/G/LbhKPDX8 d8pXyjZEsIAwWcLvtcTJ65Yt/mNsi/oAyicWuk5BYrd1mp52IyxKgc4wsA3MzSf8VvHt uqejoBtmxijuF6EmcGkFQMNr2t5of1PPrYTZ2fA4MSDFMsW+ef4zPI/JeU+bmkgPQiAL QaJldRzm/qPpk02Fa7+BaGDX1Mfb79rlz2hHU+mPIYYqClsyN6kCF1X0+7eRWj5bIXNp 81tw== 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=tr0S65ZJqFi3CbWwCn7ts/kAMT0K4Bo9LNBJXQ652ZoOgD9+IP18BFxHEc7WN1pIb9 N4MpN3kPw1sjdVtddwxuP0fJTgE3gKydEwjcjfV/P97DaOLclD++oMI9QSbUMm8nEpin Lk6E1XPmzxcgkT1tfvyob+kHmjHUNEe/Gqb5nC7nSAzHwBz6oJ7gVy5yvJIKz4hNHtYS DWI47q0xL/DAS8s+1yWSZ2C0yDL1VUSkajfBPEAwWOuw5R2HAoAU/7MCEZptPCX3qnMx EZU4/ezp6vCHfykKW4x0y0RkccobcgdNrESmYHDTXi4fY/6uZTLdFadibh0zgXykvcYz /K6w== X-Forwarded-Encrypted: i=1; AJvYcCU2j02MrAxykHKMD00tlvKrdQlZg7YHv3ba2Y1H0LZolAP55WUUydTPf3LOThrUt5AZfqQD+75bAXIp@vger.kernel.org X-Gm-Message-State: AOJu0YywARHlWfg2g6HUtmjvKcLccFqwFwCVcOMwflU48vhMxzLXF1XF KSKlAwJ0+G7LP1TKzHNtkHfSxy1uIeCeXaPNDwcizzF8yItSdYg1sko6nDw4oYE= 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() Precedence: bulk X-Mailing-List: linux-omap@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 Use dev_err_probe() to avoid dmesg flood on actual defer. This makes the code also simpler. Signed-off-by: Krzysztof Kozlowski --- 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: 822340 Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C23D14B084 for ; Fri, 23 Aug 2024 10:16:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724408177; cv=none; b=CH2aQQeJvUAdoXIHhDWj+M2+u52LOGhwSUeVTQFWPXxPQxUJMZWkPDoOdT1rVvgSi9Pv8mlfiJxqNOQKzDgYFwoSl2JPNXLp7oRBTTLOsvEnb+e9cMTRxBYpODqYT2+EXyHsnxr2vcmqA9sYhnq+p+YyBgSj8M7oHCEL46s3fxk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724408177; c=relaxed/simple; bh=ZwCto+Ttph4EufVXEro/gEKUqJQirV37As8vR+9RWpU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hwWOqlhyLr8M/n6ByxYehRGgQP5YEIg2HepxCz+CBE2lMMs6g01FMI5G1RAHUVf4eyXVxfrGViN0ycASPa2LY+Il4jeGn8oJ9WXRHRw1fILqpQjdpmwfdLMOX4tPI4WHNEOBnhTo5x2luWCxaePEFHA1HQCkHoABfS+1/TXGKJU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=HN8Um5lz; arc=none smtp.client-ip=209.85.208.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="HN8Um5lz" Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-5bef259a71fso249681a12.1 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=vger.kernel.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=HN8Um5lz5NFy/2ogaturIBc7T5AP2lo0uJxdQLThIY6dRpwdws6GINXvcPFYaSBjNV BksXRaR2pT92cN29J2ihDsW8crQIFnByk3Q9WBG4izAqA+2Cqbn2BSNecT/Cx9UTy659 1j+zefbd08fuqDGZe7n9jyvknl4WoWvfJ+Vux8dZ4IZe3uRAIQiMrNicneCD0M9wPRBV E/g8Fw8ytkUqIyccEcDCXNBYBr0+kp6rsEboX0NWccmJmhMpFNOyK0bt/Cpj1+laID3D h6Agmk/W7DD1UJuU6NiFUf2+0iyFPTXiVrSzJqyTq/6ZfirjLvmRT9bwWIVxBfSBtA33 vRbA== 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=OxeXl4Dg2LN4W9PVhXnESx08S9Xtx0bYdadzwGQPRJPsHiNJt49B/RQv0KsLEV5eF9 6InNlF+v5XoSN5fwzpAGI1092htuO4/2adYPlFmCZLGvTAQY9D9FLAcJ6TQy7TesSvjn aecDNhYX0faq/HpXkBhVmkdEbQ9aUNJQ2r2orFGIkDPZYqStasJibEl0ylQ4bNn5sWMa GzJGDE9gdtMwpr9mjpnmJeq6e9RVjm1JK4z2m7fF2WCbWvaXIALP5TI5d24VIag2vjAQ c23dHYAxP7xVBvqrulBHUUNJgOSR49LVxyF/jw4TC/BFkCIuPPBGRFvkdECjfwBEY5IW J21A== X-Forwarded-Encrypted: i=1; AJvYcCUJnMURFGtnmU5UZAGbnCSposVMSvgLDFDf9zDkhm29hqF8GWN1nFldjdHTXKxBVDXv88nZxBSWrHKz@vger.kernel.org X-Gm-Message-State: AOJu0YyzemGMKnq+gfurylTL/TCQsXPsW+gGAyrc0Iuxh3YAaAElq9CF FiSFrrpQgSReIgp25qqSGVX0jwXBktqKsZoFOuAGVFSHPwB0qDugful6WEx3KmE= 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() Precedence: bulk X-Mailing-List: linux-omap@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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 --- 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: 822039 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C45618890D for ; Fri, 23 Aug 2024 10:16:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724408179; cv=none; b=vBon2j8LOVBZwd9eJm5zXf+vH4gT4VYh3wdBXZYGNIhZ/4HRqu/EXua+61ADaapoMDGvS1ao+DJbtZuFDFLEW7H5IZfaFn8b6bHegR95ZTDQCVX0hJww1TYPK63K10OrtV4xpcrv8NrC13WdmaIvOajDdA3TikGC/N2bE3wmEVM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724408179; c=relaxed/simple; bh=Hq4cb2PCysHDymYKqh8l8D8U4p6NzM2SO2TX8TxhsYs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BoLHUHzxgBlZGGjW5WKXGIZHQAq1/6V93sZZutYgbu/Udaqxdvwp+JpnmIxnYpvAQf5QfIA8pLG5uSUDrbClxWN9fwchBiEoPWKGIX2l7lADvHV0+81qIJtn1AiQPfVlYwWLVdR7DURrB9TN3xMdu+2BmeKqqyzkRXmR9s+r95Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=rrFLilM6; arc=none smtp.client-ip=209.85.218.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="rrFLilM6" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a86939e9d7cso13569366b.2 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=vger.kernel.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=rrFLilM6dhovfNOSkW4k3uJp4luyF4hZ96Sgn9ZMHsL+Mj9PrOCwLUjEDnj1Gr2bzu olZ2mOkZlWlZXAguzBMemaVkpZPscuTVr5onT7Jamfl+1MVxrPv58QCD3Zc66pUwNby8 FzK47kG6+Qhs0M2SaGGQhQQkx2I1zaTKWRxeuXnfOVLPVWgCvd9kv4xr48ZX9L7srJNK Ty3LuQ2/Hd4g01iGKfpXLoxwq39lFm8LspFYj0trQBU9u8eDZdesut3Aj72lanQpdftG HrCFeC8JX9iDFouFQ1vwEEGFAep/pIyFm0wYpqdsarFFbga+cc4p7AZFf+vd6Jghmfq0 OmbQ== 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=pBhHCRyKF9mwIXPu66HUQ/ns1YclcdEHb6Tj+0j7xtlCgyJV/9GPd9KSFuaWeUQRaR NIIgbCvPyfxDtGTnwyvgJloacbd7fkmZt1k8syjAfY949KFjo8BcS45J3oJQHOTFCLL6 nE46jwQn6ljy5TJ5yF5dZq5Ae7+tyzXDwUrQsuwYEvFjXNgUeeH2SeKSzfdgZkWjZLcU oCTXWw/SxSwGymg3oAT7JJuNwodm+cJcqer2WFovJQDfmXcvm6cg/utFJtpHl25InmnM 1BwHsUK8ZOFYGR+diFG4V6/PaIXUEgzsJX4PqSmI/LfVFj8Ksz4irAR3vrr4QmPJrvXk 48NA== X-Forwarded-Encrypted: i=1; AJvYcCUcd6BZTy3Kp+RRxXo1bda9fxcjfr+6c4OjLz6AGrmG+fhPOF5QzpXeOvRKxLuMntEzJ03DEVNmI5RM@vger.kernel.org X-Gm-Message-State: AOJu0YxSDtIBuL6D8BGdLpw6Zul3KyuHBv0igPfy9Evy8v9d+hxZBBF1 u8Bh2zucvqmArrHW76SmW/ojiSCUyqbE88BRRL1it6P3rKnVF88ix6+jjReH/10= 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() Precedence: bulk X-Mailing-List: linux-omap@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 Use dev_err_probe() to avoid dmesg flood on actual defer. This makes the code also simpler. Signed-off-by: Krzysztof Kozlowski --- 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: 822339 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 72757187842 for ; Fri, 23 Aug 2024 10:16:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724408180; cv=none; b=Ch0KGQSceoaZ29Qs6AOWz48gXc2pMcqkGzud4fRRsS5lZC1gRAek57ZxYpjLNrjRqqPO03j3L6wwXpxmG0WGnn7clrdlHNm1LEgqHRnLncCvM5n1cif1Y9h3wpdY1aJZP6Wx1KvELRhtVgtIVytQPfoOExsPe8lzpDNaB+bHAR0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724408180; c=relaxed/simple; bh=GtxnoHO8CDfRvCPOOhVqBA6bOVSvOhWRpFVjrz6fU/I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YQMmG5112lKGcB8Wfr542Ewj+2HNbk/ZgrpcHTJkTtu9KSE6/LyeGl7/liyiE7raH/ujRj0oikYspphYW13fISTtHZEj/MimsIao/pmmT80SNPIlbqV/IIBM4soAqzD6fHhLuWuwyvVpdSsxa6Dqq2wJVWu6dgtE4yXfRUZIiGc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=UC5Fswln; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UC5Fswln" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-42802ddfaa6so1741225e9.1 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=vger.kernel.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=UC5FswlnE89o3m7ZofvkXKe9LAaDcTfLPNaj/iw8lsp+xXGvFiDKaZ8s3ZR6+tbUbt r+nHxa9MuDVbZ15dlG0wbmfO7JJUeUMjiBBgRe4lMhKiYwrTUzWom9SP/kYflGNluUxe ezf12UWTkgsqQvEpYT+OrVSp1RarPbqVOZOuf3D+YXY5f3EBg6J5cShiy9E5LCPX7Cpw bBE44rO8MSfVFnfwxx0ogT33bX8ywKDDfr+3kH7zhT+8H5WVDceq6UGY0aNVgd+95HpD FhjAOSHOH6frBr0iX9abqAdbnRgXh5SabNi4oiRCuHn2xDV+rFLodRbGknVc3Dr1Qwjh EMjQ== 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=Ni3z90Zx84CmM/GmiuHEat5Z1BAV9+og94N1cy74MrsSKwe2kAhfxT/KmzLH7mVxuB rcQQAWixPwk/9nDea/zrU5v6rG2mWfHVSLxumL0wb+RYNKlwDsacdTeTaWJWi6hqIFUf KwHfyhhwY+9eaH4usddAQStWzsgcBypjKV6BVeEpDVYwaotJkKrUoxm5THkV9d7pDK3y KjKUfSz/SNnwLc5Z2AkhuvnOsddqlXll8/EzDsqPP9ZmsyBe70uihTaQcvKg63oj6ngi TTbFBjw3VH2ZyZniKqKaVj+g/g0Q3Red+H1KCtFdQUtTkQUnZTkTfnMbGHUXBzBA/LbZ AlGA== X-Forwarded-Encrypted: i=1; AJvYcCWq+po2pAO04QfnihsDRTV88p4uxOoZGjfUp0+jYjzrQsN6PmE90gWFblYTXLmOX0IHB6FFyCY6Y2/o@vger.kernel.org X-Gm-Message-State: AOJu0YxBl/E08k+nO3D4DHsKuamYyWWzEUvEd3phkXV0jz7xWohHEJ43 zCrHIH7XewgUj46odv2YQIu6kwGXLIL7mZtfjCzT/VE01YdbJIkP5qCxVUB9IJE= 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() Precedence: bulk X-Mailing-List: linux-omap@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 Use devm_clk_get_enabled() to drop clock prepare/unprepare parts and make code simpler. Signed-off-by: Krzysztof Kozlowski --- 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);