diff mbox series

[1/4] pflash_cfi01: Add pflash_cfi01_get_blk() helper

Message ID 20190304194857.9780-2-philmd@redhat.com
State New
Headers show
Series pc: Support firmware configuration with -blockdev (splitted) | expand

Commit Message

Philippe Mathieu-Daudé March 4, 2019, 7:48 p.m. UTC
Add an helper to access the opaque struct PFlashCFI01.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
[PMD: Extracted from bigger patch]
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/block/pflash_cfi01.c  | 5 +++++
 include/hw/block/flash.h | 1 +
 2 files changed, 6 insertions(+)

Comments

Laszlo Ersek March 5, 2019, 5:17 p.m. UTC | #1
On 03/04/19 20:48, Philippe Mathieu-Daudé wrote:
> Add an helper to access the opaque struct PFlashCFI01.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> [PMD: Extracted from bigger patch]
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/block/pflash_cfi01.c  | 5 +++++
>  include/hw/block/flash.h | 1 +
>  2 files changed, 6 insertions(+)
> 
> diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
> index 9d1c356eb6..9ecab693e8 100644
> --- a/hw/block/pflash_cfi01.c
> +++ b/hw/block/pflash_cfi01.c
> @@ -972,6 +972,11 @@ MemoryRegion *pflash_cfi01_get_memory(PFlashCFI01 *fl)
>      return &fl->mem;
>  }
>  
> +BlockBackend *pflash_cfi01_get_blk(PFlashCFI01 *fl)
> +{
> +    return fl->blk;
> +}
> +
>  static void postload_update_cb(void *opaque, int running, RunState state)
>  {
>      PFlashCFI01 *pfl = opaque;
> diff --git a/include/hw/block/flash.h b/include/hw/block/flash.h
> index 914932eaec..a0f488732a 100644
> --- a/include/hw/block/flash.h
> +++ b/include/hw/block/flash.h
> @@ -22,6 +22,7 @@ PFlashCFI01 *pflash_cfi01_register(hwaddr base,
>                                     uint16_t id0, uint16_t id1,
>                                     uint16_t id2, uint16_t id3,
>                                     int be);
> +BlockBackend *pflash_cfi01_get_blk(PFlashCFI01 *fl);
>  MemoryRegion *pflash_cfi01_get_memory(PFlashCFI01 *fl);
>  
>  /* pflash_cfi02.c */
> 

I generally prefer to keep the same order between declarations of
functions, and definitions of the same functions. Compare
pflash_cfi01_get_memory() here.

With that updated,

Reviewed-by: Laszlo Ersek <lersek@redhat.com>


Thanks
Laszlo
Markus Armbruster March 6, 2019, 2:16 p.m. UTC | #2
Laszlo Ersek <lersek@redhat.com> writes:

> On 03/04/19 20:48, Philippe Mathieu-Daudé wrote:
>> Add an helper to access the opaque struct PFlashCFI01.
>> 
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> [PMD: Extracted from bigger patch]
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>>  hw/block/pflash_cfi01.c  | 5 +++++
>>  include/hw/block/flash.h | 1 +
>>  2 files changed, 6 insertions(+)
>> 
>> diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
>> index 9d1c356eb6..9ecab693e8 100644
>> --- a/hw/block/pflash_cfi01.c
>> +++ b/hw/block/pflash_cfi01.c
>> @@ -972,6 +972,11 @@ MemoryRegion *pflash_cfi01_get_memory(PFlashCFI01 *fl)
>>      return &fl->mem;
>>  }
>>  
>> +BlockBackend *pflash_cfi01_get_blk(PFlashCFI01 *fl)
>> +{
>> +    return fl->blk;
>> +}
>> +
>>  static void postload_update_cb(void *opaque, int running, RunState state)
>>  {
>>      PFlashCFI01 *pfl = opaque;
>> diff --git a/include/hw/block/flash.h b/include/hw/block/flash.h
>> index 914932eaec..a0f488732a 100644
>> --- a/include/hw/block/flash.h
>> +++ b/include/hw/block/flash.h
>> @@ -22,6 +22,7 @@ PFlashCFI01 *pflash_cfi01_register(hwaddr base,
>>                                     uint16_t id0, uint16_t id1,
>>                                     uint16_t id2, uint16_t id3,
>>                                     int be);
>> +BlockBackend *pflash_cfi01_get_blk(PFlashCFI01 *fl);
>>  MemoryRegion *pflash_cfi01_get_memory(PFlashCFI01 *fl);
>>  
>>  /* pflash_cfi02.c */
>> 
>
> I generally prefer to keep the same order between declarations of
> functions, and definitions of the same functions. Compare
> pflash_cfi01_get_memory() here.

My fault, not Philippe's.

> With that updated,
>
> Reviewed-by: Laszlo Ersek <lersek@redhat.com>

Thanks!
diff mbox series

Patch

diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
index 9d1c356eb6..9ecab693e8 100644
--- a/hw/block/pflash_cfi01.c
+++ b/hw/block/pflash_cfi01.c
@@ -972,6 +972,11 @@  MemoryRegion *pflash_cfi01_get_memory(PFlashCFI01 *fl)
     return &fl->mem;
 }
 
+BlockBackend *pflash_cfi01_get_blk(PFlashCFI01 *fl)
+{
+    return fl->blk;
+}
+
 static void postload_update_cb(void *opaque, int running, RunState state)
 {
     PFlashCFI01 *pfl = opaque;
diff --git a/include/hw/block/flash.h b/include/hw/block/flash.h
index 914932eaec..a0f488732a 100644
--- a/include/hw/block/flash.h
+++ b/include/hw/block/flash.h
@@ -22,6 +22,7 @@  PFlashCFI01 *pflash_cfi01_register(hwaddr base,
                                    uint16_t id0, uint16_t id1,
                                    uint16_t id2, uint16_t id3,
                                    int be);
+BlockBackend *pflash_cfi01_get_blk(PFlashCFI01 *fl);
 MemoryRegion *pflash_cfi01_get_memory(PFlashCFI01 *fl);
 
 /* pflash_cfi02.c */