Received: by 10.213.65.68 with SMTP id h4csp191551imn; Tue, 13 Mar 2018 00:36:26 -0700 (PDT) X-Google-Smtp-Source: AG47ELvz152NazxhrYRxlx/oJCjYhCy21RdIH6BZ9VWeQ1dpeFMZcsQNCH89d6uEDhSbRX9H08xL X-Received: by 2002:a17:902:24c:: with SMTP id 70-v6mr3015552plc.384.1520926585943; Tue, 13 Mar 2018 00:36:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520926585; cv=none; d=google.com; s=arc-20160816; b=prn4fqWz/6ZPMJlJNKpzsqgc77N5ML0+CkEaI45fz0MFlNKa7yYMsKBxQGm8GpcYqC I7IggE6wt2I94er47Tn2+ww2uhW8q1CTUte6zSKBDdMIsibSkh2J4Rv9g7mhOeia8Yc7 ZBi/lPbfX9q4Lm6065CaZU1WQ2BggjW2vublKi3oAtEjiSba5841j5J8Sw37e35ht/RT qm6l4zAKOZIcucMufbXzl1ekrvu2WpMmwzvc5T7CJ3/m3pqJkqcuKTYpmVe1cbLDGZ9L RP8WVHkXJqzavfxMtRDaX3JVwNuHT1UyjZXp+dIKozAraWdOWRyDQeNhxGJT4C7jjo2P Ve7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=HCGwdnBFaELwnEUBO5m7hQBsMvhYTO4ysonGfWa7jZs=; b=nqiAYZgX7G/y91O7A5aymLclZ8PV0tS/MpDidFtG+H4Lpk31EXW60wrLQSvXfMkegJ Nh+soLhhRItEn1uGCn2IiLPyM7psc0zhAR5Gsqgmyb0hbf4rrv4xLUBF+ikVLDYPzPGa gk23A+sH+jzPLsLHyBHoBtqURRhPtgIIFZ28YFSI+G5Tx72e71eNrRFzXRrZnoCcgkdM Cg6TtAxXULsDXlc6bcnnagxfX3bvQ1yFwVpVXT+l+lRNHUhzr9zG5jui7sJwToTrPLQR Jzxc+aYhYWSeDCAlyog5nHfOYEiWA539ZC7MogxjwhF4qse0WL5djTORdPB27f4zvhyF Sqvw== ARC-Authentication-Results: i=1; mx.google.com; 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 e67si6167572pgc.274.2018.03.13.00.36.11; Tue, 13 Mar 2018 00:36:25 -0700 (PDT) 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; 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 S1752093AbeCMHey (ORCPT + 99 others); Tue, 13 Mar 2018 03:34:54 -0400 Received: from verein.lst.de ([213.95.11.211]:56444 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751903AbeCMHeu (ORCPT ); Tue, 13 Mar 2018 03:34:50 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id C315F7F173; Tue, 13 Mar 2018 08:34:48 +0100 (CET) Date: Tue, 13 Mar 2018 08:34:48 +0100 From: Christoph Hellwig To: Nipun Gupta Cc: hch@lst.de, robin.murphy@arm.com, linux@armlinux.org.uk, gregkh@linuxfoundation.org, m.szyprowski@samsung.com, bhelgaas@google.com, dmitry.torokhov@gmail.com, rafael.j.wysocki@intel.com, jarkko.sakkinen@linux.intel.com, linus.walleij@linaro.org, johan@kernel.org, msuchanek@suse.de, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, linux-pci@vger.kernel.org Subject: Re: [PATCH] dma-mapping: move dma configuration to bus infrastructure Message-ID: <20180313073448.GA32269@lst.de> References: <1520868292-2479-1-git-send-email-nipun.gupta@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1520868292-2479-1-git-send-email-nipun.gupta@nxp.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +int amba_dma_configure(struct device *dev) > +{ > + enum dev_dma_attr attr; > + int ret = 0; > + > + if (dev->of_node) { > + ret = of_dma_configure(dev, dev->of_node); > + } else if (has_acpi_companion(dev)) { > + attr = acpi_get_dma_attr(to_acpi_device_node(dev->fwnode)); > + if (attr != DEV_DMA_NOT_SUPPORTED) > + ret = acpi_dma_configure(dev, attr); > + } > + > + return ret; This code sniplet is duplicated so many times that I think we should just have some sort of dma_common_configure() for it that the various busses can use. > +void amba_dma_deconfigure(struct device *dev) > +{ > + of_dma_deconfigure(dev); > + acpi_dma_deconfigure(dev); > +} As mention in my previous reply I think we don't even need a deconfigure callback at this point - just remove the ACPI and OF wrappers and clear the dma ops. Also in this series we should replace the force_dma flag by use of the proper method, e.g. give a force parameter to of_dma_configure and the new dma_common_configure helper that the busses that want it can set.