Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2569148pxj; Mon, 10 May 2021 06:07:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyM5L7sJuy4jc6tcoEZKjg8s0ASEk6nZtr4dg3AmIRXnPYKhSHNN/mA9OrrP43T+Ygy3O/G X-Received: by 2002:a17:907:7b9f:: with SMTP id ne31mr25589488ejc.139.1620652074548; Mon, 10 May 2021 06:07:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620652074; cv=none; d=google.com; s=arc-20160816; b=gPihvj4WIep9KdALzp/0cDvrp+vExcjfnW85wxZg8s9ACmcg8XpO7JG6I7Q6j07R1W Ayntwx5hb+5OQg/s9qKFtn11hXT+ZrHA8Yn2Po7zxn0nQzt8KvZnAS2ZZ16iP06QXLia TTC1okx9iCUQMsX1eLq6Cjq/hAYNS3h+nhlv84Y2qCLC00C/5cmUrHF8eIuZLYQmxEhu ShYmvbJy9/PmC+wHla0Vi/y98VCP+ZHC5uoPlIqu0WkY4i8OXVGNaCIj9ufuvfWXHkOD QQHxn4VeebIXvJSKIGF4pqrHcET+iPfliduoAh0zP98sqS3ZeIvv1OeRZcI4e0chlGQ6 QnqA== 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=CiE+DRXkOw8bMfDOSqysGFYepMljSM6PNYuMxJPfrmU=; b=Py4/qwkJ7Zd2UlNhfFH93powcxtz+R/A4NrC2294yRp/M8UnERW/rCQzdSiqPvtH2l s6ngD9spCIo1ajCebKaLaXm6ijvolLfRk25XmCC03oxHkMcc9GIMsLZMOmpdd4/Kt0sp BCR+JuNAdBqrM2UMTwqklfR8W+dwPniojB/4daqP8BQcP+wSuWNuqheRQUjt0EWAj5te zTVg1zWj9Mue9IRBAZ5Upg4J10Yt0Ku2rOZkLMRiPzjjQGJyQT36n0ClQ2HMMB5B/ZGu Z9d3L2v9yrAEKvkOHfHKfvStH0wEC6sgZk9KH/v7BzmhRAtXGfZew01TDEd85Aupb9kO HaYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deviqon.com header.s=google header.b=XecbULtB; 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 g9si12409638edm.502.2021.05.10.06.07.30; Mon, 10 May 2021 06:07:54 -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=XecbULtB; 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 S1351316AbhEJNGI (ORCPT + 99 others); Mon, 10 May 2021 09:06:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351143AbhEJNDA (ORCPT ); Mon, 10 May 2021 09:03:00 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAFDBC061358 for ; Mon, 10 May 2021 05:55:56 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id x5so16504270wrv.13 for ; Mon, 10 May 2021 05:55:56 -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=CiE+DRXkOw8bMfDOSqysGFYepMljSM6PNYuMxJPfrmU=; b=XecbULtBOeyGf4Bxa5VCo5LMZqF3LVtq4rHnbXFTCyIjfm01Vj82BE+TIOjJjDSWCq FS+PUOyMtrSvIAEw80KWs6lCMFZ4akV2WfrLhPF9QH1ltKGPtGAilNPBf0DbrN9lKLYC y+uoq0TZ2nRmHuDMbCvTQGPQ+aKPVpSIghEDSV1zKxsfzRZbX0yaU2DNQ7M2O6VeumQ7 qF4JOc9t6DqgBg0NV/ry4TbeNyHV98txsDTMkzr3w0K6janzYGmo9/1gmtITuOpO1PsP m8WTEfbxEFQ5cRTj7Krpj8o1+Fb/SOs6ztekIu4wkok42DeW1+MdfIt9i83FSI8X7jfx W0kQ== 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=CiE+DRXkOw8bMfDOSqysGFYepMljSM6PNYuMxJPfrmU=; b=R7yH7iZEqwQSlxGFUXVxRz5Og+mZ1my3Ms7sr91EeT9wl40HQTRhznKxSLQ0XctSd5 5qssawxq4OkO5J1LbYYQJA4Vu0dePW6ul2b0i33tNXRL+9phBTb4lsoWj9eFCTbWXum0 vnkktl4pFU/P3+G++1+dIzWpRJCCsN30GgxMuLypiWrlVh8pKoie64/hY8s9Rgkf/I18 qLExzo/WoDFPgKk3YXRnMBzEtClcqPdhi25RSYoKmLN6Em0v/ZCXOaEkvfUXeWT6cT2I KXNwlJn0/2tF44OPxTUi6qup1LCc/GbdhWHJi2FxTTM3bhZI7TnY74MgVxvW0KaA8chB KpeQ== X-Gm-Message-State: AOAM533jHR+xZHVtEUaxWC0DvZKTS4Scazr7+yD7OOv1h+Jzd6xP8nA7 BtuGAx/hClr0in2A7NhkpDf40nDiyrYaGg== X-Received: by 2002:a5d:64c7:: with SMTP id f7mr30026754wri.257.1620651355719; Mon, 10 May 2021 05:55:55 -0700 (PDT) Received: from neptune.. ([5.2.193.191]) by smtp.gmail.com with ESMTPSA id n2sm23134329wmb.32.2021.05.10.05.55.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 May 2021 05:55:55 -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 05/11] iio: adc: ad7192: use devm_clk_get_optional() for mclk Date: Mon, 10 May 2021 15:55:17 +0300 Message-Id: <20210510125523.1271237-6-aardelean@deviqon.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510125523.1271237-1-aardelean@deviqon.com> References: <20210510125523.1271237-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 crazy). 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 2ed580521d81..2671581d761f 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 { @@ -981,8 +981,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