Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp595529ybg; Thu, 19 Mar 2020 05:28:38 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs4GUn/NUJvEVKXMUx175VMSCv51MV9xgkCtk0H7C/aiDsav9n6Fh7Fu+WSbF6sKA/0iDyJ X-Received: by 2002:aca:aa81:: with SMTP id t123mr2150057oie.117.1584620918726; Thu, 19 Mar 2020 05:28:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584620918; cv=none; d=google.com; s=arc-20160816; b=ujtWr1bMkflu3gK0tWwTUAJssvz9qq8MB4ByREV+7sw67A83Mhzc3PlywQz1K+6UO3 RCo0Uwsc4vM7JPDbPJPaLs3QmpE2Fmh9LblkeY9RouTSsq55hEGCOn0FO1effWa1ITPx XHTBsyl1v0/9HmBbIp9qpmsXouPif/Oa8q0QdEGSyf3m0U2gZuwhXADUiBfFe8EevQtG H2xCc9lqJ6Xxdb8cgLnFLs/b+frUgZMaXNkzuuAWJg92xAsO801DMu+J5MM6ZBVL85QO BV+skcaIEITEJh+WVsRIguPgephIKhwE8t935uBjTnJx0JZB8AAvaoQ0QKXdLlh8DfCr qkhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:date:from:dkim-signature; bh=A9SGNay6V5AK51JymycAKfsjcnHxWtXDcTFCmT1Vk+E=; b=sGf/xyN+FchTpxvCA6w3ykiSd6C0zqc23vc8GUBmHfE/w4iyX5is11M/CfJUiisVOK os1kBLWpAGLdCouHIthgZyidmep7xTWHHKixF3xEMs9yAp8+03bHk2AMelcVTL9vDayh ZGuuFHkDzKyc/QkA/UiVUFypJK1K9FL0RiBng1GO5K0NmutQouRzL9kN7tdO0ICtKyIK Ut+JMDCQTf5EhCgwa89nY/KQYWGyEYPc4tmbcHOJJU3c/8o17+v2/c5O2M/RCC55w8Gh DPNUY5hYbKzuPbruh6g96vpeXpwe3HMpGKGjc9KRBk4cpsbabNkug5JsxM0rkF4J3tdm ly/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rWNJYxiR; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e15si874311oie.5.2020.03.19.05.28.25; Thu, 19 Mar 2020 05:28:38 -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=@gmail.com header.s=20161025 header.b=rWNJYxiR; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727064AbgCSM2C (ORCPT + 99 others); Thu, 19 Mar 2020 08:28:02 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:52835 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727016AbgCSM2B (ORCPT ); Thu, 19 Mar 2020 08:28:01 -0400 Received: by mail-wm1-f68.google.com with SMTP id 11so2073787wmo.2 for ; Thu, 19 Mar 2020 05:27:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=A9SGNay6V5AK51JymycAKfsjcnHxWtXDcTFCmT1Vk+E=; b=rWNJYxiRGxQPNJ0vJ1Hjn39bP0NuYfEf0w9eCCOSFBbW/sR8X1EFAiE6O254aP4Ixe L7MD8WjBigyHc4soKokx0mhvOKKcjHY/Tw4QX7eK1MibVaNsHMWU6cI3oTfIwW+5pe1o U9CTwcxKCVhYuUxbnfM24442Zj7K7kYk3CWsdxf0LXFUUwRHpMtrcuKOunQ+BoHLSGVf kXodDeNl44EuXRVB/pgfNykVP/TvEpim6P1SaEK1hVlrNMRE6/g2I3e9rtzFf20071kk KNCZMmH5m9m/S8sPgBBLdJ5lByOqjlqeAl58Yb924o+xaQKHT01k8jpmbLZYQ4NHbfJ+ CcMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=A9SGNay6V5AK51JymycAKfsjcnHxWtXDcTFCmT1Vk+E=; b=JJhSbN0yIpaotcKfNmz17e4yAeWWhlrMY4NuLnhyXA68jkZldsH3WoNLjcjt7EhBmQ BFYdBW2s7QmSyL44mgSz3YOUQyme88IV237+kyey5sdegwz76nWfxPJLO1mpxkJel/5w hmnW1f8rpFESM6CNoT8KPExVc+Hfq/EzEaJLCE5pXc43sNmI96QGNI01SUbxzpFSWGPp fek872ifrQrHEtp1vEnKve1YLWx3ty/ljjMhpLOh/YmtZpgrWTAi3EYon/hxIrfLKhHk UArb17wN2qP3kzE/lvrnAjMlLf3QToR5n7/K9Ro2nyk2HIfAc9V0RjBvZEIoX5jZUF8y /VzA== X-Gm-Message-State: ANhLgQ1KzqAnVNIuCHxY4xNhSCqXpuyQHjlzWQtYwOMbvXsFQAkeyt40 EHl/kJQ05Cyn4Ve+DLxI9XQ= X-Received: by 2002:a1c:bd82:: with SMTP id n124mr3468131wmf.162.1584620879035; Thu, 19 Mar 2020 05:27:59 -0700 (PDT) Received: from wambui.local ([197.237.61.225]) by smtp.googlemail.com with ESMTPSA id c124sm3022493wma.10.2020.03.19.05.27.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2020 05:27:58 -0700 (PDT) From: Wambui Karuga X-Google-Original-From: Wambui Karuga Date: Thu, 19 Mar 2020 15:27:29 +0300 (EAT) To: Daniel Vetter , Greg KH , Wambui Karuga , Dave Airlie , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann cc: dri-devel , Linux Kernel Mailing List Subject: Re: [PATCH v2 10/17] drm/vram-helper: make drm_vram_mm_debugfs_init() return 0 In-Reply-To: <20200319101830.GB2363188@phenom.ffwll.local> Message-ID: References: <20200310133121.27913-1-wambui.karugax@gmail.com> <20200310133121.27913-11-wambui.karugax@gmail.com> <20200318152627.GY2363188@phenom.ffwll.local> <20200318165846.GC3090655@kroah.com> <20200319075524.GB3445010@kroah.com> <20200319101830.GB2363188@phenom.ffwll.local> User-Agent: Alpine 2.21.99999 (LNX 375 2019-10-29) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 19 Mar 2020, Daniel Vetter wrote: > On Thu, Mar 19, 2020 at 08:55:24AM +0100, Greg KH wrote: >> On Wed, Mar 18, 2020 at 08:10:43PM +0100, Daniel Vetter wrote: >>> On Wed, Mar 18, 2020 at 5:58 PM Greg KH wrote: >>>> >>>> On Wed, Mar 18, 2020 at 05:31:47PM +0100, Daniel Vetter wrote: >>>>> On Wed, Mar 18, 2020 at 5:03 PM Wambui Karuga wrote: >>>>>> >>>>>> >>>>>> >>>>>> On Wed, 18 Mar 2020, Daniel Vetter wrote: >>>>>> >>>>>>> On Tue, Mar 10, 2020 at 04:31:14PM +0300, Wambui Karuga wrote: >>>>>>>> Since 987d65d01356 (drm: debugfs: make >>>>>>>> drm_debugfs_create_files() never fail), drm_debugfs_create_files() never >>>>>>>> fails and should return void. Therefore, remove its use as the >>>>>>>> return value of drm_vram_mm_debugfs_init(), and have the function >>>>>>>> return 0 directly. >>>>>>>> >>>>>>>> v2: have drm_vram_mm_debugfs_init() return 0 instead of void to avoid >>>>>>>> introducing build issues and build breakage. >>>>>>>> >>>>>>>> References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html >>>>>>>> Signed-off-by: Wambui Karuga >>>>>>>> Acked-by: Thomas Zimmermann >>>>>>>> --- >>>>>>>> drivers/gpu/drm/drm_gem_vram_helper.c | 10 ++++------ >>>>>>>> 1 file changed, 4 insertions(+), 6 deletions(-) >>>>>>>> >>>>>>>> diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c >>>>>>>> index 92a11bb42365..c8bcc8609650 100644 >>>>>>>> --- a/drivers/gpu/drm/drm_gem_vram_helper.c >>>>>>>> +++ b/drivers/gpu/drm/drm_gem_vram_helper.c >>>>>>>> @@ -1048,14 +1048,12 @@ static const struct drm_info_list drm_vram_mm_debugfs_list[] = { >>>>>>>> */ >>>>>>>> int drm_vram_mm_debugfs_init(struct drm_minor *minor) >>>>>>>> { >>>>>>>> - int ret = 0; >>>>>>>> - >>>>>>>> #if defined(CONFIG_DEBUG_FS) >>>>>>> >>>>>>> Just noticed that this #if here is not needed, we already have a dummy >>>>>>> function for that case. Care to write a quick patch to remove it? On top >>>>>>> of this patch series here ofc, I'm in the processing of merging the entire >>>>>>> pile. >>>>>>> >>>>>>> Thanks, Daniel >>>>>> Hi Daniel, >>>>>> Without this check here, and compiling without CONFIG_DEBUG_FS, this >>>>>> function is run and the drm_debugfs_create_files() does not have access to >>>>>> the parameters also protected by an #if above this function. So the change >>>>>> throws an error for me. Is that correct? >>>>> >>>>> Hm right. Other drivers don't #ifdef out their debugfs file functions >>>>> ... kinda a bit disappointing that we can't do this in the neatest way >>>>> possible. >>>>> >>>>> Greg, has anyone ever suggested to convert the debugfs_create_file >>>>> function (and similar things) to macros that don't use any of the >>>>> arguments, and then also annotating all the static functions/tables as >>>>> __maybe_unused and let the compiler garbage collect everything? >>>>> Instead of explicit #ifdef in all the drivers ... >>>> >>>> No, no one has suggested that, having the functions be static inline >>>> should make it all "just work" properly if debugfs is not enabled. The >>>> variables will not be used, so the compiler should just optimize them >>>> away properly. >>>> >>>> No checks for CONFIG_DEBUG_FS should be needed anywhere in .c code. >>> >>> So the trouble with this one is that the static inline functions for >>> the debugfs file are wrapped in a #if too, and hence if we drop the >>> #if around the function call stuff won't compile. Should we drop all >>> the #if in the .c file and assume the compiler will remove all the >>> dead code and dead functions? >> >> Yes you should :) >> >> there should not be any need for #if in a .c file for debugfs stuff. > > Wambui, can you pls try that out? I.e. removing all the #if for > CONFIG_DEBUG_FS from that file. Removing them works with CONFIG_DEBUG_FS enabled or disabled. I can send a patch for that. wambui karuga > -Daniel > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch >