[10/19] drm/radeon/radeon: Move prototype into shared header
Commit Message
Unfortunately, a suitable one didn't already exist.
Fixes the following W=1 kernel build warning(s):
drivers/gpu/drm/radeon/radeon_device.c:637:6: warning: no previous prototype for ‘radeon_device_is_virtual’ [-Wmissing-prototypes]
637 | bool radeon_device_is_virtual(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-media@vger.kernel.org
Cc: linaro-mm-sig@lists.linaro.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
drivers/gpu/drm/radeon/radeon_device.c | 1 +
drivers/gpu/drm/radeon/radeon_device.h | 32 ++++++++++++++++++++++++++
drivers/gpu/drm/radeon/radeon_drv.c | 3 +--
3 files changed, 34 insertions(+), 2 deletions(-)
create mode 100644 drivers/gpu/drm/radeon/radeon_device.h
Comments
Hi Lee,
On Fri, Nov 06, 2020 at 09:49:40PM +0000, Lee Jones wrote:
> Unfortunately, a suitable one didn't already exist.
>
> Fixes the following W=1 kernel build warning(s):
>
> drivers/gpu/drm/radeon/radeon_device.c:637:6: warning: no previous prototype for ‘radeon_device_is_virtual’ [-Wmissing-prototypes]
> 637 | bool radeon_device_is_virtual(void)
> | ^~~~~~~~~~~~~~~~~~~~~~~~
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Sumit Semwal <sumit.semwal@linaro.org>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-media@vger.kernel.org
> Cc: linaro-mm-sig@lists.linaro.org
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
> drivers/gpu/drm/radeon/radeon_device.c | 1 +
> drivers/gpu/drm/radeon/radeon_device.h | 32 ++++++++++++++++++++++++++
> drivers/gpu/drm/radeon/radeon_drv.c | 3 +--
> 3 files changed, 34 insertions(+), 2 deletions(-)
> create mode 100644 drivers/gpu/drm/radeon/radeon_device.h
Other public functions in radeon_device.c have their prototype in
radeon.h - for example radeon_is_px()
Add radeon_device_is_virtual() there so we avoiid this new header.
Sam
On Sat, 07 Nov 2020, Sam Ravnborg wrote:
> Hi Lee,
>
> On Fri, Nov 06, 2020 at 09:49:40PM +0000, Lee Jones wrote:
> > Unfortunately, a suitable one didn't already exist.
> >
> > Fixes the following W=1 kernel build warning(s):
> >
> > drivers/gpu/drm/radeon/radeon_device.c:637:6: warning: no previous prototype for ‘radeon_device_is_virtual’ [-Wmissing-prototypes]
> > 637 | bool radeon_device_is_virtual(void)
> > | ^~~~~~~~~~~~~~~~~~~~~~~~
> >
> > Cc: Alex Deucher <alexander.deucher@amd.com>
> > Cc: "Christian König" <christian.koenig@amd.com>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > Cc: Sumit Semwal <sumit.semwal@linaro.org>
> > Cc: amd-gfx@lists.freedesktop.org
> > Cc: dri-devel@lists.freedesktop.org
> > Cc: linux-media@vger.kernel.org
> > Cc: linaro-mm-sig@lists.linaro.org
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> > ---
> > drivers/gpu/drm/radeon/radeon_device.c | 1 +
> > drivers/gpu/drm/radeon/radeon_device.h | 32 ++++++++++++++++++++++++++
> > drivers/gpu/drm/radeon/radeon_drv.c | 3 +--
> > 3 files changed, 34 insertions(+), 2 deletions(-)
> > create mode 100644 drivers/gpu/drm/radeon/radeon_device.h
>
> Other public functions in radeon_device.c have their prototype in
> radeon.h - for example radeon_is_px()
>
> Add radeon_device_is_virtual() there so we avoiid this new header.
I'm happy to do that, if it's deemed better.
On Sat, 07 Nov 2020, Sam Ravnborg wrote:
> Hi Lee,
>
> On Fri, Nov 06, 2020 at 09:49:40PM +0000, Lee Jones wrote:
> > Unfortunately, a suitable one didn't already exist.
> >
> > Fixes the following W=1 kernel build warning(s):
> >
> > drivers/gpu/drm/radeon/radeon_device.c:637:6: warning: no previous prototype for ‘radeon_device_is_virtual’ [-Wmissing-prototypes]
> > 637 | bool radeon_device_is_virtual(void)
> > | ^~~~~~~~~~~~~~~~~~~~~~~~
> >
> > Cc: Alex Deucher <alexander.deucher@amd.com>
> > Cc: "Christian König" <christian.koenig@amd.com>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > Cc: Sumit Semwal <sumit.semwal@linaro.org>
> > Cc: amd-gfx@lists.freedesktop.org
> > Cc: dri-devel@lists.freedesktop.org
> > Cc: linux-media@vger.kernel.org
> > Cc: linaro-mm-sig@lists.linaro.org
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> > ---
> > drivers/gpu/drm/radeon/radeon_device.c | 1 +
> > drivers/gpu/drm/radeon/radeon_device.h | 32 ++++++++++++++++++++++++++
> > drivers/gpu/drm/radeon/radeon_drv.c | 3 +--
> > 3 files changed, 34 insertions(+), 2 deletions(-)
> > create mode 100644 drivers/gpu/drm/radeon/radeon_device.h
>
> Other public functions in radeon_device.c have their prototype in
> radeon.h - for example radeon_is_px()
>
> Add radeon_device_is_virtual() there so we avoiid this new header.
Oh yes, I remember why this wasn't a suitable solution now:
The macro "radeon_init" in radeon.h clashes with the init function of
the same name in radeon_drv.c:
In file included from drivers/gpu/drm/radeon/radeon_drv.c:53:
drivers/gpu/drm/radeon/radeon_drv.c:620:31: error: expected identifier or ‘(’ before ‘void’
620 | static int __init radeon_init(void)
| ^~~~
drivers/gpu/drm/radeon/radeon.h:2705:28: note: in definition of macro ‘radeon_init’
2705 | #define radeon_init(rdev) (rdev)->asic->init((rdev))
| ^~~~
In file included from drivers/gpu/drm/radeon/radeon_drv.c:35:
drivers/gpu/drm/radeon/radeon_drv.c: In function ‘__inittest’:
drivers/gpu/drm/radeon/radeon_drv.c:653:13: error: ‘radeon_init’ undeclared (first use in this function); did you mean ‘radeon_exit’?
653 | module_init(radeon_init);
| ^~~~~~~~~~~
include/linux/module.h:133:11: note: in definition of macro ‘module_init’
133 | { return initfn; } | ^~~~~~
drivers/gpu/drm/radeon/radeon_drv.c:653:13: note: each undeclared identifier is reported only once for each function it appears in
653 | module_init(radeon_init);
| ^~~~~~~~~~~
include/linux/module.h:133:11: note: in definition of macro ‘module_init’
133 | { return initfn; } | ^~~~~~
In file included from include/linux/compiler_types.h:65,
from <command-line>:
drivers/gpu/drm/radeon/radeon_drv.c: At top level:
drivers/gpu/drm/radeon/radeon_drv.c:653:13: error: ‘radeon_init’ undeclared here (not in a function); did you mean ‘radeon_exit’?
653 | module_init(radeon_init);
| ^~~~~~~~~~~
include/linux/compiler_attributes.h:109:65: note: in definition of macro ‘__copy’
109 | # define __copy(symbol) __attribute__((__copy__(symbol)))
| ^~~~~~
drivers/gpu/drm/radeon/radeon_drv.c:653:1: note: in expansion of macro ‘module_init’
653 | module_init(radeon_init);
| ^~~~~~~~~~~
In file included from drivers/gpu/drm/radeon/radeon_drv.c:35:
include/linux/module.h:134:6: error: ‘init_module’ aliased to undefined symbol ‘radeon_init’
134 | int init_module(void) __copy(initfn) __attribute__((alias(#initfn)));
| ^~~~~~~~~~~
drivers/gpu/drm/radeon/radeon_drv.c:653:1: note: in expansion of macro ‘module_init’
653 | module_init(radeon_init);
| ^~~~~~~~~~~
How would you like me to move forward?
Hi Lee,
> >
> > Other public functions in radeon_device.c have their prototype in
> > radeon.h - for example radeon_is_px()
> >
> > Add radeon_device_is_virtual() there so we avoiid this new header.
>
> Oh yes, I remember why this wasn't a suitable solution now:
>
> The macro "radeon_init" in radeon.h clashes with the init function of
> the same name in radeon_drv.c:
>
> In file included from drivers/gpu/drm/radeon/radeon_drv.c:53:
> drivers/gpu/drm/radeon/radeon_drv.c:620:31: error: expected identifier or ‘(’ before ‘void’
> 620 | static int __init radeon_init(void)
...
>
> How would you like me to move forward?
Fix the thousand of warnings in other places :-)
I will take a look at radeon and post a new series based on your work
with all W=1 warnings fixed.
Sam
On Mon, 09 Nov 2020, Sam Ravnborg wrote:
> Hi Lee,
> > >
> > > Other public functions in radeon_device.c have their prototype in
> > > radeon.h - for example radeon_is_px()
> > >
> > > Add radeon_device_is_virtual() there so we avoiid this new header.
> >
> > Oh yes, I remember why this wasn't a suitable solution now:
> >
> > The macro "radeon_init" in radeon.h clashes with the init function of
> > the same name in radeon_drv.c:
> >
> > In file included from drivers/gpu/drm/radeon/radeon_drv.c:53:
> > drivers/gpu/drm/radeon/radeon_drv.c:620:31: error: expected identifier or ‘(’ before ‘void’
> > 620 | static int __init radeon_init(void)
> ...
> >
> > How would you like me to move forward?
>
> Fix the thousand of warnings in other places :-)
> I will take a look at radeon and post a new series based on your work
> with all W=1 warnings fixed.
I'll drop this patch and carry on ploughing through the rest of them.
@@ -42,6 +42,7 @@
#include <drm/drm_probe_helper.h>
#include <drm/radeon_drm.h>
+#include "radeon_device.h"
#include "radeon_reg.h"
#include "radeon.h"
#include "atom.h"
new file mode 100644
@@ -0,0 +1,32 @@
+/* radeon_drv.h -- Private header for radeon device -*- linux-c -*-
+ *
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Fremont, California.
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __RADEON_DEV_H__
+#define __RADEON_DEV_H__
+
+bool radeon_device_is_virtual(void);
+
+#endif /* __RADEON_DEV_H__ */
@@ -51,6 +51,7 @@
#include <drm/radeon_drm.h>
#include "radeon_drv.h"
+#include "radeon_device.h"
/*
* KMS wrapper.
@@ -300,8 +301,6 @@ MODULE_DEVICE_TABLE(pci, pciidlist);
static struct drm_driver kms_driver;
-bool radeon_device_is_virtual(void);
-
static int radeon_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
{