From patchwork Thu Sep 12 06:52:15 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: 827776 Delivered-To: patch@linaro.org Received: by 2002:adf:ab1c:0:b0:367:895a:4699 with SMTP id q28csp1127591wrc; Wed, 11 Sep 2024 23:52:54 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWpn1tQqNMYmq3msrhbpXwUZ4Cv3bSi6ZBhsUq2ElJh9baqkoKuzHIIaao2JDtX32yphO9flw==@linaro.org X-Google-Smtp-Source: AGHT+IH5vyc+WQGmNAxv8xEjuuM0dLn6LoZxf5QV5d4/tXypvTuKTEC/LbVjjOTN8wvgeZnVaWNC X-Received: by 2002:a05:622a:52:b0:458:5dd8:c7d5 with SMTP id d75a77b69052e-4586032670emr27184701cf.31.1726123974636; Wed, 11 Sep 2024 23:52:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726123974; cv=none; d=google.com; s=arc-20240605; b=BK/PqqGHaQzmDkwmEu/auMmSJHqO15ouoxLHEvjICUKon3oqAlWKz2IdmU5fo0BiVG vM/TorvE1JAuLbsJQ+bY36mmjyZ7e7pVRZlAiXp5avqDoyMVD1A6EdYP/3ZUdfRXUMkJ glGGyqsNdl0fuaudE32ItVLXgh6oIcY72bkwYhcA9iSbbnHPOBpxIUauWbmuMLCjCEUZ FI48qTIc8S6gNZxZF7BYFj47RCzKE2kF5cU0TyGOKMr2oVc5/Mrgc4uPc91NJSprZsBQ gVsH0Ei96zNDMDoKCGj8pI4Xk6g1fzCbQQQtb4PmV0nGuYCsZwX062vxLKC6G4ssb1FX HNTw== 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:to:from :dkim-signature; bh=930EOxitUPSbWDmKCRCTZhjU+xHgrO7ejJVauC14yVw=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=EZcH90NeHCa94q5S63Jxouw1rnUqznYhaFUNI8TB5g71eA5nGXcdYHn8Opauo33QT/ 7fZFh2zPzkwFwO6ducWFxRFxLYzepyuq/cDvamp/zEU2oZbz85YdpRi3jbIhW+AZ2g+L wvih6/rQYO66wsjSctvgeRhmJx/oNzcrvtJnZurJqUCxk5mEo5LqobFGpcqvZpzNv42M JtJSfOV1tPl+DjyIN1gocJehnvKlNyfYrFv6z9LzYqgy7mbINwmcdWYjVRMQW0HHOJi1 gFLO/hG6HbRomrDMBcyNLBLiH/9FImur/fKCrEaZGFZY36jcHRtSNfgyc4/LG/EmZiA+ /Edw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NOxrXpFg; 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 d75a77b69052e-45822fb00dcsi122651581cf.624.2024.09.11.23.52.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Sep 2024 23:52:54 -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=NOxrXpFg; 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 1sodh5-0003xL-U7; Thu, 12 Sep 2024 02:52:43 -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 1sodh3-0003rw-Oy for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:52:41 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sodh1-0003Ow-SW for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:52:41 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-42cba6cdf32so4614775e9.1 for ; Wed, 11 Sep 2024 23:52:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726123958; x=1726728758; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=930EOxitUPSbWDmKCRCTZhjU+xHgrO7ejJVauC14yVw=; b=NOxrXpFgxqcO2+LzMprcOOts1kj2pJwsJRrp9QdOOGq8rBHE9FMbfwBSMeX/HQ7EIk HdD40ILENyvmHpS8FCwMr5MN46JG4Bt2ZaxPsJ1sCoOIegSKSyrp5dd7LGCoFvUCL5Lu e09yAuNgTc8VtwWn8Dl9WbQtR+O5bSgk9Li/SsHpubSl9J4O0syab/c+BIKLv8tG5qIC tpBUWAjnf4I+Ey2TKlMUCP1kuzafMcCgesG55ueSP6HIWr8GKJzx+ijGc/+zoPzJMLBA ZM6vr0q5aVzEJEvcjJ2Yi4HyD+/Dzhb+UxtVXLYhoXsPcK/C+u8kwSU8imBvdH6MhmoS kLQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726123958; x=1726728758; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=930EOxitUPSbWDmKCRCTZhjU+xHgrO7ejJVauC14yVw=; b=CmbF1ZioOScJ4EFUbL2nhlev5ko2IENOc7VhWr7Z6u8ftutstLvGhtnnNSXv2DTlNN iFeCEA71uL/p0tjUzQsV9tkKJwCjd6p3L1p7n8AOZjMq3jps0Uq8I/AxZ45L0KJXyjlU q55v6HHHmMyYipBx3z8nMDh4efSPtIE+DzvfziNvTTuupTd7Xlqk9bJe5lvm6gj0kxFG zA2XdifyU/NnQ4ui65rmE2uM4w9hFk/rELoENWamhl/lALrV0bEAAQcKfVwLh1yGTii6 mDGWGN8CbRy+e+02ToHUPIEjthyRJKqraZNsRRpadI/Zz3PKdG9P7ojDmmtBLKPPLzTg 20OQ== X-Gm-Message-State: AOJu0Yze5k3XOpbaL+cKk7by2xSD8GC0tINOWaEDpmUiv8kfRMvMvYE7 mzd+rIa8butjzQs64oRmNf/OEpkURqmPTWQWPpfIBDcUiKHFihGS+n/001y/QrzlAoUN3O4sQPw I X-Received: by 2002:a05:600c:1c04:b0:42c:bd5a:9479 with SMTP id 5b1f17b1804b1-42cdb54cf2amr14877375e9.18.1726123957154; Wed, 11 Sep 2024 23:52:37 -0700 (PDT) Received: from m1x-phil.lan (mic92-h03-176-184-33-210.dsl.sta.abo.bbox.fr. [176.184.33.210]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37895675b7esm13427501f8f.50.2024.09.11.23.52.36 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Sep 2024 23:52:36 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL v2 44/61] hw/sensor/tmp105: Coding style fixes Date: Thu, 12 Sep 2024 08:52:15 +0200 Message-ID: <20240912065227.67848-2-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240912065227.67848-1-philmd@linaro.org> References: <20240912065227.67848-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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 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 Message-Id: <20240906154911.86803-2-philmd@linaro.org> --- 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;