Received: by 2002:ac0:a874:0:0:0:0:0 with SMTP id c49csp250922ima; Fri, 15 Mar 2019 01:55:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTzFVxOXkPAt47dCzr+s/iNqGPEIfTa9WHSFrH3bzWK8k+oQEvPmlFWoGQ3So+j6KfqMi8 X-Received: by 2002:a62:1346:: with SMTP id b67mr2920636pfj.195.1552640153911; Fri, 15 Mar 2019 01:55:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552640153; cv=none; d=google.com; s=arc-20160816; b=pFdtn/6lJruWD2LejXhGLAXECMYBEigl8V+yQsafXn4EwJvkalNM/EOvYVYfAnIhTQ PV+uu28Xe78AIH1YUaAw/mAeN01g2uyXkW9JlGQDNPmLhQ5iKca50Yw/w0AaM70S41rP X/2NXdmWGxgGIEIkTwxuE0FPxBPOtkXrdFD/gBduD/5AMR7T9cq/0/QyEqSQjJbwQ+b6 iKEdlkHtt9SHT2Qjy2caDmGfRTISrv6AkiROzJwjKRyj8M6iWDK82gSYiJfCUz8NRhyE 5i3BtZ3mf2CBJzeKBG+obICuGaZm+v7hkYRAMYvwd+PbtZPHbRGM/nB8+vGZfd3PkaNM 6pDg== 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:dkim-signature; bh=LupZRW1uB+cSCMAHlxjj+Z/tSq1eYIlK2KG3gehlTIc=; b=JITxRkinf4z+y3pMtHe/Qlbxqp3yR82iuiTo7txt89IHqN71M7vNFkxUlZsF8xbzfB c7J/EW5Hew/aR2x6Q4bAHYwy/UkykhvDoLCLjLZ7yTV0wi1g0pR54o+s+WvZssojTHtP bPjxebFP8o/g/fJZ2tiXZwpisl7CedtSOUI6x17mb4+ZqLIqfdxXkOPbLwRCw5o+EXEP fGttwmMWU6HpCjR9PKIQVln9wKK0HTrPKvZf8TsuvQFS1b+jA6s5UTLeCZYj4D0Vj4gt /afxGzAAm7ZH3bAUrXP6wUf0AeAO5DhMf71LGbeDJnHX7rCuLixUqKZOISqwIbdbugmZ nbCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=UWtF51Um; 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 i3si1330681pgq.282.2019.03.15.01.55.36; Fri, 15 Mar 2019 01:55:53 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=UWtF51Um; 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 S1728003AbfCOIyu (ORCPT + 99 others); Fri, 15 Mar 2019 04:54:50 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:54050 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726766AbfCOIyt (ORCPT ); Fri, 15 Mar 2019 04:54:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding: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=LupZRW1uB+cSCMAHlxjj+Z/tSq1eYIlK2KG3gehlTIc=; b=UWtF51UmCT4NEFMfpWluvUMaZ aE9KaHuLwKiM10lvO42/MoJMW0RTbmKWS7IK0OH+dYhLD7XE+zeguTUgmWTjsNk4j0mZH9WZ87F1D ZYvGJX23mQprmddgQhoYVYSaqz5URIPcSTX+IHrAT9F1vbMmD1QWCyNBV9aJD0QatdkuifqM7dtRj RvGJwvU1IFBj4r57fkgGoU1Vo7npA+hGidFUQvDluxO2rGh/ishtM4wCIukWgL/LumymAx3wJtjEl O080+5O5CIr01NcHTulZzI3arGVLUUT8NEM6CuAXyGo7hTRk2jpLeSF03o3XdF+gZ2T+CxGO5Wv26 yxK8VQ69w==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4ic2-0001QE-RI; Fri, 15 Mar 2019 08:54:46 +0000 Date: Fri, 15 Mar 2019 01:54:46 -0700 From: Christoph Hellwig To: John Stultz Cc: lkml , "Andrew F. Davis" , Laura Abbott , Benjamin Gaignard , Greg KH , Sumit Semwal , Liam Mark , Brian Starkey , Chenbo Feng , Alistair Strachan , dri-devel@lists.freedesktop.org Subject: Re: [RFC][PATCH 1/5 v2] dma-buf: Add dma-buf heaps framework Message-ID: <20190315085446.GA4470@infradead.org> References: <1551819273-640-1-git-send-email-john.stultz@linaro.org> <1551819273-640-2-git-send-email-john.stultz@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1551819273-640-2-git-send-email-john.stultz@linaro.org> User-Agent: Mutt/1.9.2 (2017-12-15) 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 > +static int dma_heap_release(struct inode *inode, struct file *filp) > +{ > + filp->private_data = NULL; > + > + return 0; > +} No point in clearing ->private_data, the file is about to be freed. > + > +static long dma_heap_ioctl(struct file *filp, unsigned int cmd, > + unsigned long arg) Pleae don't use the weird legacy filp naming, file is a perfectly valid and readable default name for struct file pointers. > +{ > + switch (cmd) { > + case DMA_HEAP_IOC_ALLOC: > + { > + struct dma_heap_allocation_data heap_allocation; > + struct dma_heap *heap = filp->private_data; > + int fd; Please split each ioctl into a separate function from the very start, otherwise this will grow into a spaghetty mess sooner than you can see cheese. > + dev_ret = device_create(dma_heap_class, > + NULL, > + heap->heap_devt, > + NULL, > + heap->name); No need this weird argument alignment.