From patchwork Sun Mar 26 12:37:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 75054 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp932223vqo; Sun, 26 Mar 2023 06:15:02 -0700 (PDT) X-Google-Smtp-Source: AK7set9GaPFNs8xqDfQBuyX3AoXaBysmMY154PR6arVIjp3qLHAoQKk9LSFJC3FBVfVwa2Lb2QIl X-Received: by 2002:a05:6a20:2903:b0:d3:a347:7db4 with SMTP id t3-20020a056a20290300b000d3a3477db4mr8056824pzf.15.1679836502349; Sun, 26 Mar 2023 06:15:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679836502; cv=none; d=google.com; s=arc-20160816; b=H0d6l10OILXyfsjK0wBJ7SMRLy1dLn66GT3XKXhAeVdyfYeB7FTWPimJ1hOOGXpfo8 0U1p2iIEw7HwTqYYF15jSdWSXg6s88HGnH3j51Eeq3P5jVy4WBAe7wSyRJZ5K5MF5MDt Mo4DHnyVyMA8H+yJXoMm5yFPLH5uvU0WLS6Tk2v/CmHhpnq84VKys2q4ARcBxMTZ1d3+ iPyEdpb2I2ZiFhcUNjet+tmSptH6jLiJJ1saeh+7ZqH3dOpeuVLs8dj43p3dD0DxWIGi Z/WIrPnJYeiqBgwKIwpOFvqcm09ViLCZxTd48LNbxSdJEgyOxT3kAoBfRNH20h8NpI4b qHZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=+QW1dSbyLG3xntrkGICO8y2sUTAa88hbcOxhVacYaYY=; b=J6Qnmms5iaJmCJVyGDCrBNkEsD45tBV2wrJJnW9mMsiAT7TU5gM9zoxLoNLUHNfHP4 wIIZXDDQHR/+xgMBRmAMHjoF3ZTpmkBY4tWUnn1FsjWWmWxfzLkvv6JxawNLqSFfsppU YzLb1hcDOgGEgGBg0TWLlLYQXokf6fgey7mMVfIbXQtCjyxnmMb7DmqXmUcs7lkSFrl0 Oc9OkKMAd0rjij9VQA9+OzWwkRkUeDesgF7QeffKAT0nimbvWJi2AnRKk7y0xy1pHaAq 12tcsVVwYvVmszReGK6b/q3B6sGxLRM9S3RnXu6k0rsaSIlHBe3+ygVU0QPR0sQHeNfR vYvw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k20-20020a628414000000b0062a28cd7c1bsi10001377pfd.264.2023.03.26.06.14.49; Sun, 26 Mar 2023 06:15:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231771AbjCZMiC (ORCPT + 99 others); Sun, 26 Mar 2023 08:38:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229988AbjCZMiA (ORCPT ); Sun, 26 Mar 2023 08:38:00 -0400 Received: from smtp.smtpout.orange.fr (smtp-19.smtpout.orange.fr [80.12.242.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B67C076A3 for ; Sun, 26 Mar 2023 05:37:58 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id gPd9pANE3TpvfgPd9p9CXS; Sun, 26 Mar 2023 14:37:56 +0200 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 26 Mar 2023 14:37:56 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Marek Szyprowski , Joerg Roedel , Will Deacon , Robin Murphy , Krzysztof Kozlowski , Alim Akhtar Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH] iommu/exynos: Use the devm_clk_get_optional() helper Date: Sun, 26 Mar 2023 14:37:50 +0200 Message-Id: <99c0d5ce643737ee0952df41fd60433a0bbeb447.1679834256.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761436240126560616?= X-GMAIL-MSGID: =?utf-8?q?1761436240126560616?= Use devm_clk_get_optional() instead of hand writing it. This saves some loC and improves the semantic. Signed-off-by: Christophe JAILLET Acked-by: Marek Szyprowski --- drivers/iommu/exynos-iommu.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 483aaaeb6dae..867f409e0325 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -747,22 +747,16 @@ static int exynos_sysmmu_probe(struct platform_device *pdev) return ret; } - data->clk = devm_clk_get(dev, "sysmmu"); - if (PTR_ERR(data->clk) == -ENOENT) - data->clk = NULL; - else if (IS_ERR(data->clk)) + data->clk = devm_clk_get_optional(dev, "sysmmu"); + if (IS_ERR(data->clk)) return PTR_ERR(data->clk); - data->aclk = devm_clk_get(dev, "aclk"); - if (PTR_ERR(data->aclk) == -ENOENT) - data->aclk = NULL; - else if (IS_ERR(data->aclk)) + data->aclk = devm_clk_get_optional(dev, "aclk"); + if (IS_ERR(data->aclk)) return PTR_ERR(data->aclk); - data->pclk = devm_clk_get(dev, "pclk"); - if (PTR_ERR(data->pclk) == -ENOENT) - data->pclk = NULL; - else if (IS_ERR(data->pclk)) + data->pclk = devm_clk_get_optional(dev, "pclk"); + if (IS_ERR(data->pclk)) return PTR_ERR(data->pclk); if (!data->clk && (!data->aclk || !data->pclk)) { @@ -770,10 +764,8 @@ static int exynos_sysmmu_probe(struct platform_device *pdev) return -ENOSYS; } - data->clk_master = devm_clk_get(dev, "master"); - if (PTR_ERR(data->clk_master) == -ENOENT) - data->clk_master = NULL; - else if (IS_ERR(data->clk_master)) + data->clk_master = devm_clk_get_optional(dev, "master"); + if (IS_ERR(data->clk_master)) return PTR_ERR(data->clk_master); data->sysmmu = dev;