Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753844Ab3CKQ4A (ORCPT ); Mon, 11 Mar 2013 12:56:00 -0400 Received: from smtp-out-222.synserver.de ([212.40.185.222]:1142 "EHLO smtp-out-222.synserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751319Ab3CKQz7 (ORCPT ); Mon, 11 Mar 2013 12:55:59 -0400 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 28480 Message-ID: <513E0D0C.1080203@metafoo.de> Date: Mon, 11 Mar 2013 17:57:48 +0100 From: Lars-Peter Clausen User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: Matt Porter CC: Vinod Koul , Chris Ball , Dan Williams , Sekhar Nori , Grant Likely , Linux DaVinci Kernel List , Linux Kernel Mailing List , Linux MMC List Subject: Re: [PATCH v4 1/3] dmaengine: add dma_get_slave_sg_limits() References: <1362599767-11292-1-git-send-email-mporter@ti.com> <1362599767-11292-2-git-send-email-mporter@ti.com> In-Reply-To: <1362599767-11292-2-git-send-email-mporter@ti.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1350 Lines: 30 [...] > * struct with auxiliary transfer status information, otherwise the call > * will just return a simple status code > * @device_issue_pending: push pending transactions to hardware > + * @device_slave_sg_limits: return the slave SG capabilities > */ > struct dma_device { > > @@ -602,6 +615,9 @@ struct dma_device { > dma_cookie_t cookie, > struct dma_tx_state *txstate); > void (*device_issue_pending)(struct dma_chan *chan); > + struct dma_slave_sg_limits *(*device_slave_sg_limits)( > + struct dma_chan *chan, enum dma_slave_buswidth addr_width, > + u32 maxburst); In my opinion it is better to pass in a pointer to a dma_slave_sg_limits struct and let the driver fill it. Instead of passing back a pointer to an internal structure. It is kind of problematic because you never really know when the user is done using the struct and you don't know when it is safe to free or reuse it. E.g. in your implementation for the edma driver if the function is called with different parameters for the same channel, the previous result will also be overwritten. - Lars -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/