Update hp_wmi_group to simplify feature addition
PATCH 1/1 Update hp_wmi_group to simplify feature addition
The purpose for this patch is introduce two minor changes. The first set of changes are style related reported by checkpatch.pl script. Lastly, changes were introduced in preparation to submission of four new features. The addition of hp_wmi_groups will simplify the integration of the upcoming driver security features with sysfs.
All changes were validated on a HP ZBook Workstation, HP EliteBook x360, and HP EliteBook 850 G8 notebooks.
---
Based on the latest platform-drivers-x86.git/for-next
--- drivers/platform/x86/hp-wmi.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/platform/x86/hp-wmi.c +17 -1
@@ -605,6 +605,7 @@ static int hp_wmi_rfkill2_refresh(void)for (i =0 ; i < rfkill2_count; i++) {int num = rfkill2[i].num;struct bios_rfkill2_device_state *devstate; + devstate = &state.device[num]; if (num >= state.count ||
@@ -625,6 +626,7 @@ static ssize_t display_show(struct device *dev, struct device_attribute *attr, char *buf) {int value =hp_wmi_read_int (HPWMI_DISPLAY_QUERY ); +if (value <0 )return value;return sprintf (buf,"%d\n" , value);
@@ -634,6 +636,7 @@ static ssize_t hddtemp_show(struct device *dev, struct device_attribute *attr, char *buf) {int value =hp_wmi_read_int (HPWMI_HDDTEMP_QUERY ); +if (value <0 )return value;return sprintf (buf,"%d\n" , value);
@@ -643,6 +646,7 @@ static ssize_t als_show(struct device *dev, struct device_attribute *attr, char *buf) {int value =hp_wmi_read_int (HPWMI_ALS_QUERY ); +if (value <0 )return value;return sprintf (buf,"%d\n" , value);
@@ -652,6 +656,7 @@ static ssize_t dock_show(struct device *dev, struct device_attribute *attr, char *buf) {int value =hp_wmi_get_dock_state (); +if (value <0 )return value;return sprintf (buf,"%d\n" , value);
@@ -661,6 +666,7 @@ static ssize_t tablet_show(struct device *dev, struct device_attribute *attr, char *buf) {int value =hp_wmi_get_tablet_mode (); +if (value <0 )return value;return sprintf (buf,"%d\n" , value);
@@ -671,6 +677,7 @@ static ssize_t postcode_show(struct device *dev, struct device_attribute *attr, {/* Get the POST error code of previous boot failure. */ int value =hp_wmi_read_int (HPWMI_POSTCODEERROR_QUERY ); +if (value <0 )return value;return sprintf (buf,"0x%x\n" , value);
@@ -733,7 +740,15 @@ static struct attribute *hp_wmi_attrs[] = { &dev_attr_postcode.attr, NULL, }; -ATTRIBUTE_GROUPS (hp_wmi); + +static const struct attribute_group hp_wmi_group = { + .attrs = hp_wmi_attrs, +}; + +static const struct attribute_group *hp_wmi_groups[] = { + &hp_wmi_group, +NULL , +};static void hp_wmi_notify (u32 value,void *context) {
@@ -1013,6 +1028,7 @@ static int __init hp_wmi_rfkill2_setup(struct platform_device *device)struct rfkill *rfkill;enum rfkill_type type;char *name; +switch (state.device[i].radio_type) {case HPWMI_WIFI : type =RFKILL_TYPE_WLAN ;
Signature · 1 line
2.25.1
Hi Jorge,
Quoted 22 lines · Jorge Lopez
The purpose for this patch is introduce two minor changes. The first set of changes are style related reported by checkpatch.pl script. Lastly, changes were introduced in preparation to submission of four new features. The addition of
hp_wmi_groupswill simplify the integration of the upcoming driver security features with sysfs.All changes were validated on a HP ZBook Workstation, HP EliteBook x360, and HP EliteBook 850 G8 notebooks.
Signed-off-by Jorge Lopez <[email protected]>---
Based on the latest platform-drivers-x86.git/for-next--- drivers/platform/x86/hp-wmi.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)drivers/platform/x86/hp-wmi.c +0
-0
drivers/platform/x86/hp-wmi.c static int hp_wmi_rfkill2_refresh(void) · line 608
Quoted 4 lines
drivers/platform/x86/hp-wmi.c +1
-0@@ -605,6 +605,7 @@ static int hp_wmi_rfkill2_refresh(void)for (i =0 ; i < rfkill2_count; i++) {int num = rfkill2[i].num;struct bios_rfkill2_device_state *devstate; +
There is lots of unrelated whitespace addition, here.
drivers/platform/x86/hp-wmi.c static ssize_t display_show(struct device *dev, struct device_attribute *attr, · line 629
Quoted 8 lines
drivers/platform/x86/hp-wmi.c +1
-0devstate = &state.device[num]; if (num >= state.count ||@@ -625,6 +626,7 @@ static ssize_t display_show(struct device *dev, struct device_attribute *attr, char *buf) {int value =hp_wmi_read_int (HPWMI_DISPLAY_QUERY ); +
and here.
drivers/platform/x86/hp-wmi.c static ssize_t hddtemp_show(struct device *dev, struct device_attribute *attr, · line 639
Quoted 8 lines
drivers/platform/x86/hp-wmi.c +1
-0if (value <0 )return value;return sprintf (buf,"%d\n" , value);@@ -634,6 +636,7 @@ static ssize_t hddtemp_show(struct device *dev, struct device_attribute *attr, char *buf) {int value =hp_wmi_read_int (HPWMI_HDDTEMP_QUERY ); +
and here.
drivers/platform/x86/hp-wmi.c static ssize_t als_show(struct device *dev, struct device_attribute *attr, · line 649
Quoted 8 lines
drivers/platform/x86/hp-wmi.c +1
-0if (value <0 )return value;return sprintf (buf,"%d\n" , value);@@ -643,6 +646,7 @@ static ssize_t als_show(struct device *dev, struct device_attribute *attr, char *buf) {int value =hp_wmi_read_int (HPWMI_ALS_QUERY ); +
and here.
drivers/platform/x86/hp-wmi.c static ssize_t dock_show(struct device *dev, struct device_attribute *attr, · line 659
Quoted 8 lines
drivers/platform/x86/hp-wmi.c +1
-0if (value <0 )return value;return sprintf (buf,"%d\n" , value);@@ -652,6 +656,7 @@ static ssize_t dock_show(struct device *dev, struct device_attribute *attr, char *buf) {int value =hp_wmi_get_dock_state (); +
etc.
drivers/platform/x86/hp-wmi.c static ssize_t tablet_show(struct device *dev, struct device_attribute *attr, · line 669
Quoted 8 lines
drivers/platform/x86/hp-wmi.c +1
-0if (value <0 )return value;return sprintf (buf,"%d\n" , value);@@ -661,6 +666,7 @@ static ssize_t tablet_show(struct device *dev, struct device_attribute *attr, char *buf) {int value =hp_wmi_get_tablet_mode (); +
and even more.
drivers/platform/x86/hp-wmi.c static ssize_t postcode_show(struct device *dev, struct device_attribute *attr, · line 680
Quoted 8 lines
drivers/platform/x86/hp-wmi.c +1
-0if (value <0 )return value;return sprintf (buf,"%d\n" , value);@@ -671,6 +677,7 @@ static ssize_t postcode_show(struct device *dev, struct device_attribute *attr, {/* Get the POST error code of previous boot failure. */ int value =hp_wmi_read_int (HPWMI_POSTCODEERROR_QUERY ); +
and even more.
Quoted 21 lines
drivers/platform/x86/hp-wmi.c +9
-1if (value <0 )return value;return sprintf (buf,"0x%x\n" , value);@@ -733,7 +740,15 @@ static struct attribute *hp_wmi_attrs[] = { &dev_attr_postcode.attr, NULL, }; -ATTRIBUTE_GROUPS (hp_wmi); + +static const struct attribute_group hp_wmi_group = { + .attrs = hp_wmi_attrs, +}; + +static const struct attribute_group *hp_wmi_groups[] = { + &hp_wmi_group, +NULL , +};static void hp_wmi_notify (u32 value,void *context) {
drivers/platform/x86/hp-wmi.c static int __init hp_wmi_rfkill2_setup(struct platform_device *device) · line 1031
Quoted 4 lines
drivers/platform/x86/hp-wmi.c +1
-0@@ -1013,6 +1028,7 @@ static int __init hp_wmi_rfkill2_setup(struct platform_device *device)struct rfkill *rfkill;enum rfkill_type type;char *name; +
and even more.
drivers/platform/x86/hp-wmi.c static int __init hp_wmi_rfkill2_setup(struct platform_device *device) · line 1034
Quoted 3 lines
drivers/platform/x86/hp-wmi.c +0
-0switch (state.device[i].radio_type) {case HPWMI_WIFI : type =RFKILL_TYPE_WLAN ;
Note these white-space conditions are a correct cleanup from a code-style point of view, but please split this patch into 2 patches, 1 with the change from the commit message and a new patch with all the whitespace patches.
Regards,
Hans