提交 75a11f11 编写于 作者: Z Zhang Rui 提交者: Rafael J. Wysocki

ideapad_laptop: convert internal function calls to use ideapad_private as parameter

As struct ideapad_private has all the information needed for any operations,
convert ideapad_register_rfkill()/ideapad_unregister_rfkill() and
ideapad_sync_touchpad_state() to use struct ideapad_private as the parameter,
to be consistent with the others.
Signed-off-by: NZhang Rui <rui.zhang@intel.com>
CC: Matthew Garrett <matthew.garrett@nebula.com>
CC: Ike Panhc <ike.pan@canonical.com>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 469f6434
...@@ -469,9 +469,8 @@ static void ideapad_sync_rfk_state(struct ideapad_private *priv) ...@@ -469,9 +469,8 @@ static void ideapad_sync_rfk_state(struct ideapad_private *priv)
rfkill_set_hw_state(priv->rfk[i], hw_blocked); rfkill_set_hw_state(priv->rfk[i], hw_blocked);
} }
static int ideapad_register_rfkill(struct acpi_device *adev, int dev) static int ideapad_register_rfkill(struct ideapad_private *priv, int dev)
{ {
struct ideapad_private *priv = dev_get_drvdata(&adev->dev);
int ret; int ret;
unsigned long sw_blocked; unsigned long sw_blocked;
...@@ -483,8 +482,10 @@ static int ideapad_register_rfkill(struct acpi_device *adev, int dev) ...@@ -483,8 +482,10 @@ static int ideapad_register_rfkill(struct acpi_device *adev, int dev)
return 0; return 0;
} }
priv->rfk[dev] = rfkill_alloc(ideapad_rfk_data[dev].name, &adev->dev, priv->rfk[dev] = rfkill_alloc(ideapad_rfk_data[dev].name,
ideapad_rfk_data[dev].type, &ideapad_rfk_ops, &priv->adev->dev,
ideapad_rfk_data[dev].type,
&ideapad_rfk_ops,
(void *)(long)dev); (void *)(long)dev);
if (!priv->rfk[dev]) if (!priv->rfk[dev])
return -ENOMEM; return -ENOMEM;
...@@ -505,10 +506,8 @@ static int ideapad_register_rfkill(struct acpi_device *adev, int dev) ...@@ -505,10 +506,8 @@ static int ideapad_register_rfkill(struct acpi_device *adev, int dev)
return 0; return 0;
} }
static void ideapad_unregister_rfkill(struct acpi_device *adev, int dev) static void ideapad_unregister_rfkill(struct ideapad_private *priv, int dev)
{ {
struct ideapad_private *priv = dev_get_drvdata(&adev->dev);
if (!priv->rfk[dev]) if (!priv->rfk[dev])
return; return;
...@@ -762,13 +761,12 @@ static const struct acpi_device_id ideapad_device_ids[] = { ...@@ -762,13 +761,12 @@ static const struct acpi_device_id ideapad_device_ids[] = {
}; };
MODULE_DEVICE_TABLE(acpi, ideapad_device_ids); MODULE_DEVICE_TABLE(acpi, ideapad_device_ids);
static void ideapad_sync_touchpad_state(struct acpi_device *adev) static void ideapad_sync_touchpad_state(struct ideapad_private *priv)
{ {
struct ideapad_private *priv = dev_get_drvdata(&adev->dev);
unsigned long value; unsigned long value;
/* Without reading from EC touchpad LED doesn't switch state */ /* Without reading from EC touchpad LED doesn't switch state */
if (!read_ec_data(adev->handle, VPCCMD_R_TOUCHPAD, &value)) { if (!read_ec_data(priv->adev->handle, VPCCMD_R_TOUCHPAD, &value)) {
/* Some IdeaPads don't really turn off touchpad - they only /* Some IdeaPads don't really turn off touchpad - they only
* switch the LED state. We (de)activate KBC AUX port to turn * switch the LED state. We (de)activate KBC AUX port to turn
* touchpad off and on. We send KEY_TOUCHPAD_OFF and * touchpad off and on. We send KEY_TOUCHPAD_OFF and
...@@ -812,12 +810,12 @@ static int ideapad_acpi_add(struct acpi_device *adev) ...@@ -812,12 +810,12 @@ static int ideapad_acpi_add(struct acpi_device *adev)
for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++) { for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++) {
if (test_bit(ideapad_rfk_data[i].cfgbit, &priv->cfg)) if (test_bit(ideapad_rfk_data[i].cfgbit, &priv->cfg))
ideapad_register_rfkill(adev, i); ideapad_register_rfkill(priv, i);
else else
priv->rfk[i] = NULL; priv->rfk[i] = NULL;
} }
ideapad_sync_rfk_state(priv); ideapad_sync_rfk_state(priv);
ideapad_sync_touchpad_state(adev); ideapad_sync_touchpad_state(priv);
if (!acpi_video_backlight_support()) { if (!acpi_video_backlight_support()) {
ret = ideapad_backlight_init(priv); ret = ideapad_backlight_init(priv);
...@@ -829,7 +827,7 @@ static int ideapad_acpi_add(struct acpi_device *adev) ...@@ -829,7 +827,7 @@ static int ideapad_acpi_add(struct acpi_device *adev)
backlight_failed: backlight_failed:
for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++) for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++)
ideapad_unregister_rfkill(adev, i); ideapad_unregister_rfkill(priv, i);
ideapad_input_exit(priv); ideapad_input_exit(priv);
input_failed: input_failed:
ideapad_debugfs_exit(priv); ideapad_debugfs_exit(priv);
...@@ -847,7 +845,7 @@ static int ideapad_acpi_remove(struct acpi_device *adev) ...@@ -847,7 +845,7 @@ static int ideapad_acpi_remove(struct acpi_device *adev)
ideapad_backlight_exit(priv); ideapad_backlight_exit(priv);
for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++) for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++)
ideapad_unregister_rfkill(adev, i); ideapad_unregister_rfkill(priv, i);
ideapad_input_exit(priv); ideapad_input_exit(priv);
ideapad_debugfs_exit(priv); ideapad_debugfs_exit(priv);
ideapad_platform_exit(priv); ideapad_platform_exit(priv);
...@@ -882,7 +880,7 @@ static void ideapad_acpi_notify(struct acpi_device *adev, u32 event) ...@@ -882,7 +880,7 @@ static void ideapad_acpi_notify(struct acpi_device *adev, u32 event)
ideapad_input_report(priv, vpc_bit); ideapad_input_report(priv, vpc_bit);
break; break;
case 5: case 5:
ideapad_sync_touchpad_state(adev); ideapad_sync_touchpad_state(priv);
break; break;
case 4: case 4:
ideapad_backlight_notify_brightness(priv); ideapad_backlight_notify_brightness(priv);
...@@ -906,8 +904,14 @@ static void ideapad_acpi_notify(struct acpi_device *adev, u32 event) ...@@ -906,8 +904,14 @@ static void ideapad_acpi_notify(struct acpi_device *adev, u32 event)
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int ideapad_acpi_resume(struct device *device) static int ideapad_acpi_resume(struct device *device)
{ {
ideapad_sync_rfk_state(ideapad_priv); struct ideapad_private *priv;
ideapad_sync_touchpad_state(to_acpi_device(device));
if (!device)
return -EINVAL;
priv = dev_get_drvdata(device);
ideapad_sync_rfk_state(priv);
ideapad_sync_touchpad_state(priv);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册