Received: by 2002:ac0:950e:0:0:0:0:0 with SMTP id f14csp3584imc; Fri, 15 Mar 2019 13:26:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXgo7rx4UXcEeDRqi72gyQtj+ta+dURtzozImEWPvBwFTsfasZGHeOoM8KcC6Amzib6xik X-Received: by 2002:a17:902:121:: with SMTP id 30mr6236240plb.315.1552681565028; Fri, 15 Mar 2019 13:26:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552681565; cv=none; d=google.com; s=arc-20160816; b=ylScee6apOfIc5TDnTet9OilUvXXNE9RbE1MBRm8MnXonGW7M7MHhBDwXeErwSc3Ef dpOaYMpiY/SEWzsNGr+Y7eKAReKP8wxXvMEvws7j+rKNT0Mmr6mSC5TjU5J3kxKxCGfE oGiKrRdRwRDN3TP5OS1X5sq5qZQRip02LlFHOViY02YtYWzOjSzra0NDNQv8KgUeiyVs 1+pwanBy0LfjAYrCP67HinlVG6IqN+Q1U0etDGO7VivP39iyPF2jnm+t7ikCgFSDRSDM 8bYz0reoOFD1B8VGgt1UCHgSJ+j/7NFycYqatga/RlOGmFwrY6DLaRXHLdJsulOpVAHm 2uQQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=wABOveJnWUn+P+j/gJAh/x9s3BNdmYToGkKoqGqody0=; b=dtzkIwh0ussV+gA/7xtLEkzmW4lkdreKvHwqJFXFRiUImCSQn8FSj2iPkegpSjJuTH sLrtkJDgjAJunPGYZ3z67882L4QtgAosMK9D3CXynkLU9gcH86ds63M+odv2aVOFHy+H 0gU5xamMgVJrPsxl8o55s4j/2J/Fg2QXA0B/esqK+1YdQTZl4h8akWXbgIhe7n/xb4HR Yvc2InxCMKc33AF6PhXVyZUzydGl6qSUiukv9jTH2PMUewRpkWmDordXWI5rDu8zfKR+ 1Cb/lEqVZ9mV864IrfiuUQgniU5k4hYymFa+oKYQLOktUTcCXFUpLMgQLKmms3wf1JVg ydrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=FBezPb+P; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y4si2584436plk.30.2019.03.15.13.25.49; Fri, 15 Mar 2019 13:26:05 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=FBezPb+P; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726452AbfCOUZN (ORCPT + 99 others); Fri, 15 Mar 2019 16:25:13 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:45450 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726292AbfCOUZN (ORCPT ); Fri, 15 Mar 2019 16:25:13 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x2FKOjGj040565; Fri, 15 Mar 2019 15:24:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1552681485; bh=wABOveJnWUn+P+j/gJAh/x9s3BNdmYToGkKoqGqody0=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=FBezPb+PgE5XufIuf6h4WCPH1unzj743zXaKGUQsZSoYr7jF8AnDLXliG5R99xt9i zHWImE4xdhVZtdBLLAAzJz/Fsfm1ufVpdGB6EKGOOR+y6cSc6ZH6YpVaVohK17SA2W IR4xZoZ5wmABeSU62wJtFGHGvNeQlffF6dL34FS0= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2FKOjCs109470 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 15 Mar 2019 15:24:45 -0500 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 15 Mar 2019 15:24:44 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1713.5 via Frontend Transport; Fri, 15 Mar 2019 15:24:44 -0500 Received: from [128.247.58.147] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id x2FKOicJ030323; Fri, 15 Mar 2019 15:24:44 -0500 Subject: Re: [RFC][PATCH 1/5 v2] dma-buf: Add dma-buf heaps framework To: Christoph Hellwig , John Stultz CC: lkml , Laura Abbott , Benjamin Gaignard , Greg KH , Sumit Semwal , Liam Mark , Brian Starkey , Chenbo Feng , Alistair Strachan , References: <1551819273-640-1-git-send-email-john.stultz@linaro.org> <1551819273-640-2-git-send-email-john.stultz@linaro.org> <20190315085446.GA4470@infradead.org> From: "Andrew F. Davis" Message-ID: <525c65f4-7d73-bc77-5086-4db70e6e54f2@ti.com> Date: Fri, 15 Mar 2019 15:24:44 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190315085446.GA4470@infradead.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/15/19 3:54 AM, Christoph Hellwig wrote: >> +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. > This was leftover from when release had some memory to free, will remove. >> + >> +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. > Thanks for info, I saw both used and this was used where I found the prototype so I used it too, will fix. >> +{ >> + 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. > Good idea, will fix. >> + dev_ret = device_create(dma_heap_class, >> + NULL, >> + heap->heap_devt, >> + NULL, >> + heap->name); > > No need this weird argument alignment. > I kinda like it this way, if everything cant fit on one line then everything gets its own line, seems more consistent. If there is strong objection I can fix.