Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4707376rwl; Mon, 3 Apr 2023 08:32:54 -0700 (PDT) X-Google-Smtp-Source: AKy350Y3IkNieLULR1srVfNHAqRtBo65YX2YGUQ3VCV2Pc6NZ5ARgAWocTPXQrtlGs6PJFKkGbTK X-Received: by 2002:a05:6402:e:b0:4fa:d75c:16cd with SMTP id d14-20020a056402000e00b004fad75c16cdmr31043348edu.34.1680535973813; Mon, 03 Apr 2023 08:32:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680535973; cv=none; d=google.com; s=arc-20160816; b=pmiL4hbohelrf9/+4Rg1692BEZBvzvnaIhk+gx/Pp47srbJSXnoliXw9hSaxvnOlua kRt2dSRmwYokVZiFoS0jhk2LxOMUJusZkdbW7sgpod2Vy++q/cXaWa4KWwn3J43yc3Oc pk/Ytp/DvCfRL2IOz60eIVsV+0EZ1b9f1xWlw0okheiFUl9JFtTBN6skyxr0bRFJ7hld SrJOUVumYd1HQdIl+dT/nKu9Ds2wIInll8MsXEUMBBQs4HZ+kmVsIBKsR0MEyiovfvB1 Yhd7Ach4hA7jrVJUXLG2+gFBq35XaGmu8X/c0ScwhpIgvPhVwgaltX3JfrHvrGy4EETB MBdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=aTzkLYbvfd2IjRZTFEqIenxLEq+ZjYmO48DPd7DLZEY=; b=VOTpQNs7L2DhRxM6behePXhQiXDGjkBldqJVuN7Nzyn998tUNglkv51yVMFBtFwl+t 34IZ2bdu7WzQrlikYJQoMAxO23G6YqXiZ1c///JSzP6lunLxnxvrAaybYK20S3VNyTh7 WKRm73iD0v78fVfQ9kBfr0LvncCSeTYxU/TphfByreiv6nvJZUItTAms783XTkxzkZEn JGVFh/hAWi+yfEtaeCOJCEz3s+rTnNhxZtWFSBE/RoB4dMDX9UB6xsJ0/+u4m1zGYZXa ocAeuTh8syGaatyNwRtl6f9/ZLNFNVlZADM0mR9HM6eGW8ZfUUNl6yWtmdNiK6XOev44 4WeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="G/Pda6VD"; 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 qh8-20020a170906eca800b009345ceac84asi3862514ejb.362.2023.04.03.08.32.29; Mon, 03 Apr 2023 08:32:53 -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="G/Pda6VD"; 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 S232745AbjDCPXL (ORCPT + 99 others); Mon, 3 Apr 2023 11:23:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232202AbjDCPXK (ORCPT ); Mon, 3 Apr 2023 11:23:10 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5738170F for ; Mon, 3 Apr 2023 08:23:08 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id j24so29801822wrd.0 for ; Mon, 03 Apr 2023 08:23:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680535387; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=aTzkLYbvfd2IjRZTFEqIenxLEq+ZjYmO48DPd7DLZEY=; b=G/Pda6VDK6CxGQSeSiPCjP+S24TJAX3Dk5+qGro8GNMocnUHuA1ITVKwywe21C5HZ7 BESY7KJmZeWGxvOiIkcexgYYe30hSBzTlwgAN8o1/RAw0tLS5N7FLOirAFLszZcqLGl1 CwuiLVeC+RO+KLy33iEYBdVr+oDSxoxm0vh+f219Xp1IcVHRFeC3XocRX5h/gDSYIjtI b2EF8E1pP7XBplWfwKAwhI+4YALVOxcVL4siHkV/ujRLQwvYLbawMIDMnrXM0MRDjWJh rrvkgHAWGLTfKWyV/ZR9fPL9645FfkiJlty1QZ3DTHj9KOj7DWAUvHXE6sJ5LwLxFT8Z BPwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680535387; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=aTzkLYbvfd2IjRZTFEqIenxLEq+ZjYmO48DPd7DLZEY=; b=Hv7C7PUGpx1d/IBomY8W1JVSUro3lqRMoWr70QmhppNm0VSkaUHbW62ugy5mZfJVoB meON27HsmZz9NDUj65OwK39oxI7O8x4sqRihxZ+2DyErK97ogLP5A6JaRJzqH6V5QKN6 eLa3vdkNvrgSD1vo+ncY1AOWfqs9za8EDF+Lli0fJztV5VF5CWk1OU7CRMZqcyJJXGEn GlDSdC45F0ji64URX3VkGUUmLnLx1icmP4xywKbMK2K8GyIvKPWjJ1qHiSv1mXOafJ/L Q0M1IDOBbUyJdKSBzaNNq/9QQTgWe4GLbRrNc8QS8Cpdz6z48J//QlUou69TX2TZWs4H vJIw== X-Gm-Message-State: AAQBX9czNTn6XNch3SMR8inw/Z89WBSeXdrUaxy02t2FnPXADi4mdF1N BlFRPvMED+vEQpjZvXryIy9amRY5Z/iC3+kD X-Received: by 2002:adf:fccc:0:b0:2cf:e868:f789 with SMTP id f12-20020adffccc000000b002cfe868f789mr26500082wrs.48.1680535387234; Mon, 03 Apr 2023 08:23:07 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id p6-20020a5d6386000000b002e558f1c45fsm9870405wru.69.2023.04.03.08.23.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Apr 2023 08:23:06 -0700 (PDT) Date: Mon, 3 Apr 2023 18:23:03 +0300 From: Dan Carpenter To: Khadija Kamran Cc: outreachy@lists.linux.dev, hvaibhav.linux@gmail.com, johan@kernel.org, elder@kernel.org, gregkh@linuxfoundation.org, greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Alison Schofield Subject: Re: [PATCH 2/2] staging: greybus: refactor arche_platform_wd_irq() Message-ID: <02031cc0-c035-4171-89d2-6e53a5c3d6d8@kili.mountain> References: <96d04a4ff3d4a46293355f5afae3a8ece65f2c5b.1680185025.git.kamrankhadijadj@gmail.com> <6ce8aa34-e600-4d6a-adad-ead8255342e5@kili.mountain> <9688d93f-5ece-4799-898d-98515a98f9be@kili.mountain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9688d93f-5ece-4799-898d-98515a98f9be@kili.mountain> X-Spam-Status: No, score=0.1 required=5.0 tests=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 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 On Mon, Apr 03, 2023 at 07:29:36AM +0300, Dan Carpenter wrote: > > > This checks that we are not in WD_STATE_COLDBOOT_START state. How are > > > we going to be in COLDBOOT if we are in INIT? Is this changing in the > > > background? Can this check be removed? It turned out the answer was yes, it can be removed. > Also if stuff is changing in the background and there is no way the > locking is correct. The locking is correct. Take a look at it. We are holding the &arche_pdata->wake_lock in arche_platform_wd_irq() and every place that calls arche_platform_set_wake_detect_state() takes that lock first. So it can't change in the background. Delete the check like so. regards, dan carpenter diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c index fcbd5f71eff2..4cca45ee70b3 100644 --- a/drivers/staging/greybus/arche-platform.c +++ b/drivers/staging/greybus/arche-platform.c @@ -172,18 +172,11 @@ static irqreturn_t arche_platform_wd_irq(int irq, void *devid) arche_platform_set_wake_detect_state(arche_pdata, WD_STATE_IDLE); } else { - /* - * Check we are not in middle of irq thread - * already - */ - if (arche_pdata->wake_detect_state != - WD_STATE_COLDBOOT_START) { - arche_platform_set_wake_detect_state(arche_pdata, - WD_STATE_COLDBOOT_TRIG); - spin_unlock_irqrestore(&arche_pdata->wake_lock, - flags); - return IRQ_WAKE_THREAD; - } + arche_platform_set_wake_detect_state(arche_pdata, + WD_STATE_COLDBOOT_TRIG); + spin_unlock_irqrestore(&arche_pdata->wake_lock, + flags); + return IRQ_WAKE_THREAD; } } } else {