Received: by 2002:ac0:cd04:0:0:0:0:0 with SMTP id w4csp612998imn; Sat, 2 Jul 2022 02:07:17 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u1+s9BKXR6kZNvCG/JArPWiPuEv1nj3QYUrSLzrvpXNdadcbkUGGS4Z+wkvweSGY1rwYxf X-Received: by 2002:a05:6402:950:b0:439:646e:c68e with SMTP id h16-20020a056402095000b00439646ec68emr13999630edz.42.1656752837190; Sat, 02 Jul 2022 02:07:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656752837; cv=none; d=google.com; s=arc-20160816; b=TKehcp4DVcAyjGkBrGh8b8UT4eoSBDudp32G9YKVIiK+AsyKaB7SbS25rmCSB0chxm DZwAFMgLyO2j6ndGRYVk/Riur04nWAUFKG5z+FoLm1o40YQ51EUhk4qZ+DpRgNjidd1G kr+VR3aIGgQVGDr1GjmxakmssEMFyIoAqHjx1xJrl5LUCdqI+0+x2Mds6rZ3WOGpNVFd BTWKgCYbPrZm0TGHMkzmRJZpwpFyffZ7xiWxPJdmu/0tl+9c5ss59XLBIRBGIrCy0+Vp FkXKaEoNZxbW4Wao5DvpQLvl0vft1M6nLFZDMNQtjb7Isyrkp1A0RPTJ9BDQ3OZUARre t1qQ== 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=xzytIjE57UyjLf5iE8uCuMXiTfnurGpdSiaoc4cIUx8=; b=n0Pv7+mcJZ0klwL0YMLOV5F/3zC/OcMk9azG0jphk7d3dnr0sHpyNOE8B0sWe6eCJr gyBJbYfc1H/hPGh4S32fZ7vu8/ocDPgPZ8KlCr9/Q1NNKCmmZbjxWRUb+sB0tdSyOjUy z/DdZiqROyD1gpSkbKmlaZLngZYHn8ZoBvVfNONeJ5aaL0khZFkjS4qki1OpikK/OaHJ u0U9NtzENqZ5LW/L7oFjwddXhmJdA1dOyDpsy8LeAPlW0DaKcSNA2g5X8BFCzVBPIncj xxWoS3x+1p3/3VLeeSIghzaZHVnFxVLITAENmVvgIfZbbKhPHgqe4inZVubxVMK1VF4g QC4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Zn+soKIG; 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 ne16-20020a1709077b9000b006e8d1d9dc28si6389238ejc.32.2022.07.02.02.06.38; Sat, 02 Jul 2022 02:07:17 -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=Zn+soKIG; 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 S232147AbiGBItz (ORCPT + 99 others); Sat, 2 Jul 2022 04:49:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230096AbiGBItx (ORCPT ); Sat, 2 Jul 2022 04:49:53 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E79541A061; Sat, 2 Jul 2022 01:49:49 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id c130-20020a1c3588000000b0039c6fd897b4so4962477wma.4; Sat, 02 Jul 2022 01:49:49 -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=xzytIjE57UyjLf5iE8uCuMXiTfnurGpdSiaoc4cIUx8=; b=Zn+soKIG6jLILePplWiptlN68bslIlY1l7jNBTAK9UAEKlI7OAwZkT3o7CKgk1ucbW r/73trnXdoxyLMq/hZrXPzz/xV+SZF/SYkFGngqyfXx5Sklgv5R0mE1X/Nn1VxR/OH7B rQ1L7uHV1w4Nl+2mLsbhlCVYb+lKGueI6CpAvmSyQB/xCacXBY92oiH7yoxar1bRmE+c jxdfI/Vfs39RzsgueWQ8g8FalQ/hrWPEeOCSufgEOCnRJb1UMPZ7wwZrVnL79jo2ztz2 l6f0aSMJBO8F7ra3/Yd7T3/rFKpBg0YGgeX8t7+H/oyg9+lkh2phPsPIhcYTVklTib4y K5YQ== 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=xzytIjE57UyjLf5iE8uCuMXiTfnurGpdSiaoc4cIUx8=; b=PKPRsJPWTLs8zqi32BuAFBISg3DdQ0TyPRCRSzHw02+k76rmmaNJHuyTmQnJPBP1VS 2wfniTjBEpBXUcGe4OyEz+lZM14bzXF/gJ7KaH7DMI3Lcrc+edqpx1j0i6IpHzlQfKZl JE2Cp0j3dq8R5ZPFoVc6mxJ4lSp61gEOUmTlprsZrQzpWOnXkGZ84tyv08Hz+hgPKfXA G5lcRPNhaXRBHM+Mq5gp2+AAWm2xZwTTGqAomANZaHNBxkbrN6yOD6vYq5OjFwuFg5Bz dmQz80mDhkn9a3P26BPqO5fMGfgOv14EI0xYiLNw/0X/vM/Et/bcfV1r+nhb4KMfPm5O svJQ== X-Gm-Message-State: AJIora83RpXWB30Uheb70MPGuX7HBZi/u2pXcetxnt7rKfL9CIyeDTfd KBZJP1/LIROWkX3tfmG4X9E= X-Received: by 2002:a1c:2b05:0:b0:3a0:2ae2:5277 with SMTP id r5-20020a1c2b05000000b003a02ae25277mr21097394wmr.30.1656751788410; Sat, 02 Jul 2022 01:49:48 -0700 (PDT) Received: from localhost.localdomain ([2001:1670:c:f4bd:c360:335a:282d:b75f]) by smtp.gmail.com with ESMTPSA id q20-20020a7bce94000000b0039c4b518df4sm15904408wmj.5.2022.07.02.01.49.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Jul 2022 01:49:48 -0700 (PDT) From: Yassine Oudjana X-Google-Original-From: Yassine Oudjana To: Caleb Connolly Cc: Yassine Oudjana , Yassine Oudjana , Andy Gross , Bjorn Andersson , Vinod Koul , Srinivas Kandagatla , linux-arm-msm@vger.kernel.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] dmaengine: qcom: bam_dma: fix runtime PM underflow Date: Sat, 2 Jul 2022 12:48:39 +0400 Message-Id: <20220702084838.13233-1-y.oudjana@protonmail.com> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220609195043.1544625-1-caleb.connolly@linaro.org> References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 From: Yassine Oudjana From: Yassine Oudjana On Thu, 9 Jun 2022 20:50:43 +0100, Caleb Connolly wrote: > > When PM runtime is disabled, pm_runtime_get() isn't called, but > pm_runtime_put() still is. Fix this by creating a matching wrapper > on pm_runtime_put_autosuspend(). > > Fixes: dbad41e7bb5f ("dmaengine: qcom: bam_dma: check if the runtime pm enabled") > Signed-off-by: Caleb Connolly > --- > drivers/dma/qcom/bam_dma.c | 18 +++++++++++++----- > 1 file changed, 13 insertions(+), 5 deletions(-) > > diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c > index 87f6ca1541cf..a36dedee262e 100644 > --- a/drivers/dma/qcom/bam_dma.c > +++ b/drivers/dma/qcom/bam_dma.c > @@ -566,6 +566,14 @@ static int bam_pm_runtime_get_sync(struct device *dev) > return 0; > } > > +static int bam_pm_runtime_put_autosuspend(struct device *dev) > +{ > + if (pm_runtime_enabled(dev)) > + return pm_runtime_put_autosuspend(dev); > + > + return 0; > +} > + > /** > * bam_free_chan - Frees dma resources associated with specific channel > * @chan: specified channel > @@ -617,7 +625,7 @@ static void bam_free_chan(struct dma_chan *chan) > > err: > pm_runtime_mark_last_busy(bdev->dev); > - pm_runtime_put_autosuspend(bdev->dev); > + bam_pm_runtime_put_autosuspend(bdev->dev); > } > > /** > @@ -793,7 +801,7 @@ static int bam_pause(struct dma_chan *chan) > bchan->paused = 1; > spin_unlock_irqrestore(&bchan->vc.lock, flag); > pm_runtime_mark_last_busy(bdev->dev); > - pm_runtime_put_autosuspend(bdev->dev); > + bam_pm_runtime_put_autosuspend(bdev->dev); > > return 0; > } > @@ -819,7 +827,7 @@ static int bam_resume(struct dma_chan *chan) > bchan->paused = 0; > spin_unlock_irqrestore(&bchan->vc.lock, flag); > pm_runtime_mark_last_busy(bdev->dev); > - pm_runtime_put_autosuspend(bdev->dev); > + bam_pm_runtime_put_autosuspend(bdev->dev); > > return 0; > } > @@ -936,7 +944,7 @@ static irqreturn_t bam_dma_irq(int irq, void *data) > } > > pm_runtime_mark_last_busy(bdev->dev); > - pm_runtime_put_autosuspend(bdev->dev); > + bam_pm_runtime_put_autosuspend(bdev->dev); > > return IRQ_HANDLED; > } > @@ -1111,7 +1119,7 @@ static void bam_start_dma(struct bam_chan *bchan) > bam_addr(bdev, bchan->id, BAM_P_EVNT_REG)); > > pm_runtime_mark_last_busy(bdev->dev); > - pm_runtime_put_autosuspend(bdev->dev); > + bam_pm_runtime_put_autosuspend(bdev->dev); > } > > /** > -- > 2.36.1 > Thanks for the fix! On the Xiaomi Mi Note 2: Tested-by: Yassine Oudjana