[PATCH] system/physmem: remove redundant arg reassignment

Manos Pitsidianakis posted 1 patch 9 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20240215091506.1932251-1-manos.pitsidianakis@linaro.org
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Peter Xu <peterx@redhat.com>, David Hildenbrand <david@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>
system/physmem.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
[PATCH] system/physmem: remove redundant arg reassignment
Posted by Manos Pitsidianakis 9 months, 2 weeks ago
Arguments `ram_block` are reassigned to local declarations `block`
without further use. Remove re-assignment to reduce noise.

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
---
 system/physmem.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/system/physmem.c b/system/physmem.c
index 5e66d9ae36..d4c3bfac65 100644
--- a/system/physmem.c
+++ b/system/physmem.c
@@ -2154,10 +2154,8 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length)
  *
  * Called within RCU critical section.
  */
-void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_t addr)
+void *qemu_map_ram_ptr(RAMBlock *block, ram_addr_t addr)
 {
-    RAMBlock *block = ram_block;
-
     if (block == NULL) {
         block = qemu_get_ram_block(addr);
         addr -= block->offset;
@@ -2182,10 +2180,9 @@ void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_t addr)
  *
  * Called within RCU critical section.
  */
-static void *qemu_ram_ptr_length(RAMBlock *ram_block, ram_addr_t addr,
+static void *qemu_ram_ptr_length(RAMBlock *block, ram_addr_t addr,
                                  hwaddr *size, bool lock)
 {
-    RAMBlock *block = ram_block;
     if (*size == 0) {
         return NULL;
     }

base-commit: 5767815218efd3cbfd409505ed824d5f356044ae
-- 
γαῖα πυρί μιχθήτω


Re: [PATCH] system/physmem: remove redundant arg reassignment
Posted by Philippe Mathieu-Daudé 9 months, 2 weeks ago
On 15/2/24 10:15, Manos Pitsidianakis wrote:
> Arguments `ram_block` are reassigned to local declarations `block`
> without further use. Remove re-assignment to reduce noise.
> 
> Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> ---
>   system/physmem.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/system/physmem.c b/system/physmem.c
> index 5e66d9ae36..d4c3bfac65 100644
> --- a/system/physmem.c
> +++ b/system/physmem.c
> @@ -2154,10 +2154,8 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length)
>    *
>    * Called within RCU critical section.
>    */
> -void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_t addr)
> +void *qemu_map_ram_ptr(RAMBlock *block, ram_addr_t addr)

Better update the declaration in the same commit:

-- >8 --
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 177be23db7..bf4db3b374 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -2960,7 +2960,7 @@ MemTxResult flatview_read_continue(FlatView *fv, 
hwaddr addr,
                                     MemTxAttrs attrs, void *buf,
                                     hwaddr len, hwaddr addr1, hwaddr l,
                                     MemoryRegion *mr);
-void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_t addr);
+void *qemu_map_ram_ptr(RAMBlock *block, ram_addr_t addr);

  /* Internal functions, part of the implementation of 
address_space_read_cached
   * and address_space_write_cached.  */
---

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>


Re: [PATCH] system/physmem: remove redundant arg reassignment
Posted by Philippe Mathieu-Daudé 9 months ago
On 15/2/24 12:09, Philippe Mathieu-Daudé wrote:
> On 15/2/24 10:15, Manos Pitsidianakis wrote:
>> Arguments `ram_block` are reassigned to local declarations `block`
>> without further use. Remove re-assignment to reduce noise.
>>
>> Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
>> ---
>>   system/physmem.c | 7 ++-----
>>   1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/system/physmem.c b/system/physmem.c
>> index 5e66d9ae36..d4c3bfac65 100644
>> --- a/system/physmem.c
>> +++ b/system/physmem.c
>> @@ -2154,10 +2154,8 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t 
>> length)
>>    *
>>    * Called within RCU critical section.
>>    */
>> -void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_t addr)
>> +void *qemu_map_ram_ptr(RAMBlock *block, ram_addr_t addr)
> 
> Better update the declaration in the same commit:
> 
> -- >8 --
> diff --git a/include/exec/memory.h b/include/exec/memory.h
> index 177be23db7..bf4db3b374 100644
> --- a/include/exec/memory.h
> +++ b/include/exec/memory.h
> @@ -2960,7 +2960,7 @@ MemTxResult flatview_read_continue(FlatView *fv, 
> hwaddr addr,
>                                      MemTxAttrs attrs, void *buf,
>                                      hwaddr len, hwaddr addr1, hwaddr l,
>                                      MemoryRegion *mr);
> -void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_t addr);
> +void *qemu_map_ram_ptr(RAMBlock *block, ram_addr_t addr);

FYI this is now merged as commit aab4631a4a ("system/physmem:
remove redundant arg reassignment").

> 
>   /* Internal functions, part of the implementation of 
> address_space_read_cached
>    * and address_space_write_cached.  */
> ---
> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> 


Re: [PATCH] system/physmem: remove redundant arg reassignment
Posted by Michael Tokarev 9 months, 2 weeks ago
15.02.2024 12:15, Manos Pitsidianakis :
> Arguments `ram_block` are reassigned to local declarations `block`
> without further use. Remove re-assignment to reduce noise.

Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
And applied to trivial-patches, thanks!

/mjt
Re: [PATCH] system/physmem: remove redundant arg reassignment
Posted by David Hildenbrand 9 months, 2 weeks ago
On 15.02.24 10:15, Manos Pitsidianakis wrote:
> Arguments `ram_block` are reassigned to local declarations `block`
> without further use. Remove re-assignment to reduce noise.
> 
> Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> ---
>   system/physmem.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/system/physmem.c b/system/physmem.c
> index 5e66d9ae36..d4c3bfac65 100644
> --- a/system/physmem.c
> +++ b/system/physmem.c
> @@ -2154,10 +2154,8 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length)
>    *
>    * Called within RCU critical section.
>    */
> -void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_t addr)
> +void *qemu_map_ram_ptr(RAMBlock *block, ram_addr_t addr)
>   {
> -    RAMBlock *block = ram_block;
> -
>       if (block == NULL) {
>           block = qemu_get_ram_block(addr);
>           addr -= block->offset;
> @@ -2182,10 +2180,9 @@ void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_t addr)
>    *
>    * Called within RCU critical section.
>    */
> -static void *qemu_ram_ptr_length(RAMBlock *ram_block, ram_addr_t addr,
> +static void *qemu_ram_ptr_length(RAMBlock *block, ram_addr_t addr,
>                                    hwaddr *size, bool lock)
>   {
> -    RAMBlock *block = ram_block;
>       if (*size == 0) {
>           return NULL;
>       }
> 
> base-commit: 5767815218efd3cbfd409505ed824d5f356044ae

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Cheers,

David / dhildenb