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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EA70C433F5 for ; Thu, 21 Oct 2021 12:56:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 09051610C8 for ; Thu, 21 Oct 2021 12:56:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 09051610C8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:39560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdXc2-0005Du-RB for qemu-devel@archiver.kernel.org; Thu, 21 Oct 2021 08:56:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35672) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdXau-0004X8-Cu for qemu-devel@nongnu.org; Thu, 21 Oct 2021 08:54:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:49290) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdXas-0007D1-3e for qemu-devel@nongnu.org; Thu, 21 Oct 2021 08:54:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634820889; 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=hwuF1zT9+lJ/xZCf0fc227ElB/0m1lX5DfWEklhd0PY=; b=fEE0caFNcIaPMyBCKOGqee1ievcifBH/G3VE7swc638gfQQmOcAn/gOo40umiN+cP3nkYT H1aoRP4QFC3gvC3Ar6PgMwnbI9drZqmDGRA1go0jFD0Imwxxs9cBe/ujO46ayU8gBtxOAm aI653Eb7mgJjWSfkHI/+vUlfZHRpKho= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-522-TW4NSWrjPDqKKQr0GJe8AQ-1; Thu, 21 Oct 2021 08:54:48 -0400 X-MC-Unique: TW4NSWrjPDqKKQr0GJe8AQ-1 Received: by mail-wm1-f70.google.com with SMTP id v10-20020a1cf70a000000b00318203a6bd1so284209wmh.6 for ; Thu, 21 Oct 2021 05:54:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:from:to:cc:references:in-reply-to :content-transfer-encoding; bh=hwuF1zT9+lJ/xZCf0fc227ElB/0m1lX5DfWEklhd0PY=; b=vN1St1DK7YhLswsj3cU70UORRDDe8StuGidhtuGzjOF0gzqmUcv62AnTRlV5dxY1VR 170N6rcvXltOcmWX/OmYy07F+6zSpnVoU5+fOdyH0aqOVa2y7Vwop9E6bOAfYLaqqx7A dBsBBpALQabWKFWnweIps8aKxZUUSl/+GPJ0iLGtMn4pzdXRMB7kZvQkQUZImKABcW72 bqtxfqUgwDP1lzdM4Efl9ostvWXnnQHf0RjD79uZj97NXZk612qEbZ98q+gBoz69K5wd gwR5qpcMITTl+x74v9lRqbMLUBh3JhvU/zdjG+4i693MmmawWlHB5MrCuc258+2ws1Cr fFxw== X-Gm-Message-State: AOAM532uBwoV90A80MVbAj2xnQhNJZM0xQImyjFf1XVbaoVMRliZfJwe +ZjJP3pPdQgXXfs4EKci9ZSaf2jLYP/JsKh+aqEQaGH75VNGNDFByp8wbEL9gKYRxHQIPESFP8i d4PGP9lcfl9P8Rfg= X-Received: by 2002:a5d:6ac3:: with SMTP id u3mr4551081wrw.357.1634820886933; Thu, 21 Oct 2021 05:54:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxoHIoFMXp/k56j6/jEOQ8EFUCS9/b4eQE5anIx9koa7BqdT2kjRUNjLbj8Dr3OUGdmJxpgw== X-Received: by 2002:a5d:6ac3:: with SMTP id u3mr4551039wrw.357.1634820886665; Thu, 21 Oct 2021 05:54:46 -0700 (PDT) Received: from [192.168.1.36] (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id i13sm5512735wmq.41.2021.10.21.05.54.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Oct 2021 05:54:46 -0700 (PDT) Message-ID: Date: Thu, 21 Oct 2021 14:54:44 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 Subject: Re: [PATCH 4/8] pci: Define pci_bus_fn/pci_bus_ret_fn type From: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= To: Peter Xu , qemu-devel@nongnu.org References: <20211021104259.57754-1-peterx@redhat.com> <20211021104259.57754-5-peterx@redhat.com> In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -56 X-Spam_score: -5.7 X-Spam_bar: ----- X-Spam_report: (-5.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-2.867, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , "Daniel P . Berrange" , Eduardo Habkost , David Hildenbrand , Jason Wang , "Michael S . Tsirkin" , Markus Armbruster , Shannon Zhao , Alex Williamson , Eric Auger , Igor Mammedov , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 10/21/21 13:44, Philippe Mathieu-Daudé wrote: > On 10/21/21 12:42, Peter Xu wrote: >> The pci_bus_fn is similar to pci_bus_dev_fn that only takes a PCIBus* and an >> opaque. The pci_bus_ret_fn is similar to pci_bus_fn but it allows to return a >> void* pointer. >> >> Use them where proper in pci.[ch], and to be used elsewhere. >> >> Signed-off-by: Peter Xu >> --- >> hw/pci/pci.c | 6 ++---- >> include/hw/pci/pci.h | 12 +++++------- >> 2 files changed, 7 insertions(+), 11 deletions(-) > >> --- a/include/hw/pci/pci.h >> +++ b/include/hw/pci/pci.h >> @@ -402,6 +402,8 @@ OBJECT_DECLARE_TYPE(PCIBus, PCIBusClass, PCI_BUS) >> #define TYPE_PCIE_BUS "PCIE" >> >> typedef void (*pci_bus_dev_fn)(PCIBus *b, PCIDevice *d, void *opaque); >> +typedef void (*pci_bus_fn)(PCIBus *b, void *opaque); >> +typedef void* (*pci_bus_ret_fn)(PCIBus *b, void *opaque); Now looking at patch #8, I wonder if it wouldn't be cleaner to have a single: /* * pci_bus_fn: * @bus: PCI bus * @opaque: Pointer to opaque pointer, can be used as input *and* output * Return #true on success, #false on failure */ typedef bool (*pci_bus_fn)(PCIBus *bus, void **opaque);