Re: [ibm-acpi-devel] [PATCH 2/3] thinkpad_acpi: Don't repeat ourselves in hotkey_init_tablet_mode()

2016-11-11 Thread kbuild test robot
Hi Lyude,

[auto build test WARNING on platform-drivers-x86/for-next]
[also build test WARNING on v4.9-rc3 next-20161028]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/Lyude/Add-support-for-X1-Yoga-2016-Tablet-Mode-refactors/20161101-070155
base:   git://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git 
for-next
config: i386-randconfig-c0-11010241 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/platform/x86/thinkpad_acpi.c: In function 'hotkey_init_tablet_mode':
>> drivers/platform/x86/thinkpad_acpi.c:3139:31: warning: passing argument 1 of 
>> 'hotkey_get_tablet_mode' from incompatible pointer type
 res = hotkey_get_tablet_mode(_tablet_mode);
  ^
   drivers/platform/x86/thinkpad_acpi.c:2085:12: note: expected 'int *' but 
argument is of type 'bool *'
static int hotkey_get_tablet_mode(int *status)
   ^

vim +/hotkey_get_tablet_mode +3139 drivers/platform/x86/thinkpad_acpi.c

  3123  static int
  3124  hotkey_init_tablet_mode(void)
  3125  {
  3126  int res;
  3127  char *type;
  3128  bool in_tablet_mode;
  3129  
  3130  /* For X41t, X60t, X61t Tablets... */
  3131  if (acpi_evalf(hkey_handle, , "MHKG", "qd")) {
  3132  tp_features.hotkey_tablet = TP_HOTKEY_TABLET_USES_MHKG;
  3133  type = "MHKG";
  3134  }
  3135  
  3136  if (!tp_features.hotkey_tablet)
  3137  return 0;
  3138  
> 3139  res = hotkey_get_tablet_mode(_tablet_mode);
  3140  if (res)
  3141  return res;
  3142  
  3143  pr_info("Tablet mode switch found (type: %s), currently in %s 
mode\n",
  3144  type, in_tablet_mode ? "tablet" : "laptop");
  3145  
  3146  res = add_to_attr_set(hotkey_dev_attributes,
  3147_attr_hotkey_tablet_mode.attr);

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
--
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi___
ibm-acpi-devel mailing list
ibm-acpi-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel


Re: [ibm-acpi-devel] [PATCH 2/3] thinkpad_acpi: Don't repeat ourselves in hotkey_init_tablet_mode()

2016-11-11 Thread kbuild test robot
Hi Lyude,

[auto build test ERROR on platform-drivers-x86/for-next]
[also build test ERROR on v4.9-rc3 next-20161028]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/Lyude/Add-support-for-X1-Yoga-2016-Tablet-Mode-refactors/20161101-070155
base:   git://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git 
for-next
config: x86_64-randconfig-x014-201644 (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 errors (new ones prefixed by >>):

   drivers/platform/x86/thinkpad_acpi.c: In function 'hotkey_init_tablet_mode':
>> drivers/platform/x86/thinkpad_acpi.c:3139:31: error: passing argument 1 of 
>> 'hotkey_get_tablet_mode' from incompatible pointer type 
>> [-Werror=incompatible-pointer-types]
 res = hotkey_get_tablet_mode(_tablet_mode);
  ^
   drivers/platform/x86/thinkpad_acpi.c:2085:12: note: expected 'int *' but 
argument is of type 'bool * {aka _Bool *}'
static int hotkey_get_tablet_mode(int *status)
   ^~
   cc1: some warnings being treated as errors

vim +/hotkey_get_tablet_mode +3139 drivers/platform/x86/thinkpad_acpi.c

  3133  type = "MHKG";
  3134  }
  3135  
  3136  if (!tp_features.hotkey_tablet)
  3137  return 0;
  3138  
> 3139  res = hotkey_get_tablet_mode(_tablet_mode);
  3140  if (res)
  3141  return res;
  3142  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
--
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi___
ibm-acpi-devel mailing list
ibm-acpi-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel


Re: [ibm-acpi-devel] [PATCH 2/3] thinkpad_acpi: Don't repeat ourselves in hotkey_init_tablet_mode()

2016-11-08 Thread Henrique de Moraes Holschuh
On Mon, 07 Nov 2016, Lyude wrote:
> There's no need to have multiple copies of the logic we use for checking
> whether or not we're in tablet mode, so just use
> hotkey_get_tablet_mode() when checking the initial state in
> hotkey_init_tablet_mode().

...

> @@ -3130,13 +3130,16 @@ hotkey_init_tablet_mode(void)
>   /* For X41t, X60t, X61t Tablets... */
>   if (acpi_evalf(hkey_handle, , "MHKG", "qd")) {
>   tp_features.hotkey_tablet = TP_HOTKEY_TABLET_USES_MHKG;
> - in_tablet_mode = !!(res & TP_HOTKEY_TABLET_MASK);
>   type = "MHKG";
>   }
>  
>   if (!tp_features.hotkey_tablet)
>   return 0;
>  
> + res = hotkey_get_tablet_mode(_tablet_mode);
> + if (res)
> + return res;
> +

Won't this way of doing things cause the ACPI methods to be called
twice in a row?

The hotkey_init_tablet_mode() code does mode detection, and thus
hotkey_get_tablet_mode() must be kept in sync with it *anyway* (and not
the opposite), so it doesn't look like a very relevant maintenance
burden...

-- 
  Henrique Holschuh

--
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
___
ibm-acpi-devel mailing list
ibm-acpi-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel


[ibm-acpi-devel] [PATCH 2/3] thinkpad_acpi: Don't repeat ourselves in hotkey_init_tablet_mode()

2016-11-07 Thread Lyude
There's no need to have multiple copies of the logic we use for checking
whether or not we're in tablet mode, so just use
hotkey_get_tablet_mode() when checking the initial state in
hotkey_init_tablet_mode().

Cc: Daniel Martin 
Signed-off-by: Lyude 
---
 drivers/platform/x86/thinkpad_acpi.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/thinkpad_acpi.c 
b/drivers/platform/x86/thinkpad_acpi.c
index dfa1af8..ad93c41 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -3130,13 +3130,16 @@ hotkey_init_tablet_mode(void)
/* For X41t, X60t, X61t Tablets... */
if (acpi_evalf(hkey_handle, , "MHKG", "qd")) {
tp_features.hotkey_tablet = TP_HOTKEY_TABLET_USES_MHKG;
-   in_tablet_mode = !!(res & TP_HOTKEY_TABLET_MASK);
type = "MHKG";
}
 
if (!tp_features.hotkey_tablet)
return 0;
 
+   res = hotkey_get_tablet_mode(_tablet_mode);
+   if (res)
+   return res;
+
pr_info("Tablet mode switch found (type: %s), currently in %s mode\n",
type, in_tablet_mode ? "tablet" : "laptop");
 
-- 
2.7.4


--
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
___
ibm-acpi-devel mailing list
ibm-acpi-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel


[ibm-acpi-devel] [PATCH 2/3] thinkpad_acpi: Don't repeat ourselves in hotkey_init_tablet_mode()

2016-10-31 Thread Lyude
There's no need to have multiple copies of the logic we use for checking
whether or not we're in tablet mode, so just use
hotkey_get_tablet_mode() when checking the initial state in
hotkey_init_tablet_mode().

Cc: Daniel Martin 
Signed-off-by: Lyude 
---
 drivers/platform/x86/thinkpad_acpi.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/thinkpad_acpi.c 
b/drivers/platform/x86/thinkpad_acpi.c
index 369b483..92e8986 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -3130,13 +3130,16 @@ hotkey_init_tablet_mode(void)
/* For X41t, X60t, X61t Tablets... */
if (acpi_evalf(hkey_handle, , "MHKG", "qd")) {
tp_features.hotkey_tablet = TP_HOTKEY_TABLET_USES_MHKG;
-   in_tablet_mode = !!(res & TP_HOTKEY_TABLET_MASK);
type = "MHKG";
}
 
if (!tp_features.hotkey_tablet)
return 0;
 
+   res = hotkey_get_tablet_mode(_tablet_mode);
+   if (res)
+   return res;
+
pr_info("Tablet mode switch found (type: %s), currently in %s mode\n",
type, in_tablet_mode ? "tablet" : "laptop");
 
-- 
2.7.4


--
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
___
ibm-acpi-devel mailing list
ibm-acpi-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel