From patchwork Mon Nov 23 19:25:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Lutomirski X-Patchwork-Id: 7685501 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CB5A4BF90C for ; Mon, 23 Nov 2015 19:25:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F276220558 for ; Mon, 23 Nov 2015 19:25:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EA8EF20818 for ; Mon, 23 Nov 2015 19:25:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753052AbbKWTZf (ORCPT ); Mon, 23 Nov 2015 14:25:35 -0500 Received: from mail.kernel.org ([198.145.29.136]:56080 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752714AbbKWTZe (ORCPT ); Mon, 23 Nov 2015 14:25:34 -0500 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AB8D620815; Mon, 23 Nov 2015 19:25:33 +0000 (UTC) Received: from localhost (c-71-202-137-17.hsd1.ca.comcast.net [71.202.137.17]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D604E20814; Mon, 23 Nov 2015 19:25:32 +0000 (UTC) From: Andy Lutomirski To: Darren Hart Cc: Matthew Garrett , linux-acpi@vger.kernel.org, platform-driver-x86@vger.kernel.org, Andy Lutomirski Subject: [PATCH] wmi: Set wmi devices' parents Date: Mon, 23 Nov 2015 11:25:30 -0800 Message-Id: <7c58f0a208e0c903008989aec457230e5e58608e.1448306649.git.luto@kernel.org> X-Mailer: git-send-email 2.5.0 X-Spam-Status: No, score=-7.5 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 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Without this patch, wmi devices are in /sys/virtual/wmi. They're logically children of the ACPI WMI device, so slot them into the device hierarchy. With this change, on my laptop, they end up in /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C14:00/wmi and /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C14:01/wmi. Signed-off-by: Andy Lutomirski --- The WMI driver doesn't really play well with the driver model. This helps a little. Depending on how much time I find, I may send some followups to turn it into a real bus driver since it really does work like a bus. drivers/platform/x86/wmi.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index eb391a281833..e58768787677 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -684,9 +684,11 @@ static struct class wmi_class = { }; static int wmi_create_device(const struct guid_block *gblock, - struct wmi_block *wblock, acpi_handle handle) + struct wmi_block *wblock, + struct acpi_device *device) { wblock->dev.class = &wmi_class; + wblock->dev.parent = &device->dev; dev_set_name(&wblock->dev, "%pUL", gblock->guid); @@ -723,7 +725,7 @@ static bool guid_already_parsed(const char *guid_string) /* * Parse the _WDG method for the GUID data blocks */ -static int parse_wdg(acpi_handle handle) +static int parse_wdg(struct acpi_device *device) { struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL}; union acpi_object *obj; @@ -733,7 +735,7 @@ static int parse_wdg(acpi_handle handle) int retval; u32 i, total; - status = acpi_evaluate_object(handle, "_WDG", NULL, &out); + status = acpi_evaluate_object(device->handle, "_WDG", NULL, &out); if (ACPI_FAILURE(status)) return -ENXIO; @@ -757,7 +759,7 @@ static int parse_wdg(acpi_handle handle) if (!wblock) return -ENOMEM; - wblock->handle = handle; + wblock->handle = device->handle; wblock->gblock = gblock[i]; /* @@ -767,7 +769,7 @@ static int parse_wdg(acpi_handle handle) for device creation. */ if (!guid_already_parsed(gblock[i].guid)) { - retval = wmi_create_device(&gblock[i], wblock, handle); + retval = wmi_create_device(&gblock[i], wblock, device); if (retval) { wmi_free_devices(); goto out_free_pointer; @@ -884,7 +886,7 @@ static int acpi_wmi_add(struct acpi_device *device) return -ENODEV; } - error = parse_wdg(device->handle); + error = parse_wdg(device); if (error) { acpi_remove_address_space_handler(device->handle, ACPI_ADR_SPACE_EC,