From patchwork Thu May 1 21:04:50 2025 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: 886374 Delivered-To: patch@linaro.org Received: by 2002:a5d:430f:0:b0:38f:210b:807b with SMTP id h15csp514491wrq; Thu, 1 May 2025 14:07:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXLj9NqF2UD5Oi9t0/EMMVi6GNKIAAn8exnCmQPcnrO2i36m8ce/7pr8zbPZC1N0WpR/E8klg==@linaro.org X-Google-Smtp-Source: AGHT+IFDohpDKow7uRYeMhmtp9RF9LKuHTz3eG+zD0V9JowiNx2pokwsWEhSGZ/McfepeCpStBJf X-Received: by 2002:ad4:5bec:0:b0:6ea:d033:2853 with SMTP id 6a1803df08f44-6f51527cbe6mr11954476d6.16.1746133672332; Thu, 01 May 2025 14:07:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1746133672; cv=none; d=google.com; s=arc-20240605; b=TrY9YwJ5rdLu33f3d2yoVvEGw1bK6byxAbye8ZyNoijVH+m2klA9r5dF48Zthmrqck gRgrC3CI8d3QTj8FhXKRqwTH5t4HmN3Gxpc4qKfNWOzbuhON1T7lYFJ/8LckR6z8DMj5 zxWj/XNvEUuziCuiJt07Z1oTJtN0RbT7BVTxSwxj2jLVJHadhpbS7oXWuXP+QIpFh4ij ALVX6wCZVwBymk8diDlSFZlhbuJFcXJUvx4qvskY/iboBc2i1fcF65ABOevtspJ4OgqV sCp5hqOo25HXkyPnI3t0C9+K7umsO62I593gUveL8Tk+ieQZhtuM58mwwkbC03+baBpB V4KQ== 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=pT5M0lz4iXxP6eQat70i7GTGsl8o8UafTe6D3H+LKG8=; fh=uloqeIiLIhsqAWHY8zIEmzfMIcw7bGWZuINspytDykk=; b=hxCEdi/lK2oc6xEaUaR/fvLf05AzA3ItBvuwzRpusmA0tCLiU3jh7HOwZFsLJk558k StUQzYshonnBjxPEdrW8Y6J+xJysnUEvEozuPyVShf7B3hmDLva76BIhjZvKn/WvBDjA EL3a0e4wm7Oa/oeZlTmyD/YlUMa2CzFvOwxIq4sCY5rlQMIUrdtGznzZ53bGCIJnQX8s k3PxzznwbEVybYcZ6zkuBrQzLtFRtGRjT9YRHaqupQUiYCmnS3b+xusENrAJRgA0a2e8 e6TBdlG4aHYvce9fQuYqJaYRm7urIwzEQwHs7r5lyPk5u9M0OqgJ0mIrK8gbLW+oo+1/ Tbmw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Sua5MDqv; 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 af79cd13be357-7cad241be5dsi150459885a.328.2025.05.01.14.07.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 May 2025 14:07:52 -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=Sua5MDqv; 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 1uAb7b-0003Ny-4x; Thu, 01 May 2025 17:07:08 -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 1uAb7J-0002hA-3e for qemu-devel@nongnu.org; Thu, 01 May 2025 17:06:49 -0400 Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uAb7H-0006kk-K2 for qemu-devel@nongnu.org; Thu, 01 May 2025 17:06:48 -0400 Received: by mail-il1-x12a.google.com with SMTP id e9e14a558f8ab-3d7f111e9e1so15688715ab.1 for ; Thu, 01 May 2025 14:06:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746133606; x=1746738406; 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=pT5M0lz4iXxP6eQat70i7GTGsl8o8UafTe6D3H+LKG8=; b=Sua5MDqv7+6kbyAqjpct4jTdLQdqHqv0IN5nm61nsYJ5oko+xCpP0FaSGXQrt4x2kz HPMfOt6CDVHsFVaekaf3aGxjsemz9+90wqyYKOBZMJbeko1U6JCQ1ncv5zwyNsR+7uCT lUOsJQtpHnneU9UCRnozttz0HTE3s5d8HLdzUfZFP7332y6qS5xPB78DRT3z5BuYDXPg zHezqZRJ32bbNvsTmy/NTI7jbu3e1dkPoPYloJiiMTwzm2TXD9ogoBtHOJ1GeDoXEQg2 4OMCSKuKVKXIyG27Q42OaWrmUr5UWj+/1sgOFwvE9JDJYjnNn/TWujAWjDoqKE+kEa2H WTng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746133606; x=1746738406; 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=pT5M0lz4iXxP6eQat70i7GTGsl8o8UafTe6D3H+LKG8=; b=k3fDjbHxesh7wskVBgObOmDgFDUZDMht8hTqXhbgQG85tPCW4clkUYbgnssJMD80E7 O/WwKDiEpzaop79aqbB5qtG/OZHfqKcV0qi6KIpt2oJYDYGB8ITOzoX+FqXxc4HN31Np 2LSm2ngE9kUUZCBPt9E3rtSWI6u3qnc8A5aDQetl/MpIp4GHEaL0s/ZUMqrI2BE3CAe9 c/MLMVQ5U2quTjCCmLyhQkbKfH5W/SmIwWBBOh6lVHUYSXnqUUdC2hTX5N6mtEuPouzz FKibBVkvyKiuu1Pcfe/k0/UyzYSs3Qd1WmZjeTTOU11A/8F5ERy5kxSXlPof20wInEcl OPXA== X-Gm-Message-State: AOJu0Yy139C/nAAjJFYA5pjO5tp8YQO4fHhmaX8W/+522xWT4R2Fsiia MYK2/66j/kAAs4yh1mVVAR1bkUBsx1Xg19vKmQ50QqU0rAAP+QV1yKMm4r2qPEb1Vfv/mo/DEvk b X-Gm-Gg: ASbGnct3wdKD6W9/48b+0xLet8fybJnsntJclyZedANecZ4nQ3W6s7Sgt95A8ybzms0 /wneDWZsBc/TnIVbEskPoAFYjQiyU74yTzJlBD/hta9VWkUO1m3rH8sDVS94GL0XswLag9NWSN0 WQ1ADmyfXanyelwkbr4dErP96ZjosczXKA3ctrTIeuvOt5J3v4UHkMY5ezUI7ahyS+pcPpotfrL hxAmiM470Gntk+VwOSEI4y9KA6l+flfSUSuacFVTtz3CdgeVUBrKLmffRrWDHJbCMu0KbjnOrmv uf065jw6suMvw3czj0cNnGaSCYhCAGA3l47RuKbKc32ga+cGSQ8zcKkbpMzNMElzBzdkjJl8xPN u0Lx59pS3sY3Qkr4= X-Received: by 2002:a05:6e02:3784:b0:3d8:21ae:d9c with SMTP id e9e14a558f8ab-3d97c154012mr5765095ab.5.1746133606161; Thu, 01 May 2025 14:06:46 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4f88aac7e27sm44626173.138.2025.05.01.14.06.42 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 01 May 2025 14:06:45 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Cl=C3=A9ment_Mathieu--Drif?= , Zhao Liu , Hanna Reitz , Igor Mammedov , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Paolo Bonzini , Eduardo Habkost , qemu-block@nongnu.org, Jason Wang , Richard Henderson , Yanan Wang , Ani Sinha , "Michael S. Tsirkin" , Thomas Huth , Gerd Hoffmann , Kevin Wolf , Yi Liu Subject: [PATCH 12/18] hw/nvram/fw_cfg: Inline fw_cfg_file_slots() Date: Thu, 1 May 2025 23:04:50 +0200 Message-ID: <20250501210456.89071-13-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250501210456.89071-1-philmd@linaro.org> References: <20250501210456.89071-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::12a; envelope-from=philmd@linaro.org; helo=mail-il1-x12a.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=unavailable 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 Now than fw_cfg_file_slots() only returns FW_CFG_FILE_SLOTS_DFLT, we can inline it. Signed-off-by: Philippe Mathieu-Daudé --- hw/nvram/fw_cfg.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 71c41c979d7..de65ee8342e 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -255,15 +255,10 @@ static void fw_cfg_write(FWCfgState *s, uint8_t value) /* nothing, write support removed in QEMU v2.4+ */ } -static inline uint16_t fw_cfg_file_slots(const FWCfgState *s) -{ - return FW_CFG_FILE_SLOTS_DFLT; -} - /* Note: this function returns an exclusive limit. */ static inline uint32_t fw_cfg_max_entry(const FWCfgState *s) { - return FW_CFG_FILE_FIRST + fw_cfg_file_slots(s); + return FW_CFG_FILE_FIRST + FW_CFG_FILE_SLOTS_DFLT; } static int fw_cfg_select(FWCfgState *s, uint16_t key) @@ -845,13 +840,13 @@ void fw_cfg_add_file_callback(FWCfgState *s, const char *filename, int order = 0; if (!s->files) { - dsize = sizeof(uint32_t) + sizeof(FWCfgFile) * fw_cfg_file_slots(s); + dsize = sizeof(uint32_t) + sizeof(FWCfgFile) * FW_CFG_FILE_SLOTS_DFLT; s->files = g_malloc0(dsize); fw_cfg_add_bytes(s, FW_CFG_FILE_DIR, s->files, dsize); } count = be32_to_cpu(s->files->count); - assert(count < fw_cfg_file_slots(s)); + assert(count < FW_CFG_FILE_SLOTS_DFLT); /* Find the insertion point, sorting by file name. */ for (index = count; @@ -926,7 +921,7 @@ void *fw_cfg_modify_file(FWCfgState *s, const char *filename, } } - assert(index < fw_cfg_file_slots(s)); + assert(index < FW_CFG_FILE_SLOTS_DFLT); /* add new one */ fw_cfg_add_file_callback(s, filename, NULL, NULL, NULL, data, len, true);