From patchwork Fri Sep 6 15:49:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 825995 Delivered-To: patch@linaro.org Received: by 2002:adf:a345:0:b0:367:895a:4699 with SMTP id d5csp872682wrb; Fri, 6 Sep 2024 08:49:43 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWzNVNN9WterQcW5NOPZnOu6HWl4cjbWv3fvMSm1jM+szmIiyYtbX4Pkd0tFM3ODLEIZ+fiKA==@linaro.org X-Google-Smtp-Source: AGHT+IF+WtU2AKg5eJe/IQ5J2ZZUR0LZYSNSJZ25RxBVfrNvch6OnNx9DlaZyHlLGmiqz9/ALeCl X-Received: by 2002:a05:6214:5890:b0:6b5:d95c:692d with SMTP id 6a1803df08f44-6c52850fff8mr62033466d6.13.1725637782802; Fri, 06 Sep 2024 08:49:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725637782; cv=none; d=google.com; s=arc-20240605; b=CkoF6b76rpc+aNyLpTu3MkD7Omwbd4a7XBm5MiPWqORrWLclRyZyMGGUwuCBN0GMRT HlShpIFIZ/66o7scKfYXQYOebmrieLihdIpj99AeOB01kaO7LkR+JUGx0gSYs11T9278 AUqWyt1iir5TYtzD4cREdyXURs0q2Q9ElD/9vVY+PAjPm38lAd0bGSMqaNcDRXA37i3V JazIygPTUGEuqRhhxA/5Wxg0dYpilavUc7is7oNuaN9sk/dqLzJn/5ds+8ZdjxMM+nJd zNSrMmI51GCswNCshFXuhezTHwlfMUF02liSlHHPOAKG4V678vh98t31B9VlbSalOJBf ZTIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ub8tZ79/fRaGRCH8Xhob5KBKMKk2ELdx+VDpRNkwtNw=; fh=GUfNz8m23x71celdWh98+HOq7KNEoq5S47nKDIG9+FQ=; b=fSiLfFgi4YItK8NbYfk03UbaBgeCAZR3a8+Gv9IN8LKF0rYF0BqR7BohMwU6FIi6eX 0zz/SThBFxDPlwrsuggcB2sLBv069CkxDtSJvofvfVnV8WKmmwCCQ4r7dIidS/pJfUu/ zpdJertKFRmi9KJgJm589zi5lq0QCayqcemg2jHPcM3GM/3erk0ks9vzcVE+wn1rnxEa scaR0J4jEZTlPjZ1Uwt9Y876M59M3eqChmhII2vW9ZrQIqe019WkjdWC79cY1Yjjau0L QQxpk5QMw3Zjvtcrcsf++ncrWyO2mps4oapSfEi1iuxFP4kuhNPPZDDdb1gSRz2QUGZn D2Fg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="vI8mI/FN"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6c53062a485si5648336d6.67.2024.09.06.08.49.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Sep 2024 08:49:42 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="vI8mI/FN"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smbDA-00088c-Ur; Fri, 06 Sep 2024 11:49:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1smbD8-000880-Kf for qemu-devel@nongnu.org; Fri, 06 Sep 2024 11:49:22 -0400 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smbD6-0008Aa-SK for qemu-devel@nongnu.org; Fri, 06 Sep 2024 11:49:22 -0400 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5c255e3c327so2347984a12.1 for ; Fri, 06 Sep 2024 08:49:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725637759; x=1726242559; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ub8tZ79/fRaGRCH8Xhob5KBKMKk2ELdx+VDpRNkwtNw=; b=vI8mI/FNZEN7vNeyqLFQo5ITlF1dolcsFGJgd7T6c7ZJpn3YeESjM17iGFLK/XL402 jgLLyBApU2EoTji5gifvH9FYvcrLUzBmQx6dRgMyxEXR7C7DfbI51+0Jx2EexgNgvE0y vSsMRiYBSybV8ARwHE9DBVelhF00ZFYWc99ZO2E2wU2QrmDAqPvRfJbgiPxUtqYV0uJd AzX/KwtAChBs6tTY1HlzvLQwhODl2kvdLHHaj6r1+l2+DdhU995Fsud730/veAux+auG hsR5aCwSLUITf/neJhveItjJDeodNzM8XkCpnK1+mp1WTuZkNYdLIJF76h9q7dJs0Gv7 /d3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725637759; x=1726242559; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ub8tZ79/fRaGRCH8Xhob5KBKMKk2ELdx+VDpRNkwtNw=; b=NiX+mBpRE9wBujqyhooHRFpQwpmfmhunJ8ZT0OHO/lOErdjUZ4DjSeI1QnB+V9GkaH 01O4240dj8FPIchTolLGIR9bUtzI7Tbn4arZEXQbVa7b4pv3viaopW7j6/ZBtU6/4YUb 6KnmE8VkTpbdHaPjy+kPFKyvXFMrIhUf+PMAmtNG3AyStytojA7uI50UkF0wg1ikULsK bk9BjkV83f6oDDE+XA8I/fSjVBMF+lYA/UqdXGMALqb9PKq0BvAXwHbUdPKJR2oMiMXF LYbKodFom6g2x7/sfHzkcBagAXWBeCbvNDOVjcd/TWDV233XYOyi0p5dj39d+wJj0THg 4dSg== X-Forwarded-Encrypted: i=1; AJvYcCU5fUYCA2jaDWu+mkMouIHBGJBCa2isvNgiPpjO45O1PduJFgf0EMwpg7O6ZJTqwQ2bzyJTxznXFecW@nongnu.org X-Gm-Message-State: AOJu0YwQZt5nAZgOi8ufx/dHSPNeW4G92+YtcOpBB9p7dXjUDcSnDA4w 7VMD2o1ameft0ZXKC3HHhr1SX7NArZf+125/otfo3EeI0dHsmAJbp7WtlT/9UbQ= X-Received: by 2002:a05:6402:348d:b0:5c2:4740:939d with SMTP id 4fb4d7f45d1cf-5c3dc7baf09mr2029890a12.26.1725637759197; Fri, 06 Sep 2024 08:49:19 -0700 (PDT) Received: from localhost.localdomain (225.13.23.93.rev.sfr.net. [93.23.13.225]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c3cc529241sm2571799a12.11.2024.09.06.08.49.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 06 Sep 2024 08:49:18 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Guenter Roeck , qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= Subject: [PATCH v2 1/5] hw/sensor/tmp105: Coding style fixes Date: Fri, 6 Sep 2024 17:49:07 +0200 Message-ID: <20240906154911.86803-2-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240906154911.86803-1-philmd@linaro.org> References: <20240906154911.86803-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52c; envelope-from=philmd@linaro.org; helo=mail-ed1-x52c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Guenter Roeck Coding style asks for no space between variable and "++". The next patch in this series will change one of those assignments. Instead of changing just one with that patch, change all of them for consistency. While at it, also fix other coding style problems reported by checkpatch. Signed-off-by: Guenter Roeck Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater --- hw/sensor/tmp105.c | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c index a8730d0b7f..ad97c9684c 100644 --- a/hw/sensor/tmp105.c +++ b/hw/sensor/tmp105.c @@ -29,16 +29,17 @@ static void tmp105_interrupt_update(TMP105State *s) { - qemu_set_irq(s->pin, s->alarm ^ ((~s->config >> 2) & 1)); /* POL */ + qemu_set_irq(s->pin, s->alarm ^ ((~s->config >> 2) & 1)); /* POL */ } static void tmp105_alarm_update(TMP105State *s) { - if ((s->config >> 0) & 1) { /* SD */ - if ((s->config >> 7) & 1) /* OS */ - s->config &= ~(1 << 7); /* OS */ - else + if ((s->config >> 0) & 1) { /* SD */ + if ((s->config >> 7) & 1) { /* OS */ + s->config &= ~(1 << 7); /* OS */ + } else { return; + } } if (s->config >> 1 & 1) { @@ -89,7 +90,8 @@ static void tmp105_get_temperature(Object *obj, Visitor *v, const char *name, visit_type_int(v, name, &value, errp); } -/* Units are 0.001 centigrades relative to 0 C. s->temperature is 8.8 +/* + * Units are 0.001 centigrades relative to 0 C. s->temperature is 8.8 * fixed point, so units are 1/256 centigrades. A simple ratio will do. */ static void tmp105_set_temperature(Object *obj, Visitor *v, const char *name, @@ -118,30 +120,30 @@ static void tmp105_read(TMP105State *s) { s->len = 0; - if ((s->config >> 1) & 1) { /* TM */ + if ((s->config >> 1) & 1) { /* TM */ s->alarm = 0; tmp105_interrupt_update(s); } switch (s->pointer & 3) { case TMP105_REG_TEMPERATURE: - s->buf[s->len ++] = (((uint16_t) s->temperature) >> 8); - s->buf[s->len ++] = (((uint16_t) s->temperature) >> 0) & - (0xf0 << ((~s->config >> 5) & 3)); /* R */ + s->buf[s->len++] = (((uint16_t) s->temperature) >> 8); + s->buf[s->len++] = (((uint16_t) s->temperature) >> 0) & + (0xf0 << ((~s->config >> 5) & 3)); /* R */ break; case TMP105_REG_CONFIG: - s->buf[s->len ++] = s->config; + s->buf[s->len++] = s->config; break; case TMP105_REG_T_LOW: - s->buf[s->len ++] = ((uint16_t) s->limit[0]) >> 8; - s->buf[s->len ++] = ((uint16_t) s->limit[0]) >> 0; + s->buf[s->len++] = ((uint16_t) s->limit[0]) >> 8; + s->buf[s->len++] = ((uint16_t) s->limit[0]) >> 0; break; case TMP105_REG_T_HIGH: - s->buf[s->len ++] = ((uint16_t) s->limit[1]) >> 8; - s->buf[s->len ++] = ((uint16_t) s->limit[1]) >> 0; + s->buf[s->len++] = ((uint16_t) s->limit[1]) >> 8; + s->buf[s->len++] = ((uint16_t) s->limit[1]) >> 0; break; } } @@ -153,18 +155,20 @@ static void tmp105_write(TMP105State *s) break; case TMP105_REG_CONFIG: - if (s->buf[0] & ~s->config & (1 << 0)) /* SD */ + if (s->buf[0] & ~s->config & (1 << 0)) { /* SD */ printf("%s: TMP105 shutdown\n", __func__); + } s->config = s->buf[0]; - s->faults = tmp105_faultq[(s->config >> 3) & 3]; /* F */ + s->faults = tmp105_faultq[(s->config >> 3) & 3]; /* F */ tmp105_alarm_update(s); break; case TMP105_REG_T_LOW: case TMP105_REG_T_HIGH: - if (s->len >= 3) + if (s->len >= 3) { s->limit[s->pointer & 1] = (int16_t) ((((uint16_t) s->buf[0]) << 8) | s->buf[1]); + } tmp105_alarm_update(s); break; } @@ -175,7 +179,7 @@ static uint8_t tmp105_rx(I2CSlave *i2c) TMP105State *s = TMP105(i2c); if (s->len < 2) { - return s->buf[s->len ++]; + return s->buf[s->len++]; } else { return 0xff; } @@ -215,7 +219,7 @@ static int tmp105_post_load(void *opaque, int version_id) { TMP105State *s = opaque; - s->faults = tmp105_faultq[(s->config >> 3) & 3]; /* F */ + s->faults = tmp105_faultq[(s->config >> 3) & 3]; /* F */ tmp105_interrupt_update(s); return 0;