diff mbox series

[v1,1/6] Correct code style related issues in hp-wmi

Message ID 20220404203626.4311-2-jorge.lopez2@hp.com (mailing list archive)
State Accepted, archived
Headers show
Series HP WMI Security Features | expand

Commit Message

Jorge Lopez April 4, 2022, 8:36 p.m. UTC
Update hp-wmi driver to address all code style issues reported
by checkpatch.pl script.

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

v1-0001-Update-hp_wmi_group-to-simplify-feature-addition patch was
broken in two separate patches.  This patch is patch 1 of 2
---
 drivers/platform/x86/hp-wmi.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Hans de Goede April 11, 2022, 12:47 p.m. UTC | #1
Hi,

On 4/4/22 22:36, Jorge Lopez wrote:
> Update hp-wmi driver to address all code style issues reported
> by checkpatch.pl script.
> 
> 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>

Thank you for your patch, I've applied this patch to my review-hans 
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans

p.s.

Note I've decided to not merge the "Update hp_wmi_group to simplify
feature addition" patch for now, since this may turn out to not
be necessary when you change things to use the firmware-atrributes
class.



> ---
> Based on the latest platform-drivers-x86.git/for-next
> 
> v1-0001-Update-hp_wmi_group-to-simplify-feature-addition patch was
> broken in two separate patches.  This patch is patch 1 of 2
> ---
>  drivers/platform/x86/hp-wmi.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
> index 0e9a25b56e0e..667f94bba905 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);
> @@ -1013,6 +1020,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;
Jorge Lopez April 11, 2022, 2 p.m. UTC | #2
On Mon, Apr 11, 2022 at 7:47 AM Hans de Goede <hdegoede@redhat.com> wrote:
>
> Hi,
>
> On 4/4/22 22:36, Jorge Lopez wrote:
> > Update hp-wmi driver to address all code style issues reported
> > by checkpatch.pl script.
> >
> > 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>
>
> Thank you for your patch, I've applied this patch to my review-hans
> branch:
> https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
>
> Note it will show up in my review-hans branch once I've pushed my
> local branch there, which might take a while.
>
> Once I've run some tests on this branch the patches there will be
> added to the platform-drivers-x86/for-next branch and eventually
> will be included in the pdx86 pull-request to Linus for the next
> merge-window.
>
> Regards,
>
> Hans
>
> p.s.
>
> Note I've decided to not merge the "Update hp_wmi_group to simplify
> feature addition" patch for now, since this may turn out to not
> be necessary when you change things to use the firmware-atrributes
> class.
>

Thank you.   I will reach out if I have questions about some of the
fields and possible backwards compatibility issues.
>
>
> > ---
> > Based on the latest platform-drivers-x86.git/for-next
> >
> > v1-0001-Update-hp_wmi_group-to-simplify-feature-addition patch was
> > broken in two separate patches.  This patch is patch 1 of 2
> > ---
> >  drivers/platform/x86/hp-wmi.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> >
> > diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
> > index 0e9a25b56e0e..667f94bba905 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);
> > @@ -1013,6 +1020,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;
>
diff mbox series

Patch

diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 0e9a25b56e0e..667f94bba905 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);
@@ -1013,6 +1020,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;