Re: [PATCH v2 3/3] efi: earlycon: Add support for generic framebuffers and move to console subsystem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Aug 6, 2022 at 6:38 PM Markuss Broks <markuss.broks@xxxxxxxxx> wrote:
>
> Add early console support for generic linear framebuffer devices.
> This driver supports probing from cmdline early parameters
> or from the device-tree using information in simple-framebuffer node.
> The EFI functionality should be retained in whole.
> The driver was disabled on ARM because of a bug in early_ioremap

We refer to functions like func().

> implementation on ARM and on IA64 because of lack of early_memremap_prot.

Ditto.

...

> +#include <asm/early_ioremap.h>

Can it be placed after linux/* ones?

> +#include <linux/console.h>
> +#include <linux/efi.h>
> +#include <linux/font.h>
> +#include <linux/io.h>
> +#include <linux/kernel.h>
> +#include <linux/mm.h>
> +#include <linux/of.h>
> +#include <linux/of_fdt.h>
> +#include <linux/serial_core.h>
> +#include <linux/screen_info.h>

...

> +static int __init simplefb_earlycon_remap_fb(void)
> +{
> +       unsigned long mapping;

+ Blank line.

> +       /* bail if there is no bootconsole or it has been disabled already */
> +       if (!earlycon_console || !(earlycon_console->flags & CON_ENABLED))
> +               return 0;
> +
> +       if (region_intersects(info.phys_base, info.size,
> +                             IORESOURCE_SYSTEM_RAM, IORES_DESC_NONE) == REGION_INTERSECTS)
> +               mapping = MEMREMAP_WB;
> +       else
> +               mapping = MEMREMAP_WC;

> +       info.virt_base = memremap(info.phys_base, info.size, mapping);
> +
> +       return info.virt_base ? 0 : -ENOMEM;

Easier to read the standard pattern:

  if (!info.virt_base)
    return -ENOMEM;

  return 0;

> +}

...

> +static void simplefb_earlycon_write_char(u8 *dst, unsigned char c, unsigned int h)
> +{
> +       const u8 *src;
> +       int m, n, bytes;
> +       u8 x;
> +
> +       bytes = BITS_TO_BYTES(font->width);
> +       src = font->data + c * font->height * bytes + h * bytes;
> +
> +       for (m = 0; m < font->width; m++) {
> +               n = m % 8;
> +               x = *(src + m / 8);

I would write it as

  x = src[m / 8];

> +               if ((x >> (7 - n)) & 1)

> +                       memset(dst, 0xff, (info.depth / 8));

Too many parentheses.

> +               else
> +                       memset(dst, 0, (info.depth / 8));

Ditto.

> +               dst += (info.depth / 8);

Ditto.

> +       }
> +}

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux