2020-12-19 17:59:12

by Lakshmi Ramasubramanian

[permalink] [raw]
Subject: [PATCH v13 4/6] powerpc: Delete unused function delete_fdt_mem_rsv()

delete_fdt_mem_rsv() defined in "arch/powerpc/kexec/file_load.c"
has been renamed to fdt_find_and_del_mem_rsv(), and moved to
"drivers/of/kexec.c".

Remove delete_fdt_mem_rsv() in "arch/powerpc/kexec/file_load.c".

Co-developed-by: Prakhar Srivastava <[email protected]>
Signed-off-by: Prakhar Srivastava <[email protected]>
Signed-off-by: Lakshmi Ramasubramanian <[email protected]>
---
arch/powerpc/include/asm/kexec.h | 1 -
arch/powerpc/kexec/file_load.c | 32 --------------------------------
2 files changed, 33 deletions(-)

diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h
index dbf09d2f36d0..d4b7d2d6191d 100644
--- a/arch/powerpc/include/asm/kexec.h
+++ b/arch/powerpc/include/asm/kexec.h
@@ -126,7 +126,6 @@ int setup_purgatory(struct kimage *image, const void *slave_code,
int setup_new_fdt(const struct kimage *image, void *fdt,
unsigned long initrd_load_addr, unsigned long initrd_len,
const char *cmdline);
-int delete_fdt_mem_rsv(void *fdt, unsigned long start, unsigned long size);

#ifdef CONFIG_PPC64
struct kexec_buf;
diff --git a/arch/powerpc/kexec/file_load.c b/arch/powerpc/kexec/file_load.c
index 9f3ec0b239ef..f37652ccb8a1 100644
--- a/arch/powerpc/kexec/file_load.c
+++ b/arch/powerpc/kexec/file_load.c
@@ -109,38 +109,6 @@ int setup_purgatory(struct kimage *image, const void *slave_code,
return 0;
}

-/**
- * delete_fdt_mem_rsv - delete memory reservation with given address and size
- *
- * Return: 0 on success, or negative errno on error.
- */
-int delete_fdt_mem_rsv(void *fdt, unsigned long start, unsigned long size)
-{
- int i, ret, num_rsvs = fdt_num_mem_rsv(fdt);
-
- for (i = 0; i < num_rsvs; i++) {
- uint64_t rsv_start, rsv_size;
-
- ret = fdt_get_mem_rsv(fdt, i, &rsv_start, &rsv_size);
- if (ret) {
- pr_err("Malformed device tree.\n");
- return -EINVAL;
- }
-
- if (rsv_start == start && rsv_size == size) {
- ret = fdt_del_mem_rsv(fdt, i);
- if (ret) {
- pr_err("Error deleting device tree reservation.\n");
- return -EINVAL;
- }
-
- return 0;
- }
- }
-
- return -ENOENT;
-}
-
/*
* setup_new_fdt - modify /chosen and memory reservation for the next kernel
* @image: kexec image being loaded.
--
2.29.2


2020-12-23 01:11:17

by Thiago Jung Bauermann

[permalink] [raw]
Subject: Re: [PATCH v13 4/6] powerpc: Delete unused function delete_fdt_mem_rsv()


Lakshmi Ramasubramanian <[email protected]> writes:

> delete_fdt_mem_rsv() defined in "arch/powerpc/kexec/file_load.c"
> has been renamed to fdt_find_and_del_mem_rsv(), and moved to
> "drivers/of/kexec.c".
>
> Remove delete_fdt_mem_rsv() in "arch/powerpc/kexec/file_load.c".
>
> Co-developed-by: Prakhar Srivastava <[email protected]>
> Signed-off-by: Prakhar Srivastava <[email protected]>
> Signed-off-by: Lakshmi Ramasubramanian <[email protected]>
> ---
> arch/powerpc/include/asm/kexec.h | 1 -
> arch/powerpc/kexec/file_load.c | 32 --------------------------------
> 2 files changed, 33 deletions(-)

As I mentioned in the other email, this patch could remove
setup_new_fdt() as well.

I'm a bit ambivalent on whether this patch should be squashed with
patch 2 or left on its own, but I tend toward the latter option because
patch 2 is big enough already.

--
Thiago Jung Bauermann
IBM Linux Technology Center

2020-12-23 05:10:50

by Lakshmi Ramasubramanian

[permalink] [raw]
Subject: Re: [PATCH v13 4/6] powerpc: Delete unused function delete_fdt_mem_rsv()

On 12/22/20 5:08 PM, Thiago Jung Bauermann wrote:
>
> Lakshmi Ramasubramanian <[email protected]> writes:
>
>> delete_fdt_mem_rsv() defined in "arch/powerpc/kexec/file_load.c"
>> has been renamed to fdt_find_and_del_mem_rsv(), and moved to
>> "drivers/of/kexec.c".
>>
>> Remove delete_fdt_mem_rsv() in "arch/powerpc/kexec/file_load.c".
>>
>> Co-developed-by: Prakhar Srivastava <[email protected]>
>> Signed-off-by: Prakhar Srivastava <[email protected]>
>> Signed-off-by: Lakshmi Ramasubramanian <[email protected]>
>> ---
>> arch/powerpc/include/asm/kexec.h | 1 -
>> arch/powerpc/kexec/file_load.c | 32 --------------------------------
>> 2 files changed, 33 deletions(-)
>
> As I mentioned in the other email, this patch could remove
> setup_new_fdt() as well.
>
> I'm a bit ambivalent on whether this patch should be squashed with
> patch 2 or left on its own, but I tend toward the latter option because
> patch 2 is big enough already.
>

I also think Patch #2 is already big enough - I don't want to make more
changes in that patch.

I will remove delete_fdt_mem_rsv() and setup_new_fdt() in this patch
(Patch #4) and call of_kexec_setup_new_fdt() directly (in
setup_new_fdt_ppc64()).

thanks,
-lakshmi