From patchwork Sat May 17 12:22:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Billauer X-Patchwork-Id: 4196491 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7E873BEEAB for ; Sat, 17 May 2014 12:39:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AAAF9203EC for ; Sat, 17 May 2014 12:39:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 66AD52040F for ; Sat, 17 May 2014 12:39:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757231AbaEQMjE (ORCPT ); Sat, 17 May 2014 08:39:04 -0400 Received: from ar-005-i192.relay.mailchannels.net ([162.253.144.74]:64246 "EHLO relay.mailchannels.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757219AbaEQMjC (ORCPT ); Sat, 17 May 2014 08:39:02 -0400 X-Greylist: delayed 968 seconds by postgrey-1.27 at vger.kernel.org; Sat, 17 May 2014 08:39:02 EDT X-Sender-Id: totalchoicehosting|x-authuser|billaue Received: from leviathan.tchmachines.com (unknown [10.218.133.212]) by relay.mailchannels.net (Postfix) with ESMTPA id 6161B1214BC; Sat, 17 May 2014 12:22:56 +0000 (UTC) X-Sender-Id: totalchoicehosting|x-authuser|billaue Received: from leviathan.tchmachines.com (leviathan.tchmachines.com [10.244.170.26]) (using TLSv1 with cipher DHE-RSA-AES256-SHA) by 0.0.0.0:2500 (trex/5.1.2); Sat, 17 May 2014 12:22:57 GMT X-MC-Relay: Neutral X-MailChannels-SenderId: totalchoicehosting%7Cx-authuser%7Cbillaue X-MailChannels-Auth-Id: totalchoicehosting Received: from 93-173-165-139.bb.netvision.net.il ([93.173.165.139]:35539 helo=ocho.localdomain) by leviathan.tchmachines.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82) (envelope-from ) id 1Wldde-0003Qg-8V; Sat, 17 May 2014 08:22:54 -0400 Received: from ocho.localdomain (localhost.localdomain [127.0.0.1]) by ocho.localdomain (8.14.4/8.14.4) with ESMTP id s4HCMphZ015602; Sat, 17 May 2014 15:22:51 +0300 Received: (from eli@localhost) by ocho.localdomain (8.14.4/8.14.4/Submit) id s4HCMpc8015601; Sat, 17 May 2014 15:22:51 +0300 From: Eli Billauer To: tj@kernel.org Cc: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org, bhelgaas@google.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Eli Billauer Subject: [PATCH 3/3] dma-mapping: pci: Add devm_ interface for pci_map_single Date: Sat, 17 May 2014 15:22:25 +0300 Message-Id: <1400329345-15556-3-git-send-email-eli.billauer@gmail.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1400329345-15556-1-git-send-email-eli.billauer@gmail.com> References: <1400329345-15556-1-git-send-email-eli.billauer@gmail.com> X-AuthUser: billaue Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Eli Billauer --- Documentation/driver-model/devres.txt | 2 ++ include/asm-generic/pci-dma-compat.h | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 0 deletions(-) diff --git a/Documentation/driver-model/devres.txt b/Documentation/driver-model/devres.txt index 2112a00..fea2c69 100644 --- a/Documentation/driver-model/devres.txt +++ b/Documentation/driver-model/devres.txt @@ -274,6 +274,8 @@ DMA PCI pcim_enable_device() : after success, all PCI ops become managed pcim_pin_device() : keep PCI device enabled after release + pcim_map_single() + pcim_unmap_single() IOMAP devm_ioport_map() diff --git a/include/asm-generic/pci-dma-compat.h b/include/asm-generic/pci-dma-compat.h index 1437b7d..444e598 100644 --- a/include/asm-generic/pci-dma-compat.h +++ b/include/asm-generic/pci-dma-compat.h @@ -113,4 +113,21 @@ static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask) } #endif +/* + * Managed DMA API + */ + +static inline dma_addr_t +pcim_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction) +{ + return dmam_map_single(hwdev == NULL ? NULL : &hwdev->dev, ptr, size, (enum dma_data_direction)direction); +} + +static inline void +pcim_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, + size_t size, int direction) +{ + dmam_unmap_single(hwdev == NULL ? NULL : &hwdev->dev, dma_addr, size, (enum dma_data_direction)direction); +} + #endif