History log of /linux-master/drivers/auxdisplay/panel.c
Revision Date Author Comments
# b33190d0 15-Feb-2021 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

auxdisplay: panel: Switch to use module_parport_driver()

Switch to use module_parport_driver() to reduce boilerplate code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>


# a952abcd 11-Sep-2023 Justin Stitt <justinstitt@google.com>

auxdisplay: panel: Replace deprecated strncpy() with strtomem_pad()

`strncpy` is deprecated and as such we should prefer more robust and
less ambiguous interfaces.

In this case, all of `press_str`, `repeat_str` and `release_str` are
explicitly marked as nonstring:
| struct { /* valid when type == INPUT_TYPE_KBD */
| char press_str[sizeof(void *) + sizeof(int)] __nonstring;
| char repeat_str[sizeof(void *) + sizeof(int)] __nonstring;
| char release_str[sizeof(void *) + sizeof(int)] __nonstring;
| } kbd;

... which makes `strtomem_pad` a suitable replacement as it is
functionally the same whilst being more obvious about its behavior.

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1]
Link: https://github.com/KSPP/linux/issues/90
Cc: linux-hardening@vger.kernel.org
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Justin Stitt <justinstitt@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230911-strncpy-drivers-auxdisplay-panel-c-v1-1-b60bd0ae8552@google.com
Signed-off-by: Kees Cook <keescook@chromium.org>


# fa60ce2c 06-May-2021 Masahiro Yamada <masahiroy@kernel.org>

treewide: remove editor modelines and cruft

The section "19) Editor modelines and other cruft" in
Documentation/process/coding-style.rst clearly says, "Do not include any
of these in source files."

I recently receive a patch to explicitly add a new one.

Let's do treewide cleanups, otherwise some people follow the existing code
and attempt to upstream their favoriate editor setups.

It is even nicer if scripts/checkpatch.pl can check it.

If we like to impose coding style in an editor-independent manner, I think
editorconfig (patch [1]) is a saner solution.

[1] https://lore.kernel.org/lkml/20200703073143.423557-1-danny@kdrag0n.dev/

Link: https://lkml.kernel.org/r/20210324054457.1477489-1-masahiroy@kernel.org
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Miguel Ojeda <ojeda@kernel.org> [auxdisplay]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 351dcacc 16-Nov-2020 Lars Poeschel <poeschel@lemonage.de>

auxdisplay: panel: Remove redundant charlcd_ops structures

The three struct charlcd_ops contain the same data, so we only need one
of this structures. The other two are removed.

Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>


# 32d917e7 16-Nov-2020 Lars Poeschel <poeschel@lemonage.de>

auxdisplay: panel: Fix missing print function pointer

charlcd drivers need to provide some print function to charlcd. For
hd44780 based panel driver this function was missing. We provide the
generic hd44780_common_print function which should be suitable.

Fixes: b26deabb1d915fe87d395081bbd3058b938dee89 ("auxdisplay: hd44780_common_print")
Reported-by: kernel test robot <oliver.sang@intel.com>
Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>


# 377cf2cb 03-Nov-2020 Lars Poeschel <poeschel@lemonage.de>

auxdisplay: hd44780: Remove clear_fast

We remove the hd44780_clear_fast (display) clear implementation. With
the new timeout the normal clear_display is reasonably fast. So there is
no need for a clear_fast anymore.

Link: https://lore.kernel.org/lkml/20200922092121.GG16421@1wt.eu/

Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>


# 339acb08 03-Nov-2020 Lars Poeschel <poeschel@lemonage.de>

auxdisplay: Move char redefine code to hd44780_common

Take the code to redefine characters out of charlcd and move it to
hd44780_common, as this is hd44780 specific.
There is now a function hd44780_common_redefine_char that drivers use
and charlcd calls it through its ops function pointer.

Reviewed-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>


# d2f2187e 03-Nov-2020 Lars Poeschel <poeschel@lemonage.de>

auxdisplay: implement various hd44780_common_ functions

This implements various hd44780_common_ functions for hd44780 compatible
display drivers to use. charlcd then calls these functions through its
ops function pointer.
The functions namely are:
- hd44780_common_shift_cursor
- hd44780_common_display_shift
- hd44780_common_display
- hd44780_common_cursor
- hd44780_common_blink
- hd44780_common_fontsize
- hd44780_common_lines

Reviewed-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>


# 01ec46df 03-Nov-2020 Lars Poeschel <poeschel@lemonage.de>

auxdisplay: Move init_display to hd44780_common

The init_display function is moved over to hd44780_common. charlcd uses
it via its ops function pointer and drivers initialize the ops with the
common hd44780_common_init_display function.

Reviewed-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>


# 45421ffe 03-Nov-2020 Lars Poeschel <poeschel@lemonage.de>

auxdisplay: Move clear_display to hd44780_common

This moves the clear_display function from charlcd to hd44780_common.
This is one more step to make charlcd independent from device specific
code. The two hd44780 drivers use the new function from hd44780_common
and charlcd calls this function through its function pointer in its ops
structure.

Reviewed-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>


# 88645a86 03-Nov-2020 Lars Poeschel <poeschel@lemonage.de>

auxdisplay: add home to charlcd_ops

This adds a home function to the charlcd_ops struct and offer an
implementation for hd44780_common. This implementation is used by our
two hd44780 drivers. This is to make charlcd device independent.

Reviewed-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>


# d3a2fb81 03-Nov-2020 Lars Poeschel <poeschel@lemonage.de>

auxdisplay: provide hd44780_common_gotoxy

Provide a hd44780_common_gotoxy function and a pointer in the ops for
charlcd to use to move the cursor.

Reviewed-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>


# 2c6a82f2 03-Nov-2020 Lars Poeschel <poeschel@lemonage.de>

auxdisplay: Move write_cmd pointers to hd44780 drivers

The write_cmd function is used to send commands to hd44780 displays.
The individual hd44780 drivers then implement their appropriate way of
doing this with their supported displays. So we move this pointer so
hd44780_common.

Reviewed-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>


# 71ff701b 03-Nov-2020 Lars Poeschel <poeschel@lemonage.de>

auxdisplay: Move write_data pointer to hd44780_common

This moves the write_data function pointer from struct charlcd_ops to
struct hd44780_common. This is the function that actually writes the
character to the display. This hd44780 hardware specific function is
used by two drivers at the moment.

Reviewed-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>


# 2545c1c9 03-Nov-2020 Lars Poeschel <poeschel@lemonage.de>

auxdisplay: Move hwidth and bwidth to struct hd44780_common

hwidth is for the hardware buffer size and bwidth is for the buffer
width of one single line. This is specific to the hd44780 displays and
so it is moved out from charlcd to struct hd44780_common.

Reviewed-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>


# 718e05ed 03-Nov-2020 Lars Poeschel <poeschel@lemonage.de>

auxdisplay: Introduce hd44780_common.[ch]

There is some hd44780 specific code in charlcd and this code is used by
multiple drivers. To make charlcd independent from this device specific
code this has to be moved to a place where the multiple drivers can
share their common code. This common place is now introduced as
hd44780_common.

Reviewed-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>


# 66ce7d5c 03-Nov-2020 Lars Poeschel <poeschel@lemonage.de>

auxdisplay: Use an enum for charlcd backlight on/off ops

We use an enum for calling the functions in charlcd, that turn the
backlight on or off. This enum is generic and can be used for other
charlcd turn on / turn off operations as well.

Reviewed-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>


# df561f66 23-Aug-2020 Gustavo A. R. Silva <gustavoars@kernel.org>

treewide: Use fallthrough pseudo-keyword

Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.

[1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>


# 6ce6ae7c 11-Mar-2020 Zhenzhong Duan <zhenzhong.duan@gmail.com>

misc: cleanup minor number definitions in c file into miscdevice.h

HWRNG_MINOR and RNG_MISCDEV_MINOR are duplicate definitions, use
unified HWRNG_MINOR instead and moved into miscdevice.h

ANSLCD_MINOR and LCD_MINOR are duplicate definitions, use unified
LCD_MINOR instead and moved into miscdevice.h

MISCDEV_MINOR is renamed to PXA3XX_GCU_MINOR and moved into
miscdevice.h

Other definitions are just moved without any change.

Link: https://lore.kernel.org/lkml/20200120221323.GJ15860@mit.edu/t/
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Build-tested-by: Willy TARREAU <wtarreau@haproxy.com>
Build-tested-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@gmail.com>
Acked-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Link: https://lore.kernel.org/r/20200311071654.335-2-zhenzhong.duan@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 75354284 06-Aug-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

auxdisplay: charlcd: move charlcd.h to drivers/auxdisplay

This header is included in drivers/auxdisplay/. Make it a local header.

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>


# b33d5675 08-Jul-2019 zhengbin <zhengbin13@huawei.com>

auxdisplay: panel: need to delete scan_timer when misc_register fails in panel_attach

In panel_attach, if misc_register fails, we need to delete scan_timer,
which was setup in keypad_init->init_scan_timer.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>


# 9b11d639 12-Mar-2019 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

auxdisplay: panel: Convert to use charlcd_free()

Convert to use charlcd_free() instead of kfree() for sake of type check.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>


# 98cade0a 14-Aug-2018 Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>

Compiler Attributes: auxdisplay: panel: use __nonstring

Let gcc know these arrays are not meant to be NUL-terminated
by annotating them with the new __nonstring variable attribute;
and remove the comment since it conveys the same information.

Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # on top of v4.19-rc5, clang 7
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>


# 351f683b 17-Feb-2018 Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>

auxdisplay: Replace licenses with SPDX identifiers

Cc: Philippe Ombredanne <pombredanne@nexb.com>
Acked-by: Willy Tarreau <w@1wt.eu>
Acked-by: Linus Walleij <triad@dflund.se>
Acked-by: Robin van der Gracht <robin@protonic.nl>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>


# 5617c599 19-Feb-2018 Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>

auxdisplay: panel: Change comments to silence fallthrough warnings

Compiling with W=1 with gcc 7.2.0 gives 3 warnings like:

drivers/auxdisplay/panel.c: In function ‘panel_process_inputs’:
drivers/auxdisplay/panel.c:1374:17: warning: this statement may fall
through [-Wimplicit-fallthrough=]

Cc: Willy Tarreau <w@1wt.eu>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>


# 7e047107 25-Oct-2017 Kees Cook <keescook@chromium.org>

auxdisplay: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Cc: Miguel Ojeda Sandonis <miguel.ojeda.sandonis@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Paul Burton <paul.burton@mips.com>
Tested-by: Paul Burton <paul.burton@mips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 607a6301 19-Oct-2017 Kees Cook <keescook@chromium.org>

auxdisplay: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Cc: Paul Burton <paul.burton@imgtec.com>
Cc: Miguel Ojeda Sandonis <miguel.ojeda.sandonis@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Paul Burton <paul.burton@mips.com>
Tested-by: Paul Burton <paul.burton@mips.com> # for img-ascii-lcd


# 93dc1774 07-Sep-2017 Willy Tarreau <w@1wt.eu>

auxdisplay: charlcd: properly restore atomic counter on error path

Commit f4757af ("staging: panel: Fix single-open policy race condition")
introduced in 3.19-rc1 attempted to fix a race condition on the open, but
failed to properly do it and used to exit without restoring the semaphore.

This results in -EBUSY being returned after the first open error until
the module is reloaded or the system restarted (ie: consecutive to a
dual open resulting in -EBUSY or to a permission error).

[ Note for stable maintainers: the code moved from drivers/misc/panel.c
to drivers/auxdisplay/{charlcd,panel}.c during 4.12. The patch easily
applies there (modulo the renamed atomic counter) but I can provide a
tested backport if desired. ]

Fixes: f4757af85 # 3.19-rc1
Cc: stable@vger.kernel.org
Cc: Mariusz Gorski <marius.gorski@gmail.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Miguel Ojeda Sandonis <miguel.ojeda.sandonis@gmail.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7b948f13 14-Jul-2017 Arvind Yadav <arvind.yadav.cs@gmail.com>

auxdisplay: constify charlcd_ops.

charlcd_ops are not supposed to change at runtime. All functions
working with charlcd_ops provided by <misc/charlcd.h> work with
const charlcd_ops. So mark the non-const structs as const.

File size before:
text data bss dec hex filename
12750 560 362 13672 3568 drivers/auxdisplay/panel.o

File size After adding 'const':
text data bss dec hex filename
12942 368 362 13672 3568 drivers/auxdisplay/panel.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 4654bdb6 25-Apr-2017 Wei Yongjun <weiyongjun1@huawei.com>

auxdisplay: Convert list_for_each to entry variant

convert list_for_each() to list_for_each_entry() where
applicable.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 51c1e9b5 04-Apr-2017 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

auxdisplay: Move panel.c to drivers/auxdisplay folder

It looks like panel.c belongs to auxdisplay subsystem.

Move it to drivers/auxdisplay folder.
No functional changes intended.

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>