Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp934305pxb; Wed, 6 Apr 2022 04:44:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyD77mHdIUlsjQlsI8D5rU7PGGF/jjJLQSLBVrimKoNpFWozy0tknbfeAcRzH6K6V5ribS5 X-Received: by 2002:a62:62c3:0:b0:4fd:e9ab:199b with SMTP id w186-20020a6262c3000000b004fde9ab199bmr8420382pfb.59.1649245456326; Wed, 06 Apr 2022 04:44:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649245456; cv=none; d=google.com; s=arc-20160816; b=Rlqt+JZTCgzw6O9axTeUprFvKkr7kmY9Zz7h4IRG53gXO5p6Ma9X7VUJQX66RSN0xO 7Tn9LtPSiC3EFUJIQkLqESHikFq8V9su02917De/DHEcnytSR1h8KB2JtB7F7Fzq0SRv Lpk+OTjZJf+08FA6mYzs54WkRLRklXJvzWKnWr6Qb8pe8yXbhxM3WUksujZprhK2djiq 2WtcqVG4jrlmBC3WUusIrBv1wFNPqA9iZ5AO9jXB+jhQW0oa8SAEe9K1BU4Fc5qULpHl qBjEEsVBCz0ydPDY7p372jRIyVUTV/TPfp90EJ6iBBwG+UJQoVZiH8lkY23VP8L4+eKp GmLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :dkim-signature; bh=HhCRNMxeN/GjO55RvomQG0xoJmMvvbdrMDnAktj+ZOw=; b=pXSJwtUg+BdObj5mK08KH7t6m9IkuqEpRbQbhgqIqPJXrEuDk2LQBcRhLt5hh41sW3 JP34ceyxYN18E3D1wa58MLMXaoeDbgLjbuSW3Wt59RGIEZgvIwNkHFw8JVaHIElbLGih +/d5A8XleKEG0yT5Lc3D139FwhBm8psGh+j+P/qzqBtKkDUIQ0SugQJLR+SyR4Y7h6Lg hov9vV6MJH6mltn9/yxsIulIfQq5RCz1FfsI27t5gk/SlUhfMZL83JeKebhWFNtW9+jS h0QTuQMYa9tG9aQSWOPwJE0TkmUJ4JCnYzzeJ/cNj1C9pIdnojy/wLR2Q6Ix0nTG8wea WDnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=cNqMfgmX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id z1-20020a6552c1000000b003816043eed4si15166780pgp.201.2022.04.06.04.44.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 04:44:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=cNqMfgmX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 87B1761E423; Wed, 6 Apr 2022 03:01:11 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384331AbiDEUzp (ORCPT + 99 others); Tue, 5 Apr 2022 16:55:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381268AbiDELnj (ORCPT ); Tue, 5 Apr 2022 07:43:39 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4BA6114FC3; Tue, 5 Apr 2022 04:09:06 -0700 (PDT) Received: from ssl.serverraum.org (web.serverraum.org [172.16.0.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 65CC922247; Tue, 5 Apr 2022 13:09:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1649156944; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HhCRNMxeN/GjO55RvomQG0xoJmMvvbdrMDnAktj+ZOw=; b=cNqMfgmXtFPvgEEwbWq+VnwdvMuscRpK20137u0iJSnBDLVHoJFUu5w4qyLSMk8UBd8eum 0HMbGVUDIyLdMdlDNStBDi+KY7vBSzta24pjZddLL/yJGIlyoEPC3VL3TgfKTOY12IUtu8 hkJrB7ZhYGB9P1u1D5xx4Y+a7XRIo5o= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Tue, 05 Apr 2022 13:09:04 +0200 From: Michael Walle To: Codrin.Ciubotariu@microchip.com Cc: Nicolas.Ferre@microchip.com, alexandre.belloni@bootlin.com, Claudiu.Beznea@microchip.com, sumit.semwal@linaro.org, christian.koenig@amd.com, linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, stable@vger.kernel.org Subject: Re: [PATCH] i2c: at91: use dma safe buffers In-Reply-To: <360914ee-594c-86bc-2436-aa863a67953a@microchip.com> References: <20220303161724.3324948-1-michael@walle.cc> <46e1be55-9377-75b7-634d-9eadbebc98d7@microchip.com> <360914ee-594c-86bc-2436-aa863a67953a@microchip.com> User-Agent: Roundcube Webmail/1.4.13 Message-ID: <27f124c9adaf8a4fbdfb7a38456c4a2e@walle.cc> X-Sender: michael@walle.cc X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Am 2022-04-05 12:02, schrieb Codrin.Ciubotariu@microchip.com: > On 05.04.2022 12:38, Michael Walle wrote: >> Am 2022-04-05 11:23, schrieb Codrin.Ciubotariu@microchip.com: >>>> +       if (dev->use_dma) { >>>> +               dma_buf = i2c_get_dma_safe_msg_buf(m_start, 1); >>> >>> If you want, you could just dev->buf = i2c_get_dma_safe... >> >> But where is the error handling in that case? dev->buf will >> be NULL, which is eventually passed to dma_map_single(). >> >> Also, I need the dma_buf for the i2c_put_dma_safe_msg_buf() >> call anyway, because dev->buf will be modified during >> processing. > > You still: > if (!dev->buf) { > ret = -ENOMEM; > goto out; > } > > So, at91_do_twi_transfer()/dma_map_single() will not be called. Ahh, I misunderstood you. Yes, but as I said, I need the dma_buf temporary variable anyway, because dev->buf is modified, eg. see at91_twi_read_data_dma_callback(). -michael