[PATCH] hwmon: adt7475: constify attribute_group structures.
attribute_groups are not supposed to change at runtime. All functions working with attribute_groups provided by work with const attribute_group. So mark the non-const structs as const. File size before: textdata bss dec hex filename 100557032 0 1708742bf drivers/hwmon/adt7475.o File size After adding 'const': textdata bss dec hex filename 105676520 0 1708742bf drivers/hwmon/adt7475.o Signed-off-by: Arvind Yadav --- drivers/hwmon/adt7475.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c index c803e3c..973f17a 100644 --- a/drivers/hwmon/adt7475.c +++ b/drivers/hwmon/adt7475.c @@ -1205,14 +1205,14 @@ static SENSOR_DEVICE_ATTR_2(pwm3_auto_point2_pwm, S_IRUGO | S_IWUSR, show_pwm, NULL }; -static struct attribute_group adt7475_attr_group = { .attrs = adt7475_attrs }; -static struct attribute_group fan4_attr_group = { .attrs = fan4_attrs }; -static struct attribute_group pwm2_attr_group = { .attrs = pwm2_attrs }; -static struct attribute_group in0_attr_group = { .attrs = in0_attrs }; -static struct attribute_group in3_attr_group = { .attrs = in3_attrs }; -static struct attribute_group in4_attr_group = { .attrs = in4_attrs }; -static struct attribute_group in5_attr_group = { .attrs = in5_attrs }; -static struct attribute_group vid_attr_group = { .attrs = vid_attrs }; +static const struct attribute_group adt7475_attr_group = { .attrs = adt7475_attrs }; +static const struct attribute_group fan4_attr_group = { .attrs = fan4_attrs }; +static const struct attribute_group pwm2_attr_group = { .attrs = pwm2_attrs }; +static const struct attribute_group in0_attr_group = { .attrs = in0_attrs }; +static const struct attribute_group in3_attr_group = { .attrs = in3_attrs }; +static const struct attribute_group in4_attr_group = { .attrs = in4_attrs }; +static const struct attribute_group in5_attr_group = { .attrs = in5_attrs }; +static const struct attribute_group vid_attr_group = { .attrs = vid_attrs }; static int adt7475_detect(struct i2c_client *client, struct i2c_board_info *info) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] hwmon: adc128d818: constify attribute_group structures.
attribute_groups are not supposed to change at runtime. All functions working with attribute_groups provided by work with const attribute_group. So mark the non-const structs as const. File size before: textdata bss dec hex filename 23042936 052401478 drivers/hwmon/adc128d818.o File size After adding 'const': textdata bss dec hex filename 23442872 052161460 drivers/hwmon/adc128d818.o Signed-off-by: Arvind Yadav --- drivers/hwmon/adc128d818.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/adc128d818.c b/drivers/hwmon/adc128d818.c index a557b46..bd2ca31 100644 --- a/drivers/hwmon/adc128d818.c +++ b/drivers/hwmon/adc128d818.c @@ -384,7 +384,7 @@ static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO, NULL }; -static struct attribute_group adc128_group = { +static const struct attribute_group adc128_group = { .attrs = adc128_attrs, .is_visible = adc128_is_visible, }; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2] hwmon: nct7802: constify attribute_group structures.
attribute_groups are not supposed to change at runtime. All functions working with attribute_groups provided by work with const attribute_group. So mark the non-const structs as const. File size before: textdata bss dec hex filename 61619400 0 155613cc9 drivers/hwmon/nct7802.o File size After adding 'const': textdata bss dec hex filename 64659080 0 155453cb9 drivers/hwmon/nct7802.o Signed-off-by: Arvind Yadav --- Changes in v1: Subject was not correct. Now comparing size of nct7802.c drivers/hwmon/nct7802.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/nct7802.c b/drivers/hwmon/nct7802.c index 12b94b0..2876c18 100644 --- a/drivers/hwmon/nct7802.c +++ b/drivers/hwmon/nct7802.c @@ -704,7 +704,7 @@ static umode_t nct7802_temp_is_visible(struct kobject *kobj, return attr->mode; } -static struct attribute_group nct7802_temp_group = { +static const struct attribute_group nct7802_temp_group = { .attrs = nct7802_temp_attrs, .is_visible = nct7802_temp_is_visible, }; @@ -802,7 +802,7 @@ static umode_t nct7802_in_is_visible(struct kobject *kobj, return attr->mode; } -static struct attribute_group nct7802_in_group = { +static const struct attribute_group nct7802_in_group = { .attrs = nct7802_in_attrs, .is_visible = nct7802_in_is_visible, }; @@ -880,7 +880,7 @@ static umode_t nct7802_fan_is_visible(struct kobject *kobj, return attr->mode; } -static struct attribute_group nct7802_fan_group = { +static const struct attribute_group nct7802_fan_group = { .attrs = nct7802_fan_attrs, .is_visible = nct7802_fan_is_visible, }; @@ -898,7 +898,7 @@ static umode_t nct7802_fan_is_visible(struct kobject *kobj, NULL }; -static struct attribute_group nct7802_pwm_group = { +static const struct attribute_group nct7802_pwm_group = { .attrs = nct7802_pwm_attrs, }; @@ -1011,7 +1011,7 @@ static SENSOR_DEVICE_ATTR(pwm3_auto_point4_pwm, S_IRUGO | S_IWUSR, NULL }; -static struct attribute_group nct7802_auto_point_group = { +static const struct attribute_group nct7802_auto_point_group = { .attrs = nct7802_auto_point_attrs, }; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] hwmon: nct7802: constify attribute_group structures.
attribute_groups are not supposed to change at runtime. All functions working with attribute_groups provided by work with const attribute_group. So mark the non-const structs as const. File size before: textdata bss dec hex filename 6655 304 069591b2f drivers/hwmon/hwmon.o File size After adding 'const': textdata bss dec hex filename 6703 240 069431b1f drivers/hwmon/hwmon.o Signed-off-by: Arvind Yadav --- drivers/hwmon/nct7802.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/nct7802.c b/drivers/hwmon/nct7802.c index 12b94b0..2876c18 100644 --- a/drivers/hwmon/nct7802.c +++ b/drivers/hwmon/nct7802.c @@ -704,7 +704,7 @@ static umode_t nct7802_temp_is_visible(struct kobject *kobj, return attr->mode; } -static struct attribute_group nct7802_temp_group = { +static const struct attribute_group nct7802_temp_group = { .attrs = nct7802_temp_attrs, .is_visible = nct7802_temp_is_visible, }; @@ -802,7 +802,7 @@ static umode_t nct7802_in_is_visible(struct kobject *kobj, return attr->mode; } -static struct attribute_group nct7802_in_group = { +static const struct attribute_group nct7802_in_group = { .attrs = nct7802_in_attrs, .is_visible = nct7802_in_is_visible, }; @@ -880,7 +880,7 @@ static umode_t nct7802_fan_is_visible(struct kobject *kobj, return attr->mode; } -static struct attribute_group nct7802_fan_group = { +static const struct attribute_group nct7802_fan_group = { .attrs = nct7802_fan_attrs, .is_visible = nct7802_fan_is_visible, }; @@ -898,7 +898,7 @@ static umode_t nct7802_fan_is_visible(struct kobject *kobj, NULL }; -static struct attribute_group nct7802_pwm_group = { +static const struct attribute_group nct7802_pwm_group = { .attrs = nct7802_pwm_attrs, }; @@ -1011,7 +1011,7 @@ static SENSOR_DEVICE_ATTR(pwm3_auto_point4_pwm, S_IRUGO | S_IWUSR, NULL }; -static struct attribute_group nct7802_auto_point_group = { +static const struct attribute_group nct7802_auto_point_group = { .attrs = nct7802_auto_point_attrs, }; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] hwmon: constify attribute_group structures.
attribute_groups are not supposed to change at runtime. All functions working with attribute_groups provided by work with const attribute_group. So mark the non-const structs as const. File size before: textdata bss dec hex filename 6655 304 069591b2f drivers/hwmon/hwmon.o File size After adding 'const': textdata bss dec hex filename 6703 240 069431b1f drivers/hwmon/hwmon.o Signed-off-by: Arvind Yadav --- drivers/hwmon/hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index dd6e17c..2ac578a 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c @@ -85,7 +85,7 @@ static umode_t hwmon_dev_name_is_visible(struct kobject *kobj, return attr->mode; } -static struct attribute_group hwmon_dev_attr_group = { +static const struct attribute_group hwmon_dev_attr_group = { .attrs = hwmon_dev_attrs, .is_visible = hwmon_dev_name_is_visible, }; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 3/3] hwmon: ltc2990: support all measurement modes
Hi Tom, [auto build test WARNING on hwmon/hwmon-next] [also build test WARNING on v4.12 next-20170704] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Tom-Levens/hwmon-ltc2990-refactor-value-conversion/20170705-050920 base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next config: x86_64-randconfig-x010-201727 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones prefixed by >>): drivers/hwmon/ltc2990.c: In function 'ltc2990_attrs_visible': >> drivers/hwmon/ltc2990.c:164:40: warning: suggest parentheses around >> arithmetic in operand of '|' [-Wparentheses] ltc2990_attrs_ena_0[data->mode[0]] & ~~~^ ltc2990_attrs_ena_1[data->mode[1]]; ~~ vim +164 drivers/hwmon/ltc2990.c 148 if (unlikely(ret < 0)) 149 return ret; 150 151 return snprintf(buf, PAGE_SIZE, "%d\n", value); 152 } 153 154 static umode_t ltc2990_attrs_visible(struct kobject *kobj, 155 struct attribute *a, int n) 156 { 157 struct device *dev = container_of(kobj, struct device, kobj); 158 struct ltc2990_data *data = dev_get_drvdata(dev); 159 struct device_attribute *da = 160 container_of(a, struct device_attribute, attr); 161 struct sensor_device_attribute *attr = to_sensor_dev_attr(da); 162 163 int attrs_mask = LTC2990_IN0 | LTC2990_TEMP1 | > 164 ltc2990_attrs_ena_0[data->mode[0]] & 165 ltc2990_attrs_ena_1[data->mode[1]]; 166 167 if (attr->index & attrs_mask) 168 return a->mode; 169 170 return 0; 171 } 172 --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip