From patchwork Fri May 18 22:47:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 10412417 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3C2F76031B for ; Fri, 18 May 2018 22:47:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BC9628AF7 for ; Fri, 18 May 2018 22:47:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E30228B01; Fri, 18 May 2018 22:47:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 773F428AF7 for ; Fri, 18 May 2018 22:47:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752188AbeERWry (ORCPT ); Fri, 18 May 2018 18:47:54 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:36463 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751747AbeERWrx (ORCPT ); Fri, 18 May 2018 18:47:53 -0400 Received: by mail-pg0-f65.google.com with SMTP id 63-v6so1736578pgg.3 for ; Fri, 18 May 2018 15:47:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=cpvdCZFGKQrlOaFSFwF0Pr2uOcS4UM63G2qtNs155Ic=; b=AUUUm2mIRXPCgDKBIOQUmWXCrXO+pLReJNFg05k6mnOHQWg9FcQY1Lp7AqF/EOMuEn TAASa3BSOeO4hip/IgOb7iMV21VmrHBZ381/XVPlqnuSdCqlO9av4TQh8w/swike+ueJ H+s7KvP4sKsGWD5jKH1b87FAxD2VIkgMXirvo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=cpvdCZFGKQrlOaFSFwF0Pr2uOcS4UM63G2qtNs155Ic=; b=p9n9MtApWhFCNbB41JHBARPzaUnPOzw2ZdtHHY+VR/72ufOr+b+16w8YEqfxM/SKhj xw8HJp+X4EI6QcHxOBemFAGKOqjI4fYzy0CuR+NjlT3/c/WCb/KK+eKCuaEgHr5nNmlZ 6jjwYSw48BXf523zZ6M8w7tUtIo86jIQsXMCx7X5zT2kODXt7166xAtkzmN2LJ5sXhx8 unVPt7UXXuF9A1RNPn6xYFT8n6KMIXA8G63o0rjrtcHar2ENWvKHNuhml9mQzonj/Z/R 4evzbGWqB13AgUOlRuWud97Q5n2TKE7d6O+ddWUn0PbQvVvb3QCQkff+/D51bRPl3JEK EdpA== X-Gm-Message-State: ALKqPwc4OK94J/wxhjdmjb+OdF/syjbiFSAzhpfIOaGjKS/RzSZNG6S7 PjNSWLd+hqrkLOgMB70y3/BkYQ== X-Google-Smtp-Source: AB8JxZoq90QFTXmafx0muHbPiZLeGEZqbZT/mLa5d0wGTRNLQNuv7wLBnl+hDF4SMqdwIL9Ki39pSw== X-Received: by 2002:a65:628c:: with SMTP id f12-v6mr3804392pgv.36.1526683672798; Fri, 18 May 2018 15:47:52 -0700 (PDT) Received: from swboyd.mtv.corp.google.com ([2620:0:1000:1511:d30e:62c6:f82c:ff40]) by smtp.gmail.com with ESMTPSA id y83-v6sm20982229pfd.21.2018.05.18.15.47.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 May 2018 15:47:52 -0700 (PDT) From: Stephen Boyd To: Andy Gross Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Karthikeyan Ramasubramanian , Sagar Dharia , Girish Mahadevan Subject: [PATCH] soc: qcom: geni: Make version macros simpler Date: Fri, 18 May 2018 15:47:50 -0700 Message-Id: <20180518224750.232742-1-swboyd@chromium.org> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This macro doesn't work, because it hides a local variable inside of the macro to hold the version and that variable name is called 'ver' and 'version' sometimes. Let's change this to be more explicit. Introduce three macros for the major, minor, and step of the version, and require callers to pass the version in to get the part of the version out. This way we don't hide local variables inside macros and things are less evil overall. Cc: Karthikeyan Ramasubramanian Cc: Sagar Dharia Cc: Girish Mahadevan Signed-off-by: Stephen Boyd Reviewed-by: Douglas Anderson Reviewed-by: Bjorn Andersson --- include/linux/qcom-geni-se.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/include/linux/qcom-geni-se.h b/include/linux/qcom-geni-se.h index 5d6144977828..3bcd67fd5548 100644 --- a/include/linux/qcom-geni-se.h +++ b/include/linux/qcom-geni-se.h @@ -225,19 +225,14 @@ struct geni_se { #define HW_VER_MINOR_SHFT 16 #define HW_VER_STEP_MASK GENMASK(15, 0) +#define GENI_SE_VERSION_MAJOR(ver) ((ver & HW_VER_MAJOR_MASK) >> HW_VER_MAJOR_SHFT) +#define GENI_SE_VERSION_MINOR(ver) ((ver & HW_VER_MINOR_MASK) >> HW_VER_MINOR_SHFT) +#define GENI_SE_VERSION_STEP(ver) (ver & HW_VER_STEP_MASK) + #if IS_ENABLED(CONFIG_QCOM_GENI_SE) u32 geni_se_get_qup_hw_version(struct geni_se *se); -#define geni_se_get_wrapper_version(se, major, minor, step) do { \ - u32 ver; \ -\ - ver = geni_se_get_qup_hw_version(se); \ - major = (ver & HW_VER_MAJOR_MASK) >> HW_VER_MAJOR_SHFT; \ - minor = (ver & HW_VER_MINOR_MASK) >> HW_VER_MINOR_SHFT; \ - step = version & HW_VER_STEP_MASK; \ -} while (0) - /** * geni_se_read_proto() - Read the protocol configured for a serial engine * @se: Pointer to the concerned serial engine.