Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp378640lqo; Fri, 10 May 2024 02:41:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWTThPttYCkJY8PW+/GFfHb6xYcBfWDVUPHmuSa88gDHAxYX9wzlUxTnttDbz1HKWivwfk5hjm2MM+ZtRX/Ik80EL221uS+fjzi4M4x1g== X-Google-Smtp-Source: AGHT+IHVOAf8W+aE7Cu0Dpn/+DmmPsR8e7BEFtnFI/H1VtY9jTjCr3g3vWI5M4XU+xe8pGNjuXY1 X-Received: by 2002:a05:6830:119:b0:6f0:3546:739f with SMTP id 46e09a7af769-6f0e9170fb5mr2147555a34.22.1715334065641; Fri, 10 May 2024 02:41:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715334065; cv=pass; d=google.com; s=arc-20160816; b=vvt1/gEukw5IvDZ9bVJnL3rzzKAJyBMz7XP2snGuHB55dbXTprUcyMa7XygSzWE8Mq 6W4Xm8o2xFXNQLrG+t7RZWD32W5C8pCBM2qBZCrw++sWDVUB9saKvzKJ5zcLghroQTuR eIVit4kbFPyt6zMEfOtDCehMGikWZW+wMyHsFtTMPNd5JAI6ujaI7f9gTSkdwLVbMGfS DmBQW8iQSDlBzeCXgB6pgefL0zrSB9wfMelx0+OpXixPDqgvCuI4Cem68PGkx136upqI 8k2HuE6yNGm/rp1MwMF5ShF5XTf4rH+PF+/CNphmYj5nsUubIOubpyPPu8ZGABVjbYcw 31TQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=RkRaYasEXgqE/p0OdCATEgprTM8CbZFE90OPXfYhKMQ=; fh=Qajb2HWGBW2UF2UB9uFS/6OI3lO6o+yseUpRTq7Ex64=; b=JsRa2e3ajQJDyvTRU8osUT9TwyA6NHiCZ3zodY6UCwQIbVdYCcLtw/zF8d2ncBmIZs TQFulLUD6hmUy5e/uaHnOqIjgWoQDQID6tKUZnoG8YCBoVWJuETXuyqHMhj05Nti4him qsqmv3ayM85ij9yjyeauwmQFmF9Rvc57KcpRE5bAKvwCSZcHSUgCQw4jFKO3GcHoZb44 R+faVY05OPJi5FixLNVhCgixlaFoSqZmxGP4aGigss3BpK+KPG6C9XIFJK6S0UM4Viut lVz6xnkupFYRY6oMCYOOqxhAxExiKPqVtHg1C8ymjBZJjsHTKzbBFJaXsBTYdgwzx32Q lUXQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=D4Tp99ij; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-175543-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175543-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-634103f5b4csi3305969a12.404.2024.05.10.02.41.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 02:41:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-175543-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=D4Tp99ij; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-175543-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175543-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6C50A282439 for ; Fri, 10 May 2024 09:41:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DB9FA1635CB; Fri, 10 May 2024 09:40:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="D4Tp99ij" Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (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 A2FB015B108; Fri, 10 May 2024 09:40:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715334057; cv=none; b=nBS9iyhh8MwOqgytjlAJ3IIem2WnxDXoJQ3NUsl5Tg3lzj3B7MA3ZCWZAWvuFYi7m7uYj/e9wWRMZB8FlvRJvfkr1ABncgWmFvtUgk8nRmryKfi0ApCsFPBt1MH4KB58ufJZvyrXFW/pSMkg9GvJrWq1WppiPBqt18Pn6SbH5OY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715334057; c=relaxed/simple; bh=omwIVooKj2lhfiK2OyYV/ShnqtuKeUSCLFPStJaY/u4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Xcnx9z2QYMZhn0l9C48q9+R6LRo4S+kh0vfOd8OC2mDfK2uyOGEHzekancE6rwTqrfGugq4WaVBXv030jjH4Sr1Ief4WlBfQD3AHXTGQIUmPpSzA975IvYbax40UZlYOTh6osLJb6iEkUyJXXsOu8NBkL55q2sVGTld06GUf8S0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=D4Tp99ij; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6f47787a0c3so1658360b3a.0; Fri, 10 May 2024 02:40:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715334055; x=1715938855; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=RkRaYasEXgqE/p0OdCATEgprTM8CbZFE90OPXfYhKMQ=; b=D4Tp99ijdwPXk8U6YAzzWsie0Apx0Rlv1bPJ2wOHb20bpAoP8A7A1oqSpZvyJO8BVH ApYswZu2pQ124+K48RFoS7MErIUdnCjqGzmI1NE3Z5pNNTmEanAMPjJVdQmCzweEzHFK LjWaRjBiitsFNzKhuQFrNsGMxC8ykGAAi7OoVCk8UKUJG2To2Y8mYCUPqg06h2txJzVM 36mDGHhMZ5tRkxevHrZgYv1WV3j/NsT+B8T1GHjnbeuaO0DqcXHcDsaboJJfnHsYgUg9 W+HZcjQJ6x8XWRWmZcsnMv6VjF5+k+0s4kVF0iH8l8w4mYuGor08zjA8QCqph9n/GR98 ihFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715334055; x=1715938855; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=RkRaYasEXgqE/p0OdCATEgprTM8CbZFE90OPXfYhKMQ=; b=FwXmdWY4bziP6HnbPFBlreJIzQmuYwrnXpcWAnFnQkLg9crJ8/ZJe9goZJYpHdGm7B TaIqSfow8h3EFJOB/v2e0QlcJp15cP3o8K0oxu9bOjHjitAEiC7a2JI/Y0Jk5Ne/H1VU 9G8nSf5qvaz2vBLfvokhOF0EkzIQUSS0fRqXQWKhPKMsHic5/UVohVd57RqZIfNevM5l eGR22FlvIeeWXQhOELJ7nopWJeBrGwAf2PB8LQyj3B+OoqMuLZiRzHW0FTjlPwNQJPv7 7LKRDbwYA5pspUsKVdWi6z5caPoEt+cZ+GQtmhjzWRoVpjE+u4ZqvE6z3EMsNkeNPUQX PL0w== X-Forwarded-Encrypted: i=1; AJvYcCUjDwoDhiKH4OL+cVs2W1b740C/CDeFmxZLcF8uqXL2IKSAEEPzqXwtXRN21Vp7zyCRSsjjvhsbn7vJakQ40HWWnonn4nKrO5msM9SAQvYvSk21626Q+asAkNZjDUY0Ivn+4hVd/z7Uqhyo1cQxoiskQGULouYHmE/38UpexsaldUVCcb2sB1xgHQ== X-Gm-Message-State: AOJu0Yw1zBAWMRzaODMjYB4J1oQ3xwVMRNS6zIF1v9/fyeNvoCZzXsB6 +j5SLU62F8eHMbnfCxlIQe0G3wIybgHP/x+E4/s4GY5/VFAW1yTa X-Received: by 2002:a05:6a00:3ccd:b0:6f3:ebc4:4406 with SMTP id d2e1a72fcca58-6f4e026b878mr2506655b3a.7.1715334054910; Fri, 10 May 2024 02:40:54 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2ade28asm2554518b3a.139.2024.05.10.02.40.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 02:40:54 -0700 (PDT) From: Anand Moon To: Chanwoo Choi , MyungJoo Ham , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar Cc: Anand Moon , Christophe JAILLET , linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 1/2] PM / devfreq: exynos: Use Use devm_clk_get_enabled() helpers Date: Fri, 10 May 2024 15:10:24 +0530 Message-ID: <20240510094034.12493-1-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The devm_clk_get_enabled() helpers: - call devm_clk_get() - call clk_prepare_enable() and register what is needed in order to call clk_disable_unprepare() when needed, as a managed resource. This simplifies the code and avoids the calls to clk_disable_unprepare(). While at it, use dev_err_probe consistently, and use its return value to return the error code. Signed-off-by: Anand Moon --- v5 - No change V4 - wrap up the error messagee within 80 char v3 - No change v2 - No change --- drivers/devfreq/exynos-bus.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c index 00118580905a..7d06c476d8e9 100644 --- a/drivers/devfreq/exynos-bus.c +++ b/drivers/devfreq/exynos-bus.c @@ -160,7 +160,6 @@ static void exynos_bus_exit(struct device *dev) platform_device_unregister(bus->icc_pdev); dev_pm_opp_of_remove_table(dev); - clk_disable_unprepare(bus->clk); dev_pm_opp_put_regulators(bus->opp_token); } @@ -171,7 +170,6 @@ static void exynos_bus_passive_exit(struct device *dev) platform_device_unregister(bus->icc_pdev); dev_pm_opp_of_remove_table(dev); - clk_disable_unprepare(bus->clk); } static int exynos_bus_parent_parse_of(struct device_node *np, @@ -247,23 +245,16 @@ static int exynos_bus_parse_of(struct device_node *np, int ret; /* Get the clock to provide each bus with source clock */ - bus->clk = devm_clk_get(dev, "bus"); - if (IS_ERR(bus->clk)) { - dev_err(dev, "failed to get bus clock\n"); - return PTR_ERR(bus->clk); - } - - ret = clk_prepare_enable(bus->clk); - if (ret < 0) { - dev_err(dev, "failed to get enable clock\n"); - return ret; - } + bus->clk = devm_clk_get_enabled(dev, "bus"); + if (IS_ERR(bus->clk)) + return dev_err_probe(dev, PTR_ERR(bus->clk), + "failed to get bus clock\n"); /* Get the freq and voltage from OPP table to scale the bus freq */ ret = dev_pm_opp_of_add_table(dev); if (ret < 0) { dev_err(dev, "failed to get OPP table\n"); - goto err_clk; + return ret; } rate = clk_get_rate(bus->clk); @@ -281,8 +272,6 @@ static int exynos_bus_parse_of(struct device_node *np, err_opp: dev_pm_opp_of_remove_table(dev); -err_clk: - clk_disable_unprepare(bus->clk); return ret; } @@ -453,7 +442,6 @@ static int exynos_bus_probe(struct platform_device *pdev) err: dev_pm_opp_of_remove_table(dev); - clk_disable_unprepare(bus->clk); err_reg: dev_pm_opp_put_regulators(bus->opp_token); -- 2.44.0