drivers/gpu/drm: fix (sparse) warnings
Subsystems (3)
cover drivers/gpu/drm: fix (sparse) warnings
The following series fixes a couple of (sparse) warnings.
---
Hannes Eder (3):
drivers/gpu/drm: comment out dead code drivers/gpu/drm: fix sparse warnings: unexport symbols drivers/gpu/drm: fix sparse warnings: make symbols static
drivers/gpu/drm/drm_crtc.c | 17 ++++++++++------- drivers/gpu/drm/drm_crtc_helper.c | 6 +++--- drivers/gpu/drm/drm_edid.c | 4 ++-- drivers/gpu/drm/drm_modes.c | 13 +++++++------ 4 files changed, 22 insertions(+), 18 deletions(-)
PATCH 1/3 drivers/gpu/drm: fix sparse warnings: make symbols static
Fix this sparse warnings:
drivers/gpu/drm/drm_crtc.c:270:17: warning: symbol 'drm_crtc_from_fb' was not declared. Should it be static? drivers/gpu/drm/drm_crtc.c:810:5: warning: symbol 'drm_mode_group_init' was not declared. Should it be static? drivers/gpu/drm/drm_crtc.c:913:6: warning: symbol 'drm_crtc_convert_to_umode' was not declared. Should it be static? drivers/gpu/drm/drm_crtc.c:945:6: warning: symbol 'drm_crtc_convert_umode' was not declared. Should it be static? drivers/gpu/drm/drm_edid.c:252:25: warning: symbol 'drm_mode_std' was not declared. Should it be static? drivers/gpu/drm/drm_modes.c:446:6: warning: symbol 'list_sort' was not declared. Should it be static?
--- drivers/gpu/drm/drm_crtc.c | 15 ++++++++------- drivers/gpu/drm/drm_edid.c | 4 ++-- drivers/gpu/drm/drm_modes.c | 4 ++-- 3 files changed, 12 insertions(+), 11 deletions(-)
drivers/gpu/drm/drm_crtc.c +8 -7
@@ -267,8 +267,8 @@ EXPORT_SYMBOL(drm_mode_object_find);* RETURNS: * Pointer to the CRTC or NULL if it wasn't found. */ -struct drm_crtc *drm_crtc_from_fb (struct drm_device *dev, -struct drm_framebuffer *fb) +static struct drm_crtc *drm_crtc_from_fb (struct drm_device *dev, +struct drm_framebuffer *fb) {struct drm_crtc *crtc;
@@ -807,7 +807,8 @@ void drm_mode_config_init(struct drm_device *dev) }EXPORT_SYMBOL (drm_mode_config_init); -int drm_mode_group_init (struct drm_device *dev,struct drm_mode_group *group) +static int drm_mode_group_init (struct drm_device *dev, +struct drm_mode_group *group) {uint32_t total_objects =0 ;
@@ -910,8 +911,8 @@ EXPORT_SYMBOL(drm_mode_config_cleanup);* Convert a drm_display_mode into a drm_mode_modeinfo structure to return to * the user. */ -void drm_crtc_convert_to_umode (struct drm_mode_modeinfo *out, -struct drm_display_mode *in) +static void drm_crtc_convert_to_umode (struct drm_mode_modeinfo *out, +struct drm_display_mode *in) { out->clock = in->clock; out->hdisplay = in->hdisplay;
@@ -942,8 +943,8 @@ void drm_crtc_convert_to_umode(struct drm_mode_modeinfo *out,* Convert a drm_mode_modeinfo into a drm_display_mode structure to return to * the caller. */ -void drm_crtc_convert_umode (struct drm_display_mode *out, -struct drm_mode_modeinfo *in) +static void drm_crtc_convert_umode (struct drm_display_mode *out, +struct drm_mode_modeinfo *in) { out->clock = in->clock; out->hdisplay = in->hdisplay;
drivers/gpu/drm/drm_edid.c +2 -2
@@ -249,8 +249,8 @@ static void edid_fixup_preferred(struct drm_connector *connector,* Punts for now, but should eventually use the FB layer's CVT based mode * generation code. */ -struct drm_display_mode *drm_mode_std (struct drm_device *dev, -struct std_timing *t) +static struct drm_display_mode *drm_mode_std (struct drm_device *dev, +struct std_timing *t) {struct drm_display_mode *mode;int hsize = t->hsize *8 +248 , vsize;
drivers/gpu/drm/drm_modes.c +2 -2
@@ -443,8 +443,8 @@ static int drm_mode_compare(struct list_head *lh_a, struct list_head *lh_b)/* FIXME: what we don't have a list sort function? */ /* list sort from Mark J Roberts ([email protected]) */ -void list_sort (struct list_head *head, -int (*cmp)(struct list_head *a,struct list_head *b)) +static void list_sort (struct list_head *head, +int (*cmp)(struct list_head *a,struct list_head *b)) {struct list_head *p, *q, *e, *list, *tail, *oldhead;int insize, nmerges, psize, qsize, i;
Re: [PATCH 1/3] drivers/gpu/drm: fix sparse warnings: make symbols static
[Added To]
Quoted 85 lines · Hannes Eder
Fix this sparse warnings:
drivers/gpu/drm/drm_crtc.c:270:17: warning: symbol '
drm_crtc_from_fb' was not declared. Should it be static?drivers/gpu/drm/drm_crtc.c:810:5: warning: symbol 'drm_mode_group_init' was not declared. Should it be static?drivers/gpu/drm/drm_crtc.c:913:6: warning: symbol 'drm_crtc_convert_to_umode' was not declared. Should it be static?drivers/gpu/drm/drm_crtc.c:945:6: warning: symbol 'drm_crtc_convert_umode' was not declared. Should it be static?drivers/gpu/drm/drm_edid.c:252:25: warning: symbol 'drm_mode_std' was not declared. Should it be static?drivers/gpu/drm/drm_modes.c:446:6: warning: symbol 'list_sort' was not declared. Should it be static?Signed-off-by Hannes Eder <[email protected]>---
drivers/gpu/drm/drm_crtc.c | 15 ++++++++-------drivers/gpu/drm/drm_edid.c| 4 ++--drivers/gpu/drm/drm_modes.c| 4 ++--3 files changed, 12 insertions(+), 11 deletions(-)drivers/gpu/drm/drm_crtc.c +8
-7@@ -267,8 +267,8 @@ EXPORT_SYMBOL(drm_mode_object_find);* RETURNS: * Pointer to the CRTC or NULL if it wasn't found. */ -struct drm_crtc *drm_crtc_from_fb (struct drm_device *dev, - struct drm_framebuffer *fb) +static struct drm_crtc *drm_crtc_from_fb (struct drm_device *dev, + struct drm_framebuffer *fb) { struct drm_crtc *crtc;@@ -807,7 +807,8 @@ void drm_mode_config_init(struct drm_device *dev) } EXPORT_SYMBOL(drm_mode_config_init); -int drm_mode_group_init (struct drm_device *dev,struct drm_mode_group *group) +static int drm_mode_group_init (struct drm_device *dev, + struct drm_mode_group *group) { uint32_t total_objects = 0;@@ -910,8 +911,8 @@ EXPORT_SYMBOL(drm_mode_config_cleanup);* Convert a drm_display_mode into a drm_mode_modeinfo structure to return to * the user. */ -void drm_crtc_convert_to_umode (struct drm_mode_modeinfo *out, - struct drm_display_mode *in) +static void drm_crtc_convert_to_umode (struct drm_mode_modeinfo *out, + struct drm_display_mode *in) { out->clock = in->clock; out->hdisplay = in->hdisplay;@@ -942,8 +943,8 @@ void drm_crtc_convert_to_umode(struct drm_mode_modeinfo *out,* Convert a drm_mode_modeinfo into a drm_display_mode structure to return to * the caller. */ -void drm_crtc_convert_umode (struct drm_display_mode *out, - struct drm_mode_modeinfo *in) +static void drm_crtc_convert_umode (struct drm_display_mode *out, + struct drm_mode_modeinfo *in) { out->clock = in->clock; out->hdisplay = in->hdisplay;drivers/gpu/drm/drm_edid.c +2
-2@@ -249,8 +249,8 @@ static void edid_fixup_preferred(struct drm_connector *connector,* Punts for now, but should eventually use the FB layer's CVT based mode * generation code. */ -struct drm_display_mode *drm_mode_std (struct drm_device *dev, - struct std_timing *t) +static struct drm_display_mode *drm_mode_std (struct drm_device *dev, + struct std_timing *t) { struct drm_display_mode *mode; int hsize = t->hsize * 8 + 248, vsize;drivers/gpu/drm/drm_modes.c +0
-0
drivers/gpu/drm/drm_modes.c static int drm_mode_compare(struct list_head *lh_a, struct list_head *lh_b) · line 450
Quoted 10 lines
drivers/gpu/drm/drm_modes.c +2
-2@@ -443,8 +443,8 @@ static int drm_mode_compare(struct list_head *lh_a, struct list_head *lh_b) /* FIXME: what we don't have a list sort function? */ /* list sort from Mark J Roberts ([email protected]) */ -void list_sort (struct list_head *head, - int (*cmp)(struct list_head *a, struct list_head *b)) +static void list_sort (struct list_head *head, + int (*cmp)(struct list_head *a, struct list_head *b)) { struct list_head *p, *q, *e, *list, *tail, *oldhead; int insize, nmerges, psize, qsize, i;
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/3 drivers/gpu/drm: fix sparse warnings: unexport symbols
In reply to Hannes EderFix this sparse warnings:
drivers/gpu/drm/drm_crtc_helper.c:137:6: warning: symbol 'drm_helper_probe_connector_modes' was not declared. Should it be static? drivers/gpu/drm/drm_modes.c:360:6: warning: symbol 'drm_mode_validate_clocks' was not declared. Should it be static?
--- drivers/gpu/drm/drm_crtc_helper.c | 6 +++--- drivers/gpu/drm/drm_modes.c | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_crtc_helper.c +3 -3
@@ -134,8 +134,9 @@ void drm_helper_probe_single_connector_modes(struct drm_connector *connector, }EXPORT_SYMBOL (drm_helper_probe_single_connector_modes); -void drm_helper_probe_connector_modes (struct drm_device *dev,uint32_t maxX, -uint32_t maxY) +static void drm_helper_probe_connector_modes (struct drm_device *dev, +uint32_t maxX, +uint32_t maxY) {struct drm_connector *connector;
@@ -143,7 +144,6 @@ void drm_helper_probe_connector_modes(struct drm_device *dev, uint32_t maxX,drm_helper_probe_single_connector_modes (connector, maxX, maxY); } } -EXPORT_SYMBOL (drm_helper_probe_connector_modes);/**
drivers/gpu/drm/drm_modes.c +3 -4
@@ -357,9 +357,9 @@ EXPORT_SYMBOL(drm_mode_validate_size);* sure each mode falls within a given range (defined by @min and @max * arrays) and sets @mode->status as needed. */ -void drm_mode_validate_clocks (struct drm_device *dev, -struct list_head *mode_list, -int *min,int *max,int n_ranges) +static void drm_mode_validate_clocks (struct drm_device *dev, +struct list_head *mode_list, +int *min,int *max,int n_ranges) {struct drm_display_mode *mode;int i;
@@ -376,7 +376,6 @@ void drm_mode_validate_clocks(struct drm_device *dev, mode->status =MODE_CLOCK_RANGE ; } } -EXPORT_SYMBOL (drm_mode_validate_clocks);/** * drm_mode_prune_invalid - remove invalid modes from mode list
Re: [PATCH 2/3] drivers/gpu/drm: fix sparse warnings: unexport symbols
Quoted 28 lines · Hannes Eder
Fix this sparse warnings:
drivers/gpu/drm/drm_crtc_helper.c:137:6: warning: symbol 'drm_helper_probe_connector_modes' was not declared. Should it be static?drivers/gpu/drm/drm_modes.c:360:6: warning: symbol 'drm_mode_validate_clocks' was not declared. Should it be static?Signed-off-by Hannes Eder <[email protected]>--- drivers/gpu/drm/drm_crtc_helper.c | 6 +++--- drivers/gpu/drm/drm_modes.c | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-)drivers/gpu/drm/drm_crtc_helper.c +3
-2@@ -134,8 +134,9 @@ void drm_helper_probe_single_connector_modes(struct drm_connector *connector, }EXPORT_SYMBOL (drm_helper_probe_single_connector_modes); -void drm_helper_probe_connector_modes (struct drm_device *dev,uint32_t maxX, -uint32_t maxY) +static void drm_helper_probe_connector_modes (struct drm_device *dev, +uint32_t maxX, +uint32_t maxY) {struct drm_connector *connector;
drivers/gpu/drm/drm_crtc_helper.c void drm_helper_probe_connector_modes(struct drm_device *dev, uint32_t maxX, · line 147
Quoted 5 lines
drivers/gpu/drm/drm_crtc_helper.c +0
-1@@ -143,7 +144,6 @@ void drm_helper_probe_connector_modes(struct drm_device *dev, uint32_t maxX,drm_helper_probe_single_connector_modes (connector, maxX, maxY); } } -EXPORT_SYMBOL (drm_helper_probe_connector_modes);
hmm, what you are trying to do ?
Quoted 20 lines
drivers/gpu/drm/drm_crtc_helper.c +0
-0/** drivers/gpu/drm/drm_modes.c +3
-3@@ -357,9 +357,9 @@ EXPORT_SYMBOL(drm_mode_validate_size);* sure each mode falls within a given range (defined by @min and @max * arrays) and sets @mode->status as needed. */ -void drm_mode_validate_clocks (struct drm_device *dev, -struct list_head *mode_list, -int *min,int *max,int n_ranges) +static void drm_mode_validate_clocks (struct drm_device *dev, +struct list_head *mode_list, +int *min,int *max,int n_ranges) {struct drm_display_mode *mode;int i;
drivers/gpu/drm/drm_modes.c void drm_mode_validate_clocks(struct drm_device *dev, · line 379
Quoted 4 lines
drivers/gpu/drm/drm_modes.c +0
-1@@ -376,7 +376,6 @@ void drm_mode_validate_clocks(struct drm_device *dev, mode->status =MODE_CLOCK_RANGE ; } } -EXPORT_SYMBOL (drm_mode_validate_clocks);
??
--
JSR
Re: [PATCH 2/3] drivers/gpu/drm: fix sparse warnings: unexport symbols
Quoted 55 lines · Jaswinder Singh Rajput
Quoted 28 lines · Hannes Eder
Fix this sparse warnings:
drivers/gpu/drm/drm_crtc_helper.c:137:6: warning: symbol 'drm_helper_probe_connector_modes' was not declared. Should it be static?drivers/gpu/drm/drm_modes.c:360:6: warning: symbol 'drm_mode_validate_clocks' was not declared. Should it be static?Signed-off-by Hannes Eder <[email protected]>--- drivers/gpu/drm/drm_crtc_helper.c | 6 +++--- drivers/gpu/drm/drm_modes.c | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-)drivers/gpu/drm/drm_crtc_helper.c +3
-2@@ -134,8 +134,9 @@ void drm_helper_probe_single_connector_modes(struct drm_connector *connector, }EXPORT_SYMBOL (drm_helper_probe_single_connector_modes); -void drm_helper_probe_connector_modes (struct drm_device *dev,uint32_t maxX, -uint32_t maxY) +static void drm_helper_probe_connector_modes (struct drm_device *dev, +uint32_t maxX, +uint32_t maxY) {struct drm_connector *connector;drivers/gpu/drm/drm_crtc_helper.c void drm_helper_probe_connector_modes(struct drm_device *dev, uint32_t maxX, · line 147
Quoted 5 lines
drivers/gpu/drm/drm_crtc_helper.c +0
-1@@ -143,7 +144,6 @@ void drm_helper_probe_connector_modes(struct drm_device *dev, uint32_t maxX,drm_helper_probe_single_connector_modes (connector, maxX, maxY); } } -EXPORT_SYMBOL (drm_helper_probe_connector_modes);hmm, what you are trying to do ?
Quoted 18 lines
drivers/gpu/drm/drm_crtc_helper.c +0
-0/** drivers/gpu/drm/drm_modes.c +3
-3@@ -357,9 +357,9 @@ EXPORT_SYMBOL(drm_mode_validate_size);* sure each mode falls within a given range (defined by @min and @max * arrays) and sets @mode->status as needed. */ -void drm_mode_validate_clocks (struct drm_device *dev, -struct list_head *mode_list, -int *min,int *max,int n_ranges) +static void drm_mode_validate_clocks (struct drm_device *dev, +struct list_head *mode_list, +int *min,int *max,int n_ranges) {struct drm_display_mode *mode;
Quoted 8 lines
drivers/gpu/drm/drm_modes.c void drm_mode_validate_clocks(struct drm_device *dev, · line 379
Quoted 6 lines
drivers/gpu/drm/drm_modes.c +0
-1int i;@@ -376,7 +376,6 @@ void drm_mode_validate_clocks(struct drm_device *dev, mode->status =MODE_CLOCK_RANGE ; } } -EXPORT_SYMBOL (drm_mode_validate_clocks);??
In both cases: a grep over the entire kernel tree shows that the function is only used within the compilation unit it is defined, therefore make it static and un-EXPORT it.
Hannes
Re: [PATCH 2/3] drivers/gpu/drm: fix sparse warnings: unexport symbols
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
-EXPORT_SYMBOL(drm_mode_validate_clocks);
??
In both cases: a grep over the entire kernel tree shows that the function is only used within the compilation unit it is defined, therefore make it static and un-EXPORT it.
I don't know anything about this specific context, but aren't things in general exported so that external modules can use them? If that is the case, grepping over the kernel sources is not sufficient.
julia
Re: [PATCH 2/3] drivers/gpu/drm: fix sparse warnings: unexport symbols
Quoted 3 lines · Julia Lawall
I don't know anything about this specific context, but aren't things in general exported so that external modules can use them? If that is the case, grepping over the kernel sources is not sufficient.
Good point, but it indicates that the function does not have a caller within kernel tree.
Ok, there could be other clients. So this patch might just be a hint for the original author or maintainer that there is maybe no need to export this function.
Quoted 2 lines · Jaswinder Singh Rajput
If it is EXPORTED you cannot make it static. EXPORTED means it can be used from a kernel module.
Right, that's why I have made it static and removed the EXPORT_SYMBOL, all under the assumption that there is _no_ client for this function, but there may be some outside the kernel tree. I can not judge this.
Hannes
Re: [PATCH 2/3] drivers/gpu/drm: fix sparse warnings: unexport symbols
In reply to Hannes EderQuoted 26 lines · Hannes Eder
Quoted 17 lines
Quoted 17 lines
/**
drivers/gpu/drm/drm_modes.c +3
-3@@ -357,9 +357,9 @@ EXPORT_SYMBOL(drm_mode_validate_size);* sure each mode falls within a given range (defined by @min and @max * arrays) and sets @mode->status as needed. */ -void drm_mode_validate_clocks (struct drm_device *dev, -struct list_head *mode_list, -int *min,int *max,int n_ranges) +static void drm_mode_validate_clocks (struct drm_device *dev, +struct list_head *mode_list, +int *min,int *max,int n_ranges) {struct drm_display_mode *mode;Quoted 8 lines
drivers/gpu/drm/drm_modes.c void drm_mode_validate_clocks(struct drm_device *dev, · line 379
Quoted 6 lines
drivers/gpu/drm/drm_modes.c +0
-1int i;@@ -376,7 +376,6 @@ void drm_mode_validate_clocks(struct drm_device *dev, mode->status =MODE_CLOCK_RANGE ; } } -EXPORT_SYMBOL (drm_mode_validate_clocks);??
Quoted 3 lines
In both cases: a grep over the entire kernel tree shows that the function is only used within the compilation unit it is defined, therefore make it static and un-EXPORT it.
If it is EXPORTED you cannot make it static. EXPORTED means it can be used from a kernel module.
you need to define the declaration of these functions on related header file to fix these sparse warnings.
--
JSR
PATCH 3/3 drivers/gpu/drm: comment out dead code
In reply to Hannes EderThe functions:
drm_crtc_from_fb
drm_mode_validate_clocks
are not used, so comment them out.
--- drivers/gpu/drm/drm_crtc.c | 2 ++ drivers/gpu/drm/drm_modes.c | 2 ++ 2 files changed, 4 insertions(+), 0 deletions(-)
drivers/gpu/drm/drm_crtc.c +2 -0
@@ -254,6 +254,7 @@ void *drm_mode_object_find(struct drm_device *dev, uint32_t id, uint32_t type) }EXPORT_SYMBOL (drm_mode_object_find); +#ifdef UNUSED /** * drm_crtc_from_fb - find the CRTC structure associated with an fb * @dev: DRM device
@@ -278,6 +279,7 @@ static struct drm_crtc *drm_crtc_from_fb(struct drm_device *dev, }return NULL ; } +#endif /* UNUSED */ /** * drm_framebuffer_init - initialize a framebuffer
drivers/gpu/drm/drm_modes.c +2 -0
@@ -341,6 +341,7 @@ void drm_mode_validate_size(struct drm_device *dev, }EXPORT_SYMBOL (drm_mode_validate_size); +#ifdef UNUSED /** * drm_mode_validate_clocks - validate modes against clock limits * @dev: DRM device
@@ -376,6 +377,7 @@ static void drm_mode_validate_clocks(struct drm_device *dev, mode->status = MODE_CLOCK_RANGE; } } +#endif /* UNUSED */ /** * drm_mode_prune_invalid - remove invalid modes from mode list
Re: [PATCH 3/3] drivers/gpu/drm: comment out dead code
[Added To]
Quoted 48 lines · Hannes Eder
The functions:
drm_crtc_from_fb
drm_mode_validate_clocksare not used, so comment them out.
Signed-off-by Hannes Eder <[email protected]>---
drivers/gpu/drm/drm_crtc.c | 2 ++
drivers/gpu/drm/drm_modes.c | 2 ++2 files changed, 4 insertions(+), 0 deletions(-)drivers/gpu/drm/drm_crtc.c +2
-0@@ -254,6 +254,7 @@ void *drm_mode_object_find(struct drm_device *dev, uint32_t id, uint32_t type) } EXPORT_SYMBOL(drm_mode_object_find); +#ifdef UNUSED /*** drm_crtc_from_fb - find the CRTC structure associated with an fb * @dev: DRM device @@ -278,6 +279,7 @@ static struct drm_crtc *drm_crtc_from_fb(struct drm_device *dev, } return NULL; } +#endif /* UNUSED */ /*** drm_framebuffer_init - initialize a framebuffer drivers/gpu/drm/drm_modes.c +1
-0@@ -341,6 +341,7 @@ void drm_mode_validate_size(struct drm_device *dev, } EXPORT_SYMBOL(drm_mode_validate_size); +#ifdef UNUSED /*** drm_mode_validate_clocks - validate modes against clock limits * @dev: DRM device
drivers/gpu/drm/drm_modes.c static void drm_mode_validate_clocks(struct drm_device *dev, · line 383
Quoted 7 lines
drivers/gpu/drm/drm_modes.c +1
-0@@ -376,6 +377,7 @@ static void drm_mode_validate_clocks(struct drm_device *dev, mode->status = MODE_CLOCK_RANGE; } } +#endif /* UNUSED */ /*** drm_mode_prune_invalid - remove invalid modes from mode list
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html