Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1489325 > unrolled thread
| Started by | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| First post | 2016-09-22 20:40 +0200 |
| Last post | 2016-09-22 20:50 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 14/14] GPU-DRM-TTM: Mark an array of text strings as "const" in ttm_dma_pool_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-22 20:40 +0200
Re: [PATCH 14/14] GPU-DRM-TTM: Mark an array of text strings as "const" in ttm_dma_pool_init() Joe Perches <joe@perches.com> - 2016-09-22 20:50 +0200
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-09-22 20:40 +0200 |
| Subject | [PATCH 14/14] GPU-DRM-TTM: Mark an array of text strings as "const" in ttm_dma_pool_init() |
| Message-ID | <skh4B-1rX-29@gated-at.bofh.it> |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 22 Sep 2016 18:46:01 +0200
The local variable "n" was not modified after it was initialized with
a few text strings.
Thus express this detail also by the data type qualifier "const".
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
index aa1679d..e21c1b3 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
@@ -574,7 +574,7 @@ static int ttm_dma_pool_match(struct device *dev, void *res, void *match_data)
static struct dma_pool *ttm_dma_pool_init(struct device *dev, gfp_t flags,
enum pool_type type)
{
- char *n[] = {"wc", "uc", "cached", " dma32", "unknown",};
+ char const * const n[] = {"wc", "uc", "cached", " dma32", "unknown",};
enum pool_type t[] = {IS_WC, IS_UC, IS_CACHED, IS_DMA32, IS_UNDEFINED};
struct device_pools *sec_pool;
struct dma_pool *pool, **ptr;
--
2.10.0
[toc] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2016-09-22 20:50 +0200 |
| Subject | Re: [PATCH 14/14] GPU-DRM-TTM: Mark an array of text strings as "const" in ttm_dma_pool_init() |
| Message-ID | <skhei-1xN-21@gated-at.bofh.it> |
| In reply to | #1489325 |
On Thu, 2016-09-22 at 19:46 +0200, SF Markus Elfring wrote:
> The local variable "n" was not modified after it was initialized with
> a few text strings.
> Thus express this detail also by the data type qualifier "const".
[]
> diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
[]
> @@ -574,7 +574,7 @@ static int ttm_dma_pool_match(struct device *dev, void *res, void *match_data)
> static struct dma_pool *ttm_dma_pool_init(struct device *dev, gfp_t flags,
> enum pool_type type)
> {
> - char *n[] = {"wc", "uc", "cached", " dma32", "unknown",};
> + char const * const n[] = {"wc", "uc", "cached", " dma32", "unknown",};
> enum pool_type t[] = {IS_WC, IS_UC, IS_CACHED, IS_DMA32, IS_UNDEFINED};
Please think a little deeper about what you are changing here
and look at the line immediately below it too.
Both should be static const to avoid unnecessary reload.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web