From patchwork Sat Apr 24 04:56:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1469881 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=Yni9Lg7W; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FRzSC2vb7z9sT6 for ; Sat, 24 Apr 2021 14:58:03 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 725B782C9E; Sat, 24 Apr 2021 06:57:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Yni9Lg7W"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 073F682B72; Sat, 24 Apr 2021 06:56:47 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7BE3782B78 for ; Sat, 24 Apr 2021 06:56:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pj1-x1036.google.com with SMTP id t13so76786pji.4 for ; Fri, 23 Apr 2021 21:56:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=I4OEz997rR5fdKLBguItVmX9VMQAOBuYf6I/8zZcZQs=; b=Yni9Lg7Wz/ir5oIpuUSA9eBuxx9Cs96dlBADXeVFjyLP960PV27OhcXHIhqNC45QwN 8FO0SWgGYtMDXPKvTub4tVkbZ6eZBkcQykjLKDvSStTcJEXiby4TXMKHnQ89CyEy37uL m2Ls9IGJFpzjhUtrRwRYaUifw/M+q0XoDGu9Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=I4OEz997rR5fdKLBguItVmX9VMQAOBuYf6I/8zZcZQs=; b=MkfL4tb1dxINU+pYb8/HZHEyHqM6X8ypATUfL/7o/qeMmG/rfmOaaJt3Buer83odgp NJpzmxzKtVxVfxiQJ8nJozaWw/YnVgoS4aDB/OLkVarpUhlYEcEjY1WfxjUZ7ol1Tw4B zUCeT7NgYs5vVMwhZqSiqX0ya0EN808sGiWrQMGmth51g256+V4TsqWB8OshLKS3q7UI iFAVi6Czgt+FKUCVdnClllgR9wvi1NQFz4RP+C2VVFQyjC58egWLVumeXgBLKs9D1GVf UMBp6oNFjKer43b4DQyZ+f6+YmkXtSY8fVaeCdMq+W62j4lhZF9ZdZlCK+pwPAsjvsrO wgEA== X-Gm-Message-State: AOAM5304ktjh9YdFixmXh90BQ/sDupR0uq5ExrP7F1Y8xgxkeiGAgjPH M8S1LNY7hOzoB89YW0GMsverHiFcJXp7dwMH X-Google-Smtp-Source: ABdhPJybRtiykgmigK3FdbO1Q7YZpuipL4p5utFrSsv0iPhM4uDTlV/71gny4Ai92PsgOyXWaVyrEA== X-Received: by 2002:a17:902:7b92:b029:eb:6fc0:39e6 with SMTP id w18-20020a1709027b92b02900eb6fc039e6mr7343763pll.83.1619240200799; Fri, 23 Apr 2021 21:56:40 -0700 (PDT) Received: from sjg1.roam.corp.google.com ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id l35sm5949077pgm.10.2021.04.23.21.56.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Apr 2021 21:56:40 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng Subject: [PATCH v2 01/16] pci: Use const for pci_find_device_id() etc. Date: Sat, 24 Apr 2021 16:56:11 +1200 Message-Id: <20210424045627.313802-2-sjg@chromium.org> X-Mailer: git-send-email 2.31.1.498.g6c1eba8ee3d-goog In-Reply-To: <20210424045627.313802-1-sjg@chromium.org> References: <20210424045627.313802-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean These functions don't modify the device-ID struct that is passed in, so mark the argument as const, so the data structure can be declared that way. This allows it to be placed in the rodata section. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- (no changes since v1) drivers/pci/pci-uclass.c | 6 +++--- include/pci.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index dfd54b339f4..dffe5297944 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -162,7 +162,7 @@ int dm_pci_bus_find_bdf(pci_dev_t bdf, struct udevice **devp) } static int pci_device_matches_ids(struct udevice *dev, - struct pci_device_id *ids) + const struct pci_device_id *ids) { struct pci_child_plat *pplat; int i; @@ -179,7 +179,7 @@ static int pci_device_matches_ids(struct udevice *dev, return -EINVAL; } -int pci_bus_find_devices(struct udevice *bus, struct pci_device_id *ids, +int pci_bus_find_devices(struct udevice *bus, const struct pci_device_id *ids, int *indexp, struct udevice **devp) { struct udevice *dev; @@ -199,7 +199,7 @@ int pci_bus_find_devices(struct udevice *bus, struct pci_device_id *ids, return -ENODEV; } -int pci_find_device_id(struct pci_device_id *ids, int index, +int pci_find_device_id(const struct pci_device_id *ids, int index, struct udevice **devp) { struct udevice *bus; diff --git a/include/pci.h b/include/pci.h index 5f36537b725..f2dfbda5b08 100644 --- a/include/pci.h +++ b/include/pci.h @@ -1070,7 +1070,7 @@ int pci_get_ff(enum pci_size_t size); * @devp: Returns matching device if found * @return 0 if found, -ENODEV if not */ -int pci_bus_find_devices(struct udevice *bus, struct pci_device_id *ids, +int pci_bus_find_devices(struct udevice *bus, const struct pci_device_id *ids, int *indexp, struct udevice **devp); /** @@ -1082,7 +1082,7 @@ int pci_bus_find_devices(struct udevice *bus, struct pci_device_id *ids, * @devp: Returns matching device if found * @return 0 if found, -ENODEV if not */ -int pci_find_device_id(struct pci_device_id *ids, int index, +int pci_find_device_id(const struct pci_device_id *ids, int index, struct udevice **devp); /**