From patchwork Tue Sep 15 08:34:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 7180921 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 6001FBEEC1 for ; Tue, 15 Sep 2015 08:35:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61F2E205B3 for ; Tue, 15 Sep 2015 08:35:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 649AB20573 for ; Tue, 15 Sep 2015 08:35:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751961AbbIOIfK (ORCPT ); Tue, 15 Sep 2015 04:35:10 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:36578 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751330AbbIOIfH (ORCPT ); Tue, 15 Sep 2015 04:35:07 -0400 Received: by padhk3 with SMTP id hk3so170252653pad.3 for ; Tue, 15 Sep 2015 01:35:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=jD9KFRAKPAO5exhl5zM3zIQlH1ZQPG4lUdu+pRn+EYk=; b=LUFmj/N3M4zs1GMSjKCE4w3k6jhkNNjo+I73gs1G7MG5Nm9k4C4GlQhDicWr7GbNZ4 5W8d2WOP01g8MSM3b/DhrAQ46IFvQmTS0l7YpSDwrHCSMbNWtLFX5XrPFMXjMPM9RVqI aaudDRbpLzGSIQ+bsDsPOspZf/pI29B6W5RP44V2Fn3CWxUUFvAtXhn1Wym9RHYsgTzY Bwh+/kN5fg41UXsdOOOTPlZndGsZkyOT+T3EZLwsXE/6ir3aPzEZ7siUecJHbFdsW/Sd Svl30C5BL/DjLjakMNzNbZ/aGGBByIP7EDQ8y2P75GRmUgXMLwEbe6EJ+eULR9OLgOKm vPyA== X-Gm-Message-State: ALoCoQnxkfIuuY51Habqr5e1iCwYk8jaLnPmvTLhRA16au49UqnCtykMwgvjh/RNuRszxoi605E3 X-Received: by 10.68.110.132 with SMTP id ia4mr16523312pbb.165.1442306107055; Tue, 15 Sep 2015 01:35:07 -0700 (PDT) Received: from localhost ([122.172.133.50]) by smtp.gmail.com with ESMTPSA id xd10sm20623853pab.25.2015.09.15.01.35.05 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 15 Sep 2015 01:35:06 -0700 (PDT) From: Viresh Kumar To: gregkh@linuxfoundation.org Cc: linaro-kernel@lists.linaro.org, Rafael Wysocki , sboyd@codeaurora.org, arnd@arndb.de, Viresh Kumar , , Len Brown , linux-acpi@vger.kernel.org (open list:ACPI), linux-kernel@vger.kernel.org (open list) Subject: [PATCH V3 1/2] ACPI / EC: Fix broken big-endian 64bit platforms using 'global_lock' Date: Tue, 15 Sep 2015 14:04:58 +0530 Message-Id: <9b705747a138c96c26faee5218f7b47403195b28.1442305897.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.4.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 global_lock is defined as an unsigned long and accessing only its lower 32 bits from sysfs is incorrect, as we need to consider other 32 bits for big endian 64 bit systems. Fix that by making global_lock an u32 instead. Cc: # v4.1+ Signed-off-by: Viresh Kumar --- Its marked just for # v4.1+, because arm64 has the first 64 big-endian platform with ACPI. And ACPI support for that is mainlined recently only (Arnd Bergmann). Another thing worth noticing is that, global_lock is getting an unsigned long long value assigned to it in ec_parse_device() and this is what Arnd had to say about that: "I think that's fine, it does this because the _GLP variable in ACPI is defined as an u64. And that's what happens on 32-bit architectures anyway." This patch should go via GregKH, as the second patch has dependency on it. V2->V3: - Moved this out in a separate patch, so that it can be backported. --- drivers/acpi/ec_sys.c | 2 +- drivers/acpi/internal.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/ec_sys.c b/drivers/acpi/ec_sys.c index b4c216bab22b..bea8e425a8de 100644 --- a/drivers/acpi/ec_sys.c +++ b/drivers/acpi/ec_sys.c @@ -128,7 +128,7 @@ static int acpi_ec_add_debugfs(struct acpi_ec *ec, unsigned int ec_device_count) if (!debugfs_create_x32("gpe", 0444, dev_dir, (u32 *)&first_ec->gpe)) goto error; if (!debugfs_create_bool("use_global_lock", 0444, dev_dir, - (u32 *)&first_ec->global_lock)) + &first_ec->global_lock)) goto error; if (write_support) diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 9e426210c2a8..9db196de003c 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h @@ -138,7 +138,7 @@ struct acpi_ec { unsigned long gpe; unsigned long command_addr; unsigned long data_addr; - unsigned long global_lock; + u32 global_lock; unsigned long flags; unsigned long reference_count; struct mutex mutex;