From patchwork Tue Jul 9 12:59:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13727866 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) (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 2D58615B55D for ; Tue, 9 Jul 2024 12:59:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720529999; cv=none; b=cF42QLzgTTCC4PELkMyj4O/ahg5AyfS1+lt9zVMvguVnRkB+bFyAyGgK+si5K1twi96ufghngVoK5vHVIfftlSUMvRp70fZK4x+T2ZjpT5jg3Pf/MExRUlxVW63GMvWCy1AdpkPkgpFBHzFoOTwll7Hjm61dE2Fm6JOkqzZRWok= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720529999; c=relaxed/simple; bh=iOmmg+031BO+zTgqj4Da5Rimz0tYxzcZBtos8xp+M6k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Zu+fDHSTdqkbAmlAQtudXbQ0fUgXvNjkift2RQrxXMYJ47rYHDPToLegz0f3Xq2jDRi/DSOFtVTX5kum2SrU/si1bAAz4cVmBtO9BlJrzMa3JUXjyrIF4BZpEyMS7jLPeCeqT3bGN3lhbQYWQEldE/P6coCLPY4RFW16+TE7dQw= 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=LZNWhJby; arc=none smtp.client-ip=209.85.208.52 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="LZNWhJby" Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-595856e2332so503302a12.1 for ; Tue, 09 Jul 2024 05:59:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720529995; x=1721134795; darn=lists.linux.dev; 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=Hpq15xCFbtYALDYFY4KDY3RIliIQDLzZlDT5dVHuf9o=; b=LZNWhJbyX0PL7SJZ80QKrPRpDA5x+o1IxO5EL6Zc28dNP5Cd98wYcMEfSz/zZc+mlh 89O5DtJ56A077o6NxTSLLaqp2Yc5clQe5ttZC/AIOaeSuHDXVLkuFgKGnwpULbIxxi+S 684dz2Tpke5ThviUz8Il2AZNWyvdHr0DZ4w2qjrocSF/ZMI/8VBbArYn0eb/HrqdJ/Rj clGe6oZhUY0fLSmW8Ugng77B4KGAWIDN+En+qOdM92RMcynRpU+zFrCQeSDHveJNDr44 ncWosjCcogr9sCN6kUrUgDxLJmbUu6fz0Iy0UDibzKib3qcqT/d6bUhADwCIfCQHynl5 K5IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720529995; x=1721134795; 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=Hpq15xCFbtYALDYFY4KDY3RIliIQDLzZlDT5dVHuf9o=; b=g99PWnGT3UwqNuuQbYFC8/ftwwYiArqli7jpbUa059SF+X51epHQLPjQRJ8SPZydZ9 t3N0IA6BL16bdMzLgsoXc1+UE1JoyMZnwqgPsB9HVUB7Yt6CLW5P4GUfo5FUqex0G5EC yZJprQL8BlGWSFVNhn4my+uyRgvghUw+Zgqcl8Xv37pKSMATYUtIOryKvQ9VqfpJZaQv wr+ENifS5uHiqG5r9BO5CsMSLL6rsj1V5fRzepE6RJo7BiwBOnkqNC1EC4ZX2GzpsxHH fTa5JcKV4f59unSTt15Aulra+6AXnMth0vCx8/sFQAbyGHPqsoEgulUQWxjXn+faOQXM yIow== X-Forwarded-Encrypted: i=1; AJvYcCUdmsmj/n2e1g33SJ2oa8fhjyQFz0k2ZDmQbjdnz9O13xhLPg5uTF7i9S8OiAxiGfyOmH9jNJ9VlIR9aka7B3kjijW6 X-Gm-Message-State: AOJu0YwugtkEzVIQMl7IXbftoWxGSGcfKAP6zZb4c2oVDacD0i03tpME 5p7elrtApHDos3LFszPiw77XrOEBdBX7ePvIV3/sA2YTbcBpo/rkfmT5WCTdPaI= X-Google-Smtp-Source: AGHT+IEnBykQHOg72vb+3a+PwqhhC6nKKTeE5KfSm0UJxuh/0+T6xpvhz21MgJnNUb9TuX3+w8AJwQ== X-Received: by 2002:a05:6402:5256:b0:58d:eca:b9bf with SMTP id 4fb4d7f45d1cf-594bcab156emr1744682a12.37.1720529995591; Tue, 09 Jul 2024 05:59:55 -0700 (PDT) Received: from [127.0.1.1] ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a780a6e157bsm76643166b.80.2024.07.09.05.59.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 05:59:55 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 09 Jul 2024 14:59:31 +0200 Subject: [PATCH 01/12] thermal/drivers/broadcom: fix race between removal and clock disable Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240709-thermal-probe-v1-1-241644e2b6e0@linaro.org> References: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> In-Reply-To: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Alim Akhtar , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Amit Kucheria , Thara Gopinath Cc: linux-pm@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, stable@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3012; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=iOmmg+031BO+zTgqj4Da5Rimz0tYxzcZBtos8xp+M6k=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmjTQ83IPlStNA8YpS9fGSEe7VT+gKCvXpGdAfJ 5hWjtkURB6JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZo00PAAKCRDBN2bmhouD 117aEACEcxeLvNx+Ph7F3Sf3xCVkyz8ERxrRXQXccTRTOYxedP0TJzaaKHlqyz+OlCmtcu9wKpm WRjmQxWKqPDDFmWgr4Y04n4SFXB05HI6p/7z3w+Qythc9voHFnPIezcyDwyr0H0DR+jZ1HLki57 pixbSiu1Oh7tFR6L/Za/4zrtmS0BDmJqfKOyUciOuKmucNdB5o2lOEIG5pGuaTP95+3pVvbGYoO ECPivYLlIIgzh4JRpRQdSKVewxs5TqSOc7Fjq9LI/I9XylD0k3GwhSVwvYdKAPJ6fhQcCIyeagv uX+tI+vwiGKZIXEGskAnZfwjacFGXNFY8hQKwXSiBooGOi5Bmdqh7FwGlomD0+XPFzSqUkyLJ4u qqUQ13wRtzhsc7FhtAlIHw2yrME7IeTNrORvMj9NSD1BEixkbPEN6uc22OqcVS/+bF+PyFVIL4j NEJbL+MzL5fhn176g4N+LyG+L7fpLqJvjWwgHOOmOZk0CTwie+3BOocSd40x7giMK+RhpOJPiDQ v0SF1Cy6EIdDlduw+X5sl681DnxfiPWMg3FZ1Sy2OGhh7M0UKc20QG3ecnPvMZys7AmalVQY14E 8ywJEmETlZS04IXHms1rYHSYGBL2DP4tNxOGJNNE4Prn+GgvrOltn4hs5agcW27LEZSHJsj9d7N 8KUwp2YTb4FzNfQ== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B During the probe, driver enables clocks necessary to access registers (in get_temp()) and then registers thermal zone with managed-resources (devm) interface. Removal of device is not done in reversed order, because: 1. Clock will be disabled in driver remove() callback - thermal zone is still registered and accessible to users, 2. devm interface will unregister thermal zone. This leaves short window between (1) and (2) for accessing the get_temp() callback with disabled clock. Fix this by enabling clock also via devm-interface, so entire cleanup path will be in proper, reversed order. Fixes: 8454c8c09c77 ("thermal/drivers/bcm2835: Remove buggy call to thermal_of_zone_unregister") Cc: Signed-off-by: Krzysztof Kozlowski --- drivers/thermal/broadcom/bcm2835_thermal.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c index 5c1cebe07580..3b1030fc4fbf 100644 --- a/drivers/thermal/broadcom/bcm2835_thermal.c +++ b/drivers/thermal/broadcom/bcm2835_thermal.c @@ -185,7 +185,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) return err; } - data->clk = devm_clk_get(&pdev->dev, NULL); + data->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(data->clk)) { err = PTR_ERR(data->clk); if (err != -EPROBE_DEFER) @@ -193,10 +193,6 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) return err; } - err = clk_prepare_enable(data->clk); - if (err) - return err; - rate = clk_get_rate(data->clk); if ((rate < 1920000) || (rate > 5000000)) dev_warn(&pdev->dev, @@ -211,7 +207,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Failed to register the thermal device: %d\n", err); - goto err_clk; + return err; } /* @@ -236,7 +232,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Not able to read trip_temp: %d\n", err); - goto err_tz; + return err; } /* set bandgap reference voltage and enable voltage regulator */ @@ -269,17 +265,11 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) */ err = thermal_add_hwmon_sysfs(tz); if (err) - goto err_tz; + return err; bcm2835_thermal_debugfs(pdev); return 0; -err_tz: - devm_thermal_of_zone_unregister(&pdev->dev, tz); -err_clk: - clk_disable_unprepare(data->clk); - - return err; } static void bcm2835_thermal_remove(struct platform_device *pdev) @@ -287,7 +277,6 @@ static void bcm2835_thermal_remove(struct platform_device *pdev) struct bcm2835_thermal_data *data = platform_get_drvdata(pdev); debugfs_remove_recursive(data->debugfsdir); - clk_disable_unprepare(data->clk); } static struct platform_driver bcm2835_thermal_driver = { From patchwork Tue Jul 9 12:59:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13727867 Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (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 D716115ECC0 for ; Tue, 9 Jul 2024 12:59:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720530000; cv=none; b=pm2hPyo15r+mbBL9cMdMw1Q5Za9j+gdqJwmSsGTovgG6iPuLgPVMyGG0dJ5yTvttJ633oKFQpRhi0OnPEOXbvYI3JYnCro4I9Za23LuDHkxEi84nZ+FgsdApiOBluHOJ6rWxPtM85nFpgVnE1tF92H+QF4iJBbH8aE52HcRMX9A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720530000; c=relaxed/simple; bh=RjQC1uaBbB53Yhyi/P627uqyyfOFXDOXyq3s45ZWBxM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tkQiCWdZ43MAroIZ/HI8uG+gyvp1/fHZ0GP0uM4pHy7l2cVpHv4nB+sXuv/B8cRA6EyM1wZE9KrvQGWKYYM8KGkbI/e/NzZW3BoCWstEfO3ZnxF495RwKWL8LT7e3RQRxxZDL66m9xyRdxIqycC5LcwIIh2JPasZsc8LQavPSI8= 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=s2p9CGks; arc=none smtp.client-ip=209.85.208.47 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="s2p9CGks" Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-58bac81f419so6777370a12.0 for ; Tue, 09 Jul 2024 05:59:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720529997; x=1721134797; darn=lists.linux.dev; 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=fJcFoKTGACpTmim9P1Jj976nNi4mK1jNtUQEiTDOytw=; b=s2p9CGks9a8Bbi6XJ9ByzUprNuHqXM9nl8F+zAIaVKbS2bVc6eWAXPaCiyqqGhGFNd MTUQvPmS9WRrGJORWJP5MGbyCASD1GFqL5k5DMB6ykgCvVzJXXOWvaAEcaPX6B3/6L+E jAplLs3ALb7ckOfWkJRECfi6gO0lM9mHyLbrh5qkvj9Zyy1Nr78bNx2d+qpr+qNUCCSO PsXYlcnI1DWx/oe7fQdfTejkiomyVpVGE40E35IlP2PcNKHHtNuQUTP+XbmW46Jxqz9a xbdpKqp218OmBJIVbwF7r9RKM+6XCqIQE5STs3ZdYaHQzx4RXlsAk/Eh0NkAMRyvVtpD j5EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720529997; x=1721134797; 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=fJcFoKTGACpTmim9P1Jj976nNi4mK1jNtUQEiTDOytw=; b=mDxYuUxmCOCwvyj1UKhzIldQ63fH+8ZeQp6T7SvkNukE8KlJpATevuDAniallcBRdc nd4F7NsXxFxgV8XtR3Pi9qnFHrdtBQBNgp0u6VwFfutHZO+cr/PSvMs27/X+6hA2YxIG wangHJwZoqUhKRBJVPV1yXdE9Fs4TaZ38mrLn+l9Qo89kooAWUhPNK+ql25/CrNMNNgJ M1FBh91vK+pyfEMCHo0X1bKIEZGRLiNf2QmJxvAhXZNGICJtuU31VWnsN+MDXmXXeiTz /bsKNEs08XIW7tsysQ7Ed54SjVdOFrNjMYofbrG6GzjIQcAgey14fbkEvaP6Z/eEbnbG W4AA== X-Forwarded-Encrypted: i=1; AJvYcCXOb4LgUUcj+QjrpB92xggthVhXtsDzjbZXNcwTFmFX0yYDGP1inVZIXGEPxc9w00os4VEnlpmMQQta9YFv46VUH+Vi X-Gm-Message-State: AOJu0YxfnTfy/HqomXHgCbZ2c9GyUkp1ra/LZ6DV/YXo5Xk5J7Prn7O8 xA5z6nsFqpPZQJm8U2cUWrnF2a0Hy8L7r7ifx4LF3LvC0lCtJyhEYISVFlr+bzU= X-Google-Smtp-Source: AGHT+IG/EpZ0t5toIJgYsDmy+lSlwqUPLBP4gxC5n68gAk80zAa31z2OQcnm9hjDsoTrcaOQEdEFCA== X-Received: by 2002:a05:6402:3549:b0:57c:8022:a3db with SMTP id 4fb4d7f45d1cf-594baa8bb2amr1889713a12.6.1720529997238; Tue, 09 Jul 2024 05:59:57 -0700 (PDT) Received: from [127.0.1.1] ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a780a6e157bsm76643166b.80.2024.07.09.05.59.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 05:59:56 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 09 Jul 2024 14:59:32 +0200 Subject: [PATCH 02/12] thermal/drivers/broadcom: simplify probe() with local dev variable Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240709-thermal-probe-v1-2-241644e2b6e0@linaro.org> References: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> In-Reply-To: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Alim Akhtar , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Amit Kucheria , Thara Gopinath Cc: linux-pm@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2740; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=RjQC1uaBbB53Yhyi/P627uqyyfOFXDOXyq3s45ZWBxM=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmjTQ9amtrI+aNEa3oCx4ZxPydRqeuklpa52dAB LGNOL97Zk2JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZo00PQAKCRDBN2bmhouD 1z5sD/99WDRBu4QU5V6WwYvNDyQArr+Kc2PBsmf7Idjv8/MU3ZqLQIQuCWsC5nPd11Ql1+rOivm OEh6aMGPc06qrxHrXChjSuuZT1n2lUMbuT4NSG0enYERdETI3Ocj5LE/XiwWz0CO1ONudHpaBsH F+PRAMNIuskbDHmKhGgaMzY4ekLQUD2ari8bhiE6AWwC7iBqwC43Vz1Y5a9TiIBU7GLLGDleKaR p1S2xYbuRg1L5MrR42iA0Yh/ZERZPK6pe9aZqRR/OKrAAQE3U20uV7o+ujzlOEpgjCpIUODy2hz MclX9k/EQI6gIgM3OVI4raCPyFOpmGybe+XhpDJl+Kpl/Su756LC2Njv61g4LkomaJ9M2QDtJME VFz036ln7aRMRWHLnYhwRLQOgrK3P7ZqDLv84hNPcgC7cSpKGXOvY/+9SoybNVYa27VTUX4M93R +yfkJx1zshd4RJbTAmPt5GUkf40Zw3hwD4iEB2/soETgKykZNflVmSMC6byQaem9oq9I4qd5ixh CG8JnwcJolzgqSh7/6gj4qSj6GlZVaJJT50IelYMGOGCj/TFCL5oayXWeKgNG7i5tYfKZXO69mc dFzUE5BnRVEncP9OHsl4AJ530wlEYhnH2y1o3wUuFmuRFyLbRdCabfqKDg18j1PksVyDdKs/xOo lpZZiFYAvBM7lXg== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Simplify the probe() function by using local 'dev' instead of &pdev->dev. Signed-off-by: Krzysztof Kozlowski --- drivers/thermal/broadcom/bcm2835_thermal.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c index 3b1030fc4fbf..38fb0c8cd55e 100644 --- a/drivers/thermal/broadcom/bcm2835_thermal.c +++ b/drivers/thermal/broadcom/bcm2835_thermal.c @@ -163,6 +163,7 @@ MODULE_DEVICE_TABLE(of, bcm2835_thermal_of_match_table); static int bcm2835_thermal_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; const struct of_device_id *match; struct thermal_zone_device *tz; struct bcm2835_thermal_data *data; @@ -170,12 +171,11 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) u32 val; unsigned long rate; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM; - match = of_match_device(bcm2835_thermal_of_match_table, - &pdev->dev); + match = of_match_device(bcm2835_thermal_of_match_table, dev); if (!match) return -EINVAL; @@ -185,28 +185,25 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) return err; } - data->clk = devm_clk_get_enabled(&pdev->dev, NULL); + data->clk = devm_clk_get_enabled(dev, NULL); if (IS_ERR(data->clk)) { err = PTR_ERR(data->clk); if (err != -EPROBE_DEFER) - dev_err(&pdev->dev, "Could not get clk: %d\n", err); + dev_err(dev, "Could not get clk: %d\n", err); return err; } rate = clk_get_rate(data->clk); if ((rate < 1920000) || (rate > 5000000)) - dev_warn(&pdev->dev, + dev_warn(dev, "Clock %pCn running at %lu Hz is outside of the recommended range: 1.92 to 5MHz\n", data->clk, rate); /* register of thermal sensor and get info from DT */ - tz = devm_thermal_of_zone_register(&pdev->dev, 0, data, - &bcm2835_thermal_ops); + tz = devm_thermal_of_zone_register(dev, 0, data, &bcm2835_thermal_ops); if (IS_ERR(tz)) { err = PTR_ERR(tz); - dev_err(&pdev->dev, - "Failed to register the thermal device: %d\n", - err); + dev_err(dev, "Failed to register the thermal device: %d\n", err); return err; } @@ -229,9 +226,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) */ err = thermal_zone_get_trip(tz, 0, &trip); if (err < 0) { - dev_err(&pdev->dev, - "Not able to read trip_temp: %d\n", - err); + dev_err(dev, "Not able to read trip_temp: %d\n", err); return err; } From patchwork Tue Jul 9 12:59:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13727868 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (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 CA8DA15F404 for ; Tue, 9 Jul 2024 13:00:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720530002; cv=none; b=kQfls+DHme60F5dlzVL0nilgl4RwDh9WAjlltM4Py96335J1q5eeqTFvOl4gU0x7fVo9asNLN36ymBMmpBJp0/n+twJJBUXEr3k8YQIxX215ECYmEdBTUd3zqWk0C6d091M2/4J+MVMTUEXmFD5zBT90pEpoHvRLv25wIzxlrv8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720530002; c=relaxed/simple; bh=OijG91pxohtoBoygJEbdOuZXOxwcKuzTYhtA02WrXbo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tXMZEtO3lIs5BQ2xz3QhDRspzr0o3eb+Ybc3Lju+zEYjH2JloQjp+71v89MmRNLki7rmNEGpuSQJg+wdNQaCcovxQb9xEYO9UU2l1aiPKEgsNG2r/0nuALR71HFvfMIAwcZh+qdkx++WvKMuuUj3VIyJzLzrBkyJHVOgS8WWNJY= 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=cjpmb35G; arc=none smtp.client-ip=209.85.218.49 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="cjpmb35G" Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a77c0b42a8fso740754266b.1 for ; Tue, 09 Jul 2024 06:00:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720529999; x=1721134799; darn=lists.linux.dev; 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=ZQuLEB2qJiap/Sb1rNOVpqnW1WOGzgRU7mgbm+ne3kM=; b=cjpmb35GGwpOARcyqnz3Dk0upIW12sXYV7CmiS1DXsoigf0sp6SdW2ksTk+NMaq+C4 q7gC6th+LEGVe8ZOvMWdNw1yIupVigkytEUi13mhFevt+1FH1BRCVKY56SY5YLxL7Xc0 1aRysJQ2fvcTFKgw4G2WilmyFWorDkgQ1mxR3coDAmoV4Rl53ABIfeWmqw/eBGv4oFWL bhg7winHB1ru59UrCg2+50NCq3KHBuITtbrIuxQLRMDC6EKylaw/Y8BVGDdU7SCkIrIH v8Bvf48WVUNUMMf1EkErYRfBdVutKQyC/Dc1WNwVmppQjWgxAnzM5oyshAPIm3iM9ePx Yguw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720529999; x=1721134799; 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=ZQuLEB2qJiap/Sb1rNOVpqnW1WOGzgRU7mgbm+ne3kM=; b=wXG1rV8GELHisSXNvOQxL1OVmwei3McrF8ROWnRdp7uO/G371T7hmg0qI7SwK5Rv/3 EKnnIjYSJhkbMKGr2W4N9/2G677471u0UmhnsrGVG67JUMu6k2qJ1eOIstmhZhvcz5sl +41wi5JzIST/XnNPlj7zs7IxvPdrXakofTQP7ht4D4sJM/EKIu8LnV/R00+fgaM/SeSW 4IQ36Fecnjp96Phv0wqGNVDbKEqt5IsEaCOjHpgCroZYuk230IPNHKxSB3GG1duUZRf3 Rj1b9xXuFvp0tSWnVMiOm4/vijnMPyEudsHyC/ZydnE7wg9j0qaBMBFwvQfWBEsQBK86 doDA== X-Forwarded-Encrypted: i=1; AJvYcCWzFVs/3+Ak5uOVpUisBcahkB6RIS2nsJixHb8D3bPxMoof0m6IzQ4CQoGf4EFyRrOKvX455n9sr5xgOckTSHOhceMe X-Gm-Message-State: AOJu0Yx5Pm6ewB0A2aiMmaWSeEREnluFc/DKne9TO99lAuAlkcndjz47 zPtlcrExlpJCrN/353MbsbYP6HHE/Wa7eqC9K6JyDjzsn0D7VOq96LRtgmYgiOI= X-Google-Smtp-Source: AGHT+IG12HwN3oOxV5hf+vTQSpbBBffLJn47R5BWqdvk7Xi4diWDjFI7QV0oZXZEBE2qrC3e3l9eZg== X-Received: by 2002:a17:907:72c5:b0:a77:e031:bb86 with SMTP id a640c23a62f3a-a780d205cbemr218452966b.7.1720529998995; Tue, 09 Jul 2024 05:59:58 -0700 (PDT) Received: from [127.0.1.1] ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a780a6e157bsm76643166b.80.2024.07.09.05.59.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 05:59:58 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 09 Jul 2024 14:59:33 +0200 Subject: [PATCH 03/12] thermal/drivers/broadcom: simplify with dev_err_probe() Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240709-thermal-probe-v1-3-241644e2b6e0@linaro.org> References: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> In-Reply-To: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Alim Akhtar , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Amit Kucheria , Thara Gopinath Cc: linux-pm@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1540; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=OijG91pxohtoBoygJEbdOuZXOxwcKuzTYhtA02WrXbo=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmjTQ+KcwZ4sIM/T90SNpy8ww/f8bdoOXoppWYY mXI1iMiuJyJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZo00PgAKCRDBN2bmhouD 11OsEACJOyTM86nzWmM/BzFwLdVuJV/2DH6g3mQPuq2GGBnXAHIMRtvUbz2BP+ih2B6JC8Z6/ur MAqux6dSBfcoOc+MU7XWRZ8uYvum/gL3re3U8jXbimRlx+2qzMFt1QZO88NV8rnN9iFaGdUoGxA MtO/FNAhuo5iQ5bgcJXLIYeQBgIXar4vzUAU5OypZWh1/naZF/rC491zwxSB07ys/oc8TWYQcB1 xyk+Mi2rQbIUEdv70pZWZEFrAfY8iRHbe3V2Q7/XO/ngND0r1sjspA8ptXvbLPU2ZRH0XG+8E5U mrpTjT0VbZKQRIEGfrocUnzk0r9ZrFIQ8dPu2BArl8Xu2lBTBy1zPN/i6Rmptn6QtHxFx4BF/8t Q1o6AIE2BeICgCJgNma++YwfzknPOw7zuAIVopKN97TYGzsmfvZHWOofylss/QYBxPGEb0o7VPZ so/S7+rrIjTjTfssg/m9s4ezQ0yM8TMcKi6Oj7dxoXqoiwj41Ikh8FtHyWxKVc1vZZX2H/sTTOi 5Hfl+SAR4qF1wMxUm/NEAhOvcAau0T+nAEtOmJaLkQyZZdcMJU/w7CD4KXry2rFhqXFWgPo9e6e leIa/cg0ozwCwDxSTE3/5jvoXJnlI7A4IAFWeuaXAD3HxJFqxHzTJO04YY6LaRB77Gs69KI98sW aVSnrWo/wvreT8w== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Error handling in probe() can be a bit simpler with dev_err_probe(). Signed-off-by: Krzysztof Kozlowski --- drivers/thermal/broadcom/bcm2835_thermal.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c index 38fb0c8cd55e..5ad87eb3f578 100644 --- a/drivers/thermal/broadcom/bcm2835_thermal.c +++ b/drivers/thermal/broadcom/bcm2835_thermal.c @@ -186,12 +186,8 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) } data->clk = devm_clk_get_enabled(dev, NULL); - if (IS_ERR(data->clk)) { - err = PTR_ERR(data->clk); - if (err != -EPROBE_DEFER) - dev_err(dev, "Could not get clk: %d\n", err); - return err; - } + if (IS_ERR(data->clk)) + return dev_err_probe(dev, PTR_ERR(data->clk), "Could not get clk\n"); rate = clk_get_rate(data->clk); if ((rate < 1920000) || (rate > 5000000)) @@ -201,11 +197,8 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) /* register of thermal sensor and get info from DT */ tz = devm_thermal_of_zone_register(dev, 0, data, &bcm2835_thermal_ops); - if (IS_ERR(tz)) { - err = PTR_ERR(tz); - dev_err(dev, "Failed to register the thermal device: %d\n", err); - return err; - } + if (IS_ERR(tz)) + return dev_err_probe(dev, PTR_ERR(tz), "Failed to register the thermal device\n"); /* * right now the FW does set up the HW-block, so we are not From patchwork Tue Jul 9 12:59:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13727869 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (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 37C5D15FD1B for ; Tue, 9 Jul 2024 13:00:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720530005; cv=none; b=SoM9Chv4oIGHEriPautPPn1mrV5SAicpvHVWcYgUh0GhPUMTrBRloQ+l+PibFADyqrkXflD2KpRCqY+1l8TSRqsOUzEoKdFQyuaHUxDb5+DJKpWvBKMODGgtd9Eml5u5sJDDv16npily1MdP71P0Lq9M0hDAIt7QwhcTMnAJNsM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720530005; c=relaxed/simple; bh=V4wSJ9/Zb1OXU1R9ZZfaP5PWSHjzT4TIbVQkHNfaWtE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YRnIFVX64YlZrFsYwdiJhZfWMbgtTjTB6hnDK8i3BGImz7ftjA1lHZB1+paC5/l2Ez0B3FrzSLd+UajpMIsrnAStdl0iQ+YHvNiHQ2eztGcuBe6iesm5F7gxCWwC2iH6BNzqtf8/1GfCnL2GbhW1I5vuFFuv88PdXNKtOv4oyG8= 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=k0Q1ULMz; arc=none smtp.client-ip=209.85.218.54 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="k0Q1ULMz" Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a77c9d3e593so445008166b.0 for ; Tue, 09 Jul 2024 06:00:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720530002; x=1721134802; darn=lists.linux.dev; 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=f78oiEcMG7OsR22tQ6+SmmwoeavBfLjWwNnYHK7srHU=; b=k0Q1ULMz2x7fZPK1wUb41/lawIdAbBK9D1l3pX9p7hV+jAhsxXjH1DVGZKpjJ4cJP0 qH5bE4L7dryVtulKgYPcgPWlzV1u4Y16/I9Oy04Qxl0voyB8IKgY0ekHKN4T3BSxTtWb FYyMAxbf6Kxa2aozVmD1+tvtHmKMrmuTJFkG4dM4vcVu2WmxS/lr+DGqXA/Gw5tY7rer o5h5EMeD1kOaTs6Kj1Jl+ju/FdYWH0wWhmUPgN5J4ve9rdx27LRlhcIphUzXCYq+Do9A DcaQU4k+X7FNiGjKEHhdVEsnx2/GARXMYd4Jl1XKEKXBUGV0Fjm0HZdaFSDy4pwTWKDX 8T1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720530002; x=1721134802; 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=f78oiEcMG7OsR22tQ6+SmmwoeavBfLjWwNnYHK7srHU=; b=mHWvBkDlOrJK1M4Pyy+0NQVQCZQGILxkRoR29v9BhmbVfGNXpC96YVIK5quyG9cmWf dYJr796TuHihgA0UNth3fTYcF41RxYOFh4f1DB8TN+QVomoyPvS0vkjZqY7y/bSqIzrA kvJ4HBO9VhcOS8mjNoeIODnT6GmbQgvGpgOBm9VUTBa5smqEAnhP7Py4ZQiZQijpBFpK Vz5Uz8wbJ+GpLmG44Yz3/a0yqf9wnuWXiT+0lt45UsEQRTHNwhviUbyHbJu5sm2EekfK kN/6FEcTDGPoL28EKQ5Z7ofbt4yts3lEOm/cl2V0swxWkSGYQ3WQvJlHm4hDSM01uDIe PQtg== X-Forwarded-Encrypted: i=1; AJvYcCUqC8rb9Y8kd4YRblEszr2Wt7WzpyMHLJxhm+8QXwWJTjcnNi0ln/oLRzvFxXMM7C5E4jT+VkZ8wJ40wroiC4EjcI+z X-Gm-Message-State: AOJu0YyLWdUoSWRD9xLzqfaiPy2w+XHfpQh2jSjiQ4/TVGq5JwNt8rOz 6NOOwa4825/uCyWv4yPZ3S0G1VY6PRK8AhttfNEUIoRVq6T7EcKLfyczQVxJBHk= X-Google-Smtp-Source: AGHT+IEeriJvbTmGkLzoFhu4w4DX/KE/KgTI6bDgim7aEIkTDJf0fpBsm7D1mMLhV9g+9hF62pQ5nw== X-Received: by 2002:a17:906:4713:b0:a75:4723:b3b3 with SMTP id a640c23a62f3a-a780b705254mr136181866b.44.1720530000690; Tue, 09 Jul 2024 06:00:00 -0700 (PDT) Received: from [127.0.1.1] ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a780a6e157bsm76643166b.80.2024.07.09.05.59.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 06:00:00 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 09 Jul 2024 14:59:34 +0200 Subject: [PATCH 04/12] thermal/drivers/exynos: simplify probe() with local dev variable Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240709-thermal-probe-v1-4-241644e2b6e0@linaro.org> References: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> In-Reply-To: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Alim Akhtar , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Amit Kucheria , Thara Gopinath Cc: linux-pm@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4669; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=V4wSJ9/Zb1OXU1R9ZZfaP5PWSHjzT4TIbVQkHNfaWtE=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmjTQ/AnkEzKq5ROG0a+eokqfAmnj00xbIkiQ4a TFG6e2ZyWSJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZo00PwAKCRDBN2bmhouD 1yZiD/4jNvAShM4vglgexAc6XF/2hixi58swvYJA00t+uj23rUy04E4TT5ciStwziYrSXtyTYS2 0ZILGpEelDV1fULI+qPc72lCRi/CsxEDWDVwbyz2vcmzrjpPg8TLVNEF2bDYMEzWZJuF3fcyJVg MArkSKydEbI8fK7VkN/oIypSNFYPLK1kX1O2kFB1MxqRBeYNlGxrJ5Cpi2E5B10JKTa2bWoq6Cl t5SKAgFs0pmuMaxbNkFk5M2kMv19vubS3mdRbTM0MAVpm+1ahnkR4ITwRWLn4Z45+mkD7Vq28PU IREO9oeydPTG2P8Qzy6GgWyqM0es0aTTqrKsYlhOUehuusp+fIScfz+4Dm+9RPT75gw6K7WG0Nu FM87LThd67ixjFpPpEz2Y5EWtbbNQhX654q1xukNTqfBgUuTkxRsm0FC3od7CR+B2EEoMCpKbhe FVSvaKDt1C9tqzJGPto4TKWlsjsZC0fBnhFdAuA5jxRV1nV0Oq6i9WozDtIEqRthg2XR/ACSylx feEUOeSiCcD7O30FLRBLUQlql/MieIi2CuvNFHrfQme6Ae0FmS2bWWUCBGOwGKk+QrNeMmS2BdD Cj7XmcbgfRI2bor7fZTkZIWy33PLEDmtlrIU9lJJKx1t30DFM2FMhVJjL13bf37N1kJbF5YF9nD HzUVw4zpL0aqBJg== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Simplify the probe() function by using local 'dev' instead of &pdev->dev. While touching devm_kzalloc(), use preferred sizeof(*) syntax. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Alim Akhtar --- drivers/thermal/samsung/exynos_tmu.c | 42 +++++++++++++++++------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 6482513bfe66..1152871cc982 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -1004,11 +1004,11 @@ static const struct thermal_zone_device_ops exynos_sensor_ops = { static int exynos_tmu_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; struct exynos_tmu_data *data; int ret; - data = devm_kzalloc(&pdev->dev, sizeof(struct exynos_tmu_data), - GFP_KERNEL); + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM; @@ -1020,7 +1020,7 @@ static int exynos_tmu_probe(struct platform_device *pdev) * TODO: Add regulator as an SOC feature, so that regulator enable * is a compulsory call. */ - ret = devm_regulator_get_enable_optional(&pdev->dev, "vtmu"); + ret = devm_regulator_get_enable_optional(dev, "vtmu"); switch (ret) { case 0: case -ENODEV: @@ -1028,8 +1028,7 @@ static int exynos_tmu_probe(struct platform_device *pdev) case -EPROBE_DEFER: return -EPROBE_DEFER; default: - dev_err(&pdev->dev, "Failed to get enabled regulator: %d\n", - ret); + dev_err(dev, "Failed to get enabled regulator: %d\n", ret); return ret; } @@ -1037,44 +1036,44 @@ static int exynos_tmu_probe(struct platform_device *pdev) if (ret) return ret; - data->clk = devm_clk_get(&pdev->dev, "tmu_apbif"); + data->clk = devm_clk_get(dev, "tmu_apbif"); if (IS_ERR(data->clk)) { - dev_err(&pdev->dev, "Failed to get clock\n"); + dev_err(dev, "Failed to get clock\n"); return PTR_ERR(data->clk); } - data->clk_sec = devm_clk_get(&pdev->dev, "tmu_triminfo_apbif"); + data->clk_sec = devm_clk_get(dev, "tmu_triminfo_apbif"); if (IS_ERR(data->clk_sec)) { if (data->soc == SOC_ARCH_EXYNOS5420_TRIMINFO) { - dev_err(&pdev->dev, "Failed to get triminfo clock\n"); + dev_err(dev, "Failed to get triminfo clock\n"); return PTR_ERR(data->clk_sec); } } else { ret = clk_prepare(data->clk_sec); if (ret) { - dev_err(&pdev->dev, "Failed to get clock\n"); + dev_err(dev, "Failed to get clock\n"); return ret; } } ret = clk_prepare(data->clk); if (ret) { - dev_err(&pdev->dev, "Failed to get clock\n"); + dev_err(dev, "Failed to get clock\n"); goto err_clk_sec; } switch (data->soc) { case SOC_ARCH_EXYNOS5433: case SOC_ARCH_EXYNOS7: - data->sclk = devm_clk_get(&pdev->dev, "tmu_sclk"); + data->sclk = devm_clk_get(dev, "tmu_sclk"); if (IS_ERR(data->sclk)) { - dev_err(&pdev->dev, "Failed to get sclk\n"); + dev_err(dev, "Failed to get sclk\n"); ret = PTR_ERR(data->sclk); goto err_clk; } else { ret = clk_prepare_enable(data->sclk); if (ret) { - dev_err(&pdev->dev, "Failed to enable sclk\n"); + dev_err(dev, "Failed to enable sclk\n"); goto err_clk; } } @@ -1085,33 +1084,32 @@ static int exynos_tmu_probe(struct platform_device *pdev) ret = exynos_tmu_initialize(pdev); if (ret) { - dev_err(&pdev->dev, "Failed to initialize TMU\n"); + dev_err(dev, "Failed to initialize TMU\n"); goto err_sclk; } - data->tzd = devm_thermal_of_zone_register(&pdev->dev, 0, data, + data->tzd = devm_thermal_of_zone_register(dev, 0, data, &exynos_sensor_ops); if (IS_ERR(data->tzd)) { ret = PTR_ERR(data->tzd); if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, "Failed to register sensor: %d\n", - ret); + dev_err(dev, "Failed to register sensor: %d\n", ret); goto err_sclk; } ret = exynos_thermal_zone_configure(pdev); if (ret) { - dev_err(&pdev->dev, "Failed to configure the thermal zone\n"); + dev_err(dev, "Failed to configure the thermal zone\n"); goto err_sclk; } - ret = devm_request_threaded_irq(&pdev->dev, data->irq, NULL, + ret = devm_request_threaded_irq(dev, data->irq, NULL, exynos_tmu_threaded_irq, IRQF_TRIGGER_RISING | IRQF_SHARED | IRQF_ONESHOT, - dev_name(&pdev->dev), data); + dev_name(dev), data); if (ret) { - dev_err(&pdev->dev, "Failed to request irq: %d\n", data->irq); + dev_err(dev, "Failed to request irq: %d\n", data->irq); goto err_sclk; } From patchwork Tue Jul 9 12:59:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13727872 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.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 0283C1586DB for ; Tue, 9 Jul 2024 13:00:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720530010; cv=none; b=HyhpTcDxx7mGf3oCCzMZE7D183dApTZLjzl+54JXtcaiHfH/6g+dkKMdIMDgWjLt7LpgnWsEsZIckABE5NDVwZ8naz+O6qChbvUv8BODD5MBM7xn7ud0Dc5csy6YZ7tClrniEoB+G5xAz7YmF+MUwJ/C2GEhgeLLy+joGLLYkqQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720530010; c=relaxed/simple; bh=uAMTrcC0mVom85qx7RgLzbVpmGNoowEa4jhQ0iR1o5U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DMikH6DvF2QUzmTJSs9AJBPIOUDJ1WA9W1iRVPx4C0DqF2p7MnYCc+5WCQe1tOmzYM6KhNB3zVUSLZUUaYT7NiwI08IL0/IeSLrpuDLd9YCSMS+PXzQiXJNMM6SLZz2gzoYnWji6cR6zl+DcqsYmxET08gzgiRV7VIU4/JSIqps= 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=Vtw5lbDY; arc=none smtp.client-ip=209.85.208.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="Vtw5lbDY" Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-595712c49ebso576258a12.0 for ; Tue, 09 Jul 2024 06:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720530003; x=1721134803; darn=lists.linux.dev; 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=ybUy1HdKJy0SC3jBHxTxEhNlXRYkfN8Lxd1LqP4XqS8=; b=Vtw5lbDYqC/6UL0btnhynfHgTskzQ6r3ZpvLGb17qJiTtO76FgIS8TFln08EqFIiKY Ki+D59jXbBlzbV64+qeT+DUdOZRX+ASZ8f07v8tnKXkecc2LzUcFfbsN2No5gdfRHVrk KhJA9MEjd/0VvlXKHltS0NBEyBKJpWcQz85XM6p7pjIjZiRrkAfhP32OtVSQrkxUj8HT AIjOgNDZZj3ovtkcQTbZTVKIq4zIlGLEWPSRDARsI8AAhgGou6zwRDnuQSMEzf1paKMZ eAPFoQfPbZowuO9p4BcOp8ZzDAwP5OtxTD8uL+0lY3uJyXb4PdsTMKVvpuRw/2DeEKSK jeQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720530003; x=1721134803; 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=ybUy1HdKJy0SC3jBHxTxEhNlXRYkfN8Lxd1LqP4XqS8=; b=o8RneXJUkjaP+VoqICbd3wtx8jieIVCtMlknj5qwPQ6Ihw9CfWUa9kgjJYh3LuyxIN MopLYbUjOFu8ulhiQ/8h4kBhinwORscsvQyoeyRqoM/kWcj0h8HFWK4UYRd6NAcio2ER atqn6wIo8KvGFFk63ewMRFeooTH5Vgo+lsS1kf80OQlGVN+hDrF58XzW2uJIIWL+NYS0 oubPH42ayPn5EBbSIL5WpOOqNtVP4rlEmFlpzn7fe67upXHIm5cHVkX2uJhgLeqUWqMS cU9wXQfKvrkWjbaRc9gxHhI+f16PmUSrXs/iA+Eu6AF1T3K7ogJuXmLPygb9GyGZ/aXw IG6Q== X-Forwarded-Encrypted: i=1; AJvYcCXHXV2I1vRDjQe/qgqAjOmdMun3ToKaH+F+IxfTJpokUI2/y5envp4VWKWnWaapXxM4J1l2i8nHUiu2fgmJG6Pw0eMo X-Gm-Message-State: AOJu0YyZ6NiONyZU3DbxyWHOBys/hyIXX6yAGCANGOR22nSngnFihFfA 0QiyObscd1uL++dUukBRDA1AI9MTvfVeE+/4baB4t+ThXKExdICAKSX1HjI9VYzxWNlHiMB36Dg E X-Google-Smtp-Source: AGHT+IEyRyFqkTwfhXvnWJMCl1GxNNv1QnYMVp0FnPJnRyxHf5vBWrGeQmH6Alt/59F10w37lZmLdg== X-Received: by 2002:a17:906:e246:b0:a6e:fb9b:6769 with SMTP id a640c23a62f3a-a780b89ed2dmr142387766b.75.1720530003303; Tue, 09 Jul 2024 06:00:03 -0700 (PDT) Received: from [127.0.1.1] ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a780a6e157bsm76643166b.80.2024.07.09.06.00.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 06:00:02 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 09 Jul 2024 14:59:35 +0200 Subject: [PATCH 05/12] thermal/drivers/exynos: simplify with dev_err_probe() Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240709-thermal-probe-v1-5-241644e2b6e0@linaro.org> References: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> In-Reply-To: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Alim Akhtar , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Amit Kucheria , Thara Gopinath Cc: linux-pm@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2154; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=uAMTrcC0mVom85qx7RgLzbVpmGNoowEa4jhQ0iR1o5U=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmjTRAedXAsDTOKwPCKtVeeBDQKl2GzAwF+mcHe Zf9U59jtBCJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZo00QAAKCRDBN2bmhouD 18itD/9VymA98RLj+xi7Rq9XMA4oXDVEu1ExLXuCaztzc4IZ5DS+lAXwA60GwTRyHSg12gpxodX wGTxdIsXm4HQC6MocbLKhr2jRUFWF5mhHytUE4GUUvT3J4F8fc73MSKOfMa/Le2ZZtj2uvOWBK0 nKj10iZWWvmTqZTX/bn9itKX3HfshX45Y9TLwc2XuczRzqCelbhxTpqZ9N4vI2XdNOQ13wHXq7A LGO2+oDYGzzp4+2ilbIJWIQI598b0kyEqWyYaPtMWlOUVBZRBhOvAG0XnSaJjR0MWXBoNsO+JjJ q4EeU+DKyl/CQnkVw3p8pZrunC3T3EaDD8IknOUF2ZiJyuD37ahtQQvv7clKHWzWiQcAgCGazqp 3X7JYISIOiq8eYnguL6kSLvstAD8KPb14mlScjX/J/vq74Cxp61tA8oPJl0ZwiUzpfGxuQvBTAs 2vQV6Zv/GDJLqwG+vPPrFjVzCId3rhmIfdJCCkHZKopeHQmi/220/XRfXg4UYRvtpado0ozAEaa RBywtVfSWiQMs9txTHYbqQXEz73r3/K/wVi1+mHB6IE4ImufypcbAQLpgM7aqn3HZtprwamb2vZ RMBUeMTZ63ZOlIdRXRwjTG0SULdlI2iKGH2LOTd6JbxVw1wcsy3SS+FrtgP6uKkfxBb1NR0EnIf qywB8pGu0hH/zaQ== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Error handling in probe() can be a bit simpler with dev_err_probe(). Signed-off-by: Krzysztof Kozlowski --- drivers/thermal/samsung/exynos_tmu.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 1152871cc982..96cffb2c44ba 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -1037,17 +1037,14 @@ static int exynos_tmu_probe(struct platform_device *pdev) return ret; data->clk = devm_clk_get(dev, "tmu_apbif"); - if (IS_ERR(data->clk)) { - dev_err(dev, "Failed to get clock\n"); - return PTR_ERR(data->clk); - } + if (IS_ERR(data->clk)) + return dev_err_probe(dev, PTR_ERR(data->clk), "Failed to get clock\n"); data->clk_sec = devm_clk_get(dev, "tmu_triminfo_apbif"); if (IS_ERR(data->clk_sec)) { - if (data->soc == SOC_ARCH_EXYNOS5420_TRIMINFO) { - dev_err(dev, "Failed to get triminfo clock\n"); - return PTR_ERR(data->clk_sec); - } + if (data->soc == SOC_ARCH_EXYNOS5420_TRIMINFO) + return dev_err_probe(dev, PTR_ERR(data->clk_sec), + "Failed to get triminfo clock\n"); } else { ret = clk_prepare(data->clk_sec); if (ret) { @@ -1067,8 +1064,7 @@ static int exynos_tmu_probe(struct platform_device *pdev) case SOC_ARCH_EXYNOS7: data->sclk = devm_clk_get(dev, "tmu_sclk"); if (IS_ERR(data->sclk)) { - dev_err(dev, "Failed to get sclk\n"); - ret = PTR_ERR(data->sclk); + ret = dev_err_probe(dev, PTR_ERR(data->sclk), "Failed to get sclk\n"); goto err_clk; } else { ret = clk_prepare_enable(data->sclk); @@ -1091,9 +1087,7 @@ static int exynos_tmu_probe(struct platform_device *pdev) data->tzd = devm_thermal_of_zone_register(dev, 0, data, &exynos_sensor_ops); if (IS_ERR(data->tzd)) { - ret = PTR_ERR(data->tzd); - if (ret != -EPROBE_DEFER) - dev_err(dev, "Failed to register sensor: %d\n", ret); + ret = dev_err_probe(dev, PTR_ERR(data->tzd), "Failed to register sensor\n"); goto err_sclk; } From patchwork Tue Jul 9 12:59:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13727870 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.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 95859168497 for ; Tue, 9 Jul 2024 13:00:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720530008; cv=none; b=WhHyNRE0z9E9IOTmT5pf77Di6Oi529hvVCuDANcNSFicRfrbxDQZC8iGgh7GhMBRqt7WjQdchruxneroBOpjeIBvLvYiQxFEbLXn7YWWo4TKvGQko9aImdn9abMyKymENijXdDvX0vjjZEreOcailJLBbskkeKYDwZ2ryX4wcuQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720530008; c=relaxed/simple; bh=Q6+hCxLVHj6awAkKLZL/lFMRRO+jJnpOsXWYwuQTpws=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oEKrmIBG8NMPKaXPfdQPOF5VPSxOpdozJ+thJrtSlUD3sRsXU36ROAoJT5Cwro8KRBGV0TlIF1dSxOY10qfpIyZlrExl8V03zyZF/9GWwgPZ/FS+p0U02BjXP6eoP1mi95/lQcjrRdK1uUG1T2FXM79Bx5XKZTRIE7UIXemEXDU= 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=uTP0Y2TW; arc=none smtp.client-ip=209.85.218.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="uTP0Y2TW" Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a77cbb5e987so465066166b.3 for ; Tue, 09 Jul 2024 06:00:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720530005; x=1721134805; darn=lists.linux.dev; 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=lpaXR5hesM6QQA2KpWYBxtlXYQSJSMhrc0LMERSNaQc=; b=uTP0Y2TWdMBGlCunYkcmtEbFSka/U7etFdjJ/3Au3OIStWWZLXVBypXmyr5AALRqG4 j5bmFl39PjvLAxfcHLHFT5MEMZPXoY9xumzGEpRgt4Ohv6RteezKGl6lYd8u5RE3MdMr +l2GBOxUlCprcTjeVh4qeQ+vs6tOP4tbsplY582L/SdYQpaUkM3LaIMh/3oQI/EwukMm cBj/gjXKQZHMtIKZ0nxsYLQ/1UuUlPuNBsMHCckmMc6WIUm4Yp+0snORxVj1wyH7diGN zjm6w2PqYWyibZwA5gXHOkucpAp9gmpuV7aqLU0vTZNOjI+hjgd02xAyFs3WdvZ41XOV rsOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720530005; x=1721134805; 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=lpaXR5hesM6QQA2KpWYBxtlXYQSJSMhrc0LMERSNaQc=; b=ke/A2rZLdd0h0iH4sSHiQLSK2jGv80mCRAh28Sv66qLJZHEcP3t7a5/6k2uXvykQFJ yuhv66EARLzpsMBXj5/vUCDX02Kl5CFLxyVc1xVtU1xQbjabo7VClyEQXEvTC1ktdeMz wh79ttAD1ms0mbrsHP/cVz+0Z/430wf8zPumx+D/W815cTrNQ94m1xmPUc8Zyx7/5bTE 1lmOEX6Mv7ueuFhZgr4cs/lxglaymCnSqyXVu6jiOlfsNo9CLfoYqXxxOxqEBFXX1mux Da+vfUKT93DTUT/p8NJVvez0DHqJ/MwkUtN/L2myt4/ksgml9Ghmbub3pQnFqquGyuQL UKeA== X-Forwarded-Encrypted: i=1; AJvYcCXNuaatcoJ7z5GPjwjXsfhJu0YI4g83b0HveiQMRgR2S3wH24Lvyoj29W/oGn6Lq47c+8g78VJm40aACpq508n5lXvm X-Gm-Message-State: AOJu0Yy+m6+t2FQ+oAJm9Ybe1Z9WkSsjb7q1R5Ymzfm2DGK0yujClkac OnYGqZeEzkoFPua1sZFaeskumXafVNSG2DcC68nU9WLrhN7HkwBp7hgH6h+svVw= X-Google-Smtp-Source: AGHT+IFpuXSVDfR9zcYD6UEE6dUM0zQ38CBB1md2Ad0sjVV+v+MC1CRRqx3iEirLTHQ2eq8mi1TqYA== X-Received: by 2002:a17:906:fb96:b0:a77:c26c:a56e with SMTP id a640c23a62f3a-a780b7053cfmr141321866b.45.1720530005087; Tue, 09 Jul 2024 06:00:05 -0700 (PDT) Received: from [127.0.1.1] ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a780a6e157bsm76643166b.80.2024.07.09.06.00.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 06:00:04 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 09 Jul 2024 14:59:36 +0200 Subject: [PATCH 06/12] thermal/drivers/hisi: simplify with dev_err_probe() Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240709-thermal-probe-v1-6-241644e2b6e0@linaro.org> References: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> In-Reply-To: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Alim Akhtar , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Amit Kucheria , Thara Gopinath Cc: linux-pm@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1065; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=Q6+hCxLVHj6awAkKLZL/lFMRRO+jJnpOsXWYwuQTpws=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmjTRBwaAjkvl6lx45yY9/ImDeEubME5uwgWFGE i+bNA0kPUGJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZo00QQAKCRDBN2bmhouD 11BuD/4vPwK3V9A2LjND5Im9CSALekgwK8+81reARKO6RvGE9eBpawhpL5BznjBw1QsJ6n5wEDW u4HfkL6X73SnVpVPx3wBkV55taP5y2WeYsDyuiSHFVYjPy+iGBCstOTmi+I2w9ep99Qoi+C4f0S saeTt6RowTWLn+n8PNcDYWh0bl6kkVTt25vdxaIEkifGnPnDCOUPrcA9eG0BzgEk4B1pXdyxQun xnzdYByJAnsbHiozgVSObIsmTDQfpk5guaL10G+OlcAWbN8L1i1pAukfDqQvcgRJGuAKviAWrkg EX+bMPSx0PZi2MtGkX53wq5+BHeGXMTuLFGuYXqXKE3i2FhBwAjY5wJp8+ay7pr3PVITVz4/5pD 7bf+V8ig7bAjt2E7vXkYTf79XHF+bZZnmyyyOZfANe/PGCcn7TAS+WTz9KBuN2zDgnYHcpcnIZG il2JHZSSkpyLmdulaW1Zw9To9yd7c6+A3okG8069epEysKAZ90Jy+Vg7xOjiLCe0q5/n27wcgFv oh6z4UgCqokMVSzGM/BdzM5D1DhOqbjQ99uxdOBtm7s3jSZHxnXnl/4v2XW0SNCdrgze9x9ttdu /+Kw/YJn0iYsTK/MqqjfXF/gOCBGincfblbkRGlpqnqB25c0g8opnegbeXBSaEu0tf3nGxYLLZN Hj6BN/VzrNndFyw== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Error handling in probe() can be a bit simpler with dev_err_probe(). Signed-off-by: Krzysztof Kozlowski --- drivers/thermal/hisi_thermal.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index dd751ae63608..0eb657db62e4 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -388,15 +388,10 @@ static int hi6220_thermal_probe(struct hisi_thermal_data *data) { struct platform_device *pdev = data->pdev; struct device *dev = &pdev->dev; - int ret; data->clk = devm_clk_get(dev, "thermal_clk"); - if (IS_ERR(data->clk)) { - ret = PTR_ERR(data->clk); - if (ret != -EPROBE_DEFER) - dev_err(dev, "failed to get thermal clk: %d\n", ret); - return ret; - } + if (IS_ERR(data->clk)) + return dev_err_probe(dev, PTR_ERR(data->clk), "failed to get thermal clk\n"); data->sensor = devm_kzalloc(dev, sizeof(*data->sensor), GFP_KERNEL); if (!data->sensor) From patchwork Tue Jul 9 12:59:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13727871 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.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 492F216A92E for ; Tue, 9 Jul 2024 13:00:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720530010; cv=none; b=YIAVKY9NsQFsXoggn4CFyP+RTv2pPj4GMJ3sg5vfSxMOkB3bxF8Ht1kvlAbL9dq955Whba8lY16/ij8+luCa0mQsmZEK3Nze8dEGZ8jYvfn+LLZabuA2C+WqvSBND9qtF0ULhdnicHyLNxmgBziAYg/rnD7SsX2p+qAQafU8bs8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720530010; c=relaxed/simple; bh=fOrJbRqwoNL/mBzSZDplHqrI4pWk/WZ0qa2hUqE6xXg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=I6yzUhQyjiXyZFw/wtsb484bEeZ/BcdC+IwsPkPr6toOrC1LQ2Wuz2buJSi2IxPyekc6miLG8GiJbaU0+mND+yvjmxYhB2o4sOG9Zz2UvfkNqJqaaRhumcJl3JL9S3Hw3ToPlVNH87mY827K2xZn/uvvXnoVj3rwOfFjW2eL6WU= 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=BiVU4Iio; arc=none smtp.client-ip=209.85.218.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="BiVU4Iio" Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a77cc73d35fso659263966b.0 for ; Tue, 09 Jul 2024 06:00:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720530007; x=1721134807; darn=lists.linux.dev; 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=BiWnHmVQfyhxRnOCy/rrdaP34wGwyHEY70ZKIG7Xyt4=; b=BiVU4Iio/qmmSt8OuYzR2RIyXnTgIVCEvBRDN1dilNJjbXkyX6MT2IUXgjEb8/Ta7O wiUXE4DT7MxzfJWDr6T/Uklhw0sKwadgPKxQFRwZhlx8Xi/EAWsI2Sl6NdZjuF+4palz 1UNEj4fFYSppjr/gqq6f9PCTgmHcEwK1+j1lZaazXfoULsrQt31RUM9Lan2HLncX9bHR +NM4XjCOeg9qPSyMhfoJmOuXlE/66rH6AusFYnMLCbQ6Hr7TxkK6DX8kxFDf80hLujgb gGYdpnFFquDsMRLIvsAA4hQl5gOB/geEzrDGhNU/sAEx8tr5Uk0EOyV1qSOWJl1pflp6 MiXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720530007; x=1721134807; 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=BiWnHmVQfyhxRnOCy/rrdaP34wGwyHEY70ZKIG7Xyt4=; b=QpPaV3EUTvWb/e5p4LwuRvorJkAulNcqEWH52Ah/PElQZl/Dahr0s/f9zFIkzy+fpN nL+lLC2+UAiZf++pcEIuwbu9ilQr/iJzHT69n+WpYqSltR/RR84CZRuCdLO89ehcSg6j vAZXopGY4Z/2fWJwP8kz/9yw7lNypVdHK0ruU3kcSM5Rl5DR/cUMEi65bvihmI5/NqE0 wZrlxvnWwQf/s9WtOXbMxdFMLTVktFRqO+pPF6rSWSQtuRXsYaLmNCXSFE0siDF6/N7u z6cnj71bRTnfX7TTreFLHE4aDzppsoN67YdnCHjhk8imjIY6JyuBELRKm/YgLWxU3EIJ 1nwQ== X-Forwarded-Encrypted: i=1; AJvYcCWx3xpXDJ4V8v7fy/HuYtF142jW1Gk2YauwseMTtIG+IRFh8ilP/nZiniDVTGFd9H9+nY58bxTmRRZz2NlHFHTut9bF X-Gm-Message-State: AOJu0YxqdftzvPZ2ahD0g6g943/PnItPuy3zmU8wjgmnLypvC9NI5ktb DXIXOaFrBnXY10r0Nefz1/HRvgEru1QYGjz/8vAle8dheTlziY2CMeeKdkyVBoA= X-Google-Smtp-Source: AGHT+IEOHPQKtfTU5lqsq5SqdLNwXEKpRHu6JIdoqZhw2lgHgU/t68cvEhBj2tknv9L6i4EcohZFdA== X-Received: by 2002:a17:906:7953:b0:a77:c043:5b59 with SMTP id a640c23a62f3a-a780d250153mr192202666b.20.1720530006772; Tue, 09 Jul 2024 06:00:06 -0700 (PDT) Received: from [127.0.1.1] ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a780a6e157bsm76643166b.80.2024.07.09.06.00.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 06:00:06 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 09 Jul 2024 14:59:37 +0200 Subject: [PATCH 07/12] thermal/drivers/imx: simplify probe() with local dev variable Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240709-thermal-probe-v1-7-241644e2b6e0@linaro.org> References: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> In-Reply-To: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Alim Akhtar , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Amit Kucheria , Thara Gopinath Cc: linux-pm@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4730; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=fOrJbRqwoNL/mBzSZDplHqrI4pWk/WZ0qa2hUqE6xXg=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmjTRC+wuSOQmMAgf0HTOGQ+3cbiEzTu+qndTQX XrnO/ZmR8yJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZo00QgAKCRDBN2bmhouD 1z6jD/wLwXfsB0BUjQImBAY0jUoaEwMbZsLzkKkXxWYMSEJJsBMorYJRBMHvLx+SgY+vuAVABOL Ok+8YBvyDADjY7rZzniYS3hbd+07x0sZSANnK5Q+hLd8IWMeUBYk4uxDYVlS8QtHVK6ppHlzRPj 5GZH6iBKphDTn5JkY/2kzUXaeTTsKf+D29Wo7e1/6TXsRr66JjKJ1vW0G21hWXv+BXt/r5nnVeS tczZFn5mt1nKxNTmzQV1fFgxU7kkckCjvmPastSo9zJEBwUwyYAXl1wfuZZ0t2jVpCkSNJKxMuM lJKnj74/RmBrYAcszQA5DKJ59U+HzLnUBuZ/NbtPcF6aqvDFChPJSjm9ozqfvJTwT11Mo7fzut+ 3OhqeXCRiooQ02P8oGkgN+7kyVMwGkeYW9jcqtKaqsntNd9WKXIl5zEsyz8QJTR6ux4pKFA28V9 HZYosyl2YtFes88sArhx/+vPZPrREun1NtSrKbafkxD8aLO2UYYQ4QCpWnXWRYww3buSXcMnLMz qfKenG7CsOKgwsDIEFQyIpxLpt+zDRgikK9azFdr1PkBhikB+epzAXkZcXYfXNWF2j5XnZYmGQb /xAdoZhKOG9FcXK30AByegtnDBW7AH2wFXgnt2vZ6ciV/e/f5A0w65CpkgxjMEs1U9Y5Clz9B3z qlOOtwrivf/GPsw== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Simplify the probe() function by using local 'dev' instead of &pdev->dev. Signed-off-by: Krzysztof Kozlowski --- drivers/thermal/imx_thermal.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 83eaae5ca3b8..05c24be5343f 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -601,28 +601,29 @@ static inline void imx_thermal_unregister_legacy_cooling(struct imx_thermal_data static int imx_thermal_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; struct imx_thermal_data *data; struct regmap *map; int measure_freq; int ret; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM; - data->dev = &pdev->dev; + data->dev = dev; - map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "fsl,tempmon"); + map = syscon_regmap_lookup_by_phandle(dev->of_node, "fsl,tempmon"); if (IS_ERR(map)) { ret = PTR_ERR(map); - dev_err(&pdev->dev, "failed to get tempmon regmap: %d\n", ret); + dev_err(dev, "failed to get tempmon regmap: %d\n", ret); return ret; } data->tempmon = map; - data->socdata = of_device_get_match_data(&pdev->dev); + data->socdata = of_device_get_match_data(dev); if (!data->socdata) { - dev_err(&pdev->dev, "no device match found\n"); + dev_err(dev, "no device match found\n"); return -ENODEV; } @@ -645,15 +646,15 @@ static int imx_thermal_probe(struct platform_device *pdev) platform_set_drvdata(pdev, data); - if (of_property_present(pdev->dev.of_node, "nvmem-cells")) { + if (of_property_present(dev->of_node, "nvmem-cells")) { ret = imx_init_from_nvmem_cells(pdev); if (ret) - return dev_err_probe(&pdev->dev, ret, + return dev_err_probe(dev, ret, "failed to init from nvmem\n"); } else { ret = imx_init_from_tempmon_data(pdev); if (ret) { - dev_err(&pdev->dev, "failed to init from fsl,tempmon-data\n"); + dev_err(dev, "failed to init from fsl,tempmon-data\n"); return ret; } } @@ -673,15 +674,14 @@ static int imx_thermal_probe(struct platform_device *pdev) ret = imx_thermal_register_legacy_cooling(data); if (ret) - return dev_err_probe(&pdev->dev, ret, + return dev_err_probe(dev, ret, "failed to register cpufreq cooling device\n"); - data->thermal_clk = devm_clk_get(&pdev->dev, NULL); + data->thermal_clk = devm_clk_get(dev, NULL); if (IS_ERR(data->thermal_clk)) { ret = PTR_ERR(data->thermal_clk); if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, - "failed to get thermal clk: %d\n", ret); + dev_err(dev, "failed to get thermal clk: %d\n", ret); goto legacy_cleanup; } @@ -694,7 +694,7 @@ static int imx_thermal_probe(struct platform_device *pdev) */ ret = clk_prepare_enable(data->thermal_clk); if (ret) { - dev_err(&pdev->dev, "failed to enable thermal clk: %d\n", ret); + dev_err(dev, "failed to enable thermal clk: %d\n", ret); goto legacy_cleanup; } @@ -707,12 +707,12 @@ static int imx_thermal_probe(struct platform_device *pdev) IMX_POLLING_DELAY); if (IS_ERR(data->tz)) { ret = PTR_ERR(data->tz); - dev_err(&pdev->dev, - "failed to register thermal zone device %d\n", ret); + dev_err(dev, "failed to register thermal zone device %d\n", + ret); goto clk_disable; } - dev_info(&pdev->dev, "%s CPU temperature grade - max:%dC" + dev_info(dev, "%s CPU temperature grade - max:%dC" " critical:%dC passive:%dC\n", data->temp_grade, data->temp_max / 1000, trips[IMX_TRIP_CRITICAL].temperature / 1000, trips[IMX_TRIP_PASSIVE].temperature / 1000); @@ -736,7 +736,7 @@ static int imx_thermal_probe(struct platform_device *pdev) usleep_range(20, 50); /* the core was configured and enabled just before */ - pm_runtime_set_active(&pdev->dev); + pm_runtime_set_active(dev); pm_runtime_enable(data->dev); ret = pm_runtime_resume_and_get(data->dev); @@ -748,11 +748,11 @@ static int imx_thermal_probe(struct platform_device *pdev) if (ret) goto thermal_zone_unregister; - ret = devm_request_threaded_irq(&pdev->dev, data->irq, + ret = devm_request_threaded_irq(dev, data->irq, imx_thermal_alarm_irq, imx_thermal_alarm_irq_thread, 0, "imx_thermal", data); if (ret < 0) { - dev_err(&pdev->dev, "failed to request alarm irq: %d\n", ret); + dev_err(dev, "failed to request alarm irq: %d\n", ret); goto thermal_zone_unregister; } From patchwork Tue Jul 9 12:59:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13727873 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (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 0271816C842 for ; Tue, 9 Jul 2024 13:00:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720530011; cv=none; b=BAJRwOog0Wm3ez9R5lpgtdnDSWKbCDhfbDQ2UZLGQMvtQs6t/GHFBLyOomDySlzwH1bRNr0z/dUccujWLESp7tegUwR4ZTzuzICRbMnvEYVEFVaZQO4QnsPArPeZlS9EjzUhtxxWXnqZsV8qc5gZ+blHM/An5HnTVCY+rJNixEM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720530011; c=relaxed/simple; bh=tbr6PgVNmRzkFl13kOpzZaHhhH1RUnpU3lH7vfxTRvg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=r1m/PdFAKVhxblp486QjtXME3yjYv483wvbOtqxZ/CwoY5+CrCdtERiAebQQSoxMZyWsKBhTH0/H+cNuIpGgVDbK5D11W9XVymWdQNZ0aiZs+wmfWex9A/sQ/X/NO2UQVcCSW9zfiQvxp1rBi28KHl1Qf81BLGNftdqoicLWP3k= 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=ISMEpCDn; arc=none smtp.client-ip=209.85.218.54 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="ISMEpCDn" Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a77c9d3e593so445034966b.0 for ; Tue, 09 Jul 2024 06:00:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720530008; x=1721134808; darn=lists.linux.dev; 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=Gd8VbJ3ePG1fDwdnkHZrN6+gKJ9mBLGNqM6Qogu2910=; b=ISMEpCDnkvQyP2CiwMpxC9LwUh9MzgR6KwI+svfUtTNYHf1Pal6sPAdklFW+uwk1iR sbhLZsHo8TEKRXYKeUt4hpTczxwkOeZ7YB3+5M/Ws+y5N+QeOeZ0vLjPAsXF6dPeoF0+ E9fqQIWX9+Eaf7vsxCxsX6sclkSLMn/19PkvJlQCWYVV0kHVTHzq2bsMe00PQA1G6s6e 16GbCQbl5KgGNiJBqhPH+DUSt9qP7ibQbB61bl4koMmOf5fCsHec+HUOgFqH1tXfw7bQ 7oET85waUTV5YJgnq8xjn6vQulC5foENlS8ynS3/8oVi8UmD8lmjKjFCuUsilZ8e9d5A VKzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720530008; x=1721134808; 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=Gd8VbJ3ePG1fDwdnkHZrN6+gKJ9mBLGNqM6Qogu2910=; b=R9CQKTCxqSX46RpaOPQoH6jemyDs9qM2pg3HQhXON70NRe8m9ylODfeSv/zpAf0GQe w/KhnmEnJcPRBV4XgfwOxXW7ZoofmPUPJqsOWpj6ejiIS3sszGDVhNP10N80q3LfIeKO OxXdYyX9pdN401Jpjeq8WpBA8PULG6qeqk/hI/lELfiMY7R3NwrFg4jQjr77rWDAGf/D DXE4j8WtdzsZne6Fo/hOcSahCxvDJ18TlzFSE7gsjHYOJiguOybNlBNkvYp81FdJam2m F0OQVLWnE+exmupXaS7oQHyndsikqkEjXPnDW32fI1cL2TGMqEi3MIOi2znU/Wzwot1E 5jfw== X-Forwarded-Encrypted: i=1; AJvYcCVHMWdy0hVDS6t4wQyOlTCSRo397QgSwt6CU38KGy900SkYR1jYMoQ7K4Ai8cUnZCQyXDzxKJswfj07UixXNP/4AK16 X-Gm-Message-State: AOJu0YzZ43G0but6n6MS145wV1laS6JJ1e1DIUP+qTeffaF6bt91Y0Lw +Xe82XyJUYu6H1PPAXsIXdI/McYxQrqTNFEMxMYXw2yU8GWQ/ZYP5o8nOwf/BtQ= X-Google-Smtp-Source: AGHT+IEjW/UsJohNSfeBsSugxbsviw/3TGejetmmkt90XFqWU53RnQehbG4JwQcqefAPiYe5iS5BSw== X-Received: by 2002:a17:906:4715:b0:a77:c525:5c70 with SMTP id a640c23a62f3a-a780b6b1901mr177894266b.32.1720530008418; Tue, 09 Jul 2024 06:00:08 -0700 (PDT) Received: from [127.0.1.1] ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a780a6e157bsm76643166b.80.2024.07.09.06.00.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 06:00:07 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 09 Jul 2024 14:59:38 +0200 Subject: [PATCH 08/12] thermal/drivers/imx: simplify with dev_err_probe() Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240709-thermal-probe-v1-8-241644e2b6e0@linaro.org> References: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> In-Reply-To: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Alim Akhtar , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Amit Kucheria , Thara Gopinath Cc: linux-pm@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=860; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=tbr6PgVNmRzkFl13kOpzZaHhhH1RUnpU3lH7vfxTRvg=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmjTRDz6ULAooyIR/nRlEWHSnnlmjdSZ27//W+I SA+eptt/ICJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZo00QwAKCRDBN2bmhouD 18ObD/9y04bIJtYRViQ9nSmrQCT/Z+mpv9+By83hpVNivTpZFLo7X8j/m3es1Qyl47e1LALCIhR 1PoBYYYc08ic70bYofzLn021hBdarIWbETDTWaUWnZEzYq7D5gVtaESAPW886+9QfegseTa/zfF Llw37q8hOvQLlfxBY3ev9Alwwq3MJDzWYUkVjy4G5kLChtPglSU/Uyjpr8wBkSTlhB5QRJT6pL1 oUYaAh+6R/brIWgvGBO362D3FT4T8h4g9/0Nt5Od+UFbhKT3UIWyymmip8XpP4N+Gls5ncV69TN kDfJsQNrrbfHAZa9DyqdLMKaVWAWGMrKNsdHl2PAc6m6wH7xvDRbkFpstRhSgsprC+n/Ee5+znq UPkhh3bs+qdYtz8ClFuVjQu3CYcnwklAbf7bbUVticdukTNt2s3QUtu7gOyC/kjJAmnWfJtlJ42 8752DAdOe/aDz8VZGjxLAKfRZSrPKPOJ+JU+AiwBx5Z4SdHPaf9DUuaKs32DKjPNpJ3nP88JGv0 /Dyi2loHDCxJtagwisIoFgvNOOQfUWzJdLBa2S68arOgq8jfABTo7byEvx790PwTuWD5hxXkaV/ fj/5iuQ9RFc4Her0dpjLSXHGxcrPWG8vDFxT+wIhyzSdDvTK+qPUe9SNAA4AQ/Ft4IU5ZSYijBI fi85lsTR8VGHGpQ== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Error handling in probe() can be a bit simpler with dev_err_probe(). Signed-off-by: Krzysztof Kozlowski --- drivers/thermal/imx_thermal.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 05c24be5343f..432d21cbd2b3 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -679,9 +679,7 @@ static int imx_thermal_probe(struct platform_device *pdev) data->thermal_clk = devm_clk_get(dev, NULL); if (IS_ERR(data->thermal_clk)) { - ret = PTR_ERR(data->thermal_clk); - if (ret != -EPROBE_DEFER) - dev_err(dev, "failed to get thermal clk: %d\n", ret); + ret = dev_err_probe(dev, PTR_ERR(data->thermal_clk), "failed to get thermal clk\n"); goto legacy_cleanup; } From patchwork Tue Jul 9 12:59:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13727874 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 8858615D5C1 for ; Tue, 9 Jul 2024 13:00:11 +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=1720530014; cv=none; b=GSW3dTbVJbYD981+OL1nL6AywI77UKTKWWys9pdqc2HXRzJpJJMZCn/VJF8+q/jvY3fYJpnMwmn0xhk9sIaAQaLcQTPtVywrmW2L6X6YwgQVAow4iAzr/EnAwU7oIEX/sj68Uhq74OebQoEcswJ9UuZQN56b3g1CTYgQg9T8OdE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720530014; c=relaxed/simple; bh=eEyUFJCaslzrN09N4kRvWhSVle3ssZXjhx/9f1+ehYc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kUSKNhLL8l8bCuJtwAwlP5WGdpr6z2e9HZMrfrnA1+QN/BfXM2rm1NuUHiTBFqSueIZOO1sfAksGFlgy9vkg8UIlEKuz9v1ooYMmeej5n194PbmuLc3WbEyVFosDKE/R2LnET5Vi5UTQPn6Ifhusnxp8RnTDbbbDn8dXMHnSjfg= 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=TwDmtiub; 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="TwDmtiub" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a7523f0870cso625087466b.3 for ; Tue, 09 Jul 2024 06:00:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720530010; x=1721134810; darn=lists.linux.dev; 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=vzW48j6krTR5s34wJWFukT+LbSymS5BDvSeAZWi+Wow=; b=TwDmtiubnfzBUhDck+QQh0oGbxEySsxZrMrGfBRsiRyElv1nEUH39OBOmMvIQ450cf YYyVh5gRWwblh5h+w0IhEKzqnlDADspHKSsk1rt3J7lWKT0QM1WjSuxD+Q8gJ1e+r9PX UQ7opabZpkOhp8q6rYuWz0NcSpGj00NISwBwNT7KlLje6TvSRZ1U+v/a1LzFmQ6s+mdz +f7YZA7IiE7wwcmYn8bqz5HAU4cf/6mscpKBqlf83sX1Btf4nfnPJNUukAC7/2DPR4UZ 23gYs6tg4Z5/KtNoU21YHAKpJaofnGC0rd5tAZYiipwMPU4/wH8NzY0SH9UcCgJMlcKB CIAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720530010; x=1721134810; 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=vzW48j6krTR5s34wJWFukT+LbSymS5BDvSeAZWi+Wow=; b=r7HKqjjD07cweuMkXlTnjxyd9jesH3EHYnuEXoJCg0GZz7N53+WEwIauDjZEeowM1H ykdUhFmXmairapd+4TSrdcskWs6mdVZbMpNYYo0SDug5VvStkcZVwgM/cs6SrwQOqfhd Tk4InM0wuFxdy/GAbyro875Pti4H8FXbRmKgF0CqJxEVhKG4LSUUUcZIlfFHIyjSk5ru Y286LAyNqH+JPtQGRt5yhftpE9h9K3ij07K/efjEtZGRGMtouL8Cniz2PdKgW3THTO4r +FI0sdbDG38gQDQOudmxz9yyvhqdeufasRY1dVb9C3amjfcS/wzaiLJIvHSjvL975dgw 6a9w== X-Forwarded-Encrypted: i=1; AJvYcCWlkMv6Evae76vGZH7wklNFZPLJNNPQe4oiEMazuz+0i5MeVVozN1B7WR+FeL3GEJhqL4VFhFgRyFZfXnwBg+Vh4yvp X-Gm-Message-State: AOJu0YxNowITATJJ+j9r+SKRnUfosaXAJ0ruBEWRFWJe6Z8W+546OJxS sRrh58xQwRggyeCk6c4pNMEkPJOT2xPvP8MQ7HSl46M/cOXW+DL3VklKsDzO20GR0o/zB1h89TR X X-Google-Smtp-Source: AGHT+IEyvSvNnHJBmTNmBE5q9+eXMI8HyGrB48FczNPHdOUgnUE83nanJw+lV2N8WjcrpE3hybyTnA== X-Received: by 2002:a17:907:94cd:b0:a72:5470:1d6a with SMTP id a640c23a62f3a-a780b6fe30emr213764166b.35.1720530010047; Tue, 09 Jul 2024 06:00:10 -0700 (PDT) Received: from [127.0.1.1] ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a780a6e157bsm76643166b.80.2024.07.09.06.00.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 06:00:09 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 09 Jul 2024 14:59:39 +0200 Subject: [PATCH 09/12] thermal/drivers/qcom-spmi-adc-tm5: simplify with dev_err_probe() Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240709-thermal-probe-v1-9-241644e2b6e0@linaro.org> References: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> In-Reply-To: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Alim Akhtar , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Amit Kucheria , Thara Gopinath Cc: linux-pm@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1109; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=eEyUFJCaslzrN09N4kRvWhSVle3ssZXjhx/9f1+ehYc=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmjTREd4eRdUgv30y5FNovCfhnVFAgPvLqDNcgl e4yxTEx/amJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZo00RAAKCRDBN2bmhouD 1wCdEACRx5XDgh1Y9pfhZ3HXgDEYgiMW8sWIXMBOoTxJ888EhSoqP9Wb31sc+oK2ivwKgeONn+7 ENo1u23SCzqi+NPsF2gmLh0H+e6wQg8HQbffNX5BGXsm98TorF70yCHoI8vAD9MRYbhh8tUCZI/ FDnGKwfssMVnW0b/cYL2JCwBwU1R7r8JVCgwTNGUZ2P7l4bkZWMOV6aJ+DbBeMxFJC/vL/WsDbd Gr53rUwbjAsXkOXKBGq+ZI3wV8ee0JC8p5CQvdgDMQ69EHo+80XUQCd2E/PgfYiEdHN3PNCiIGy k4PdVonKSj+eI/ZXG1/FFupV6MKN8AztenXuhf4xomRf4j74RLRIbBw0wX8Pl3VDAtRvlXtSuXS eueUCVbGyP6XwpYjd0JA+JopzWo9AzHEJ83VvEjTjjkKMuaFb9pg9StEasNrDN8ACCyHD+STbK6 TWjhLLG+4NSruNeKqXRtPfeTyTsOMI6urBECxP4Bztae9IjNDBzqJ/BIW1NAFf54CUyg67huw6z PkmHNbIKej5hjWe76ZLYr0kjK1XQjeXZ5Md3KDNzRf66+u8LbCLfNt/Lzred9OwqDmlQ3Us02Ld 326H2F+SemCW2qb/OGh+Bi16D4ESFSgYGoaTnfF7hJNjlJldLLbrtev/oQ5ggk7UQSQhlNI2cIL 4yGqRJoJoyeMV1A== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Error handling in probe() can be a bit simpler with dev_err_probe(). Signed-off-by: Krzysztof Kozlowski Reviewed-by: Bjorn Andersson --- drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c index 756ac6842ff9..7c9f4023babc 100644 --- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c +++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c @@ -829,12 +829,9 @@ static int adc_tm5_get_dt_channel_data(struct adc_tm5_chip *adc_tm, channel->iio = devm_fwnode_iio_channel_get_by_name(adc_tm->dev, of_fwnode_handle(node), NULL); - if (IS_ERR(channel->iio)) { - ret = PTR_ERR(channel->iio); - if (ret != -EPROBE_DEFER) - dev_err(dev, "%s: error getting channel: %d\n", name, ret); - return ret; - } + if (IS_ERR(channel->iio)) + return dev_err_probe(dev, PTR_ERR(channel->iio), "%s: error getting channel\n", + name); ret = of_property_read_u32_array(node, "qcom,pre-scaling", varr, 2); if (!ret) { From patchwork Tue Jul 9 12:59:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13727875 Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.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 4E3F316F901 for ; Tue, 9 Jul 2024 13:00:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720530015; cv=none; b=CNXhaVSvmiVnu1qOeQmRmRJwk5gg4Bac+bFuUZJ5JqI4hotAwJmYxjZaNwBT3P6+GxrXBG3NDEASwaQ32s/uax4ngB9funkIrLiZNIpNW15GPI+83dcd6PC5XYDWsO/FtwJAnDjXcU1BLxMUYyuRczUY/FtnXRnD51GWxkYTc+o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720530015; c=relaxed/simple; bh=5IfasFFY3DfwFwXO+QTo+29xzLGaIOqvgBXD6dEEpag=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ffGUI8sERmBK3kYAjXoPHsJB84GThKsUfma2Wac6fk8epXlsDGOKoKxJH/e0jlz7F5jnMLzCDd2/HON5/djS8ibHcGLl8CrM1sdMQ0zQo27hOI2OfjhyRU8CtBFCPsJX8IQduZPOtEYwNY55NOpUEhW3Czjf+s7mSBg0Jjdk7kE= 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=wqLEii3j; arc=none smtp.client-ip=209.85.208.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="wqLEii3j" Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-58b0dddab8cso7566914a12.0 for ; Tue, 09 Jul 2024 06:00:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720530012; x=1721134812; darn=lists.linux.dev; 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=8RWLQls8UMaDFCdMRrldbSCrQAHJtmCuH0F3BM+9gso=; b=wqLEii3jdqgPrSo36vAQNevBasQCjiFQYdyn+UqPzSE4jJyEKMu2ZuDphC80peIEMQ Ir/PMB7vc+lMti8UQtA2bp5qPjcP1ZWAQLVqtc4gpTN6ui+SigYDOI4Kx9jJxEGDn9yi iPIEaQVQ+PLwpwP6IdpBSXg3coutoCL9Kkmc/LfGeEHgkUjQ22G0mIvn3c2R01oBRhrc DL46cBX3GwUVZyoMPLmlbk3UDoY+L86lGdbvmUCvnd2NFSBiC4hk4NI2WUrict8jAspn GxjLfr235hPp7GtnQEY4Yri41ebMMp15Gv/1osDuI/ATfb1OzcZOd11lSYojESmafzAB WIeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720530012; x=1721134812; 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=8RWLQls8UMaDFCdMRrldbSCrQAHJtmCuH0F3BM+9gso=; b=Mh/EgXwNi/11CUlOksCpsWg+i7W0IoM+BjESdNuDRFdg8Lwm1/OlTpGZ1lqfXPyvq+ WGV4xKOrcLLkD4q1HcbAGSbSDswyqYsqkbQJF371bEK5bQSHoZVkEpSIs/gAYsdOoToe HbnzKjD4Zo8BtffVmhtkMYe2fmvHJEk3MwrJC/RdBZ/b1gL4douhYGpY+kl6KqeKXIzC euP1sw2SLyDECjBjBgaegS218agMRgJmG8Ev3wWyNO3gzrTMsJxZz+XO1c44ZEXASyv1 Hbegk9GeRJ+4f2/RdmRw4uugyjwbHHd5Gu6wV+ioyD7yyttwmWqyvboECwVo5vyB7ePU oPWQ== X-Forwarded-Encrypted: i=1; AJvYcCUl2cSuNDocBgeGT//WUo6jDGSbBKYlapAQ6eI7gK1ze2tgoC2ToLIkpSzxnwTwS7IZuPH6OLBlzozx1AnCtsHPzeO0 X-Gm-Message-State: AOJu0YxmJYlIbiYjEMqA6aL4LmW2bFRt61t4/Ha6DgPLdjDHOUPdyj/K 5brzC/u6Kh2tjoetKL5Yj2Rk8rM1/YtVBn9d59B1SvjUTb/QDDISB/tAceC23CM= X-Google-Smtp-Source: AGHT+IFxglRz/Z5T+VfCsX/knJGO7KuIZUuhmH15yka6InP9OkfkQM7bbBSdAh8pScc3pequE2wBPw== X-Received: by 2002:a17:906:6895:b0:a6f:718f:39b6 with SMTP id a640c23a62f3a-a780b6b1818mr140960666b.25.1720530011696; Tue, 09 Jul 2024 06:00:11 -0700 (PDT) Received: from [127.0.1.1] ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a780a6e157bsm76643166b.80.2024.07.09.06.00.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 06:00:11 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 09 Jul 2024 14:59:40 +0200 Subject: [PATCH 10/12] thermal/drivers/qcom-tsens: simplify with dev_err_probe() Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240709-thermal-probe-v1-10-241644e2b6e0@linaro.org> References: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> In-Reply-To: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Alim Akhtar , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Amit Kucheria , Thara Gopinath Cc: linux-pm@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=867; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=5IfasFFY3DfwFwXO+QTo+29xzLGaIOqvgBXD6dEEpag=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmjTREx8HXAlALPSavSuuehlkOZw7wYt7TltXug BcAVDhX8R6JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZo00RAAKCRDBN2bmhouD 1wUmEACGBJgbDwCnSdOFOG0UyK4a/q4rkg3R57Bwxj+JAepNmOkUzQPiVQveWtHqDxBbUYj9zfX vOKb/EKrO0f+MWilnskaKaVfllMwrCAsBOs3lPw7GpwEst8xe3ss+RZrVhS5FI7474zjTAhQ+1J J5tp6vCxsg8fL3GkKDB/DmAHDNojB4kmAjBCkNmmswkzFlGRMRzEjP/8vkziDz69+Dg34UhvVsu jfAAeVOwpXB+4gzioghBrp1lW7nsghBQsc0QXODurL5K7CX4bEVQ7ZEEeOj/2Ug/Z8JnAKhS8h+ h19BaLIC5si+YuZ4D9DNLfo3yiDZOQWoUubij+Dlvn/zXRtzAsaeBfUxwQGzI2EMPuCqotzS9sl 4QDYE3nHKah6mramxKTgnNIr/WXgM79N3qz8k2uTNQVLY2khFESwvrsxSLsRKxUtdI3SmZivv6B axMeFJyKOtY4Hvfup8JWAu1dYeF3KY9rSYC//n8Ho0l+aRbkmQasKC0ZJ7Q6uynJfYYTZUzd3yJ TW6dTT6R+HvfIwlEcRm4iLQmKVfKTVMpvVgpIC6eFf8B1mlBQgU6awT8nGy3H9iF/zScQ1lqjjO UxBnAS+lCWkHcheXC9YiZPskR0Q7VnSezb+0IQFjSY4qb39j1bLd0s/itc7o4hCUJYQTJnpw7it gmMBEdcuKixzSCw== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Error handling in probe() can be a bit simpler with dev_err_probe(). Signed-off-by: Krzysztof Kozlowski Reviewed-by: Bjorn Andersson --- drivers/thermal/qcom/tsens.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index e76e23026dc8..0b4421bf4785 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -1336,11 +1336,9 @@ static int tsens_probe(struct platform_device *pdev) if (priv->ops->calibrate) { ret = priv->ops->calibrate(priv); - if (ret < 0) { - if (ret != -EPROBE_DEFER) - dev_err(dev, "%s: calibration failed\n", __func__); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "%s: calibration failed\n", + __func__); } ret = tsens_register(priv); From patchwork Tue Jul 9 12:59:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13727876 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.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 EFC2215B116 for ; Tue, 9 Jul 2024 13:00:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720530037; cv=none; b=csv2XogxV4skkw6vp+YXeJ5OdrVmd5uzeDtJocSZNs3yImShRnT3Cla0ZE+bcCqpR32Iab7LuKoKDJPDv9dDVy3ccmFS+wEYJlKwkywyP9iFyWbHykzch+8MkphFS7aAIwBfZpjQf4P5jUrfi6Y0WwvJe3h79kOlrqfRLL83U7c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720530037; c=relaxed/simple; bh=dRNPdiMHs5AjBJLVXY9f2jPIkcAHpa0b1bsVOlnJ7RA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UOSGAWbb6l/azvDgah49NyQmxVz4zQHPrqCzHXbG3i+AIj7SR/nuhDgkq3XinJqeK+AMQCtFoVAt/ihBtGOZAnnp0HJo9BKcPxJuDI1mUH3w9cAAi6iaU/1KKgR/Su5w2BJ8STVHW3BkXohR5OdX0wmr+0+uujdyt3gQ6KNKXqY= 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=nJu6eHmv; arc=none smtp.client-ip=209.85.218.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="nJu6eHmv" Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a77e85cb9b4so296002666b.0 for ; Tue, 09 Jul 2024 06:00:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720530034; x=1721134834; darn=lists.linux.dev; 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=jjGA/qGgx+mIcxP+gFJINfnUDkg2XfZfkekchd5J/GM=; b=nJu6eHmv+6J5LxGVfY5CxHQYpiWnBr+ZAtnm/8a16g6F9FPLgTD08LQmGz4cwNFiVm mZ9w+eTurS4Ut5L8VQUfNEO+5LyFJVLFUKxMsLsB0UX6EFqksCveNCCsepog1qgheEqs fb4GLcaaQnYiXMj0cFoLevfb2Cp2XyfEWZMYAgmQalvGH1g3qHKoZlHtFLn+8poXnxO9 RSKANuCeU2HLtixb3ndJTKFjPxMDupa7+cGm8nE1Li8IoqUtwoRtia7pvzxfTcJy74MR OVvGcw60fnxkJ0dXOOb0jUFTHriFAY6ENT4he+VEFW8E+2f/oaz9MKrMgAjENsqM5eiR f8mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720530034; x=1721134834; 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=jjGA/qGgx+mIcxP+gFJINfnUDkg2XfZfkekchd5J/GM=; b=qQGKaage5pyP2Y0mjhahKGfbBsXbQ5Cjc2svZqWJ8xuVIwfxLToGg9WwjsHd0XtVSo Sver6ZOliKxpVKhnUwWXuV5tcDOWBNXSbhnOmAjSVn2Zt5e1JYVIqG64ScLGLJoC3hA+ H6zdlXbzo8IdfJXvbs24o/VVIm/OEEYib0UKGarQJ2OxRj1CLEaYYrXq9Mm7hP+bfaKt OBQ/zg8Y2hy6cmm9z4I4ZEszNTOfD88RSEnBu9EalM8lZf2/Hk1Iq5GI5h2DHTY86G7a 6S29oNSteVqwtclX4JBJuYbBB00oZ1Y5v4BRtneKCPvryKum78cK3MsSuoB5IKxQEPgQ hPqA== X-Forwarded-Encrypted: i=1; AJvYcCVaziA3e+XzMqkVP998UQhLKyqWM/u38E7lNwS8oLblcnMLYFSi6cjy756KJ8BNCxM8TOcK2/WMD/ladIWZDcDYNkIW X-Gm-Message-State: AOJu0YwlXJcIalr4LuBa0wMfCI+ql7sWklhi7ltsNr2qQxsBl7Qkz1lN V0eSZT4/evXxJnFxZKxjXRblposLTlbVfynK9tVsWdx3+NkJEPAkkY6oY0arrl0= X-Google-Smtp-Source: AGHT+IEvlSBh+Szj5ezUq5/+0OHoN+tL3GwMj4ME8t9YN2RMSRh308GAXCgqTDwSX+Qvm/IYABP5uQ== X-Received: by 2002:a17:907:7246:b0:a77:dbf0:d30 with SMTP id a640c23a62f3a-a780b705283mr174415366b.41.1720530013327; Tue, 09 Jul 2024 06:00:13 -0700 (PDT) Received: from [127.0.1.1] ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a780a6e157bsm76643166b.80.2024.07.09.06.00.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 06:00:12 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 09 Jul 2024 14:59:41 +0200 Subject: [PATCH 11/12] thermal/drivers/generic-adc: simplify probe() with local dev variable Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240709-thermal-probe-v1-11-241644e2b6e0@linaro.org> References: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> In-Reply-To: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Alim Akhtar , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Amit Kucheria , Thara Gopinath Cc: linux-pm@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2174; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=dRNPdiMHs5AjBJLVXY9f2jPIkcAHpa0b1bsVOlnJ7RA=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmjTRFZ5MLzIVp7LvkdrHSPaSlqf6y8s01csIEj qkfohuXlouJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZo00RQAKCRDBN2bmhouD 1wGREACN2X1SM0a5l36cmwMYVTDJYxFXet8S8CCm1qRc9HNMvKSHAsYsEar/4yX4RCVdwXDOf8q TVfvsvVLvi+AUnLXyO/mnAmOl6eommFQXgj+4/m42iWvIjQBdAIA5mpY6l8omPngKnf6IZAWXmD 4r2VzHfX5medjrTt6mC/LJwF3Do52VpnQN31eYcQmGzsskmQ2LoSfXYSzm79GDQjrmboKXUtZop A4qZmEZJ1y5OFdv4eDeOrpn9Bm8YRObeOyU3AzyBgOFCmnY14cvPjWuORSUj9y4FdT+yed5f3Sw bl3VlshqNjNK+vn/4AidJCYSDzuASTfyqCINvyebP/WY8AErrCA/12eJMF7RMvllwg4sKxKJeJG 6Pyd1cANRuMTwsDdqH0bnFxrwtV6ob1OU4gtL64jfMl8SPA9GMQXJNXeTFbdcnIDeYpbXralofE ruVJlaoMFhKMyyrbsGRCIc/GpYs/lmpFYMQ4QsR/6sZ692iuxND3b/rwhplPPBV3PvSYIbd3EzW xUvEp2P7HZMWHwPHm9wadE8heVQhrvxal6FQ1STTQFI4Ucyfa4FDM2eu7wDNri7M2rxf8x7czuE FpVcL5fWoMiUxtS44PCun2/gC5tFtWLekLByvUBR0acrR9R/O5qwgnJ8KBLCTwuhGLBBHjicWme +OqH4VRpb7uVS2g== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Simplify the probe() function by using local 'dev' instead of &pdev->dev. Signed-off-by: Krzysztof Kozlowski --- drivers/thermal/thermal-generic-adc.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/thermal/thermal-generic-adc.c b/drivers/thermal/thermal-generic-adc.c index 1717e4a19dcb..d08bff91ac3d 100644 --- a/drivers/thermal/thermal-generic-adc.c +++ b/drivers/thermal/thermal-generic-adc.c @@ -117,44 +117,45 @@ static int gadc_thermal_read_linear_lookup_table(struct device *dev, static int gadc_thermal_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; struct gadc_thermal_info *gti; int ret; - if (!pdev->dev.of_node) { - dev_err(&pdev->dev, "Only DT based supported\n"); + if (!dev->of_node) { + dev_err(dev, "Only DT based supported\n"); return -ENODEV; } - gti = devm_kzalloc(&pdev->dev, sizeof(*gti), GFP_KERNEL); + gti = devm_kzalloc(dev, sizeof(*gti), GFP_KERNEL); if (!gti) return -ENOMEM; - gti->channel = devm_iio_channel_get(&pdev->dev, "sensor-channel"); + gti->channel = devm_iio_channel_get(dev, "sensor-channel"); if (IS_ERR(gti->channel)) { ret = PTR_ERR(gti->channel); if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, "IIO channel not found: %d\n", ret); + dev_err(dev, "IIO channel not found: %d\n", ret); return ret; } - ret = gadc_thermal_read_linear_lookup_table(&pdev->dev, gti); + ret = gadc_thermal_read_linear_lookup_table(dev, gti); if (ret < 0) return ret; - gti->dev = &pdev->dev; + gti->dev = dev; - gti->tz_dev = devm_thermal_of_zone_register(&pdev->dev, 0, gti, + gti->tz_dev = devm_thermal_of_zone_register(dev, 0, gti, &gadc_thermal_ops); if (IS_ERR(gti->tz_dev)) { ret = PTR_ERR(gti->tz_dev); if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, + dev_err(dev, "Thermal zone sensor register failed: %d\n", ret); return ret; } - devm_thermal_add_hwmon_sysfs(&pdev->dev, gti->tz_dev); + devm_thermal_add_hwmon_sysfs(dev, gti->tz_dev); return 0; } From patchwork Tue Jul 9 12:59:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13727877 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.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 9437915ECFB for ; Tue, 9 Jul 2024 13:00:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720530039; cv=none; b=XRoTF1dc4sum7vxFfUYx1NdKEMujrG6CmfWDxz3r4ufpp/jyCbEWAGsXwQf+xKlicTOBKaeJHvM50y1ESrwl0Ah5SqkAonrvDpXqRU64z9tEXIazn//p1asYkaESKygFHoU8ih/FNzHesFrlZQK4xPoZCZKQoWTTH8eqJ1UuQgU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720530039; c=relaxed/simple; bh=+k/lazfX5D4DO7g4zI2vHTllaVZsoH4j2XRnMTI6hrs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qefuPfe7C1GumPkxvS4ngSU/u/bOAffnX+DTQ5isuFeRhPe8QEgm9kGefDIQT98d0gWnfnrVoxY2HzqbXh8b59HUQ09RccCMrdK4Aot9Rk+akQglj03UvvqTCwfbIAA/f85j4sE2oAAxMv8aQbtIZUJLsnxPH3mkFIShFkl40lw= 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=vvLWmI92; arc=none smtp.client-ip=209.85.218.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="vvLWmI92" Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a6265d3ba8fso459959666b.0 for ; Tue, 09 Jul 2024 06:00:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720530036; x=1721134836; darn=lists.linux.dev; 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=fKJKj4ePRCM54jEU3GVYM318cCZM40CyMC5+JEFGxVk=; b=vvLWmI92+mGO1/QqsoSYEcmPIrnhE09ItgRcvDzP4vMe9i6+lBv8+b5znB5h9LYFs4 TfTzHT1gNIVUsIdNQAHupZtrGD1d6Jai/OEpvkL+qNF+GX8wn/WKpKVm2j3LTxH2GRQi 642yqJPTUGRZvQTVN2ezbeNxrOvy98qKsB6bTs/ZLNGlNsngrgESQWsElDxw/dDSdpe6 /gbUT01Zmeo8M0Anocc8kIdHRNIywdj2qHptrRhBOMxr1V+nmSTbm7R9OagVM97A5Aza 7uN0roXB5dhR8Ixtka9m7uxriYjqZoqIHLHso0rMLVwxHtZv763SGYRIavbAB0YPrgAt Rj1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720530036; x=1721134836; 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=fKJKj4ePRCM54jEU3GVYM318cCZM40CyMC5+JEFGxVk=; b=eo/2DHGflg/J+PV+2Lg/eupuA95ZKZXjDlXeWOo3aa43oX9QUjvwuQ1GI+ayHG/oSd pqrPP1zJI3IYDaxB0GGZdRmBfOGXpK4WcDnL2ma6aRrw3a40tai8CShB5kWU98Tfh7Gi lknJVZzo+kuS8ryWZyCJda1+FgXV31ENp4cMdgIAzzT1whMwURcWC96kzcfiqfbpsaQj D8xGN0FMqK4TRjNey06HSZ9J44dCaGdXOPjzsVmC3ooo20nFHoZMPMDeCtT5WcWwFnji ivLRxl/58AOvUof1XYf9NwCxAiniXCskRsa+CLAZ+TlcOsYVy3mko6Wkev6j05QpOslA 1TQA== X-Forwarded-Encrypted: i=1; AJvYcCUwErXeKQhFV1Kwpgd2WCniRTfGdLPKV5bipzuOdUd6QPYuG5rr800ug69+FRWRWHzSAYeh0ocAeHeACMltE7Zi+Cb8 X-Gm-Message-State: AOJu0YzLM9DcVM+huzm6oOgPu4pMuOWdniXVsuIQvpWY+seQ5OmlGRln ugDq8JOclI1nkFh7UdCxmiiMrOUBxyI8UPV8Ov32m5UjKBIQaaGQDh0ETHiN3qQ= X-Google-Smtp-Source: AGHT+IFfkk9Ys5H4+GIS3Y5lPnmbtnsV3RBNMXH4S8d48mmpM+eZ7xVV/K5ZmahmLNMktfUV+pQZMg== X-Received: by 2002:a17:906:36d3:b0:a6f:b58f:ae3c with SMTP id a640c23a62f3a-a780b6b1b96mr159741866b.26.1720530036104; Tue, 09 Jul 2024 06:00:36 -0700 (PDT) Received: from [127.0.1.1] ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a780a6e157bsm76643166b.80.2024.07.09.06.00.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 06:00:35 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 09 Jul 2024 14:59:42 +0200 Subject: [PATCH 12/12] thermal/drivers/generic-adc: simplify with dev_err_probe() Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240709-thermal-probe-v1-12-241644e2b6e0@linaro.org> References: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> In-Reply-To: <20240709-thermal-probe-v1-0-241644e2b6e0@linaro.org> To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Alim Akhtar , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Amit Kucheria , Thara Gopinath Cc: linux-pm@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1014; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=+k/lazfX5D4DO7g4zI2vHTllaVZsoH4j2XRnMTI6hrs=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmjTRG7Kse7IUgMVRX4NLV90g5K2qD30euBH5Pl gWGaMK8maKJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZo00RgAKCRDBN2bmhouD 18nEEACI7gxKJvuvASog8vwzRg+a3PvfwZZHrDeguyKmTBJ46V5YCiPTvPJWRVtWUqdAMUfcsAW IhEdMHzSmWOUHTcfTzDHc8O7vvAT8KCZjGFJ43RMUZb3he1BN3Hp06JDNSqEf43CuJg+v+5a545 X5eNDx4RWWWh9zgEO9QzlypsgvXdE4LK4IPu1rs1ChmI8pswR04JWPcfOWCFhLuNGaByjtoPYQs U4lSOh77uqNdYjaSuxJa0xSdFyKJtxO0prRNorCSpZ3gV1xZv2zG82eAQk7TwM0bSgWEq7qg/2A YjlXyoPq9ql12lRZM+95d5OmHGaouY7kK+uWEDUBu+OcEtEizqh2+nieYVSapi1VlfMNRV3n9vq Pzq6vxcnyu4p4GjdKVYkG12RIcI5nLVWkuTA66ZwV5e4OSgs/JpkAok1I5ohrJjx8hL/JesxirT 6KLStUBfXk6SIqMuRSdiPu0hiwweitRaR51TkzYUNaurLAyaOkorxIAoWsJOImpTw9lOp/7Qjbc i5DLWLYegu0qdnia+oFrLWRyZ6bLRZ/lRQgBvq04AViCRNSyKbaDwJ6CiHd1ZKotEHRNIQ+cRj+ h7OhqavBXLHl7a8nYZlx08NNjImhGkT0HKk6NShnr2C+3pQXATuTFyePUpudMTQSEG0jiDqlcDj lMHGtvzQpjie/sw== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Error handling in probe() can be a bit simpler with dev_err_probe(). Signed-off-by: Krzysztof Kozlowski --- drivers/thermal/thermal-generic-adc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/thermal-generic-adc.c b/drivers/thermal/thermal-generic-adc.c index d08bff91ac3d..ee3d0aa31406 100644 --- a/drivers/thermal/thermal-generic-adc.c +++ b/drivers/thermal/thermal-generic-adc.c @@ -131,12 +131,8 @@ static int gadc_thermal_probe(struct platform_device *pdev) return -ENOMEM; gti->channel = devm_iio_channel_get(dev, "sensor-channel"); - if (IS_ERR(gti->channel)) { - ret = PTR_ERR(gti->channel); - if (ret != -EPROBE_DEFER) - dev_err(dev, "IIO channel not found: %d\n", ret); - return ret; - } + if (IS_ERR(gti->channel)) + return dev_err_probe(dev, PTR_ERR(gti->channel), "IIO channel not found\n"); ret = gadc_thermal_read_linear_lookup_table(dev, gti); if (ret < 0)