mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/i915: add const to bin_attribute
@ 2017-08-02 17:20 Bhumika Goyal
  2017-08-03 10:20 ` Daniel Vetter
  0 siblings, 1 reply; 2+ messages in thread
From: Bhumika Goyal @ 2017-08-02 17:20 UTC (permalink / raw)
  To: julia.lawall, daniel.vetter, jani.nikula, airlied, intel-gfx,
	dri-devel, linux-kernel
  Cc: Bhumika Goyal

Add const to bin_attribute structures as they are only passed to the
functions sysfs_{remove/create}_bin_file or
device_{remove/create}_bin_file. The corresponding arguments are of
type const, so declare the structures to be const.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 drivers/gpu/drm/i915/i915_sysfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
index 7fcf006..d61c872 100644
--- a/drivers/gpu/drm/i915/i915_sysfs.c
+++ b/drivers/gpu/drm/i915/i915_sysfs.c
@@ -220,7 +220,7 @@ static int l3_access_valid(struct drm_i915_private *dev_priv, loff_t offset)
 	return ret;
 }
 
-static struct bin_attribute dpf_attrs = {
+static const struct bin_attribute dpf_attrs = {
 	.attr = {.name = "l3_parity", .mode = (S_IRUSR | S_IWUSR)},
 	.size = GEN7_L3LOG_SIZE,
 	.read = i915_l3_read,
@@ -229,7 +229,7 @@ static int l3_access_valid(struct drm_i915_private *dev_priv, loff_t offset)
 	.private = (void *)0
 };
 
-static struct bin_attribute dpf_attrs_1 = {
+static const struct bin_attribute dpf_attrs_1 = {
 	.attr = {.name = "l3_parity_slice_1", .mode = (S_IRUSR | S_IWUSR)},
 	.size = GEN7_L3LOG_SIZE,
 	.read = i915_l3_read,
@@ -532,7 +532,7 @@ static ssize_t error_state_write(struct file *file, struct kobject *kobj,
 	return count;
 }
 
-static struct bin_attribute error_state_attr = {
+static const struct bin_attribute error_state_attr = {
 	.attr.name = "error",
 	.attr.mode = S_IRUSR | S_IWUSR,
 	.size = 0,
-- 
1.9.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/i915: add const to bin_attribute
  2017-08-02 17:20 [PATCH] drm/i915: add const to bin_attribute Bhumika Goyal
@ 2017-08-03 10:20 ` Daniel Vetter
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2017-08-03 10:20 UTC (permalink / raw)
  To: Bhumika Goyal
  Cc: julia.lawall, daniel.vetter, jani.nikula, airlied, intel-gfx,
	dri-devel, linux-kernel

On Wed, Aug 02, 2017 at 10:50:47PM +0530, Bhumika Goyal wrote:
> Add const to bin_attribute structures as they are only passed to the
> functions sysfs_{remove/create}_bin_file or
> device_{remove/create}_bin_file. The corresponding arguments are of
> type const, so declare the structures to be const.
> 
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>

Applied, thanks.
-Daniel
> ---
>  drivers/gpu/drm/i915/i915_sysfs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
> index 7fcf006..d61c872 100644
> --- a/drivers/gpu/drm/i915/i915_sysfs.c
> +++ b/drivers/gpu/drm/i915/i915_sysfs.c
> @@ -220,7 +220,7 @@ static int l3_access_valid(struct drm_i915_private *dev_priv, loff_t offset)
>  	return ret;
>  }
>  
> -static struct bin_attribute dpf_attrs = {
> +static const struct bin_attribute dpf_attrs = {
>  	.attr = {.name = "l3_parity", .mode = (S_IRUSR | S_IWUSR)},
>  	.size = GEN7_L3LOG_SIZE,
>  	.read = i915_l3_read,
> @@ -229,7 +229,7 @@ static int l3_access_valid(struct drm_i915_private *dev_priv, loff_t offset)
>  	.private = (void *)0
>  };
>  
> -static struct bin_attribute dpf_attrs_1 = {
> +static const struct bin_attribute dpf_attrs_1 = {
>  	.attr = {.name = "l3_parity_slice_1", .mode = (S_IRUSR | S_IWUSR)},
>  	.size = GEN7_L3LOG_SIZE,
>  	.read = i915_l3_read,
> @@ -532,7 +532,7 @@ static ssize_t error_state_write(struct file *file, struct kobject *kobj,
>  	return count;
>  }
>  
> -static struct bin_attribute error_state_attr = {
> +static const struct bin_attribute error_state_attr = {
>  	.attr.name = "error",
>  	.attr.mode = S_IRUSR | S_IWUSR,
>  	.size = 0,
> -- 
> 1.9.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-03 10:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-02 17:20 [PATCH] drm/i915: add const to bin_attribute Bhumika Goyal
2017-08-03 10:20 ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®