From patchwork Wed Jun 12 19:58:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10990797 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7EA9213AF for ; Wed, 12 Jun 2019 20:00:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F450287AB for ; Wed, 12 Jun 2019 20:00:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63E6028872; Wed, 12 Jun 2019 20:00:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 013F4287AB for ; Wed, 12 Jun 2019 20:00:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iEhT0tBojk+DboGjVK6x7Uk+4rMYpwZH0w9rAXDMqr0=; b=j340gkUWij59z9 n/iJ5YngwA2AboKDRGqYFYpulFmX3t0mLgqvv9rqM6ZLH7QTQSflJ0AE6onKMj5kVWzj5GuMeeSmh Xp+fJ7RaXWbctgNqV/c2xyBbl9g4f9KxGzeUOqdLE9YXYX02VK7ZGE969NFl9kbTjki5qmuKVfgxR P6fuj4WsSToYA+RUv88sZX/vWcJy8H2zc7juzZWHD2oakuRz41v7VdDrspnRbqXWqHLkykpnxfid7 LKbM00XKdF4oLDPybPNve8umPMdidvcWfaqDahWQF3fBd1stHFhoF6uyllzNvUlpwgpbGORHFRpkQ 0FrzoM16SkU1YN5Wk9fQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hb9Q6-00077X-B1; Wed, 12 Jun 2019 20:00:30 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hb9PE-0005GE-7g; Wed, 12 Jun 2019 19:59:37 +0000 Received: by mail-wr1-x444.google.com with SMTP id p13so8125433wru.10; Wed, 12 Jun 2019 12:59:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ObC610o5hWHINu0uTU3Hl+oLxvUvo9xNqJSdPceiF2s=; b=PV/Myi90oQwUTv4MltNi3KCGMwomtwtY01yXOejDgDqhUB5Q2M/JwPLZN2xZopb6Lk XxuGNpC58jARbYUyu/JPaQpJgHW6l3NCECEzHBd56a+m23TqtFzbWFpPb2c3gtJ6s/g0 M97J9Tb9p+OMt5NBMXVQlboMuNSmeCrg+9SeBABw87oyZZictQLdfyZvleUDl00Ve1o/ FOrGNyN8ZKM6bWhda7VR75zR2eH7rigUAWnDS7Y6VPLjUZYa1Rc2lt2O17CSYbUo9G5j 7iDEANSmpkZ4rFYxcIcgkKRu/VADET92ufk6D2iCY5gFDDRiEy6Dm+Etg5XTaBdF9o0h EGgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ObC610o5hWHINu0uTU3Hl+oLxvUvo9xNqJSdPceiF2s=; b=dB0HPryqJ+UbhOn5H5KVr/pdvhPeSPkIttQptx9l4lILsyJIdG6xv9YbTRfbBMPPUD z+vL0tYQMvOQspuXp1//IN0XLkUkXtI/Nm9BhCbhSgmDEVb5XrEK6Ku0QQOWW0GARyUZ lVEzA5MpcNUw/1uRJr6qOmIZu4M7g5lzpoJtejGJKwGSFj23+iGRxvQxIEAKsThneHri p5ys0AyaEduTkb8loMAB96or5NasbIjomHXlEoXkoQ3i/3tJmIeQ4rH8TTAG2F0aRS8b rxvf1nTrwTgb4NHld+UFMff6S1yQuakzqgoStebz2XtKqaXL5wnXYxWUxz1wA7Nub4ju v7tw== X-Gm-Message-State: APjAAAWPdbvgfKFL7HZ2SxjWL/vk/LhJnWb5W/C8hSUHiRjsQDncDriI WGVpsxHhyTVBL3WhFqHjJizAVUpi X-Google-Smtp-Source: APXvYqz0QFlGb11jXCoLBy5+7zRsUxelrr5LALZaZMvlKNJXCARUiloBFYpkdMQQg2ZBXsJ0hdCGmA== X-Received: by 2002:a5d:52cc:: with SMTP id r12mr16900316wrv.132.1560369572747; Wed, 12 Jun 2019 12:59:32 -0700 (PDT) Received: from blackbox.darklights.net (p200300F133DDA400428D5CFFFEB99DB8.dip0.t-ipconnect.de. [2003:f1:33dd:a400:428d:5cff:feb9:9db8]) by smtp.googlemail.com with ESMTPSA id f10sm1026745wrg.24.2019.06.12.12.59.31 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 12 Jun 2019 12:59:31 -0700 (PDT) From: Martin Blumenstingl To: linux-amlogic@lists.infradead.org, linux-pwm@vger.kernel.org, thierry.reding@gmail.com Subject: [PATCH v3 02/14] pwm: meson: use devm_clk_get_optional() to get the input clock Date: Wed, 12 Jun 2019 21:58:59 +0200 Message-Id: <20190612195911.4442-3-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190612195911.4442-1-martin.blumenstingl@googlemail.com> References: <20190612195911.4442-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190612_125936_274393_2A5CC95A X-CRM114-Status: GOOD ( 13.73 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Martin Blumenstingl , narmstrong@baylibre.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, u.kleine-koenig@pengutronix.de Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Simplify the code which fetches the input clock for a PWM channel by using devm_clk_get_optional(). This comes with a small functional change: previously all errors except EPROBE_DEFER were ignored. Now all other errors are also treated as errors. If no input clock is present devm_clk_get_optional() will return NULL instead of an error which matches the behavior of the old code. Reviewed-by: Neil Armstrong Reviewed-by: Uwe Kleine-König Signed-off-by: Martin Blumenstingl --- drivers/pwm/pwm-meson.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index 3fbbc4128ce8..35b38c7201c3 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c @@ -474,14 +474,9 @@ static int meson_pwm_init_channels(struct meson_pwm *meson, snprintf(name, sizeof(name), "clkin%u", i); - channel->clk_parent = devm_clk_get(dev, name); - if (IS_ERR(channel->clk_parent)) { - err = PTR_ERR(channel->clk_parent); - if (err == -EPROBE_DEFER) - return err; - - channel->clk_parent = NULL; - } + channel->clk_parent = devm_clk_get_optional(dev, name); + if (IS_ERR(channel->clk_parent)) + return PTR_ERR(channel->clk_parent); } return 0;