From patchwork Tue Jan 16 00:57:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 10165613 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 39364601E7 for ; Tue, 16 Jan 2018 01:03:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27B2C269B2 for ; Tue, 16 Jan 2018 01:03:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18D94204FB; Tue, 16 Jan 2018 01:03:47 +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 9D4AA204FB for ; Tue, 16 Jan 2018 01:03:46 +0000 (UTC) Received: from localhost ([::1]:49784 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebFfF-0003Pb-UE for patchwork-qemu-devel@patchwork.kernel.org; Mon, 15 Jan 2018 20:03:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59564) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebFZu-0007s9-AE for qemu-devel@nongnu.org; Mon, 15 Jan 2018 19:58:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebFZs-0000lS-Bq for qemu-devel@nongnu.org; Mon, 15 Jan 2018 19:58:14 -0500 Received: from mail-ot0-x242.google.com ([2607:f8b0:4003:c0f::242]:36511) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ebFZs-0000kr-7V for qemu-devel@nongnu.org; Mon, 15 Jan 2018 19:58:12 -0500 Received: by mail-ot0-x242.google.com with SMTP id w4so12197116otg.3 for ; Mon, 15 Jan 2018 16:58:12 -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=iIcsJREUNoTr2AKdMItSMM3N+G8vYWsUT6ClcK8QL8BOSpY8FPVbDiGj3Vgrr+neE9 MQamIVcexbsA1kYtVGYF7/Y6mnf/I7BuT46Aml4CEWLMhaMqslJmGZaAWeB9S4doNXUG YR4RTOVUefzSg/tfok/7lBgPz9/TtrnBK8FC+uzj7K7bE8+774WTcR2Jc5i/CcGXt8N8 pQHD4myy3DtJyFPF3/Rezozdf2RcrDmzlpDE6GBXzhXPd6sEH3Nh3GIaqgtqthm7x3S0 S+0S6AyBK+hYdQlZkKKpGuoIrPY3ooog10gwPMkyCjpNgDMce+5z7CZTOV371JyxC9OF mGtA== 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=olEHYzu40OnqqbZmf9dasZPYNSwAsYWGV9PGRFvxqs7XhCngWX653dwW9SoQyLBD1w ryfN2u8HZW+kFiOwIF5EuhnpKjH3q8c03xwQFddPY4NGjRbpKRxXEXoX6w8KKh5slQnF Bx+bBySKeztFjRlbLY/gdf2TDsQF6kN7xuVpi5Xe7PR8C/p6u3jr65OH4aZXU3wsLBCv Se/JDx43jrzvRTHzeUBeVHL+yQX7aVdH8BGhv+i2teL9dl49qDAjpiYV7FamU7+bz+9O KzcUPXDWIJbP1WFX/QGnxGEPQAYJuGlHid4aIkgWLMFrn+vgT1Qbnbuds4hZvZMtgPH4 7jbA== X-Gm-Message-State: AKwxyteXtiLJ3W7+Gz6QISqpev07Ymj8VJocmRoGAZFBnH+y7arCbNfO y3okUodmeQH2bdPsD95cZQ== X-Google-Smtp-Source: ACJfBovT9+wh05mXRXMHlzt+Vl4+h824DBdTfjSRHmM98JcTHVlobWAqB24fCaIumvyZMXDQGzEwmg== X-Received: by 10.157.9.2 with SMTP id 2mr19813040otp.159.1516064291324; Mon, 15 Jan 2018 16:58:11 -0800 (PST) Received: from serve.minyard.net ([47.184.168.85]) by smtp.gmail.com with ESMTPSA id o83sm428512oif.56.2018.01.15.16.58.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jan 2018 16:58:09 -0800 (PST) Received: from t430.minyard.net (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPA id E12228F4; Mon, 15 Jan 2018 18:58:06 -0600 (CST) Received: by t430.minyard.net (Postfix, from userid 1000) id A1A5F30008E; Mon, 15 Jan 2018 18:58:04 -0600 (CST) From: minyard@acm.org To: qemu-devel@nongnu.org Date: Mon, 15 Jan 2018 18:57:57 -0600 Message-Id: <1516064279-14816-6-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516064279-14816-1-git-send-email-minyard@acm.org> References: <1516064279-14816-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:c0f::242 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , 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;