lkml.org 
[lkml]   [2016]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3] x86/setup: get ramdisk parameters only once

* Alexander Kuleshov <kuleshovmail@gmail.com> wrote:

> +/*
> + * ramdisk setup
> + */
> +struct ramdisk {
> + u64 image;
> + u64 size;
> + u64 end;
> +};

So what exactly are 'image' and 'end'? The names are not self-descriptory. Please
add comments that describe them and use the opportunity to rename the fields to
more self-descriptory names.

> +static void __init relocate_initrd(struct ramdisk ramdisk)

Why pass by value, why not by address?

> {
> + u64 area_size = PAGE_ALIGN(ramdisk.size);

Why introduce a local variable here? Also, isn't ramdisk.size already page
aligned?

> +static void __init early_reserve_initrd(struct ramdisk ramdisk)
> {
> + memblock_reserve(ramdisk.image, ramdisk.end - ramdisk.image);
> }

Looks like a pretty pointless function now - can be expanded into its call site.

> void __init setup_arch(char **cmdline_p)
> {
> + struct ramdisk ramdisk_image = {
> + .image = get_ramdisk_image(),
> + .size = get_ramdisk_size(),
> + /* Assume only end is not page aligned */
> + .end = PAGE_ALIGN(ramdisk_image.image + ramdisk_image.size)
> + };
> + bool reserve_ramdisk = true;

Why not merge 'reserve_ramdisk' into the ramdisk state structure as well?

> - early_reserve_initrd();
> + if (!boot_params.hdr.type_of_loader || !ramdisk_image.image
> + || !ramdisk_image.size) {
> + reserve_ramdisk = false;
> + return; /* No initrd provided by bootloader */
> + } else
> + early_reserve_initrd(ramdisk_image);

Curly braces should be balanced.

Thanks,

Ingo

\
 
 \ /
  Last update: 2016-02-09 14:41    [W:0.041 / U:3.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site