diff mbox series

[v1] Update hp_wmi_group to simplify feature addition

Message ID 20220324153024.12662-1-jorge.lopez2@hp.com (mailing list archive)
State Changes Requested, archived
Headers show
Series [v1] Update hp_wmi_group to simplify feature addition | expand

Commit Message

Jorge Lopez March 24, 2022, 3:30 p.m. UTC
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.

Signed-off-by: Jorge Lopez <jorge.lopez2@hp.com>

---
Based on the latest platform-drivers-x86.git/for-next
---
 drivers/platform/x86/hp-wmi.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

Comments

Hans de Goede April 4, 2022, 1:36 p.m. UTC | #1
Hi Jorge,

On 3/24/22 16:30, Jorge Lopez wrote:
> 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.
> 
> Signed-off-by: Jorge Lopez <jorge.lopez2@hp.com>
> 
> ---
> Based on the latest platform-drivers-x86.git/for-next
> ---
>  drivers/platform/x86/hp-wmi.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
> index 0e9a25b56e0e..0c7d863b8aab 100644
> --- a/drivers/platform/x86/hp-wmi.c
> +++ b/drivers/platform/x86/hp-wmi.c
> @@ -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.

>  		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);
> +

and here.

>  	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);
> +

and here.

>  	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);
> +

and here.

>  	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();
> +

etc.

>  	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();
> +

and even more.

>  	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);
> +

and even more.

>  	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;
> +

and even more.

>  		switch (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
diff mbox series

Patch

diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 0e9a25b56e0e..0c7d863b8aab 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -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;