Message ID | 20191002025208.3487-2-david@gibson.dropbear.id.au |
---|---|
State | New |
Headers | show |
Series | spapr: IRQ subsystem cleanup | expand |
On 02/10/2019 04:51, David Gibson 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. > > We were also using OBJECT_CHECK() where we should have been using > INTERFACE_CHECK(). > > Signed-off-by: David Gibson <david@gibson.dropbear.id.au> > Reviewed-by: Greg Kurz <groug@kaod.org> Reviewed-by: Greg Kurz <groug@kaod.org> > --- > include/hw/ppc/xics.h | 6 +----- > 1 file changed, 1 insertion(+), 5 deletions(-) > > diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h > index 64a2c8862a..faa33ae943 100644 > --- a/include/hw/ppc/xics.h > +++ b/include/hw/ppc/xics.h > @@ -147,13 +147,9 @@ struct ICSIRQState { > uint8_t flags; > }; > > -struct XICSFabric { > - Object parent; > -}; > - > #define TYPE_XICS_FABRIC "xics-fabric" > #define XICS_FABRIC(obj) \ > - OBJECT_CHECK(XICSFabric, (obj), TYPE_XICS_FABRIC) > + INTERFACE_CHECK(XICSFabric, (obj), TYPE_XICS_FABRIC) > #define XICS_FABRIC_CLASS(klass) \ > OBJECT_CLASS_CHECK(XICSFabricClass, (klass), TYPE_XICS_FABRIC) > #define XICS_FABRIC_GET_CLASS(obj) \ >
On 02/10/2019 07:51, Cédric Le Goater wrote: > On 02/10/2019 04:51, David Gibson 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. >> >> We were also using OBJECT_CHECK() where we should have been using >> INTERFACE_CHECK(). >> >> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> >> Reviewed-by: Greg Kurz <groug@kaod.org> > > Reviewed-by: Greg Kurz <groug@kaod.org> pfff ... Reviewed-by: Cédric Le Goater <clg@kaod.org> > >> --- >> include/hw/ppc/xics.h | 6 +----- >> 1 file changed, 1 insertion(+), 5 deletions(-) >> >> diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h >> index 64a2c8862a..faa33ae943 100644 >> --- a/include/hw/ppc/xics.h >> +++ b/include/hw/ppc/xics.h >> @@ -147,13 +147,9 @@ struct ICSIRQState { >> uint8_t flags; >> }; >> >> -struct XICSFabric { >> - Object parent; >> -}; >> - >> #define TYPE_XICS_FABRIC "xics-fabric" >> #define XICS_FABRIC(obj) \ >> - OBJECT_CHECK(XICSFabric, (obj), TYPE_XICS_FABRIC) >> + INTERFACE_CHECK(XICSFabric, (obj), TYPE_XICS_FABRIC) >> #define XICS_FABRIC_CLASS(klass) \ >> OBJECT_CLASS_CHECK(XICSFabricClass, (klass), TYPE_XICS_FABRIC) >> #define XICS_FABRIC_GET_CLASS(obj) \ >> > >
On Wed, Oct 02, 2019 at 07:51:45AM +0200, Cédric Le Goater wrote: > On 02/10/2019 04:51, David Gibson 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. > > > > We were also using OBJECT_CHECK() where we should have been using > > INTERFACE_CHECK(). > > > > Signed-off-by: David Gibson <david@gibson.dropbear.id.au> > > Reviewed-by: Greg Kurz <groug@kaod.org> > > Reviewed-by: Greg Kurz <groug@kaod.org> Uhhh... you sent me an R-b line for Greg, not yourself... > > > --- > > include/hw/ppc/xics.h | 6 +----- > > 1 file changed, 1 insertion(+), 5 deletions(-) > > > > diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h > > index 64a2c8862a..faa33ae943 100644 > > --- a/include/hw/ppc/xics.h > > +++ b/include/hw/ppc/xics.h > > @@ -147,13 +147,9 @@ struct ICSIRQState { > > uint8_t flags; > > }; > > > > -struct XICSFabric { > > - Object parent; > > -}; > > - > > #define TYPE_XICS_FABRIC "xics-fabric" > > #define XICS_FABRIC(obj) \ > > - OBJECT_CHECK(XICSFabric, (obj), TYPE_XICS_FABRIC) > > + INTERFACE_CHECK(XICSFabric, (obj), TYPE_XICS_FABRIC) > > #define XICS_FABRIC_CLASS(klass) \ > > OBJECT_CLASS_CHECK(XICSFabricClass, (klass), TYPE_XICS_FABRIC) > > #define XICS_FABRIC_GET_CLASS(obj) \ > > >
On Wed, 2 Oct 2019 15:55:51 +1000 David Gibson <david@gibson.dropbear.id.au> wrote: > On Wed, Oct 02, 2019 at 07:51:45AM +0200, Cédric Le Goater wrote: > > On 02/10/2019 04:51, David Gibson 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. > > > > > > We were also using OBJECT_CHECK() where we should have been using > > > INTERFACE_CHECK(). > > > > > > Signed-off-by: David Gibson <david@gibson.dropbear.id.au> > > > Reviewed-by: Greg Kurz <groug@kaod.org> > > > > Reviewed-by: Greg Kurz <groug@kaod.org> > > Uhhh... you sent me an R-b line for Greg, not yourself... > Heh it's because people confuse our names so often that we don't really know where we stand now. -- Cedric ;-) > > > > > --- > > > include/hw/ppc/xics.h | 6 +----- > > > 1 file changed, 1 insertion(+), 5 deletions(-) > > > > > > diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h > > > index 64a2c8862a..faa33ae943 100644 > > > --- a/include/hw/ppc/xics.h > > > +++ b/include/hw/ppc/xics.h > > > @@ -147,13 +147,9 @@ struct ICSIRQState { > > > uint8_t flags; > > > }; > > > > > > -struct XICSFabric { > > > - Object parent; > > > -}; > > > - > > > #define TYPE_XICS_FABRIC "xics-fabric" > > > #define XICS_FABRIC(obj) \ > > > - OBJECT_CHECK(XICSFabric, (obj), TYPE_XICS_FABRIC) > > > + INTERFACE_CHECK(XICSFabric, (obj), TYPE_XICS_FABRIC) > > > #define XICS_FABRIC_CLASS(klass) \ > > > OBJECT_CLASS_CHECK(XICSFabricClass, (klass), TYPE_XICS_FABRIC) > > > #define XICS_FABRIC_GET_CLASS(obj) \ > > > > > >
diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 64a2c8862a..faa33ae943 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -147,13 +147,9 @@ struct ICSIRQState { uint8_t flags; }; -struct XICSFabric { - Object parent; -}; - #define TYPE_XICS_FABRIC "xics-fabric" #define XICS_FABRIC(obj) \ - OBJECT_CHECK(XICSFabric, (obj), TYPE_XICS_FABRIC) + INTERFACE_CHECK(XICSFabric, (obj), TYPE_XICS_FABRIC) #define XICS_FABRIC_CLASS(klass) \ OBJECT_CLASS_CHECK(XICSFabricClass, (klass), TYPE_XICS_FABRIC) #define XICS_FABRIC_GET_CLASS(obj) \