Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp146266ima; Fri, 1 Feb 2019 00:51:05 -0800 (PST) X-Google-Smtp-Source: ALg8bN4G7eNfqhjMQyXLz50RRJ6YuIk7QmYEa/SpFOXj19gaDlVf0t0bwHq0ZvGrXK46ZJfXyExO X-Received: by 2002:a62:2c81:: with SMTP id s123mr38056571pfs.174.1549011065809; Fri, 01 Feb 2019 00:51:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549011065; cv=none; d=google.com; s=arc-20160816; b=y6jtJ3IFwBLCGJ5Vd+hO28T36XpfQN1naDRRcer9QhPrCOIocHAWXYWfIsyMXgoEso HM0jMonRW0+P0VsgPA9n9YEKh4Eim4JLNDJ7FK//36crfX7oT6iMmZKFkpaldQBvgf/w h5NI4WV2ZxivmDpoabIro64IvtOvHQrIxDGGyCcB4paI1ba7QfeGSisnuec4qes0roC4 R2exVBN/fXeMvlTCnajoNOu+g1bI556A9NvI+DoCZJRTiJ/FDWuFIvLV8HNSVFV2n6CH 0QA9ndq8npOJXPHB1Hi9IcRvU9x0EqS/Bwmzw64dKnv4TFTEAo1VfphcSJw/6eB/GloE ff+w== 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=ofvy4DRKRwc1p2ccQlAyvHR+GYcYUgIMlkL4GALDEIQ=; b=fbZ7JGrGVr4rqHiMtLfc6qHOyIowkrNXPWOWyPeeoZb1S1ET3LR7bGIzoyuSVJAx3u Y5DlCk26kiqU3M7iA6WLnjFGR3mwkcaNm5ugiX3LEiTOAsVDzs3PjhlO1Zbi/GdvDF32 4odxnFsmJy+nntZXZ6tZRuuDzb9h5z98w/rpPub4oSM3CBYgLDm9rr1A7qVcMH1cPHoH RH9ylvrezHfl1ighoutuSv5KYyyv5tXyjXKP7nQj6sgIRMnCNAGdUuyQapC481qGdcuk 5UZ9X45FkYUVyKxoUGk1n1WXh0chhf3A4n02qN0PrfU/RiSflN77PUmT30s2Hn6eGTmI cLrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=K5Dp0HKk; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b19si7504037pfm.100.2019.02.01.00.50.50; Fri, 01 Feb 2019 00:51:05 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=K5Dp0HKk; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729837AbfBAIs4 (ORCPT + 99 others); Fri, 1 Feb 2019 03:48:56 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:48640 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729284AbfBAIsx (ORCPT ); Fri, 1 Feb 2019 03:48:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ofvy4DRKRwc1p2ccQlAyvHR+GYcYUgIMlkL4GALDEIQ=; b=K5Dp0HKkDpQQOoGsgqpd9hQw+W 1cI2Wt5fC71ayCrmx6kBB8zKXuHn0jZ/85yb6b6Czia33X7bUa0Nx+vAP6k6Z6hAzSB16fxeLh0mg i49iM5GoqYTTmqR3pSJbLLsDofyY18N9erRCzVWpU/4rT/jgwrUgbu++7P1XSGpw6UcEBqJyqURSi y0CmJ7H4ZGiiXyRLLZtK79VInnWw6BTlKPO2z5kCrPQkFnJ2qiX2SutshUBubwY7rHYhowTMRtI33 HXQ50m3pId7P4/vnJzMH9FkjyjjmfolqglbxmlY3MbWKUkHKWZhMOU1NXmafmOyoMSKsn11BKNmOf oscjPN3A==; Received: from 089144212163.atnat0021.highway.a1.net ([89.144.212.163] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gpUVG-0001XC-4S; Fri, 01 Feb 2019 08:48:50 +0000 From: Christoph Hellwig To: John Crispin , Vinod Koul , Dmitry Tarnyagin , Nicolas Ferre , Sudip Mukherjee , Felipe Balbi , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-fbdev@vger.kernel.org, alsa-devel@alsa-project.org Cc: iommu@lists.linux-foundation.org Subject: [PATCH 18/18] ALSA: pass struct device to DMA API functions Date: Fri, 1 Feb 2019 09:48:01 +0100 Message-Id: <20190201084801.10983-19-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190201084801.10983-1-hch@lst.de> References: <20190201084801.10983-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The DMA API generally relies on a struct device to work properly, and only barely works without one for legacy reasons. Pass the easily available struct device from the platform_device to remedy this. Also use GFP_KERNEL instead of GFP_USER as the gfp_t for the memory allocation, as we should treat this allocation as a normal kernel one. Signed-off-by: Christoph Hellwig --- sound/mips/sgio2audio.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sound/mips/sgio2audio.c b/sound/mips/sgio2audio.c index 3ec9391a4736..53a4ee01c522 100644 --- a/sound/mips/sgio2audio.c +++ b/sound/mips/sgio2audio.c @@ -805,7 +805,7 @@ static int snd_sgio2audio_free(struct snd_sgio2audio *chip) free_irq(snd_sgio2_isr_table[i].irq, &chip->channel[snd_sgio2_isr_table[i].idx]); - dma_free_coherent(NULL, MACEISA_RINGBUFFERS_SIZE, + dma_free_coherent(chip->card->dev, MACEISA_RINGBUFFERS_SIZE, chip->ring_base, chip->ring_base_dma); /* release card data */ @@ -843,8 +843,9 @@ static int snd_sgio2audio_create(struct snd_card *card, chip->card = card; - chip->ring_base = dma_alloc_coherent(NULL, MACEISA_RINGBUFFERS_SIZE, - &chip->ring_base_dma, GFP_USER); + chip->ring_base = dma_alloc_coherent(card->dev, + MACEISA_RINGBUFFERS_SIZE, + &chip->ring_base_dma, GFP_KERNEL); if (chip->ring_base == NULL) { printk(KERN_ERR "sgio2audio: could not allocate ring buffers\n"); -- 2.20.1