Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6061141rwl; Tue, 4 Apr 2023 07:21:43 -0700 (PDT) X-Google-Smtp-Source: AKy350at95tfUX/NYq3+gG7uKPy9J59nwFW9v+Yc8/TDxP3thLuoB4dLx/7TvlqCA2Hxb1aa9U8J X-Received: by 2002:a17:902:db12:b0:1a2:19c1:a96d with SMTP id m18-20020a170902db1200b001a219c1a96dmr3379212plx.23.1680618103282; Tue, 04 Apr 2023 07:21:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680618103; cv=none; d=google.com; s=arc-20160816; b=X3uUjaBZvjxkwEZWHmDdoR96TctsQceXr3ivY9hYoQxnhYqS0rUxN/4tGY0sCC+aix f1g8zJcX7D/w/Xk0ntHhKqoQGx2LoO5YPz1HKia2we2IUYZIjs6en3EdHQ9OfMIFA/fo ZXyF6mI0clNR196iHwtDIWkph61Z3ZDb6CX5XNUzgaxFe14Iw17Ukk/1641SY7Vq6W9G Nu73RvFowgWhqs0AaGSrKoGwyB1pg8xk++88EIj/MNk+47BK0JFbliikRnes2As9rcWJ aN4v9KQDOzxDYH/ZDFrtfMwRbsDn2645cSVIE5xVSCiS2jrRVZEC6gL1iFffmlwZrdqj 5RCw== 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=VXpkbjdlcHxE2UhGi8BVKz9oJwAUhYdEPgQCrFBUbtg=; b=USVGymSd4veDHRYraCqG0hEYONjBRajcInpJRG9ZHvB9FTG3QUsyxfL7srDgBAh3il vENIkaCBH59bU5+cHkqjiJK7hAIV3QZp8D8mo7LI2oZ82yd8C4FFv5/Ojjwg7w2YRJ/9 RAkUGR1aX2BLY8VMQhj3H1fC8IXL4sqmyLDd1g6YS+GDj2ikulgr4JPXLXCuxrgQsXck Ui9EJPkHtR/7dpZwqBxlWBjUIqv6hOmsi+GXTWF8nhgBCFCueWsc6ttqzqjEDhh9fDN2 49UMsTh+iXzlwFJmltSa0nwbXhySjWb1rOtGBZ1+C/a0D/tgRn4d05cNVJprLGk2Asy9 K2MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ANaY3Sh6; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iw11-20020a170903044b00b001a1e867f261si10061861plb.326.2023.04.04.07.21.31; Tue, 04 Apr 2023 07:21:43 -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; dkim=pass header.i=@linaro.org header.s=google header.b=ANaY3Sh6; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235820AbjDDOMc (ORCPT + 99 others); Tue, 4 Apr 2023 10:12:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235677AbjDDOMM (ORCPT ); Tue, 4 Apr 2023 10:12:12 -0400 Received: from mail-yw1-x1135.google.com (mail-yw1-x1135.google.com [IPv6:2607:f8b0:4864:20::1135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34F0A44A7 for ; Tue, 4 Apr 2023 07:12:09 -0700 (PDT) Received: by mail-yw1-x1135.google.com with SMTP id 00721157ae682-536af432ee5so616670937b3.0 for ; Tue, 04 Apr 2023 07:12:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680617528; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VXpkbjdlcHxE2UhGi8BVKz9oJwAUhYdEPgQCrFBUbtg=; b=ANaY3Sh6n86OcFsrMqgmdJnGPyQOIhZ6nlCWS5mYv5y2mHg71tnjhg8PZuIkR0nI6M unZ/wv8g57w6kK/GrQ1psdcxM1TOy1+Klw3LULHA4WnqMhiPtaWpDA/Io7YlTg2M49nD USSjeIFHQ2y8LagYrRuFGdDFh7j4n8ScbrPKYCzpoqYgKSBHhOeH1MkLxlv6mwSbxAh1 uM8+RycfcpMn80GWoODlWTd5XP+bzBoiWI2/wIaS/Jn15KelljV+kCmX1qrA0Fn6/aba OobIFVzVJ8yUydCZ6THMmCtCWYgvzJ37kiUhfdYBWEadHrxLK/PgSE2CsdOPHG3t70AL d2lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680617528; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VXpkbjdlcHxE2UhGi8BVKz9oJwAUhYdEPgQCrFBUbtg=; b=p6AF29A2JV0EWs8MezZjM+3r9hyzja7teNgF9xGXcyZCffVPVExab6f4LTAPJ5XetI 6W7FgAjkQSqbY5+6IS0Y49H2tsK2NbXHMEzXKNN0MfbKqgixndhlvs9ireDVagXhC2Z8 BG+uzp1pbUMv9lai74AuXNKBSJzvYkNBNrQl2TLOFWMrjBY2yGrI4MRsqgKqPvsPNWrp Q09gNVktTSjNVuvsY0Mb9MF1KLEcky3ChkBYbVjXyilT4BwivhIDGVnH0Klj1yc9CA+B R7uTL6yFdWO9CStCmfptopo2Witbe0i00nwV5abGEsxO452chJLwGlgLUabXXFA5q3Mr hp0w== X-Gm-Message-State: AAQBX9fJH+1tsaf9pSEmtfPxbn/z3twAZI2iiyBmzNtUfUSgy7n40ylr lpEebK4HPuKoVw/sIcTO7YuGVdn6Kb6IITFeY2nj3w== X-Received: by 2002:a81:1383:0:b0:541:61b1:4a59 with SMTP id 125-20020a811383000000b0054161b14a59mr19446751ywt.3.1680617528187; Tue, 04 Apr 2023 07:12:08 -0700 (PDT) Received: from fedora.attlocal.net (69-109-179-158.lightspeed.dybhfl.sbcglobal.net. [69.109.179.158]) by smtp.gmail.com with ESMTPSA id d195-20020a811dcc000000b00545a08184d8sm3202750ywd.104.2023.04.04.07.12.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 07:12:07 -0700 (PDT) From: William Breathitt Gray To: Jonathan Cameron , Lars-Peter Clausen Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko , William Breathitt Gray Subject: [PATCH v4 3/5] iio: addac: stx104: Improve indentation in stx104_write_raw() Date: Tue, 4 Apr 2023 10:12:00 -0400 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 By bailing out early if chan->output is false for the IIO_CHAN_INFO_RAW, indentation can be decreased by a tab and code readability improved. Suggested-by: Andy Shevchenko Signed-off-by: William Breathitt Gray --- drivers/iio/addac/stx104.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/iio/addac/stx104.c b/drivers/iio/addac/stx104.c index 8730b79e921c..9cc467469dde 100644 --- a/drivers/iio/addac/stx104.c +++ b/drivers/iio/addac/stx104.c @@ -180,20 +180,20 @@ static int stx104_write_raw(struct iio_dev *indio_dev, return 0; case IIO_CHAN_INFO_RAW: - if (chan->output) { - /* DAC can only accept up to a 16-bit value */ - if ((unsigned int)val > 65535) - return -EINVAL; + if (!chan->output) + return -EINVAL; - mutex_lock(&priv->lock); + /* DAC can only accept up to a 16-bit value */ + if ((unsigned int)val > 65535) + return -EINVAL; - priv->chan_out_states[chan->channel] = val; - iowrite16(val, &priv->reg->dac[chan->channel]); + mutex_lock(&priv->lock); - mutex_unlock(&priv->lock); - return 0; - } - return -EINVAL; + priv->chan_out_states[chan->channel] = val; + iowrite16(val, &priv->reg->dac[chan->channel]); + + mutex_unlock(&priv->lock); + return 0; } return -EINVAL; -- 2.39.2