Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp1077885pxb; Thu, 17 Feb 2022 23:33:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJxGDJKVyxGfABiOKEnZ9t9mpVvbCsAC+vHCUN6DOkBl1tmcEzYrPYCzpTsXU88uEto/tILX X-Received: by 2002:a05:6402:1341:b0:407:cece:49f8 with SMTP id y1-20020a056402134100b00407cece49f8mr6516589edw.152.1645169592125; Thu, 17 Feb 2022 23:33:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645169592; cv=none; d=google.com; s=arc-20160816; b=wnctF/3edYJf96lb8kTh9bEKVzxsWvrD2lENU3wj8ZJF56LS1PRcpYs9YYyCr9RkAQ KhfdAKLQAlHn6fsNUx7+PI4mYX/p1fMFpZ3gJHVEEXHi/kJvGsGmuYhcrNuIRr83xffo 2dlA0ZN62DALuSN3I4SuoK0c56Amc1WERh6e619d4WCl1vndakLBRastW9KqQfycj81B mTowWVPviKriD8pwJgGY7s61nX8KM0xbP8TFzNEPY1yA7VvX9yzyuWBlshXmB0XJKb/G RKhHsFrYKZwQuKGlbwiOceuJz3tpxInu2ajQb9uNzz2EVn3/xd3Kbs8KVtA/ceRPexc9 kgmA== 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=hwIwmozBRb+SIKDwAi1t2fHNjbfVfFXNlS0d8+RWGoo=; b=dOlbOiKi0vgWuccSwqSUMnTk8SO7+X2yBhi0F9vBNT+72dbblQYdHTqrx0A3dgZHH2 2wRuvmi/XFjYEghNE4L8OeWaHq2kyfyv25W1zh4e8J623SV/lc8xehg+9FyTsQvfQSRO cbbod6TAZ1VU4XVwGcIX0UKnqW7og5gFDaBf4zY/DREPVNg7XtcTmMgjd/3S4bblx/tl /l0C81qYwfiC121aAMoqQqO7KeACV06+7Kh/QiRLgWIXc2k7/fwoYUea8G6kHcVHNdjE 9TIxVmxV5dawHGPO1r9Fb6h11EK2vk5OmZsjlohRVCojnw5381Limo3FDpcR8ihHfXeU lKsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WrLbA6+N; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b17si1135784eja.522.2022.02.17.23.32.49; Thu, 17 Feb 2022 23:33:12 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=WrLbA6+N; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231377AbiBRGeQ (ORCPT + 99 others); Fri, 18 Feb 2022 01:34:16 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:51104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229768AbiBRGeA (ORCPT ); Fri, 18 Feb 2022 01:34:00 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D360A369D7; Thu, 17 Feb 2022 22:33:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 020EAB82537; Fri, 18 Feb 2022 06:33:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF86AC340EC; Fri, 18 Feb 2022 06:33:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645166020; bh=oQK3hn8aIgAl4tYz+ZxnTVfrY4IVhUqyJJf7MAjs6rg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WrLbA6+NkvFz3cXjrHpU9UPR+Oqb0OvTNd5Wip3xvgwDS4CsMCWIQJPM5xX/BYwtn WA/Bquj+XlOa96Rd6lDPFE2GFs35/Tza5wNk48smSNr4I+xPlB7vCKxsvm4XO8L794 GF+q0yfoSq9cueq4RZlrTbk3G8moWVqW4bI8Y+0aQbTT0WSjoyWaQMLgXa8l5WCLTx YpN+iaVMsF5eBIqNHvEe9c9Got1aA3YvrXCKFlRbBw32bdWOuuZEpwlp733OALEA3X WrEVX2/jdtDTpacFun+dD9Vxw6eLHRqQEYd6o/gpu/aeXqbIah3LkzIZHGcRqo0wKM nmOhsEnkrgEkA== Date: Fri, 18 Feb 2022 12:03:36 +0530 From: Vinod Koul To: Bjorn Andersson Cc: Wolfram Sang , linux-arm-msm@vger.kernel.org, Andy Gross , Douglas Anderson , Matthias Kaehlcke , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Alexey Minnekhanov Subject: Re: [PATCH v5] i2c: qcom-geni: Add support for GPI DMA Message-ID: References: <20220131120403.2481995-1-vkoul@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 On 17-02-22, 09:35, Bjorn Andersson wrote: > > +static void i2c_gpi_cb_result(void *cb, const struct dmaengine_result *result) > > +{ > > + struct geni_i2c_dev *gi2c = cb; > > + > > + if (result->result != DMA_TRANS_NOERROR) { > > + dev_err(gi2c->se.dev, "DMA txn failed:%d\n", result->result); > > Iiuc the API the expectation is that if we get !NOERROR we shouldn't > expect to get NOERROR after that. > > If so we're just returning here and leaving geni_i2c_gpi_xfer() to just > timeout in a HZ or so. Given that xfer happens under the adaptor lock, > how about carrying an error in geni_i2c_dev and complete(&done) here as > well? Yes we should call complete for errors too, will add that > > +static int setup_gpi_dma(struct geni_i2c_dev *gi2c) > > +{ > > + int ret; > > + > > + geni_se_select_mode(&gi2c->se, GENI_GPI_DMA); > > + gi2c->tx_c = dma_request_chan(gi2c->se.dev, "tx"); > > + if (IS_ERR(gi2c->tx_c)) { > > + ret = dev_err_probe(gi2c->se.dev, PTR_ERR(gi2c->tx_c), > > + "Failed to get tx DMA ch\n"); > > + if (ret < 0) > > + goto err_tx; > > + } > > + > > + gi2c->rx_c = dma_request_chan(gi2c->se.dev, "rx"); > > + if (IS_ERR(gi2c->rx_c)) { > > + ret = dev_err_probe(gi2c->se.dev, PTR_ERR(gi2c->rx_c), > > + "Failed to get rx DMA ch\n"); > > + if (ret < 0) > > + goto err_rx; > > + } > > + > > + dev_dbg(gi2c->se.dev, "Grabbed GPI dma channels\n"); > > + return 0; > > + > > +err_rx: > > + dma_release_channel(gi2c->tx_c); > > + gi2c->tx_c = NULL; > > You're not accessing tx_c or rx_c again when returning an error here. So > I don't think there's a reason to clear them. Will drop that > > static int geni_i2c_remove(struct platform_device *pdev) > > { > > struct geni_i2c_dev *gi2c = platform_get_drvdata(pdev); > > > > + release_gpi_dma(gi2c); > > Your i2c devices aren't torn down until i2c_del_adapter(), so you might > still end up trying to use the two channels here, after releasing them. > > In other words, I think you should reorder these. Agreed it should be other way round! Thanks -- ~Vinod