From patchwork Thu Apr 12 13:58:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Miao X-Patchwork-Id: 152075 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 1837BB7095 for ; Thu, 12 Apr 2012 23:58:52 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SIKXp-0003i5-6Q; Thu, 12 Apr 2012 13:58:41 +0000 Received: from mail-pz0-f49.google.com ([209.85.210.49]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SIKXm-0003hZ-Oz for kernel-team@lists.ubuntu.com; Thu, 12 Apr 2012 13:58:38 +0000 Received: by mail-pz0-f49.google.com with SMTP id q36so2494134dad.22 for ; Thu, 12 Apr 2012 06:58:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=lMxTg2BQMjIBhFYHTGdMxVG7H5xlSkRzwIdaeBCPHs8=; b=MNpezlVBUPwDeNndUz7+8yhfeIa5Fo1HlvWCfw9RtQBzyhCL3RU6gWaY1HHYPKUVaZ BeObITmPFdYW6L9a+p64Z8J6YFPAz5B/dTzWPeWKy+MecKOY/TioGD84kHp/VLHNcY8+ zE9CoMGnoURj2Y8zurMlbLH4VBJ+5dbAwzvH+szviJDPtdyTVcRWKhKg+UkjQ2Oi82WZ ZfEBqe1FMe2SKiJDzb7Z/ETvS4xAS3nga3ZKevs5xOw+W9tKiWRaSyKe3im4lFoUelmA 59IWmD2NjfIVeCsH15ZAyVspuMI06IIzoAjigRUHa0lWgYIO1dVL8LHEt/yMwnE11l/1 ZUzw== Received: by 10.68.195.233 with SMTP id ih9mr3043126pbc.128.1334239118338; Thu, 12 Apr 2012 06:58:38 -0700 (PDT) Received: from ycmiao-macbookpro.ericsmarthome.org ([112.65.50.137]) by mx.google.com with ESMTPS id or6sm5763752pbc.43.2012.04.12.06.58.35 (version=SSLv3 cipher=OTHER); Thu, 12 Apr 2012 06:58:37 -0700 (PDT) From: Eric Miao To: kernel-team@lists.ubuntu.com Subject: [Precise PATCH 2/6] Input: psmouse - use psmouse_[de]activate() from sentelic and hgpk drivers Date: Thu, 12 Apr 2012 21:58:15 +0800 Message-Id: <1334239099-3502-3-git-send-email-eric.miao@canonical.com> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1334239099-3502-1-git-send-email-eric.miao@canonical.com> References: <1334239099-3502-1-git-send-email-eric.miao@canonical.com> Cc: Dmitry Torokhov , Paul Fox , Andres Salomon X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: Paul Fox Make use of psmouse_activate() and psmouse_deactivate() from psmouse-base.c Signed-off-by: Andres Salomon Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/hgpk.c | 9 ++------- drivers/input/mouse/sentelic.c | 12 ++++-------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/input/mouse/hgpk.c b/drivers/input/mouse/hgpk.c index 0470dd4..3bf3034 100644 --- a/drivers/input/mouse/hgpk.c +++ b/drivers/input/mouse/hgpk.c @@ -640,7 +640,6 @@ static int hgpk_reset_device(struct psmouse *psmouse, bool recalibrate) static int hgpk_force_recalibrate(struct psmouse *psmouse) { - struct ps2dev *ps2dev = &psmouse->ps2dev; struct hgpk_data *priv = psmouse->private; int err; @@ -669,12 +668,9 @@ static int hgpk_force_recalibrate(struct psmouse *psmouse) * we don't have a good way to deal with it. The 2s window stuff * (below) is our best option for now. */ - - if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE)) + if (psmouse_activate(psmouse)) return -1; - psmouse_set_state(psmouse, PSMOUSE_ACTIVATED); - if (tpdebug) psmouse_dbg(psmouse, "touchpad reactivated\n"); @@ -733,8 +729,7 @@ static int hgpk_toggle_powersave(struct psmouse *psmouse, int enable) } /* should be all set, enable the touchpad */ - ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE); - psmouse_set_state(psmouse, PSMOUSE_ACTIVATED); + psmouse_activate(psmouse); psmouse_dbg(psmouse, "Touchpad powered up.\n"); } else { psmouse_dbg(psmouse, "Powering off touchpad.\n"); diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c index 86d6f39..dc8b758 100644 --- a/drivers/input/mouse/sentelic.c +++ b/drivers/input/mouse/sentelic.c @@ -90,8 +90,7 @@ static int fsp_reg_read(struct psmouse *psmouse, int reg_addr, int *reg_val) * to do that for writes because sysfs set helper does this for * us. */ - ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE); - psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); + psmouse_deactivate(psmouse); ps2_begin_command(ps2dev); @@ -128,8 +127,7 @@ static int fsp_reg_read(struct psmouse *psmouse, int reg_addr, int *reg_val) out: ps2_end_command(ps2dev); - ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE); - psmouse_set_state(psmouse, PSMOUSE_ACTIVATED); + psmouse_activate(psmouse); dev_dbg(&ps2dev->serio->dev, "READ REG: 0x%02x is 0x%02x (rc = %d)\n", reg_addr, *reg_val, rc); return rc; @@ -213,8 +211,7 @@ static int fsp_page_reg_read(struct psmouse *psmouse, int *reg_val) unsigned char param[3]; int rc = -1; - ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE); - psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); + psmouse_deactivate(psmouse); ps2_begin_command(ps2dev); @@ -239,8 +236,7 @@ static int fsp_page_reg_read(struct psmouse *psmouse, int *reg_val) out: ps2_end_command(ps2dev); - ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE); - psmouse_set_state(psmouse, PSMOUSE_ACTIVATED); + psmouse_activate(psmouse); dev_dbg(&ps2dev->serio->dev, "READ PAGE REG: 0x%02x (rc = %d)\n", *reg_val, rc); return rc;