From patchwork Mon Dec 23 11:04:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 182378 Delivered-To: patch@linaro.org Received: by 2002:a92:a146:0:0:0:0:0 with SMTP id v67csp276213ili; Mon, 23 Dec 2019 03:05:20 -0800 (PST) X-Google-Smtp-Source: APXvYqx7RpFuZs1J1REydt3PUgjkU9DLMambopHt1ljUOVBk9a2t0zBa2ZDdLG3ZjgOCegStaIAx X-Received: by 2002:a9d:478:: with SMTP id 111mr31353772otc.359.1577099119889; Mon, 23 Dec 2019 03:05:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577099119; cv=none; d=google.com; s=arc-20160816; b=rdtUL0ARURTfPX8zRrtA6KxZhhcd7Kd7O0/dHRUTtPxJ9JXqIqKB8XWqZhpUHI0cAR bQ4sqOyRIxRJTzpzg6W2fIL4v52hWzgPQaebqjh/qP17LHIr5W8vUwXNaJF4ZdMmRIFY 7+9V0OsVJNh46fB280miHvWuhC174v2CzAGWbvwLKx0sRGc7YJD7+LWXvU2fu7aENjqW pQuK3s1oXn9PJOhZYMgxoDCsjBq/VE91qUkcBO6KZ+J/ni22kEv3ym2zIfB93YQ9aPEJ i+OEfizImnxJKZMpTL/WT0evSJh3swMzo79D69WBKJzTdYddDAQLaCGReDouNui+Nfsa uDzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yfoeRD47afhb+LjeVfQOdleb+v6AX3JXFvJ9Nn4f53s=; b=NtH68Nyj0etlPojq4hA0Eve9U6D27sRYhtRJGsC4+7QabMkZnOr4sOVcqbzvdeZqNq xO3pMlQbrWKdFoZ402LoCiodIjRD6gjcY8LLIz0lEddVpS2khjR1ibPKCj1hfScMf4lj 6wiQ+ert38BOYx5H7gwKkINuIc+c8o5ppIOmLAyQ9p5tjYSOKCK2GUM1FSSolUYCc1Bn 0QKOa92DFzWLrekOzFwJgr1CGhjzI6w72Dgrt31MhcetljZITy49WUvZ+1WEB+urLiTX grFjRhEed8WpYNaVUtxqG4G51WQyec0xCdmE4JVKjB9SbbfDyNagY/w+SVwV94v1X6uu x4qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="aeG/KIw1"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u25si7492386otg.170.2019.12.23.03.05.19; Mon, 23 Dec 2019 03:05:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="aeG/KIw1"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727007AbfLWLFS (ORCPT + 27 others); Mon, 23 Dec 2019 06:05:18 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:54064 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726959AbfLWLFQ (ORCPT ); Mon, 23 Dec 2019 06:05:16 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id xBNB58JQ085642; Mon, 23 Dec 2019 05:05:08 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1577099108; bh=yfoeRD47afhb+LjeVfQOdleb+v6AX3JXFvJ9Nn4f53s=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=aeG/KIw1uwJy2AKeOrDQ6+4KERloMCKDQCtpeYGM9DihnfDRYyAS58Rc2KxQm+9XK wU6Ceq53+yx/+HWx6X1PtmX30AZIvxSurpFH3tNy4yoli7Z9uD/3JFs2GnEPcWUsQ+ WxOpbu6x4intBld+hnXEvZkvFBsS7TfFBWVfYf/c= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id xBNB58Ku037203; Mon, 23 Dec 2019 05:05:08 -0600 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Mon, 23 Dec 2019 05:05:08 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Mon, 23 Dec 2019 05:05:08 -0600 Received: from feketebors.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id xBNB4eMD025693; Mon, 23 Dec 2019 05:05:04 -0600 From: Peter Ujfalusi To: , , , CC: , , , , , , , , , , , Subject: [PATCH v8 06/18] dmaengine: Add helper function to convert direction value to text Date: Mon, 23 Dec 2019 13:04:46 +0200 Message-ID: <20191223110458.30766-7-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191223110458.30766-1-peter.ujfalusi@ti.com> References: <20191223110458.30766-1-peter.ujfalusi@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org dmaengine_get_direction_text() can be useful when the direction is printed out. The text is easier to comprehend than the number. Signed-off-by: Peter Ujfalusi --- include/linux/dmaengine.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) -- Peter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 7f9a7150a632..9852ba7399db 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -1537,4 +1537,23 @@ static inline struct dma_chan return __dma_request_channel(mask, fn, fn_param, NULL); } + +static inline char * +dmaengine_get_direction_text(enum dma_transfer_direction dir) +{ + switch (dir) { + case DMA_DEV_TO_MEM: + return "DEV_TO_MEM"; + case DMA_MEM_TO_DEV: + return "MEM_TO_DEV"; + case DMA_MEM_TO_MEM: + return "MEM_TO_MEM"; + case DMA_DEV_TO_DEV: + return "DEV_TO_DEV"; + default: + break; + } + + return "invalid"; +} #endif /* DMAENGINE_H */