[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 01/20] xics: Use incomplete type for XICSFabric
From: |
Greg Kurz |
Subject: |
Re: [PATCH 01/20] xics: Use incomplete type for XICSFabric |
Date: |
Wed, 25 Sep 2019 09:45:01 +0200 |
On Wed, 25 Sep 2019 16:45:15 +1000
David Gibson <address@hidden> wrote:
> Interface instances should never be directly dereferenced. So, the common
> practice is to make them incomplete types to make sure no-one does that.
> XICSFrabric, however, had a dummy type which is less safe.
>
> Signed-off-by: David Gibson <address@hidden>
> ---
> include/hw/ppc/xics.h | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h
> index 64a2c8862a..1ae34ce9cd 100644
> --- a/include/hw/ppc/xics.h
> +++ b/include/hw/ppc/xics.h
> @@ -147,9 +147,7 @@ struct ICSIRQState {
> uint8_t flags;
> };
>
> -struct XICSFabric {
> - Object parent;
> -};
Ok.
> +typedef struct XICSFabric XICSFabric;
>
Nak. We already have this statement earlier in this file and
we must keep it there since it is used in the definition of
some other types. I guess this doesn't cause any compiler
warning because the type is incomplete.
With this duplicate typedef removed,
Reviewed-by: Greg Kurz <address@hidden>
> #define TYPE_XICS_FABRIC "xics-fabric"
> #define XICS_FABRIC(obj) \
- [PATCH 00/20] spapr: IRQ subsystem cleanups, David Gibson, 2019/09/25
- [PATCH 01/20] xics: Use incomplete type for XICSFabric, David Gibson, 2019/09/25
- [PATCH 04/20] xics: Eliminate reset hook, David Gibson, 2019/09/25
- [PATCH 02/20] xics: Eliminate 'reject', 'resend' and 'eoi' class hooks, David Gibson, 2019/09/25
- [PATCH 07/20] spapr: Fold spapr_phb_lsi_qirq() into its single caller, David Gibson, 2019/09/25
- [PATCH 08/20] spapr: Replace spapr_vio_qirq() helper with spapr_vio_irq_pulse() helper, David Gibson, 2019/09/25