From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDF15C48BC2 for ; Sun, 27 Jun 2021 23:51:36 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1532C61C31 for ; Sun, 27 Jun 2021 23:51:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1532C61C31 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 35E2582D72; Mon, 28 Jun 2021 01:51:31 +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="PzKaISdz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9FF4982D49; Mon, 28 Jun 2021 01:51:25 +0200 (CEST) Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) (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 8096D82CDE for ; Mon, 28 Jun 2021 01:51:22 +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-ot1-x330.google.com with SMTP id i12-20020a05683033ecb02903346fa0f74dso16740304otu.10 for ; Sun, 27 Jun 2021 16:51:22 -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=BjST5LmQb1xcKdDEIvkJMv5LkahRhtCYNIwLynI5UC4=; b=PzKaISdztuvHGi61K7s8/QGPXap/lYr+wz5M60hX75W/LqakFr8BwbWJ7N2IGFu9n5 wHS61/zmU4Y+Xr0WUf0tDs4C8QZgmMC/mRXX0PY5zYu1QG3+fmQXXdGOHdcl2A6XdBDY BQ4KMuvMJKuJoLcMrPYCb18pVZD0JXQdE+DVY= 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=BjST5LmQb1xcKdDEIvkJMv5LkahRhtCYNIwLynI5UC4=; b=JfEtYlHh/ZGj8haJWiQCUw9HNvtgQyw7dMAZrJDIR1X/ych3xBUjsIm9fvnYBc/rw8 YD0Tf5iEjwB01NT72/2FwSKYk0zaCjP9OgcywkqvyEA4KCiejO2Ro7PJHK3d5+P8+Vh9 2CBoFCFCaLtKBp0F032JWja36jGM7WTmXDLXv/TY39MvsmiNZSUEk6ZLGp13h6NDBfP1 KE0npl+JD10xL/Sa0H2MYJxhmidAQDzMRwitOTOiDmYmHBpxag7+E0P/08QrgQFzH1f4 zcubrHtNq1S2hI8GH4P8XIrnWNQhs1zJY6j+B7qZ/DBb7s/7Eg6RP5KGE+jNvVwSO08d 0HGg== X-Gm-Message-State: AOAM531PfEDHQ1ewcno/KPxOosvFZ8k2oLH7WNFooo/f2poMkDLtnBdK aiq9TS92s/hQFBQuNnQjh4w09gW8NHvMs5RE X-Google-Smtp-Source: ABdhPJxGjuayIqOlP+Mkgc1QfmEPx3cVKrOHXqEURXFr5aX1B6cISFxT8rTwyB92Ivkg+DiEq5MN2Q== X-Received: by 2002:a9d:4809:: with SMTP id c9mr18618195otf.94.1624837881182; Sun, 27 Jun 2021 16:51:21 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id bb34sm1297928oob.39.2021.06.27.16.51.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Jun 2021 16:51:20 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng Subject: [PATCH v3 01/16] pci: Use const for pci_find_device_id() etc. Date: Sun, 27 Jun 2021 17:50:56 -0600 Message-Id: <20210627235111.485507-2-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210627235111.485507-1-sjg@chromium.org> References: <20210627235111.485507-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.103.2 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 22a033e6329..d64fbe0627b 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 2353cebb2a3..2ee6138324f 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); /** -- 2.32.0.93.g670b81a890-goog