diff mbox series

[09/19] hw/misc/unimp: Move struct to header file

Message ID 20180220180325.29818-10-peter.maydell@linaro.org
State Superseded
Headers show
Series Add Cortex-M33 and mps2-an505 board model | expand

Commit Message

Peter Maydell Feb. 20, 2018, 6:03 p.m. UTC
Move the definition of the struct for the unimplemented-device
from unimp.c to unimp.h, so that users can embed the struct
in their own device structs if they prefer.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

---
 include/hw/misc/unimp.h | 10 ++++++++++
 hw/misc/unimp.c         | 10 ----------
 2 files changed, 10 insertions(+), 10 deletions(-)

-- 
2.16.1

Comments

Philippe Mathieu-Daudé Feb. 20, 2018, 6:27 p.m. UTC | #1
On 02/20/2018 03:03 PM, Peter Maydell wrote:
> Move the definition of the struct for the unimplemented-device

> from unimp.c to unimp.h, so that users can embed the struct

> in their own device structs if they prefer.

> 

> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


> ---

>  include/hw/misc/unimp.h | 10 ++++++++++

>  hw/misc/unimp.c         | 10 ----------

>  2 files changed, 10 insertions(+), 10 deletions(-)

> 

> diff --git a/include/hw/misc/unimp.h b/include/hw/misc/unimp.h

> index 52e068ec3e..2a291ca42d 100644

> --- a/include/hw/misc/unimp.h

> +++ b/include/hw/misc/unimp.h

> @@ -12,6 +12,16 @@

>  

>  #define TYPE_UNIMPLEMENTED_DEVICE "unimplemented-device"

>  

> +#define UNIMPLEMENTED_DEVICE(obj) \

> +    OBJECT_CHECK(UnimplementedDeviceState, (obj), TYPE_UNIMPLEMENTED_DEVICE)

> +

> +typedef struct {

> +    SysBusDevice parent_obj;

> +    MemoryRegion iomem;

> +    char *name;

> +    uint64_t size;

> +} UnimplementedDeviceState;

> +

>  /**

>   * create_unimplemented_device: create and map a dummy device

>   * @name: name of the device for debug logging

> diff --git a/hw/misc/unimp.c b/hw/misc/unimp.c

> index bcbb585888..1c0ba2f0a7 100644

> --- a/hw/misc/unimp.c

> +++ b/hw/misc/unimp.c

> @@ -18,16 +18,6 @@

>  #include "qemu/log.h"

>  #include "qapi/error.h"

>  

> -#define UNIMPLEMENTED_DEVICE(obj) \

> -    OBJECT_CHECK(UnimplementedDeviceState, (obj), TYPE_UNIMPLEMENTED_DEVICE)

> -

> -typedef struct {

> -    SysBusDevice parent_obj;

> -    MemoryRegion iomem;

> -    char *name;

> -    uint64_t size;

> -} UnimplementedDeviceState;

> -

>  static uint64_t unimp_read(void *opaque, hwaddr offset, unsigned size)

>  {

>      UnimplementedDeviceState *s = UNIMPLEMENTED_DEVICE(opaque);

>
Richard Henderson Feb. 27, 2018, 8:50 p.m. UTC | #2
On 02/20/2018 10:03 AM, Peter Maydell wrote:
> Move the definition of the struct for the unimplemented-device

> from unimp.c to unimp.h, so that users can embed the struct

> in their own device structs if they prefer.

> 

> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

> ---

>  include/hw/misc/unimp.h | 10 ++++++++++

>  hw/misc/unimp.c         | 10 ----------

>  2 files changed, 10 insertions(+), 10 deletions(-)


Reviewed-by: Richard Henderson <richard.henderson@linaro.org>



r~
diff mbox series

Patch

diff --git a/include/hw/misc/unimp.h b/include/hw/misc/unimp.h
index 52e068ec3e..2a291ca42d 100644
--- a/include/hw/misc/unimp.h
+++ b/include/hw/misc/unimp.h
@@ -12,6 +12,16 @@ 
 
 #define TYPE_UNIMPLEMENTED_DEVICE "unimplemented-device"
 
+#define UNIMPLEMENTED_DEVICE(obj) \
+    OBJECT_CHECK(UnimplementedDeviceState, (obj), TYPE_UNIMPLEMENTED_DEVICE)
+
+typedef struct {
+    SysBusDevice parent_obj;
+    MemoryRegion iomem;
+    char *name;
+    uint64_t size;
+} UnimplementedDeviceState;
+
 /**
  * create_unimplemented_device: create and map a dummy device
  * @name: name of the device for debug logging
diff --git a/hw/misc/unimp.c b/hw/misc/unimp.c
index bcbb585888..1c0ba2f0a7 100644
--- a/hw/misc/unimp.c
+++ b/hw/misc/unimp.c
@@ -18,16 +18,6 @@ 
 #include "qemu/log.h"
 #include "qapi/error.h"
 
-#define UNIMPLEMENTED_DEVICE(obj) \
-    OBJECT_CHECK(UnimplementedDeviceState, (obj), TYPE_UNIMPLEMENTED_DEVICE)
-
-typedef struct {
-    SysBusDevice parent_obj;
-    MemoryRegion iomem;
-    char *name;
-    uint64_t size;
-} UnimplementedDeviceState;
-
 static uint64_t unimp_read(void *opaque, hwaddr offset, unsigned size)
 {
     UnimplementedDeviceState *s = UNIMPLEMENTED_DEVICE(opaque);