From: Zhang Rui <rui.zhang@intel.com>
To: rjw@sisk.pl
Cc: linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org,
Zhang Rui <rui.zhang@intel.com>,
Matthew Garrett <matthew.garrett@nebula.com>,
Ike Panhc <ike.pan@canonical.com>,
platform-driver-x86@vger.kernel.org
Subject: [PATCH 4/6] ideapad_laptop: convert internal function calls to use ideapad_private as parameter
Date: Wed, 25 Sep 2013 20:39:48 +0800 [thread overview]
Message-ID: <1380112790-2321-5-git-send-email-rui.zhang@intel.com> (raw)
In-Reply-To: <1380112790-2321-1-git-send-email-rui.zhang@intel.com>
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: Zhang Rui <rui.zhang@intel.com>
CC: Matthew Garrett <matthew.garrett@nebula.com>
CC: Ike Panhc <ike.pan@canonical.com>
CC: platform-driver-x86@vger.kernel.org
---
drivers/platform/x86/ideapad-laptop.c | 38 ++++++++++++++++++---------------
1 file changed, 21 insertions(+), 17 deletions(-)
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index edd3656..70fb5ba 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -469,9 +469,8 @@ static void ideapad_sync_rfk_state(struct ideapad_private *priv)
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;
unsigned long sw_blocked;
@@ -483,8 +482,10 @@ static int ideapad_register_rfkill(struct acpi_device *adev, int dev)
return 0;
}
- priv->rfk[dev] = rfkill_alloc(ideapad_rfk_data[dev].name, &adev->dev,
- ideapad_rfk_data[dev].type, &ideapad_rfk_ops,
+ priv->rfk[dev] = rfkill_alloc(ideapad_rfk_data[dev].name,
+ &priv->adev->dev,
+ ideapad_rfk_data[dev].type,
+ &ideapad_rfk_ops,
(void *)(long)dev);
if (!priv->rfk[dev])
return -ENOMEM;
@@ -505,10 +506,8 @@ static int ideapad_register_rfkill(struct acpi_device *adev, int dev)
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])
return;
@@ -762,13 +761,12 @@ static const struct acpi_device_id 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;
/* 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
* switch the LED state. We (de)activate KBC AUX port to turn
* touchpad off and on. We send KEY_TOUCHPAD_OFF and
@@ -812,12 +810,12 @@ static int ideapad_acpi_add(struct acpi_device *adev)
for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++) {
if (test_bit(ideapad_rfk_data[i].cfgbit, &priv->cfg))
- ideapad_register_rfkill(adev, i);
+ ideapad_register_rfkill(priv, i);
else
priv->rfk[i] = NULL;
}
ideapad_sync_rfk_state(priv);
- ideapad_sync_touchpad_state(adev);
+ ideapad_sync_touchpad_state(priv);
if (!acpi_video_backlight_support()) {
ret = ideapad_backlight_init(priv);
@@ -829,7 +827,7 @@ static int ideapad_acpi_add(struct acpi_device *adev)
backlight_failed:
for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++)
- ideapad_unregister_rfkill(adev, i);
+ ideapad_unregister_rfkill(priv, i);
ideapad_input_exit(priv);
input_failed:
ideapad_debugfs_exit(priv);
@@ -847,7 +845,7 @@ static int ideapad_acpi_remove(struct acpi_device *adev)
ideapad_backlight_exit(priv);
for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++)
- ideapad_unregister_rfkill(adev, i);
+ ideapad_unregister_rfkill(priv, i);
ideapad_input_exit(priv);
ideapad_debugfs_exit(priv);
ideapad_platform_exit(priv);
@@ -882,7 +880,7 @@ static void ideapad_acpi_notify(struct acpi_device *adev, u32 event)
ideapad_input_report(priv, vpc_bit);
break;
case 5:
- ideapad_sync_touchpad_state(adev);
+ ideapad_sync_touchpad_state(priv);
break;
case 4:
ideapad_backlight_notify_brightness(priv);
@@ -906,8 +904,14 @@ static void ideapad_acpi_notify(struct acpi_device *adev, u32 event)
#ifdef CONFIG_PM_SLEEP
static int ideapad_acpi_resume(struct device *device)
{
- ideapad_sync_rfk_state(ideapad_priv);
- ideapad_sync_touchpad_state(to_acpi_device(device));
+ struct ideapad_private *priv;
+
+ if (!device)
+ return -EINVAL;
+ priv = dev_get_drvdata(device);
+
+ ideapad_sync_rfk_state(priv);
+ ideapad_sync_touchpad_state(priv);
return 0;
}
--
1.7.9.5
next prev parent reply other threads:[~2013-09-25 12:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-25 12:39 [PATCH 0/6] ACPI bus conversion Zhang Rui
2013-09-25 12:39 ` [PATCH 1/6] ACPI ac: convert ACPI ac driver to platform bus Zhang Rui
2013-09-25 12:39 ` [PATCH 2/6] ideapad_laptop: introduce #ifdef CONFIG_PM_SLEEP for PM specific code Zhang Rui
2013-09-25 12:39 ` [PATCH 3/6] ideapad_laptop: introduce struct acpi_device pointer to ideapad_private structure Zhang Rui
2013-09-25 12:39 ` Zhang Rui [this message]
2013-09-25 12:39 ` [PATCH 5/6] ideapad_laptop: remove ideapad_handle and ideapad_priv Zhang Rui
2013-09-25 12:39 ` [PATCH 6/6] ideapad_laptop: convert ideapad device/driver to platform bus Zhang Rui
2013-09-25 14:49 ` [PATCH 0/6] ACPI bus conversion Rafael J. Wysocki
2013-09-25 16:10 ` Matthew Garrett
2013-09-25 17:30 ` Rafael J. Wysocki
2013-09-25 22:47 ` Zhang, Rui
-- strict thread matches above, loose matches on Subject: below --
2013-09-23 7:50 Zhang Rui
2013-09-23 7:50 ` [PATCH 4/6] ideapad_laptop: convert internal function calls to use ideapad_private as parameter Zhang Rui
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1380112790-2321-5-git-send-email-rui.zhang@intel.com \
--to=rui.zhang@intel.com \
--cc=ike.pan@canonical.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=matthew.garrett@nebula.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rjw@sisk.pl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).