From patchwork Sun Feb 23 17:03:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Garrett X-Patchwork-Id: 3704401 Return-Path: X-Original-To: patchwork-linux-input@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 B761D9F35F for ; Sun, 23 Feb 2014 17:03:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AB745201C7 for ; Sun, 23 Feb 2014 17:03:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ABC302015D for ; Sun, 23 Feb 2014 17:03:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751260AbaBWRDZ (ORCPT ); Sun, 23 Feb 2014 12:03:25 -0500 Received: from cavan.codon.org.uk ([93.93.128.6]:44664 "EHLO cavan.codon.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751211AbaBWRDY (ORCPT ); Sun, 23 Feb 2014 12:03:24 -0500 Received: from 209-6-207-143.c3-0.smr-ubr2.sbo-smr.ma.cable.rcn.com ([209.6.207.143] helo=x230.lan) by cavan.codon.org.uk with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1WHcSW-0000xu-Ml; Sun, 23 Feb 2014 17:03:20 +0000 From: Matthew Garrett To: dmitry.torokhov@gmail.com Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, benjamin.tissoires@redhat.com, Matthew Garrett Subject: [PATCH] input: Use platform-provided devices as i8042 serio parents Date: Sun, 23 Feb 2014 12:03:16 -0500 Message-Id: <1393174996-27764-1-git-send-email-matthew.garrett@nebula.com> X-Mailer: git-send-email 1.8.5.3 X-SA-Do-Not-Run: Yes X-SA-Exim-Connect-IP: 209.6.207.143 X-SA-Exim-Mail-From: matthew.garrett@nebula.com X-SA-Exim-Scanned: No (on cavan.codon.org.uk); SAEximRunCond expanded to false Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 i8042 devices exposed via platform firmware interfaces such as ACPI or Device Tree may provide additional information of use to userspace. Right now we don't associate the serio devices with the firmware device, and so there's no straightforward way for userspace to make use of that information. This patch simply moves the serio parent device to the firmware provided device. Signed-off-by: Matthew Garrett Tested-by: Benjamin Tissoires --- drivers/input/serio/i8042-sparcio.h | 2 ++ drivers/input/serio/i8042-x86ia64io.h | 2 ++ drivers/input/serio/i8042.c | 12 ++++++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h index d6aa4c6..7bd8e2c 100644 --- a/drivers/input/serio/i8042-sparcio.h +++ b/drivers/input/serio/i8042-sparcio.h @@ -65,6 +65,7 @@ static int sparc_i8042_probe(struct platform_device *op) kbd_iobase = of_ioremap(&kbd->resource[0], 0, 8, "kbd"); kbd_res = &kbd->resource[0]; + i8042_kbd_parent = &kbd->dev; } else if (!strcmp(dp->name, OBP_PS2MS_NAME1) || !strcmp(dp->name, OBP_PS2MS_NAME2)) { struct platform_device *ms = of_find_device_by_node(dp); @@ -72,6 +73,7 @@ static int sparc_i8042_probe(struct platform_device *op) if (irq == 0xffffffff) irq = op->archdata.irqs[0]; i8042_aux_irq = irq; + i8042_aux_parent = &ms->dev; } dp = dp->sibling; diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index 0ec9abb..47dcdf1 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h @@ -723,6 +723,7 @@ static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id * device_set_wakeup_enable(&dev->dev, true); i8042_pnp_kbd_devices++; + i8042_kbd_parent = &dev->dev; return 0; } @@ -744,6 +745,7 @@ static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id * } i8042_pnp_aux_devices++; + i8042_aux_parent = &dev->dev; return 0; } diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 020053f..86da76f 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c @@ -87,6 +87,8 @@ MODULE_PARM_DESC(debug, "Turn i8042 debugging mode on and off"); #endif static bool i8042_bypass_aux_irq_test; +static struct device *i8042_kbd_parent; +static struct device *i8042_aux_parent; #include "i8042.h" @@ -1215,7 +1217,10 @@ static int __init i8042_create_kbd_port(void) serio->stop = i8042_stop; serio->close = i8042_port_close; serio->port_data = port; - serio->dev.parent = &i8042_platform_device->dev; + if (i8042_kbd_parent) + serio->dev.parent = i8042_kbd_parent; + else + serio->dev.parent = &i8042_platform_device->dev; strlcpy(serio->name, "i8042 KBD port", sizeof(serio->name)); strlcpy(serio->phys, I8042_KBD_PHYS_DESC, sizeof(serio->phys)); @@ -1240,7 +1245,10 @@ static int __init i8042_create_aux_port(int idx) serio->start = i8042_start; serio->stop = i8042_stop; serio->port_data = port; - serio->dev.parent = &i8042_platform_device->dev; + if (i8042_aux_parent) + serio->dev.parent = i8042_aux_parent; + else + serio->dev.parent = &i8042_platform_device->dev; if (idx < 0) { strlcpy(serio->name, "i8042 AUX port", sizeof(serio->name)); strlcpy(serio->phys, I8042_AUX_PHYS_DESC, sizeof(serio->phys));