From patchwork Wed Sep 25 12:39:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Rui" X-Patchwork-Id: 2942081 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 506EB9F289 for ; Wed, 25 Sep 2013 12:40:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0786320579 for ; Wed, 25 Sep 2013 12:40:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CBEDA2057B for ; Wed, 25 Sep 2013 12:40:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755404Ab3IYMkI (ORCPT ); Wed, 25 Sep 2013 08:40:08 -0400 Received: from mga03.intel.com ([143.182.124.21]:42714 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755111Ab3IYMkH (ORCPT ); Wed, 25 Sep 2013 08:40:07 -0400 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 25 Sep 2013 05:40:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.90,978,1371106800"; d="scan'208";a="365355074" Received: from unknown (HELO rzhang1-mobl4.ccr.corp.intel.com) ([10.255.20.219]) by azsmga001.ch.intel.com with ESMTP; 25 Sep 2013 05:40:03 -0700 From: Zhang Rui To: rjw@sisk.pl Cc: linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, Zhang Rui , Matthew Garrett , Ike Panhc , platform-driver-x86@vger.kernel.org Subject: [PATCH 3/6] ideapad_laptop: introduce struct acpi_device pointer to ideapad_private structure Date: Wed, 25 Sep 2013 20:39:47 +0800 Message-Id: <1380112790-2321-4-git-send-email-rui.zhang@intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1380112790-2321-1-git-send-email-rui.zhang@intel.com> References: <1380112790-2321-1-git-send-email-rui.zhang@intel.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-8.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Introduce struct acpi_device pointer to ideapad_private structure. At the same time, replace all adevice with adev to be short and consistent. Signed-off-by: Zhang Rui CC: Matthew Garrett CC: Ike Panhc CC: platform-driver-x86@vger.kernel.org --- drivers/platform/x86/ideapad-laptop.c | 48 +++++++++++++++++---------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 5021c55..edd3656 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -73,6 +73,7 @@ enum { }; struct ideapad_private { + struct acpi_device *adev; struct rfkill *rfk[IDEAPAD_RFKILL_DEV_NUM]; struct platform_device *platform_device; struct input_dev *inputdev; @@ -468,9 +469,9 @@ 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 *adevice, int dev) +static int ideapad_register_rfkill(struct acpi_device *adev, int dev) { - struct ideapad_private *priv = dev_get_drvdata(&adevice->dev); + struct ideapad_private *priv = dev_get_drvdata(&adev->dev); int ret; unsigned long sw_blocked; @@ -482,7 +483,7 @@ static int ideapad_register_rfkill(struct acpi_device *adevice, int dev) return 0; } - priv->rfk[dev] = rfkill_alloc(ideapad_rfk_data[dev].name, &adevice->dev, + priv->rfk[dev] = rfkill_alloc(ideapad_rfk_data[dev].name, &adev->dev, ideapad_rfk_data[dev].type, &ideapad_rfk_ops, (void *)(long)dev); if (!priv->rfk[dev]) @@ -504,9 +505,9 @@ static int ideapad_register_rfkill(struct acpi_device *adevice, int dev) return 0; } -static void ideapad_unregister_rfkill(struct acpi_device *adevice, int dev) +static void ideapad_unregister_rfkill(struct acpi_device *adev, int dev) { - struct ideapad_private *priv = dev_get_drvdata(&adevice->dev); + struct ideapad_private *priv = dev_get_drvdata(&adev->dev); if (!priv->rfk[dev]) return; @@ -761,13 +762,13 @@ 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 *adevice) +static void ideapad_sync_touchpad_state(struct acpi_device *adev) { - struct ideapad_private *priv = dev_get_drvdata(&adevice->dev); + 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(adevice->handle, VPCCMD_R_TOUCHPAD, &value)) { + if (!read_ec_data(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 @@ -779,22 +780,23 @@ static void ideapad_sync_touchpad_state(struct acpi_device *adevice) } } -static int ideapad_acpi_add(struct acpi_device *adevice) +static int ideapad_acpi_add(struct acpi_device *adev) { int ret, i; int cfg; struct ideapad_private *priv; - if (read_method_int(adevice->handle, "_CFG", &cfg)) + if (read_method_int(adev->handle, "_CFG", &cfg)) return -ENODEV; priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; - dev_set_drvdata(&adevice->dev, priv); + dev_set_drvdata(&adev->dev, priv); ideapad_priv = priv; - ideapad_handle = adevice->handle; + ideapad_handle = adev->handle; priv->cfg = cfg; + priv->adev = adev; ret = ideapad_platform_init(priv); if (ret) @@ -810,12 +812,12 @@ static int ideapad_acpi_add(struct acpi_device *adevice) for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++) { if (test_bit(ideapad_rfk_data[i].cfgbit, &priv->cfg)) - ideapad_register_rfkill(adevice, i); + ideapad_register_rfkill(adev, i); else priv->rfk[i] = NULL; } ideapad_sync_rfk_state(priv); - ideapad_sync_touchpad_state(adevice); + ideapad_sync_touchpad_state(adev); if (!acpi_video_backlight_support()) { ret = ideapad_backlight_init(priv); @@ -827,7 +829,7 @@ static int ideapad_acpi_add(struct acpi_device *adevice) backlight_failed: for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++) - ideapad_unregister_rfkill(adevice, i); + ideapad_unregister_rfkill(adev, i); ideapad_input_exit(priv); input_failed: ideapad_debugfs_exit(priv); @@ -838,27 +840,27 @@ static int ideapad_acpi_add(struct acpi_device *adevice) return ret; } -static int ideapad_acpi_remove(struct acpi_device *adevice) +static int ideapad_acpi_remove(struct acpi_device *adev) { - struct ideapad_private *priv = dev_get_drvdata(&adevice->dev); + struct ideapad_private *priv = dev_get_drvdata(&adev->dev); int i; ideapad_backlight_exit(priv); for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++) - ideapad_unregister_rfkill(adevice, i); + ideapad_unregister_rfkill(adev, i); ideapad_input_exit(priv); ideapad_debugfs_exit(priv); ideapad_platform_exit(priv); - dev_set_drvdata(&adevice->dev, NULL); + dev_set_drvdata(&adev->dev, NULL); kfree(priv); return 0; } -static void ideapad_acpi_notify(struct acpi_device *adevice, u32 event) +static void ideapad_acpi_notify(struct acpi_device *adev, u32 event) { - struct ideapad_private *priv = dev_get_drvdata(&adevice->dev); - acpi_handle handle = adevice->handle; + struct ideapad_private *priv = dev_get_drvdata(&adev->dev); + acpi_handle handle = adev->handle; unsigned long vpc1, vpc2, vpc_bit; if (read_ec_data(handle, VPCCMD_R_VPC1, &vpc1)) @@ -880,7 +882,7 @@ static void ideapad_acpi_notify(struct acpi_device *adevice, u32 event) ideapad_input_report(priv, vpc_bit); break; case 5: - ideapad_sync_touchpad_state(adevice); + ideapad_sync_touchpad_state(adev); break; case 4: ideapad_backlight_notify_brightness(priv);