All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] constify x86 attribute_group structures.
@ 2017-07-20  7:21 Arvind Yadav
  2017-07-20  7:21 ` [PATCH 1/7] perf: x86: intel: uncore: constify " Arvind Yadav
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Arvind Yadav @ 2017-07-20  7:21 UTC (permalink / raw)
  To: tglx, mingo, hpa, x86, bp, tony.luck; +Cc: linux-kernel

attribute_group are not supposed to change at runtime. All functions
working with attribute_group provided by <linux/sysfs.h> and 'uncore.h'
work with const attribute_group. So mark the non-const structs as const.

Arvind Yadav (7):
  [PATCH 1/7] perf: x86: intel: uncore: constify attribute_group structures.
  [PATCH 2/7] perf: x86: intel: uncore_nhmex: constify attribute_group structures.
  [PATCH 3/7] perf: x86: intel: uncore_snb: constify attribute_group structures.
  [PATCH 4/7] perf: x86: intel: uncore_snbep: constify attribute_group structures.
  [PATCH 5/7] x86: ksysfs: constify attribute_group structures.
  [PATCH 6/7] x86: therm_throt: constify attribute_group structures.
  [PATCH 7/7] x86: microcode: constify attribute_group structures.

 arch/x86/events/intel/uncore.c           |  2 +-
 arch/x86/events/intel/uncore_nhmex.c     | 12 ++++-----
 arch/x86/events/intel/uncore_snb.c       |  6 ++---
 arch/x86/events/intel/uncore_snbep.c     | 42 ++++++++++++++++----------------
 arch/x86/kernel/cpu/mcheck/therm_throt.c |  2 +-
 arch/x86/kernel/cpu/microcode/core.c     |  4 +--
 arch/x86/kernel/ksysfs.c                 |  4 +--
 7 files changed, 36 insertions(+), 36 deletions(-)

-- 
1.9.1

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

* [PATCH 1/7] perf: x86: intel: uncore: constify attribute_group structures.
  2017-07-20  7:21 [PATCH 0/7] constify x86 attribute_group structures Arvind Yadav
@ 2017-07-20  7:21 ` Arvind Yadav
  2017-07-20  7:21 ` [PATCH 2/7] perf: x86: intel: uncore_nhmex: " Arvind Yadav
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Arvind Yadav @ 2017-07-20  7:21 UTC (permalink / raw)
  To: tglx, mingo, hpa, x86, bp, tony.luck; +Cc: linux-kernel

attribute_group are not supposed to change at runtime. All functions
working with attribute_group provided by 'uncore.h' work with const
attribute_group. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
   9361	    216	     88	   9665	   25c1	arch/x86/events/intel/uncore.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
   9393	    184	     88	   9665	   25c1	arch/x86/events/intel/uncore.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 arch/x86/events/intel/uncore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
index 44ec523..1c5390f 100644
--- a/arch/x86/events/intel/uncore.c
+++ b/arch/x86/events/intel/uncore.c
@@ -721,7 +721,7 @@ static ssize_t uncore_get_attr_cpumask(struct device *dev,
 	NULL,
 };
 
-static struct attribute_group uncore_pmu_attr_group = {
+static const struct attribute_group uncore_pmu_attr_group = {
 	.attrs = uncore_pmu_attrs,
 };
 
-- 
1.9.1

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

* [PATCH 2/7] perf: x86: intel: uncore_nhmex: constify attribute_group structures.
  2017-07-20  7:21 [PATCH 0/7] constify x86 attribute_group structures Arvind Yadav
  2017-07-20  7:21 ` [PATCH 1/7] perf: x86: intel: uncore: constify " Arvind Yadav
@ 2017-07-20  7:21 ` Arvind Yadav
  2017-07-20  7:21 ` [PATCH 3/7] perf: x86: intel: uncore_snb: " Arvind Yadav
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Arvind Yadav @ 2017-07-20  7:21 UTC (permalink / raw)
  To: tglx, mingo, hpa, x86, bp, tony.luck; +Cc: linux-kernel

attribute_group are not supposed to change at runtime. All functions
working with attribute_group provided by 'uncore.h' work with const
attribute_group. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
   8236	   5992	      1	  14229	   3795	x86/events/intel/uncore_nhmex.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
   8620	   5608	      1	  14229	   3795	x86/events/intel/uncore_nhmex.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 arch/x86/events/intel/uncore_nhmex.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/events/intel/uncore_nhmex.c b/arch/x86/events/intel/uncore_nhmex.c
index cda5693..6a5cbe9 100644
--- a/arch/x86/events/intel/uncore_nhmex.c
+++ b/arch/x86/events/intel/uncore_nhmex.c
@@ -272,7 +272,7 @@ static void nhmex_uncore_msr_enable_event(struct intel_uncore_box *box, struct p
 	NULL,
 };
 
-static struct attribute_group nhmex_uncore_ubox_format_group = {
+static const struct attribute_group nhmex_uncore_ubox_format_group = {
 	.name		= "format",
 	.attrs		= nhmex_uncore_ubox_formats_attr,
 };
@@ -299,7 +299,7 @@ static void nhmex_uncore_msr_enable_event(struct intel_uncore_box *box, struct p
 	NULL,
 };
 
-static struct attribute_group nhmex_uncore_cbox_format_group = {
+static const struct attribute_group nhmex_uncore_cbox_format_group = {
 	.name = "format",
 	.attrs = nhmex_uncore_cbox_formats_attr,
 };
@@ -407,7 +407,7 @@ static void nhmex_bbox_msr_enable_event(struct intel_uncore_box *box, struct per
 	NULL,
 };
 
-static struct attribute_group nhmex_uncore_bbox_format_group = {
+static const struct attribute_group nhmex_uncore_bbox_format_group = {
 	.name = "format",
 	.attrs = nhmex_uncore_bbox_formats_attr,
 };
@@ -484,7 +484,7 @@ static void nhmex_sbox_msr_enable_event(struct intel_uncore_box *box, struct per
 	NULL,
 };
 
-static struct attribute_group nhmex_uncore_sbox_format_group = {
+static const struct attribute_group nhmex_uncore_sbox_format_group = {
 	.name			= "format",
 	.attrs			= nhmex_uncore_sbox_formats_attr,
 };
@@ -898,7 +898,7 @@ static void nhmex_mbox_msr_enable_event(struct intel_uncore_box *box, struct per
 	NULL,
 };
 
-static struct attribute_group nhmex_uncore_mbox_format_group = {
+static const struct attribute_group nhmex_uncore_mbox_format_group = {
 	.name		= "format",
 	.attrs		= nhmex_uncore_mbox_formats_attr,
 };
@@ -1163,7 +1163,7 @@ static void nhmex_rbox_msr_enable_event(struct intel_uncore_box *box, struct per
 	NULL,
 };
 
-static struct attribute_group nhmex_uncore_rbox_format_group = {
+static const struct attribute_group nhmex_uncore_rbox_format_group = {
 	.name = "format",
 	.attrs = nhmex_uncore_rbox_formats_attr,
 };
-- 
1.9.1

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

* [PATCH 3/7] perf: x86: intel: uncore_snb: constify attribute_group structures.
  2017-07-20  7:21 [PATCH 0/7] constify x86 attribute_group structures Arvind Yadav
  2017-07-20  7:21 ` [PATCH 1/7] perf: x86: intel: uncore: constify " Arvind Yadav
  2017-07-20  7:21 ` [PATCH 2/7] perf: x86: intel: uncore_nhmex: " Arvind Yadav
@ 2017-07-20  7:21 ` Arvind Yadav
  2017-07-20  7:21 ` [PATCH 4/7] perf: x86: intel: uncore_snbep: " Arvind Yadav
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Arvind Yadav @ 2017-07-20  7:21 UTC (permalink / raw)
  To: tglx, mingo, hpa, x86, bp, tony.luck; +Cc: linux-kernel

attribute_group are not supposed to change at runtime. All functions
working with attribute_group provided by 'uncore.h' work with const
attribute_group. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
   4158	   4792	      0	   8950	   22f6	arch/x86/events/intel/uncore_snb.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
   4350	   4600	      0	   8950	   22f6	arch/x86/events/intel/uncore_snb.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 arch/x86/events/intel/uncore_snb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/events/intel/uncore_snb.c b/arch/x86/events/intel/uncore_snb.c
index a3dcc12..db1127c 100644
--- a/arch/x86/events/intel/uncore_snb.c
+++ b/arch/x86/events/intel/uncore_snb.c
@@ -130,7 +130,7 @@ static void snb_uncore_msr_exit_box(struct intel_uncore_box *box)
 	NULL,
 };
 
-static struct attribute_group snb_uncore_format_group = {
+static const struct attribute_group snb_uncore_format_group = {
 	.name		= "format",
 	.attrs		= snb_uncore_formats_attr,
 };
@@ -289,7 +289,7 @@ enum {
 	NULL,
 };
 
-static struct attribute_group snb_uncore_imc_format_group = {
+static const struct attribute_group snb_uncore_imc_format_group = {
 	.name = "format",
 	.attrs = snb_uncore_imc_formats_attr,
 };
@@ -769,7 +769,7 @@ static void nhm_uncore_msr_enable_event(struct intel_uncore_box *box, struct per
 	NULL,
 };
 
-static struct attribute_group nhm_uncore_format_group = {
+static const struct attribute_group nhm_uncore_format_group = {
 	.name = "format",
 	.attrs = nhm_uncore_formats_attr,
 };
-- 
1.9.1

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

* [PATCH 4/7] perf: x86: intel: uncore_snbep: constify attribute_group structures.
  2017-07-20  7:21 [PATCH 0/7] constify x86 attribute_group structures Arvind Yadav
                   ` (2 preceding siblings ...)
  2017-07-20  7:21 ` [PATCH 3/7] perf: x86: intel: uncore_snb: " Arvind Yadav
@ 2017-07-20  7:21 ` Arvind Yadav
  2017-07-20  7:21 ` [PATCH 5/7] x86: ksysfs: " Arvind Yadav
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Arvind Yadav @ 2017-07-20  7:21 UTC (permalink / raw)
  To: tglx, mingo, hpa, x86, bp, tony.luck; +Cc: linux-kernel

attribute_group are not supposed to change at runtime. All functions
working with attribute_group provided by 'uncore.h' work with const
attribute_group. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
  15137	  33528	      0	  48665	   be19	x86/events/intel/uncore_snbep.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
  16457	  32184	      0	  48665	   be19	x86/events/intel/uncore_snbep.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 arch/x86/events/intel/uncore_snbep.c | 42 ++++++++++++++++++------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
index dae2fed..080d8ba 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -603,27 +603,27 @@ static void snbep_uncore_msr_init_box(struct intel_uncore_box *box)
 	{ /* end: all zeroes */ },
 };
 
-static struct attribute_group snbep_uncore_format_group = {
+static const struct attribute_group snbep_uncore_format_group = {
 	.name = "format",
 	.attrs = snbep_uncore_formats_attr,
 };
 
-static struct attribute_group snbep_uncore_ubox_format_group = {
+static const struct attribute_group snbep_uncore_ubox_format_group = {
 	.name = "format",
 	.attrs = snbep_uncore_ubox_formats_attr,
 };
 
-static struct attribute_group snbep_uncore_cbox_format_group = {
+static const struct attribute_group snbep_uncore_cbox_format_group = {
 	.name = "format",
 	.attrs = snbep_uncore_cbox_formats_attr,
 };
 
-static struct attribute_group snbep_uncore_pcu_format_group = {
+static const struct attribute_group snbep_uncore_pcu_format_group = {
 	.name = "format",
 	.attrs = snbep_uncore_pcu_formats_attr,
 };
 
-static struct attribute_group snbep_uncore_qpi_format_group = {
+static const struct attribute_group snbep_uncore_qpi_format_group = {
 	.name = "format",
 	.attrs = snbep_uncore_qpi_formats_attr,
 };
@@ -1432,27 +1432,27 @@ static void ivbep_uncore_pci_init_box(struct intel_uncore_box *box)
 	NULL,
 };
 
-static struct attribute_group ivbep_uncore_format_group = {
+static const struct attribute_group ivbep_uncore_format_group = {
 	.name = "format",
 	.attrs = ivbep_uncore_formats_attr,
 };
 
-static struct attribute_group ivbep_uncore_ubox_format_group = {
+static const struct attribute_group ivbep_uncore_ubox_format_group = {
 	.name = "format",
 	.attrs = ivbep_uncore_ubox_formats_attr,
 };
 
-static struct attribute_group ivbep_uncore_cbox_format_group = {
+static const struct attribute_group ivbep_uncore_cbox_format_group = {
 	.name = "format",
 	.attrs = ivbep_uncore_cbox_formats_attr,
 };
 
-static struct attribute_group ivbep_uncore_pcu_format_group = {
+static const struct attribute_group ivbep_uncore_pcu_format_group = {
 	.name = "format",
 	.attrs = ivbep_uncore_pcu_formats_attr,
 };
 
-static struct attribute_group ivbep_uncore_qpi_format_group = {
+static const struct attribute_group ivbep_uncore_qpi_format_group = {
 	.name = "format",
 	.attrs = ivbep_uncore_qpi_formats_attr,
 };
@@ -1888,7 +1888,7 @@ int ivbep_uncore_pci_init(void)
 	NULL,
 };
 
-static struct attribute_group knl_uncore_ubox_format_group = {
+static const struct attribute_group knl_uncore_ubox_format_group = {
 	.name = "format",
 	.attrs = knl_uncore_ubox_formats_attr,
 };
@@ -1928,7 +1928,7 @@ int ivbep_uncore_pci_init(void)
 	NULL,
 };
 
-static struct attribute_group knl_uncore_cha_format_group = {
+static const struct attribute_group knl_uncore_cha_format_group = {
 	.name = "format",
 	.attrs = knl_uncore_cha_formats_attr,
 };
@@ -2038,7 +2038,7 @@ static void hswep_cbox_enable_event(struct intel_uncore_box *box,
 	NULL,
 };
 
-static struct attribute_group knl_uncore_pcu_format_group = {
+static const struct attribute_group knl_uncore_pcu_format_group = {
 	.name = "format",
 	.attrs = knl_uncore_pcu_formats_attr,
 };
@@ -2188,7 +2188,7 @@ static void knl_uncore_imc_enable_event(struct intel_uncore_box *box,
 	NULL,
 };
 
-static struct attribute_group knl_uncore_irp_format_group = {
+static const struct attribute_group knl_uncore_irp_format_group = {
 	.name = "format",
 	.attrs = knl_uncore_irp_formats_attr,
 };
@@ -2386,7 +2386,7 @@ int knl_uncore_pci_init(void)
 	NULL,
 };
 
-static struct attribute_group hswep_uncore_ubox_format_group = {
+static const struct attribute_group hswep_uncore_ubox_format_group = {
 	.name = "format",
 	.attrs = hswep_uncore_ubox_formats_attr,
 };
@@ -2440,7 +2440,7 @@ static int hswep_ubox_hw_config(struct intel_uncore_box *box, struct perf_event
 	NULL,
 };
 
-static struct attribute_group hswep_uncore_cbox_format_group = {
+static const struct attribute_group hswep_uncore_cbox_format_group = {
 	.name = "format",
 	.attrs = hswep_uncore_cbox_formats_attr,
 };
@@ -2622,7 +2622,7 @@ static void hswep_uncore_sbox_msr_init_box(struct intel_uncore_box *box)
 	NULL,
 };
 
-static struct attribute_group hswep_uncore_sbox_format_group = {
+static const struct attribute_group hswep_uncore_sbox_format_group = {
 	.name = "format",
 	.attrs = hswep_uncore_sbox_formats_attr,
 };
@@ -3317,7 +3317,7 @@ int bdx_uncore_pci_init(void)
 	NULL,
 };
 
-static struct attribute_group skx_uncore_chabox_format_group = {
+static const struct attribute_group skx_uncore_chabox_format_group = {
 	.name = "format",
 	.attrs = skx_uncore_cha_formats_attr,
 };
@@ -3416,7 +3416,7 @@ static int skx_cha_hw_config(struct intel_uncore_box *box, struct perf_event *ev
 	NULL,
 };
 
-static struct attribute_group skx_uncore_iio_format_group = {
+static const struct attribute_group skx_uncore_iio_format_group = {
 	.name = "format",
 	.attrs = skx_uncore_iio_formats_attr,
 };
@@ -3473,7 +3473,7 @@ static void skx_iio_enable_event(struct intel_uncore_box *box,
 	NULL,
 };
 
-static struct attribute_group skx_uncore_format_group = {
+static const struct attribute_group skx_uncore_format_group = {
 	.name = "format",
 	.attrs = skx_uncore_formats_attr,
 };
@@ -3574,7 +3574,7 @@ void skx_uncore_cpu_init(void)
 	NULL,
 };
 
-static struct attribute_group skx_upi_uncore_format_group = {
+static const struct attribute_group skx_upi_uncore_format_group = {
 	.name = "format",
 	.attrs = skx_upi_uncore_formats_attr,
 };
-- 
1.9.1

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

* [PATCH 5/7] x86: ksysfs: constify attribute_group structures.
  2017-07-20  7:21 [PATCH 0/7] constify x86 attribute_group structures Arvind Yadav
                   ` (3 preceding siblings ...)
  2017-07-20  7:21 ` [PATCH 4/7] perf: x86: intel: uncore_snbep: " Arvind Yadav
@ 2017-07-20  7:21 ` Arvind Yadav
  2017-07-20  7:21 ` [PATCH 6/7] x86: therm_throt: " Arvind Yadav
  2017-07-20  7:21 ` [PATCH 7/7] x86: microcode: " Arvind Yadav
  6 siblings, 0 replies; 14+ messages in thread
From: Arvind Yadav @ 2017-07-20  7:21 UTC (permalink / raw)
  To: tglx, mingo, hpa, x86, bp, tony.luck; +Cc: linux-kernel

attribute_group are not supposed to change at runtime. All functions
working with attribute_group provided by <linux/sysfs.h> work with
const attribute_group. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
   1183	    384	      0	   1567	    61f	arch/x86/kernel/ksysfs.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
   1311	    256	      0	   1567	    61f	arch/x86/kernel/ksysfs.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 arch/x86/kernel/ksysfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/ksysfs.c b/arch/x86/kernel/ksysfs.c
index 4afc67f..06e1ff5 100644
--- a/arch/x86/kernel/ksysfs.c
+++ b/arch/x86/kernel/ksysfs.c
@@ -55,7 +55,7 @@ static ssize_t boot_params_data_read(struct file *fp, struct kobject *kobj,
 	NULL,
 };
 
-static struct attribute_group boot_params_attr_group = {
+static const struct attribute_group boot_params_attr_group = {
 	.attrs = boot_params_version_attrs,
 	.bin_attrs = boot_params_data_attrs,
 };
@@ -202,7 +202,7 @@ static ssize_t setup_data_data_read(struct file *fp,
 	NULL,
 };
 
-static struct attribute_group setup_data_attr_group = {
+static const struct attribute_group setup_data_attr_group = {
 	.attrs = setup_data_type_attrs,
 	.bin_attrs = setup_data_data_attrs,
 };
-- 
1.9.1

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

* [PATCH 6/7] x86: therm_throt: constify attribute_group structures.
  2017-07-20  7:21 [PATCH 0/7] constify x86 attribute_group structures Arvind Yadav
                   ` (4 preceding siblings ...)
  2017-07-20  7:21 ` [PATCH 5/7] x86: ksysfs: " Arvind Yadav
@ 2017-07-20  7:21 ` Arvind Yadav
  2017-07-20  7:21 ` [PATCH 7/7] x86: microcode: " Arvind Yadav
  6 siblings, 0 replies; 14+ messages in thread
From: Arvind Yadav @ 2017-07-20  7:21 UTC (permalink / raw)
  To: tglx, mingo, hpa, x86, bp, tony.luck; +Cc: linux-kernel

attribute_group are not supposed to change at runtime. All functions
working with attribute_group provided by <linux/sysfs.h> work with
const attribute_group. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
   3586	    864	     32	   4482	   1182	x86/kernel/cpu/mcheck/therm_throt.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
   3550	    928	     32	   4482	   1182	x86/kernel/cpu/mcheck/therm_throt.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 arch/x86/kernel/cpu/mcheck/therm_throt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
index d7cc190..f7370ab 100644
--- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
@@ -122,7 +122,7 @@ struct thermal_state {
 	NULL
 };
 
-static struct attribute_group thermal_attr_group = {
+static const struct attribute_group thermal_attr_group = {
 	.attrs	= thermal_throttle_attrs,
 	.name	= "thermal_throttle"
 };
-- 
1.9.1

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

* [PATCH 7/7] x86: microcode: constify attribute_group structures.
  2017-07-20  7:21 [PATCH 0/7] constify x86 attribute_group structures Arvind Yadav
                   ` (5 preceding siblings ...)
  2017-07-20  7:21 ` [PATCH 6/7] x86: therm_throt: " Arvind Yadav
@ 2017-07-20  7:21 ` Arvind Yadav
  2017-07-20  8:12   ` Borislav Petkov
  6 siblings, 1 reply; 14+ messages in thread
From: Arvind Yadav @ 2017-07-20  7:21 UTC (permalink / raw)
  To: tglx, mingo, hpa, x86, bp, tony.luck; +Cc: linux-kernel

attribute_group are not supposed to change at runtime. All functions
working with attribute_group provided by <linux/sysfs.h> work with
const attribute_group. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
   3614	    545	   1560	   5719	   1657	x86/kernel/cpu/microcode/core.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
   3742	    417	   1560	   5719	   1657	x86/kernel/cpu/microcode/core.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 arch/x86/kernel/cpu/microcode/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index 9cb98ee..86e8f0b 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -561,7 +561,7 @@ static ssize_t pf_show(struct device *dev,
 	NULL
 };
 
-static struct attribute_group mc_attr_group = {
+static const struct attribute_group mc_attr_group = {
 	.attrs			= mc_default_attrs,
 	.name			= "microcode",
 };
@@ -707,7 +707,7 @@ static int mc_cpu_down_prep(unsigned int cpu)
 	NULL
 };
 
-static struct attribute_group cpu_root_microcode_group = {
+static const struct attribute_group cpu_root_microcode_group = {
 	.name  = "microcode",
 	.attrs = cpu_root_microcode_attrs,
 };
-- 
1.9.1

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

* Re: [PATCH 7/7] x86: microcode: constify attribute_group structures.
  2017-07-20  7:21 ` [PATCH 7/7] x86: microcode: " Arvind Yadav
@ 2017-07-20  8:12   ` Borislav Petkov
  2017-07-20  8:18     ` Arvind Yadav
  0 siblings, 1 reply; 14+ messages in thread
From: Borislav Petkov @ 2017-07-20  8:12 UTC (permalink / raw)
  To: Arvind Yadav; +Cc: tglx, mingo, hpa, x86, tony.luck, linux-kernel

On Thu, Jul 20, 2017 at 12:51:45PM +0530, Arvind Yadav wrote:
> attribute_group are not supposed to change at runtime. All functions
> working with attribute_group provided by <linux/sysfs.h> work with
> const attribute_group. So mark the non-const structs as const.
> 
> File size before:
>    text	   data	    bss	    dec	    hex	filename
>    3614	    545	   1560	   5719	   1657	x86/kernel/cpu/microcode/core.o
> 
> File size After adding 'const':
>    text	   data	    bss	    dec	    hex	filename
>    3742	    417	   1560	   5719	   1657	x86/kernel/cpu/microcode/core.o

Again, what are those before/after sizes supposed to show?

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--

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

* Re: [PATCH 7/7] x86: microcode: constify attribute_group structures.
  2017-07-20  8:12   ` Borislav Petkov
@ 2017-07-20  8:18     ` Arvind Yadav
  2017-07-20  8:28       ` Borislav Petkov
  0 siblings, 1 reply; 14+ messages in thread
From: Arvind Yadav @ 2017-07-20  8:18 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: tglx, mingo, hpa, x86, tony.luck, linux-kernel

Hi,


On Thursday 20 July 2017 01:42 PM, Borislav Petkov wrote:
> On Thu, Jul 20, 2017 at 12:51:45PM +0530, Arvind Yadav wrote:
>> attribute_group are not supposed to change at runtime. All functions
>> working with attribute_group provided by <linux/sysfs.h> work with
>> const attribute_group. So mark the non-const structs as const.
>>
>> File size before:
>>     text	   data	    bss	    dec	    hex	filename
>>     3614	    545	   1560	   5719	   1657	x86/kernel/cpu/microcode/core.o
>>
>> File size After adding 'const':
>>     text	   data	    bss	    dec	    hex	filename
>>     3742	    417	   1560	   5719	   1657	x86/kernel/cpu/microcode/core.o
> Again, what are those before/after sizes supposed to show?
It's just show, how much bytes move from data segment to text segment.
~arvind

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

* Re: [PATCH 7/7] x86: microcode: constify attribute_group structures.
  2017-07-20  8:18     ` Arvind Yadav
@ 2017-07-20  8:28       ` Borislav Petkov
  2017-07-20  9:01         ` Arvind Yadav
  0 siblings, 1 reply; 14+ messages in thread
From: Borislav Petkov @ 2017-07-20  8:28 UTC (permalink / raw)
  To: Arvind Yadav; +Cc: tglx, mingo, hpa, x86, tony.luck, linux-kernel

On Thu, Jul 20, 2017 at 01:48:17PM +0530, Arvind Yadav wrote:
> It's just show, how much bytes move from data segment to text segment.
> ~arvind

     3614	    545	   1560	   5719	   1657	x86/kernel/cpu/microcode/core.o

3614 + 545 = 4159

     3742	    417	   1560	   5719	   1657	x86/kernel/cpu/microcode/core.o

3742 + 417 = 4159

3742 - 3614 = 128

So 128 bytes moved to text.

I fail to see how this is relevant. Your commit message contains not
really relevant info for such a simple change. Rather, it should just be
a one-liner:

"Constify attribute_group structs because they don't change at runtime."

That's it.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--

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

* Re: [PATCH 7/7] x86: microcode: constify attribute_group structures.
  2017-07-20  8:28       ` Borislav Petkov
@ 2017-07-20  9:01         ` Arvind Yadav
  2017-07-20 10:31           ` Borislav Petkov
  0 siblings, 1 reply; 14+ messages in thread
From: Arvind Yadav @ 2017-07-20  9:01 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: tglx, mingo, hpa, x86, tony.luck, linux-kernel

Hi,


On Thursday 20 July 2017 01:58 PM, Borislav Petkov wrote:
> On Thu, Jul 20, 2017 at 01:48:17PM +0530, Arvind Yadav wrote:
>> It's just show, how much bytes move from data segment to text segment.
>> ~arvind
>       3614	    545	   1560	   5719	   1657	x86/kernel/cpu/microcode/core.o
>
> 3614 + 545 = 4159
>
>       3742	    417	   1560	   5719	   1657	x86/kernel/cpu/microcode/core.o
>
> 3742 + 417 = 4159
>
> 3742 - 3614 = 128
>
> So 128 bytes moved to text.
Yes,
>
> I fail to see how this is relevant. Your commit message contains not
> really relevant info for such a simple change. Rather, it should just be
> a one-liner:
I have mentioned all this in commit message. I have added below
message in patch. Please check my patch.

"attribute_group are not supposed to change at runtime. All functions
working with attribute_group provided by <linux/sysfs.h> work with
const attribute_group. So mark the non-const structs as const."

> "Constify attribute_group structs because they don't change at runtime."
I can add this as subject. But we should avoid lengthy subject.
Even checkpatch.pl will through warning.
>
> That's it.
>
~arvind

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

* Re: [PATCH 7/7] x86: microcode: constify attribute_group structures.
  2017-07-20  9:01         ` Arvind Yadav
@ 2017-07-20 10:31           ` Borislav Petkov
  2017-07-20 11:01             ` Arvind Yadav
  0 siblings, 1 reply; 14+ messages in thread
From: Borislav Petkov @ 2017-07-20 10:31 UTC (permalink / raw)
  To: Arvind Yadav; +Cc: tglx, mingo, hpa, x86, tony.luck, linux-kernel

On Thu, Jul 20, 2017 at 02:31:09PM +0530, Arvind Yadav wrote:
> > "Constify attribute_group structs because they don't change at runtime."
> I can add this as subject. But we should avoid lengthy subject.

Are you actually reading what I'm writing to you? I said this should be
the commit message, not the subject.

What I'm saying is, shorten your commit message - no need for the
irrelevant before/after sizes. I'm not the first reviewer to ask WTF do
those things even mean.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--

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

* Re: [PATCH 7/7] x86: microcode: constify attribute_group structures.
  2017-07-20 10:31           ` Borislav Petkov
@ 2017-07-20 11:01             ` Arvind Yadav
  0 siblings, 0 replies; 14+ messages in thread
From: Arvind Yadav @ 2017-07-20 11:01 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: tglx, mingo, hpa, x86, tony.luck, linux-kernel

Hi,


On Thursday 20 July 2017 04:01 PM, Borislav Petkov wrote:
> On Thu, Jul 20, 2017 at 02:31:09PM +0530, Arvind Yadav wrote:
>>> "Constify attribute_group structs because they don't change at runtime."
>> I can add this as subject. But we should avoid lengthy subject.
> Are you actually reading what I'm writing to you? I said this should be
> the commit message, not the subject.
>
> What I'm saying is, shorten your commit message - no need for the
> irrelevant before/after sizes. I'm not the first reviewer to ask WTF do
> those things even mean.
>
Thanks :) for your suggestion. I will remove before/after size comparison.
and send you back for review.

~arvind

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

end of thread, other threads:[~2017-07-20 11:02 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-20  7:21 [PATCH 0/7] constify x86 attribute_group structures Arvind Yadav
2017-07-20  7:21 ` [PATCH 1/7] perf: x86: intel: uncore: constify " Arvind Yadav
2017-07-20  7:21 ` [PATCH 2/7] perf: x86: intel: uncore_nhmex: " Arvind Yadav
2017-07-20  7:21 ` [PATCH 3/7] perf: x86: intel: uncore_snb: " Arvind Yadav
2017-07-20  7:21 ` [PATCH 4/7] perf: x86: intel: uncore_snbep: " Arvind Yadav
2017-07-20  7:21 ` [PATCH 5/7] x86: ksysfs: " Arvind Yadav
2017-07-20  7:21 ` [PATCH 6/7] x86: therm_throt: " Arvind Yadav
2017-07-20  7:21 ` [PATCH 7/7] x86: microcode: " Arvind Yadav
2017-07-20  8:12   ` Borislav Petkov
2017-07-20  8:18     ` Arvind Yadav
2017-07-20  8:28       ` Borislav Petkov
2017-07-20  9:01         ` Arvind Yadav
2017-07-20 10:31           ` Borislav Petkov
2017-07-20 11:01             ` Arvind Yadav

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.