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: 53619 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id ECC4B22A22 for ; Tue, 15 Sep 2015 08:35:16 +0000 (UTC) Received: by wicgb1 with SMTP id gb1sf5209949wic.3 for ; Tue, 15 Sep 2015 01:35:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=H0uKBWiTYrGOKUcUVu6qarnSrFaKdOZYt1iu52izei0=; b=JOL2GKkFG0gpkRr8J4bP2Qnqb8ShqeX0oMXjBVJBg4IQf9htN1zqulOgQ2QELpJHR6 K4ypaPqYUIbdjzGvYl0y/e3H0m4ZbUcWkOQq5pQPkVBFPNvtCDy/4K1RFBpfr/OfYVdX kjQD4lSqUNLsrIh+P+sZ9WRNqL4doSneHR3DwOgDM5c15uPWrOkJTvs+XoxQB7kjHrmb W7wAwXa5cBVmJ4G/Fw5NNHV6YahM/gYobWX6NAAbQTCK8fko+ZnP23e7EtRwBZl2fWRP HqeL7Amsb/fB9ZJxTyO48JDZUV0FWNY9dd1PIHzyHZUnRqPM9XLUjhZrSinHcbto7RZ9 Dsnw== X-Gm-Message-State: ALoCoQlNirR4nlzGYOtXUToXKjV9T40VE7ov1//ZMHdxdxQ4cJsN9tYJlcDMeQRi3OYbGxMo8smr X-Received: by 10.112.78.101 with SMTP id a5mr4077130lbx.9.1442306116296; Tue, 15 Sep 2015 01:35:16 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.130 with SMTP id r2ls113057laa.87.gmail; Tue, 15 Sep 2015 01:35:16 -0700 (PDT) X-Received: by 10.112.168.7 with SMTP id zs7mr19295304lbb.26.1442306116142; Tue, 15 Sep 2015 01:35:16 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id zn4si12509775lbb.177.2015.09.15.01.35.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Sep 2015 01:35:16 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by lamp12 with SMTP id p12so101313948lam.0 for ; Tue, 15 Sep 2015 01:35:16 -0700 (PDT) X-Received: by 10.112.156.167 with SMTP id wf7mr19200797lbb.88.1442306116046; Tue, 15 Sep 2015 01:35:16 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1647789lbq; Tue, 15 Sep 2015 01:35:15 -0700 (PDT) X-Received: by 10.66.249.166 with SMTP id yv6mr45110865pac.126.1442306115065; Tue, 15 Sep 2015 01:35:15 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ax2si11675236pbc.170.2015.09.15.01.35.14; Tue, 15 Sep 2015 01:35:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751961AbbIOIfK (ORCPT + 6 others); 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-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: list List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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;