Skip to contentSkip to conversation

s390: add const to bin_attribute structures

PATCH Applied Bhumika Goyal 2 participants 4 messages Aug 2, 2017 – Aug 3, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover s390: add const to bin_attribute structures

Declare bin_attribute structures as const.

Bhumika Goyal (2):
s390/sclp: add const to bin_attribute structure
s390/cio: add const to bin_attribute structures

 drivers/s390/char/sclp_config.c | 2 +-
 drivers/s390/cio/chp.c          | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/2 s390/sclp: add const to bin_attribute structure

Declare bin_attribute structure as const as it is only passed as an argument to the function sysfs_create_bin_file. This argument is of type const, so declare the structure as const.

Cross compiled for s390 architecture.

---
 drivers/s390/char/sclp_config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/char/sclp_config.c +1 -1
index 1406fb6..7003d52 100644
@@ -135,7 +135,7 @@ static ssize_t sysfs_ofb_data_write(struct file *filp, struct kobject *kobj,
 	return rc ?: count;
 }
 
-static struct bin_attribute ofb_bin_attr = {
+static const struct bin_attribute ofb_bin_attr = {
 	.attr = {
 		.name = "event_data",
 		.mode = S_IWUSR,
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/2 s390/cio: add const to bin_attribute structures

In reply to Bhumika Goyal

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

Cross compiled for s390 architecture.

---
 drivers/s390/cio/chp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/s390/cio/chp.c +2 -2
index 432fc40..f4166f8 100644
@@ -143,7 +143,7 @@ static ssize_t chp_measurement_chars_read(struct file *filp,
 				       sizeof(chp->cmg_chars));
 }
 
-static struct bin_attribute chp_measurement_chars_attr = {
+static const struct bin_attribute chp_measurement_chars_attr = {
 	.attr = {
 		.name = "measurement_chars",
 		.mode = S_IRUSR,
@@ -197,7 +197,7 @@ static ssize_t chp_measurement_read(struct file *filp, struct kobject *kobj,
 	return count;
 }
 
-static struct bin_attribute chp_measurement_attr = {
+static const struct bin_attribute chp_measurement_attr = {
 	.attr = {
 		.name = "measurement",
 		.mode = S_IRUSR,
Signature · 1 line
1.9.1
#3 lore raw
In reply to Bhumika Goyal
Quoted 9 lines · On Wed, 2 Aug 2017 21:37:21 +0530 Bhumika Goyal <[email protected]> wrote:

Declare bin_attribute structures as const.

Bhumika Goyal (2):
s390/sclp: add const to bin_attribute structure
s390/cio: add const to bin_attribute structures

 drivers/s390/char/sclp_config.c | 2 +-
 drivers/s390/cio/chp.c          | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Applied. Thanks!

Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.