From patchwork Thu Feb 1 18:53:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 10195929 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 796F4605F5 for ; Thu, 1 Feb 2018 19:16:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E47B28C53 for ; Thu, 1 Feb 2018 19:16:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C1C028DCE; Thu, 1 Feb 2018 19:16:09 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7658A28D54 for ; Thu, 1 Feb 2018 19:08:42 +0000 (UTC) Received: from localhost ([::1]:55019 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehK8v-0003j0-8X for patchwork-qemu-devel@patchwork.kernel.org; Thu, 01 Feb 2018 14:03:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36389) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehJz0-0003GJ-WD for qemu-devel@nongnu.org; Thu, 01 Feb 2018 13:53:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehJyw-0008W8-DB for qemu-devel@nongnu.org; Thu, 01 Feb 2018 13:53:15 -0500 Received: from mail-oi0-x243.google.com ([2607:f8b0:4003:c06::243]:40490) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ehJyw-0008Vp-8d for qemu-devel@nongnu.org; Thu, 01 Feb 2018 13:53:10 -0500 Received: by mail-oi0-x243.google.com with SMTP id 8so2947989oix.7 for ; Thu, 01 Feb 2018 10:53:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=LU1UnDBlgDqdo3POn9u4mRX5++9AzN/b7apq1erDnOc=; b=VLyF/UoGk9hjrLd61GMofuqN0nKE5U8ODFVlpkTZQatQuhC1pqYs2urUUIqHzB7LJ6 BiDg/3vCUe2YX4yXoIVkW+mnhzy842INVCs0njGLpAkzCRw6FFInc4kh07xEdbKRaWIK XjTisZMOuHGZ5bs2Eb7TJIUg9RQkneeDO0L2lUZaFCSDk6VOoBUFsgz52nZpgZzOZ4W+ OCqHrTOTjqPLKa3gI3Qg7Eq4VfpuA4Bn9zQBYvpeSlASQvz3VVEm6gg69fBj7kl/GYUs ov3pN550cQe2U07gjOR0bB0wh8QGcaoIhO/lRWdN8jfKRMgkjgjcm5F974oTTGsgOf9D Zjyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=LU1UnDBlgDqdo3POn9u4mRX5++9AzN/b7apq1erDnOc=; b=THk7tgUV7Z43DgBC+tmWUXiuD8ezr5tzRefKEW4JLGnPMlGksDvHIukI3WiwM5NsAD dbZCS3B/N/aiJ9xjl6v79ZbS6ZRdeWjAH1vaxDigQTuY+/9RcxBJx2bYFojMf1ZSfx8c 2z0CAhb9xBiiEbt6vK18Plvp3KMMSeyLMTyG27U3v2RA7reLGWMdYaF1WRVlsyXGYCZO n3ImmibYKMXoHJPT/fvIu7H5y5QtXz2bGeMolCdLKXqTMeRYZoycjePAPm7aVj9M6oxf yMV3rUdhD1EZJ2oiaFHh7NFoa6vKbVYgrEOzuPpuiqqqR8fWPN2ABR5EdCALYfo4pHdB 2Q/Q== X-Gm-Message-State: AKwxytcv4lsA0t1naDN2mVpb9kOKc09BcCp4FcqL+eegM/E+O+qUKYDf DmcsAt/CVe16W58ZIhuKNw== X-Google-Smtp-Source: AH8x224ZuCw8vfNQiLIIGry6R2nso/zcALDT3PNdHtfAtJP0UkJaeCeAddWglvo9lrvGmzPO9YkCNw== X-Received: by 10.202.67.138 with SMTP id q132mr23697186oia.245.1517511189195; Thu, 01 Feb 2018 10:53:09 -0800 (PST) Received: from serve.minyard.net ([47.184.168.85]) by smtp.gmail.com with ESMTPSA id c2sm88535oia.56.2018.02.01.10.53.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Feb 2018 10:53:08 -0800 (PST) Received: from t430.minyard.net (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPA id 383AF79A; Thu, 1 Feb 2018 12:53:06 -0600 (CST) Received: by t430.minyard.net (Postfix, from userid 1000) id 9F27B300965; Thu, 1 Feb 2018 12:53:04 -0600 (CST) From: minyard@acm.org To: Peter Maydell , qemu-devel@nongnu.org Date: Thu, 1 Feb 2018 12:53:00 -0600 Message-Id: <1517511182-9944-6-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517511182-9944-1-git-send-email-minyard@acm.org> References: <1517511182-9944-1-git-send-email-minyard@acm.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::243 Subject: [Qemu-devel] [PATCH 5/7] ipmi: Fix macro issues X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Corey Minyard Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Corey Minyard Macro parameters should almost always have () around them when used. llvm reported an error on this. Remove redundant parenthesis and put parenthesis around the entire macros with assignments in case they are used in an expression. The macros were doing ((v) & 1) for a binary input, but that only works if v == 0 or if v & 1. Changed to !!(v) so they work for all values. Remove some unused macros. Reported in https://bugs.launchpad.net/bugs/1651167 An audit of these changes found no semantic changes; this is just cleanups for proper style and to avoid a compiler warning. Signed-off-by: Corey Minyard Reviewed-by: Eric Blake --- hw/ipmi/isa_ipmi_bt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/ipmi/isa_ipmi_bt.c b/hw/ipmi/isa_ipmi_bt.c index e098fd5..e946030 100644 --- a/hw/ipmi/isa_ipmi_bt.c +++ b/hw/ipmi/isa_ipmi_bt.c @@ -45,21 +45,21 @@ #define IPMI_BT_B2H_ATN_MASK (1 << IPMI_BT_B2H_ATN_BIT) #define IPMI_BT_GET_B2H_ATN(d) (((d) >> IPMI_BT_B2H_ATN_BIT) & 0x1) #define IPMI_BT_SET_B2H_ATN(d, v) ((d) = (((d) & ~IPMI_BT_B2H_ATN_MASK) | \ - (((v) & 1) << IPMI_BT_B2H_ATN_BIT))) + (!!(v) << IPMI_BT_B2H_ATN_BIT))) #define IPMI_BT_SMS_ATN_MASK (1 << IPMI_BT_SMS_ATN_BIT) #define IPMI_BT_GET_SMS_ATN(d) (((d) >> IPMI_BT_SMS_ATN_BIT) & 0x1) #define IPMI_BT_SET_SMS_ATN(d, v) ((d) = (((d) & ~IPMI_BT_SMS_ATN_MASK) | \ - (((v) & 1) << IPMI_BT_SMS_ATN_BIT))) + (!!(v) << IPMI_BT_SMS_ATN_BIT))) #define IPMI_BT_HBUSY_MASK (1 << IPMI_BT_HBUSY_BIT) #define IPMI_BT_GET_HBUSY(d) (((d) >> IPMI_BT_HBUSY_BIT) & 0x1) #define IPMI_BT_SET_HBUSY(d, v) ((d) = (((d) & ~IPMI_BT_HBUSY_MASK) | \ - (((v) & 1) << IPMI_BT_HBUSY_BIT))) + (!!(v) << IPMI_BT_HBUSY_BIT))) #define IPMI_BT_BBUSY_MASK (1 << IPMI_BT_BBUSY_BIT) #define IPMI_BT_SET_BBUSY(d, v) ((d) = (((d) & ~IPMI_BT_BBUSY_MASK) | \ - (((v) & 1) << IPMI_BT_BBUSY_BIT))) + (!!(v) << IPMI_BT_BBUSY_BIT))) /* Mask register */ @@ -69,12 +69,12 @@ #define IPMI_BT_B2H_IRQ_EN_MASK (1 << IPMI_BT_B2H_IRQ_EN_BIT) #define IPMI_BT_GET_B2H_IRQ_EN(d) (((d) >> IPMI_BT_B2H_IRQ_EN_BIT) & 0x1) #define IPMI_BT_SET_B2H_IRQ_EN(d, v) ((d) = (((d) & ~IPMI_BT_B2H_IRQ_EN_MASK) |\ - (((v) & 1) << IPMI_BT_B2H_IRQ_EN_BIT))) + (!!(v) << IPMI_BT_B2H_IRQ_EN_BIT))) #define IPMI_BT_B2H_IRQ_MASK (1 << IPMI_BT_B2H_IRQ_BIT) #define IPMI_BT_GET_B2H_IRQ(d) (((d) >> IPMI_BT_B2H_IRQ_BIT) & 0x1) #define IPMI_BT_SET_B2H_IRQ(d, v) ((d) = (((d) & ~IPMI_BT_B2H_IRQ_MASK) | \ - (((v) & 1) << IPMI_BT_B2H_IRQ_BIT))) + (!!(v) << IPMI_BT_B2H_IRQ_BIT))) typedef struct IPMIBT { IPMIBmc *bmc;