From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2D84842FC4; Thu, 3 Aug 2023 13:50:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B934540C35; Thu, 3 Aug 2023 13:50:33 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 6F797406BA for ; Thu, 3 Aug 2023 13:50:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691063432; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x6yfxs3SK04MsBb5cFR3qb7ahd+49tTR/UrD1VvN7WQ=; b=ibAFth4IsbjTfvskc1aivRVpjs7VxfzZqwyuq+/mOHFfwMqjs0bPsd0cy6WWXWiLKyugI2 LYGFt4GskG7o/qTCB0W3iCN1gU3YMfkDGc7prtFxqbVIdoINQ0jri04E9M8P5XKlN7Qe/g iVMrj/LKTwb8b3khYXysUPbpOA7YdBI= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-435-hG6zZZEWMQWEhbU4NuIt2Q-1; Thu, 03 Aug 2023 07:50:30 -0400 X-MC-Unique: hG6zZZEWMQWEhbU4NuIt2Q-1 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-4fe43c2562aso526906e87.0 for ; Thu, 03 Aug 2023 04:50:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691063429; x=1691668229; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=x6yfxs3SK04MsBb5cFR3qb7ahd+49tTR/UrD1VvN7WQ=; b=KAvj6xy+0/D1kWMNhlBBZ+m9ev2fG+0kjCefjGHpJbWnO+qWbl0zZ7yhj36uOjQoTb WXI075YChdybXZkm+WC/ipRAnbL3qF2+TOcvUXrbzTZFCVml7gml8nkY6JZO4dwV4j5X jGSqO2s4BxU4I3eCFSLNC21m1S/Gf8w5Vb9hCSa9inAZSaeBZDS3A++cFbLln82sblMm /HEpkeR0LPMfZ4k6wE4us+xJPHvcp7og8uCTJf8e/1Oroy9yKJQwJUg5AHIS6PHsq01V QH9JY5tPNJGPMOfboWPMMHXEcz1mjJtSj9TDMOJVj3aElsGy9BWhvffVB6HBQMiiArvi Y1rg== X-Gm-Message-State: ABy/qLbRo8shevpvfq8A7vgtsLFYo6BjW0pIsOvuc9mj5YeGfyd3ZOrs /SyDdQvqYNjlnVVyjoFNLSo3GQmu7XsyBERO+VHBWuGVx5eFGxpFAsIgCOZuQl79RTBXetHej3p RKIvrHiRc52OVmCWJklc= X-Received: by 2002:a19:2d5b:0:b0:4f9:dac6:2f3d with SMTP id t27-20020a192d5b000000b004f9dac62f3dmr2953634lft.13.1691063429186; Thu, 03 Aug 2023 04:50:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlGMQW6Q0tZDN0C9LpkIKBYynWfoMX4GiHMal+LXfB5iJWCFm2PjB9HtTcaLjP+59UC5POitG7iDZOFOoeGzQIk= X-Received: by 2002:a19:2d5b:0:b0:4f9:dac6:2f3d with SMTP id t27-20020a192d5b000000b004f9dac62f3dmr2953625lft.13.1691063428896; Thu, 03 Aug 2023 04:50:28 -0700 (PDT) MIME-Version: 1.0 References: <20230803075038.307012-1-david.marchand@redhat.com> <20230803075038.307012-3-david.marchand@redhat.com> In-Reply-To: From: David Marchand Date: Thu, 3 Aug 2023 13:50:17 +0200 Message-ID: Subject: Re: [PATCH 02/14] bus/pci: add const to some experimental API To: Bruce Richardson Cc: dev@dpdk.org, thomas@monjalon.net, ferruh.yigit@amd.com, chenbo.xia@intel.com, nipun.gupta@amd.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, Aug 3, 2023 at 11:47=E2=80=AFAM Bruce Richardson wrote: > > On Thu, Aug 03, 2023 at 09:50:25AM +0200, David Marchand wrote: > > Those functions are fine with a const on the device pointer. > > > > Signed-off-by: David Marchand > > --- > > drivers/bus/pci/pci_common.c | 4 ++-- > > drivers/bus/pci/rte_bus_pci.h | 4 ++-- > > 2 files changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.= c > > index 52404ab0fe..382b0b8946 100644 > > --- a/drivers/bus/pci/pci_common.c > > +++ b/drivers/bus/pci/pci_common.c > > @@ -814,7 +814,7 @@ rte_pci_get_iommu_class(void) > > } > > > > off_t > > -rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap) > > +rte_pci_find_ext_capability(const struct rte_pci_device *dev, uint32_t= cap) > > { > > off_t offset =3D RTE_PCI_CFG_SPACE_SIZE; > > uint32_t header; > > @@ -857,7 +857,7 @@ rte_pci_find_ext_capability(struct rte_pci_device *= dev, uint32_t cap) > > } > > > > int > > -rte_pci_set_bus_master(struct rte_pci_device *dev, bool enable) > > +rte_pci_set_bus_master(const struct rte_pci_device *dev, bool enable) > > { > > uint16_t old_cmd, cmd; > > > > While generally I'm a big fan of using const everywhere we can, I wonder = if > this is confusing here, since you are changing a setting, i.e. it's not > a read-only function. Changing a setting in the underlying hardware, yes, but the C object is left untouched. --=20 David Marchand