From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751331AbdJWGKw (ORCPT ); Mon, 23 Oct 2017 02:10:52 -0400 Received: from mga11.intel.com ([192.55.52.93]:36709 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751083AbdJWGKt (ORCPT ); Mon, 23 Oct 2017 02:10:49 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,421,1503385200"; d="scan'208";a="141132122" Date: Mon, 23 Oct 2017 11:45:09 +0530 From: Vinod Koul To: Stefan =?iso-8859-1?Q?Br=FCns?= Cc: linux-sunxi@googlegroups.com, devicetree@vger.kernel.org, Chen-Yu Tsai , Andre Przywara , linux-kernel@vger.kernel.org, Dan Williams , Rob Herring , dmaengine@vger.kernel.org, Code Kipper , Maxime Ripard , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v5 07/11] dmaengine: sun6i: Retrieve channel count/max request from devicetree Message-ID: <20171023061508.GD936@localhost> References: <20170928014928.2272-1-stefan.bruens@rwth-aachen.de> <2200ff4f-67f6-45c7-a2c8-99d066af3391@rwthex-w2-a.rwth-ad.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2200ff4f-67f6-45c7-a2c8-99d066af3391@rwthex-w2-a.rwth-ad.de> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 17, 2017 at 01:06:34AM +0200, Stefan Brüns wrote: > To avoid introduction of a new compatible for each small SoC/DMA controller > variation, move the definition of the channel count to the devicetree. > > The number of vchans is no longer explicit, but limited by the highest > port/DMA request number. The result is a slight overallocation for SoCs > with a sparse port mapping. Applied, thanks. But ... > static int sun6i_dma_probe(struct platform_device *pdev) > { > + struct device_node *np = pdev->dev.of_node; > struct sun6i_dma_dev *sdc; > struct resource *res; > int ret, i; > @@ -1228,6 +1233,26 @@ static int sun6i_dma_probe(struct platform_device *pdev) > sdc->num_vchans = sdc->cfg->nr_max_vchans; > sdc->max_request = sdc->cfg->nr_max_requests; > > + ret = of_property_read_u32(np, "dma-channels", &sdc->num_pchans); > + if (ret && !sdc->num_pchans) { > + dev_err(&pdev->dev, "Can't get dma-channels.\n"); > + return ret; > + } ... we should probably use device_read_xxx calls instead of of_xxx -- ~Vinod