Advertisement
Guest User

four patches

a guest
Dec 2nd, 2017
419
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.61 KB | None | 0 0
  1. ____________________________________________________________________________
  2.  
  3. To deal with checkpatch warning:
  4. WARNING: else is not generally useful after a break or return
  5.  
  6. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
  7. ---
  8. drivers/platform/x86/ideapad-laptop.c | 12 ++++++------
  9. 1 file changed, 6 insertions(+), 6 deletions(-)
  10.  
  11. diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
  12. index 53ab4e0f8962..9f2a4bc58df0 100644
  13. --- a/drivers/platform/x86/ideapad-laptop.c
  14. +++ b/drivers/platform/x86/ideapad-laptop.c
  15. @@ -124,10 +124,10 @@ static int read_method_int(acpi_handle handle, const char *method, int *val)
  16. if (ACPI_FAILURE(status)) {
  17. *val = -1;
  18. return -1;
  19. - } else {
  20. - *val = result;
  21. - return 0;
  22. }
  23. + *val = result;
  24. + return 0;
  25. +
  26. }
  27.  
  28. static int method_gbmd(acpi_handle handle, unsigned long *ret)
  29. @@ -164,10 +164,10 @@ static int method_vpcr(acpi_handle handle, int cmd, int *ret)
  30. if (ACPI_FAILURE(status)) {
  31. *ret = -1;
  32. return -1;
  33. - } else {
  34. - *ret = result;
  35. - return 0;
  36. }
  37. + *ret = result;
  38. + return 0;
  39. +
  40. }
  41.  
  42. static int method_vpcw(acpi_handle handle, int cmd, int data)
  43.  
  44. __________________________________________________________________________________________________
  45.  
  46. To deal with checkpatch warning:
  47. WARNING: Prefer using '"%s...", __func__' to using 'write_ec_cmd',
  48. this function's name, in a string
  49.  
  50. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
  51. ---
  52. drivers/platform/x86/ideapad-laptop.c | 2 +-
  53. 1 file changed, 1 insertion(+), 1 deletion(-)
  54.  
  55. diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
  56. index 9f2a4bc58df0..37a88938bbaa 100644
  57. --- a/drivers/platform/x86/ideapad-laptop.c
  58. +++ b/drivers/platform/x86/ideapad-laptop.c
  59. @@ -231,7 +231,7 @@ static int write_ec_cmd(acpi_handle handle, int cmd, unsigned long data)
  60. if (val == 0)
  61. return 0;
  62. }
  63. - pr_err("timeout in write_ec_cmd\n");
  64. + pr_err("timeout in %s\n", __func__);
  65. return -1;
  66. }
  67. __________________________________________________________________________________________________
  68.  
  69. To deal with checkpatch warnings:
  70. WARNING: Prefer kstrto<type> to single variable sscanf
  71.  
  72. WARNING: Missing a blank line after declarations
  73.  
  74. WARNING: Block comments use a trailing */ on a separate line
  75.  
  76. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
  77. ---
  78. drivers/platform/x86/ideapad-laptop.c | 20 ++++++++++++++------
  79. 1 file changed, 14 insertions(+), 6 deletions(-)
  80.  
  81. diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
  82. index 1072b24370ac..924b07f7db06 100644
  83. --- a/drivers/platform/x86/ideapad-laptop.c
  84. +++ b/drivers/platform/x86/ideapad-laptop.c
  85. @@ -406,12 +406,14 @@ static ssize_t store_ideapad_cam(struct device *dev,
  86. struct device_attribute *attr,
  87. const char *buf, size_t count)
  88. {
  89. - int ret, state;
  90. + int ret, state, rc;
  91. struct ideapad_private *priv = dev_get_drvdata(dev);
  92.  
  93. + rc = kstrtoint(buf, 0, &state);
  94. +
  95. if (!count)
  96. return 0;
  97. - if (sscanf(buf, "%i", &state) != 1)
  98. + if (rc != 0)
  99. return -EINVAL;
  100. ret = write_ec_cmd(priv->adev->handle, VPCCMD_W_CAMERA, state);
  101. if (ret < 0)
  102. @@ -437,12 +439,14 @@ static ssize_t store_ideapad_fan(struct device *dev,
  103. struct device_attribute *attr,
  104. const char *buf, size_t count)
  105. {
  106. - int ret, state;
  107. + int ret, state, rc;
  108. struct ideapad_private *priv = dev_get_drvdata(dev);
  109.  
  110. + rc = kstrtoint(buf, 0, &state);
  111. +
  112. if (!count)
  113. return 0;
  114. - if (sscanf(buf, "%i", &state) != 1)
  115. + if (rc != 0)
  116. return -EINVAL;
  117. if (state < 0 || state > 4 || state == 3)
  118. return -EINVAL;
  119. @@ -541,6 +545,7 @@ static umode_t ideapad_is_visible(struct kobject *kobj,
  120. supported = test_bit(CFG_CAMERA_BIT, &(priv->cfg));
  121. else if (attr == &dev_attr_fan_mode.attr) {
  122. unsigned long value;
  123. +
  124. supported = !read_ec_data(priv->adev->handle, VPCCMD_R_FAN,
  125. &value);
  126. } else if (attr == &dev_attr_conservation_mode.attr) {
  127. @@ -880,11 +885,14 @@ static void ideapad_sync_touchpad_state(struct ideapad_private *priv)
  128.  
  129. /* Without reading from EC touchpad LED doesn't switch state */
  130. if (!read_ec_data(priv->adev->handle, VPCCMD_R_TOUCHPAD, &value)) {
  131. - /* Some IdeaPads don't really turn off touchpad - they only
  132. + /*
  133. + * Some IdeaPads don't really turn off touchpad - they only
  134. * switch the LED state. We (de)activate KBC AUX port to turn
  135. * touchpad off and on. We send KEY_TOUCHPAD_OFF and
  136. - * KEY_TOUCHPAD_ON to not to get out of sync with LED */
  137. + * KEY_TOUCHPAD_ON to not to get out of sync with LED
  138. + */
  139. unsigned char param;
  140. +
  141. i8042_command(&param, value ? I8042_CMD_AUX_ENABLE :
  142. I8042_CMD_AUX_DISABLE);
  143. ideapad_input_report(priv, value ? 67 : 66);
  144.  
  145. ________________________________________________________________________________________
  146.  
  147. Since Roger Jargoyhen <rjargoyhen@gmail.com> reported that this device doesn't have
  148. Hardware rfkill switch, this patch add it to no_hw_rfkill_list to prevent radio always
  149. be blocked
  150.  
  151. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
  152. ---
  153. drivers/platform/x86/ideapad-laptop.c | 7 +++++++
  154. 1 file changed, 7 insertions(+)
  155.  
  156. diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
  157. index 924b07f7db06..4d3c7a6990d4 100644
  158. --- a/drivers/platform/x86/ideapad-laptop.c
  159. +++ b/drivers/platform/x86/ideapad-laptop.c
  160. @@ -971,6 +971,13 @@ static void ideapad_wmi_notify(u32 value, void *context)
  161. * report all radios as hardware-blocked.
  162. */
  163. static const struct dmi_system_id no_hw_rfkill_list[] = {
  164. + {
  165. + .ident = "Lenovo RESCUER R720-15IKBN",
  166. + .matches = {
  167. + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  168. + DMI_MATCH(DMI_BOARD_NAME, "80WW"),
  169. + },
  170. + },
  171. {
  172. .ident = "Lenovo G40-30",
  173. .matches = {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement