diff mbox series

[v9,02/11] kexec_file: make kexec_image_post_load_cleanup_default() global

Message ID 20180425062629.29404-3-takahiro.akashi@linaro.org
State Superseded
Headers show
Series arm64: kexec: add kexec_file_load() support | expand

Commit Message

AKASHI Takahiro April 25, 2018, 6:26 a.m. UTC
Change this function from static to global so that arm64 can implement
its own arch_kimage_file_post_load_cleanup() later using
kexec_image_post_load_cleanup_default().

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

Cc: Dave Young <dyoung@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Baoquan He <bhe@redhat.com>
---
 include/linux/kexec.h | 1 +
 kernel/kexec_file.c   | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

-- 
2.17.0

Comments

Dave Young April 28, 2018, 9:45 a.m. UTC | #1
On 04/25/18 at 03:26pm, AKASHI Takahiro wrote:
> Change this function from static to global so that arm64 can implement

> its own arch_kimage_file_post_load_cleanup() later using

> kexec_image_post_load_cleanup_default().

> 

> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

> Cc: Dave Young <dyoung@redhat.com>

> Cc: Vivek Goyal <vgoyal@redhat.com>

> Cc: Baoquan He <bhe@redhat.com>

> ---

>  include/linux/kexec.h | 1 +

>  kernel/kexec_file.c   | 2 +-

>  2 files changed, 2 insertions(+), 1 deletion(-)

> 

> diff --git a/include/linux/kexec.h b/include/linux/kexec.h

> index 9e4e638fb505..49ab758f4d91 100644

> --- a/include/linux/kexec.h

> +++ b/include/linux/kexec.h

> @@ -143,6 +143,7 @@ extern const struct kexec_file_ops * const kexec_file_loaders[];

>  

>  int kexec_image_probe_default(struct kimage *image, void *buf,

>  			      unsigned long buf_len);

> +int kexec_image_post_load_cleanup_default(struct kimage *image);

>  

>  /**

>   * struct kexec_buf - parameters for finding a place for a buffer in memory

> diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c

> index 75d8e7cf040e..eef89d9b1f03 100644

> --- a/kernel/kexec_file.c

> +++ b/kernel/kexec_file.c

> @@ -78,7 +78,7 @@ void * __weak arch_kexec_kernel_image_load(struct kimage *image)

>  	return kexec_image_load_default(image);

>  }

>  

> -static int kexec_image_post_load_cleanup_default(struct kimage *image)

> +int kexec_image_post_load_cleanup_default(struct kimage *image)

>  {

>  	if (!image->fops || !image->fops->cleanup)

>  		return 0;

> -- 

> 2.17.0

> 

> 

> _______________________________________________

> kexec mailing list

> kexec@lists.infradead.org

> http://lists.infradead.org/mailman/listinfo/kexec


Acked-by: Dave Young <dyoung@redhat.com>


Thanks
Dave
James Morse May 1, 2018, 5:46 p.m. UTC | #2
Hi Akashi,

On 25/04/18 07:26, AKASHI Takahiro wrote:
> Change this function from static to global so that arm64 can implement

> its own arch_kimage_file_post_load_cleanup() later using

> kexec_image_post_load_cleanup_default().


Do we need to call kexec_image_post_load_cleanup_default()? All it does is call
the image-type fops->cleanup(), which you don't implement in this series.

Is this just-in-case someone adds cleanup() later and is surprised only the
arch-level helper is called?


Thanks,

James
AKASHI Takahiro May 7, 2018, 4:40 a.m. UTC | #3
On Tue, May 01, 2018 at 06:46:04PM +0100, James Morse wrote:
> Hi Akashi,

> 

> On 25/04/18 07:26, AKASHI Takahiro wrote:

> > Change this function from static to global so that arm64 can implement

> > its own arch_kimage_file_post_load_cleanup() later using

> > kexec_image_post_load_cleanup_default().

> 

> Do we need to call kexec_image_post_load_cleanup_default()? All it does is call

> the image-type fops->cleanup(), which you don't implement in this series.

> 

> Is this just-in-case someone adds cleanup() later and is surprised only the

> arch-level helper is called?


Yes, we want not to miss two possibilities:
- some common clean-up code is added to kexec_image_post_load_cleanup_default()
- some format(i.e. Image)-specific clean-up code is added to fops->cleanup()

-Takahiro AKASHI

> 

> 

> Thanks,

> 

> James
diff mbox series

Patch

diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 9e4e638fb505..49ab758f4d91 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -143,6 +143,7 @@  extern const struct kexec_file_ops * const kexec_file_loaders[];
 
 int kexec_image_probe_default(struct kimage *image, void *buf,
 			      unsigned long buf_len);
+int kexec_image_post_load_cleanup_default(struct kimage *image);
 
 /**
  * struct kexec_buf - parameters for finding a place for a buffer in memory
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index 75d8e7cf040e..eef89d9b1f03 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -78,7 +78,7 @@  void * __weak arch_kexec_kernel_image_load(struct kimage *image)
 	return kexec_image_load_default(image);
 }
 
-static int kexec_image_post_load_cleanup_default(struct kimage *image)
+int kexec_image_post_load_cleanup_default(struct kimage *image)
 {
 	if (!image->fops || !image->fops->cleanup)
 		return 0;