Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3277718pxj; Tue, 11 May 2021 00:20:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVqi5OJY2pnqam+9YR3/NlPpiz66Gs9OO9gNWs2ZA2C24WdDXdyNWF/YfXxJQZv2rMxyZh X-Received: by 2002:a02:91c1:: with SMTP id s1mr24937511jag.61.1620717646669; Tue, 11 May 2021 00:20:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620717646; cv=none; d=google.com; s=arc-20160816; b=b6mo6MSG8RyfTylmbdbboEiF8wN61eGhcu7sLoMNfkB8Rhl2lshVHI/5wWihLgWzqY HCjVwC/ZSuzOZk+TMDS97xHt0Fwv4fnA+Tz0PEfJCSm1/nvrVbjHyhJc0eJovyXU48et +LR8dxNqfjwaSdudnGgObdPtLyi3fogis2yCHlqva7280WUMAQ02F8eAM8KscQpsmMd9 eFdmGcPfZYNn9nZAt9SgJDfRv9noBmQXVXTzvwhPZBQe+YVNzTeTt1NaZYOsGseeFWNT w4PXY9HsXSVaaroDrHS76AgBmNxpasceyparIbLMHQMFXN0bmlaHRVh2XI/NTXv+YhPf XJAQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YxA8FQYDWbxe8BPqwCO+yOABH8hUl4nAhrh9q+4gOxs=; b=buodIFdVazhsyjGQSEs3YZGsReDpnyTQR2utmv8xmugOnq+D59T9K+rcXbcdM+e3G/ i5N5ByhvCb5vIhEuuhswUNg0NyXG4GwBsNTLmu2Cc16ekWm8GbgV//e8URaNn5QaNG8Z C6/4dQuQkQCNjbm+T0u2TDkgaoI4Z+qFTDvaUECEefQ8ggwRATKRfRuGmUJjMyUJpVJP z0ew6YRXyWeDWic4e7iqrk1x0K/tzVopJWzPnlUQV3evdNur6NFjCcf3Cyi6b7d96lFC 0iYLeP+1qhAkWgje+tWtti0FHK777ixQ7bGvS57bmiGT91SA3aspBSa0oY7EmDT1OYR9 kqgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deviqon.com header.s=google header.b=he2GENrR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deviqon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r5si20839116ilg.18.2021.05.11.00.20.34; Tue, 11 May 2021 00:20:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@deviqon.com header.s=google header.b=he2GENrR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deviqon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231154AbhEKHUM (ORCPT + 99 others); Tue, 11 May 2021 03:20:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230499AbhEKHT7 (ORCPT ); Tue, 11 May 2021 03:19:59 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F3CBC061347 for ; Tue, 11 May 2021 00:18:45 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id s7so16940458edq.12 for ; Tue, 11 May 2021 00:18:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=deviqon.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YxA8FQYDWbxe8BPqwCO+yOABH8hUl4nAhrh9q+4gOxs=; b=he2GENrRhDW+bZxoqb8MKMBMQc8bYzFKlxGSCc/RtgNDE4FeeeT7KwUKqf1IyN7XTI ZzE6fAXeKtqfvE5taWRvNTrbjh6C2sc+TVO9vkyYqblMDCYxO2U6un7qysqWqKizoEZj qSYatZDFhrRgH0xMA9eMVvskwg5W81+O2EW8lDLt5p/u1Zx+yS6OMrnSduy0f6ZKGN8h l3U3w8igjLBYJkmk49/fvz0/9bUfKXFcF/3rO0bJzGS+BoxVLrLOMZTkPOZoeyw6RjbW Z9pKmQyPebN8mQCh0YadDa3a4k4OnZOgycI1vFto98AGgY0/NiOZXL67vH+qPy8jDzcE gGcQ== 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=YxA8FQYDWbxe8BPqwCO+yOABH8hUl4nAhrh9q+4gOxs=; b=Tu249jB9EQ6ppCPYFOTBh2txqBSS39n7MJNqWXoyWJTsvxzosAFKyIDzypgMccCb8g L+QVWtUuTanRwqPcR5sccUVrKj1/sDOwJhf7gBcDybYk7VpRQ8aQqmkXZZkQzgYDasYK Zj/0IYwv5QGU/oEQqVLTXAc295nL44SrZGj63nA5Z5IK2jAeHQZAKjZvYe6O+HTK6Zh1 EDPIP78AW9PaYWhw0PdjMCEqW7yzR9zwzirj23n3ib7WUMrSETfxk/6cdEZ9ysHERY2W B90Ea8aVRUAJwwFIA4QWocIf7byrS8DX5kQdUv+G/XUCvhOPXDJSbIGNsgv3eVqgSmgX fyHw== X-Gm-Message-State: AOAM532v6UhK2rd/hEDRfzs87dMXMCWFamlMTFOEuwDRE0Wr41JFFKUW 0/g0jDuMyTCkQza3Zh4KBD5XvagV4X1OiYUn X-Received: by 2002:aa7:d3c2:: with SMTP id o2mr34437469edr.111.1620717524035; Tue, 11 May 2021 00:18:44 -0700 (PDT) Received: from neptune.. ([188.27.131.122]) by smtp.gmail.com with ESMTPSA id i6sm13871558eds.83.2021.05.11.00.18.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 May 2021 00:18:43 -0700 (PDT) From: Alexandru Ardelean To: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: jic23@kernel.org, Jonathan.Cameron@huawei.com, alexandru.tachici@analog.com, linux@deviqon.com, Alexandru Ardelean Subject: [PATCH v2 09/12] iio: adc: ad7192: use devm_clk_get_optional() for mclk Date: Tue, 11 May 2021 10:18:28 +0300 Message-Id: <20210511071831.576145-10-aardelean@deviqon.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210511071831.576145-1-aardelean@deviqon.com> References: <20210511071831.576145-1-aardelean@deviqon.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The devm_clk_get_optional() helper returns NULL when devm_clk_get() returns -ENOENT. This makes things slightly cleaner. The added benefit is mostly cosmetic. Also, a minor detail with this call, is that the reference for the parent device is taken as `spi->dev` instead of `&st->sd.spi->dev` (which looks a little quirky). Signed-off-by: Alexandru Ardelean --- drivers/iio/adc/ad7192.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c index 79df54e0dc96..18e731f1471a 100644 --- a/drivers/iio/adc/ad7192.c +++ b/drivers/iio/adc/ad7192.c @@ -326,7 +326,7 @@ static int ad7192_of_clock_select(struct ad7192_state *st) clock_sel = AD7192_CLK_INT; /* use internal clock */ - if (PTR_ERR(st->mclk) == -ENOENT) { + if (st->mclk) { if (of_property_read_bool(np, "adi,int-clock-output-enable")) clock_sel = AD7192_CLK_INT_CO; } else { @@ -986,8 +986,8 @@ static int ad7192_probe(struct spi_device *spi) st->fclk = AD7192_INT_FREQ_MHZ; - st->mclk = devm_clk_get(&st->sd.spi->dev, "mclk"); - if (IS_ERR(st->mclk) && PTR_ERR(st->mclk) != -ENOENT) { + st->mclk = devm_clk_get_optional(&spi->dev, "mclk"); + if (IS_ERR(st->mclk)) { ret = PTR_ERR(st->mclk); goto error_remove_trigger; } -- 2.31.1