Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp78313imw; Wed, 13 Jul 2022 19:37:21 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vw6Bz/PkerDqiAf39SRMKksyelJKfM1Uo+pnrmUFvWAbNDYX59WjDrDEVJjNp/XQQRcKZ+ X-Received: by 2002:a17:902:8a8e:b0:16c:66bf:1734 with SMTP id p14-20020a1709028a8e00b0016c66bf1734mr6160711plo.161.1657766241301; Wed, 13 Jul 2022 19:37:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657766241; cv=none; d=google.com; s=arc-20160816; b=gDOLpBBc2VQIjJhQhfXJwGbPyBQ7N3stNPgev/VQrSdJmYk+CIWP44aaqfr7Wa79ot XNMFjfqB+vBQJSOI/NzXBlvi8C2X+6gd7UyPCN//l5g4QR3eKqMvR+iJ+Qjna2g0jevt dytKTWMkHmGdNjOef3dYDuCfrImPQtGH4F6tkiITX5doIm/ynLmXz3gon61uaRaAtEZY DoOrK6MOwQyiL5CB5fSeE09cUosdu/9f3w2OTaJsx4CsjioejAEfVXgJKc2RIBECVtj+ mgEAAleKfr4MVlH+kyVJOECtIYGBcF0JMb4jACpC9p/7NmyH9eQSFwFVZMuLGGhIQNTA 7CpA== 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=u8xyMNAQAMH3dB784aVpeEcj3aQzHocuPU4wVMMpJ6Q=; b=aQfLDjU1lEDK5YZPRGpPMGUrz4nqsMxqvIBHXFvZ1cyi2UDxixYtjH0h/XDoZ+T4UO NKWck466/t7ZmWsZhBLrSDYuU1pK4oLMisicMBxjgmPYOKSthLwmgDmXbNfOlz87G37l hzgiYPFokPteJhvYNknExQl2vCo4N3d1ZeKU2TLuHJH0EkNLa7zHJyPjTrU+LK9ry1IN OsJkqQq2Y6iTJ8ab0pdM3JUXPH879KTc5vWS4J2eDu8Fk6Pl+Hbyh5uReLcqI0RkDTYa 2xUkryOvJwGNQAdfCIrqpJYKwsLMX0Kyti9U7mgL+lqrRIBdJTiOnFQQ0ztYZrojLizB SfwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=d4rOOUSZ; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h8-20020a17090a2ec800b001f05563b9eesi540474pjs.103.2022.07.13.19.37.09; Wed, 13 Jul 2022 19:37:21 -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=@gmail.com header.s=20210112 header.b=d4rOOUSZ; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232391AbiGNCDz (ORCPT + 99 others); Wed, 13 Jul 2022 22:03:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232382AbiGNCDv (ORCPT ); Wed, 13 Jul 2022 22:03:51 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AA1BBC36; Wed, 13 Jul 2022 19:03:50 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id d10so578233pfd.9; Wed, 13 Jul 2022 19:03:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=u8xyMNAQAMH3dB784aVpeEcj3aQzHocuPU4wVMMpJ6Q=; b=d4rOOUSZiipBq/BDH0r4CmgTwGh9cgOjb8JEnDjh45dymPaVcsge8LF8qAO/WizEGj NBGkyo2TNgAVIXYs0A2akgs7cfvUWXiu6eKuIYQtvLlfDeYJroIJb2AGhplFNeh17kMG hsKtftI8EA1fnJacwLFsoNCy0jgh2C4szjBdfJ0RbP42h5r9sVNnDbTzvMdwAe0l8A/B Vr+V9G/+f/v7phBoClB8MrjMAkuSdY23ao6Q1zPfK1YzcBA+A5jPpFNlJX+KnY7CJBUx ZmJTs8USACLpfeOxrc8RfG58JYHqziaLlwzUVks5GTIPP2wzPQIZT0l2LpyeiCX8OB4C UJ+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=u8xyMNAQAMH3dB784aVpeEcj3aQzHocuPU4wVMMpJ6Q=; b=uo6ZWe3axYoEehVCe46AaRJCNngUEMtDAqwbkdKGizru2xc6lS3vY2JquyTRojflSy aJR1uU189hkzF+Y6BUYtRHko7CYbjOi0asF2OoXj6x/Y3lm8LCr5M+EXb4jQ5rx/v/jD OOzj6y3L4Ml4OOl4kTL/JPOWisYnHbQYP9z14peXS6SnonYIR2gzrg+dYrCX7qxSBNC7 0uGh5XbmF90JtakXR+5QmlOdoRExWUFMTYudAx+dFBFcvLbMPdg1bX2LEX+w2L3tTYXz 0JFreucPB4IbVIQv24S654qUxxUhqqb7mNEUyBgHd+fKP4jU9jqfEpHVzjO4P62Ohypz 8zqQ== X-Gm-Message-State: AJIora9ff+8KUdcnPkzDloW5/f4IpDpqb8epPiONVRVoRQfAb/fHvhFD iLUGAigdq+DQHtWcOsjesS8vJTbsZBs= X-Received: by 2002:a65:5381:0:b0:415:f0ec:ac70 with SMTP id x1-20020a655381000000b00415f0ecac70mr5517289pgq.473.1657764229416; Wed, 13 Jul 2022 19:03:49 -0700 (PDT) Received: from sol.home.arpa (110-174-58-111.static.tpgi.com.au. [110.174.58.111]) by smtp.gmail.com with ESMTPSA id i137-20020a62878f000000b0052542cbff9dsm230886pfe.99.2022.07.13.19.03.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 19:03:48 -0700 (PDT) From: Kent Gibson To: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, brgl@bgdev.pl, linus.walleij@linaro.org, dipenp@nvidia.com, andy.shevchenko@gmail.com Cc: Kent Gibson Subject: [PATCH v2 1/6] gpiolib: cdev: simplify linereq_free Date: Thu, 14 Jul 2022 10:03:14 +0800 Message-Id: <20220714020319.72952-2-warthog618@gmail.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220714020319.72952-1-warthog618@gmail.com> References: <20220714020319.72952-1-warthog618@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 The edge detector is only ever started after the line desc has been determined, so move edge_detector_stop() inside the line desc check, and merge the two checked regions into one. Signed-off-by: Kent Gibson Reviewed-by: Andy Shevchenko --- drivers/gpio/gpiolib-cdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c index 0c9a63becfef..b44526e3630e 100644 --- a/drivers/gpio/gpiolib-cdev.c +++ b/drivers/gpio/gpiolib-cdev.c @@ -1460,15 +1460,15 @@ static ssize_t linereq_read(struct file *file, static void linereq_free(struct linereq *lr) { unsigned int i; - bool hte = false; + bool hte; for (i = 0; i < lr->num_lines; i++) { - if (lr->lines[i].desc) + if (lr->lines[i].desc) { hte = !!test_bit(FLAG_EVENT_CLOCK_HTE, &lr->lines[i].desc->flags); - edge_detector_stop(&lr->lines[i], hte); - if (lr->lines[i].desc) + edge_detector_stop(&lr->lines[i], hte); gpiod_free(lr->lines[i].desc); + } } kfifo_free(&lr->events); kfree(lr->label); -- 2.37.1