aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/auxdisplay (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-05-07treewide: remove editor modelines and cruftMasahiro Yamada1-7/+0
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>
2021-03-16auxdisplay: Remove in_interrupt() usage.Sebastian Andrzej Siewior1-10/+8
charlcd_write() is invoked as a VFS->write() callback and as such it is always invoked from preemptible context and may sleep. charlcd_puts() is invoked from register/unregister callback which is preemptible. The reboot notifier callback is also invoked from preemptible context. Therefore there is no need to use in_interrupt() to figure out if it is safe to sleep because it always is. in_interrupt() and related context checks are being removed from non-core code. Using schedule() to schedule (and be friendly to others) is discouraged and cond_resched() should be used instead. Remove in_interrupt() and use cond_resched() to schedule every 32 iterations if needed. Link: https://lkml.kernel.org/r/20200914204209.256266093@linutronix.de Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> [mo: fixed a couple typos in comment and commit message] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2021-02-26treewide: Miguel has movedMiguel Ojeda3-6/+6
Update contact info. Link: https://lkml.kernel.org/r/20210206162524.GA11520@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-01-25auxdisplay: Fix duplicate CHARLCD config symbolGeert Uytterhoeven1-3/+0
A second CHARLCD config symbol was added instead of moving the existing one. Fix this by removing the old one. Fixes: 718e05ed92ecac0d ("auxdisplay: Introduce hd44780_common.[ch]") Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2021-01-25auxdisplay: ht16k33: Fix refresh rate handlingGeert Uytterhoeven1-2/+1
Drop the call to msecs_to_jiffies(), as "HZ / fbdev->refresh_rate" is already the number of jiffies to wait. Fixes: 8992da44c6805d53 ("auxdisplay: ht16k33: Driver for LED controller") Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2021-01-25dt-bindings: auxdisplay: ht16k33: Keyscan function should be optionalRobin van der Gracht1-8/+6
Keyscan should be optional to support simple LED matrix displays (output only). Reported-by: Michael Kaplan <M.KAPLAN@evva.com> Signed-off-by: Robin van der Gracht <robin@protonic.nl> [geert: Rebased] Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Robin van der Gracht <robin@protonic.nl> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2020-11-16auxdisplay: panel: Remove redundant charlcd_ops structuresLars Poeschel1-38/+4
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>
2020-11-16auxdisplay: panel: Fix missing print function pointerLars Poeschel1-0/+3
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>
2020-11-14auxdisplay: fix platform_no_drv_owner.cocci warningskernel test robot1-1/+0
drivers/auxdisplay/lcd2s.c:373:3-8: No need to set .owner here. The core will do it. Remove .owner field if calls are used which set it automatically Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci Fixes: 8c9108d014c5 ("auxdisplay: add a driver for lcd2s character display") CC: Lars Poeschel <poeschel@lemonage.de> Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: kernel test robot <lkp@intel.com> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2020-11-09auxdisplay: fix use after free in lcd2s_i2c_remove()Dan Carpenter1-1/+1
The kfree() needs to be moved down a line to prevent a use after free. Fixes: 8c9108d014c5 ("auxdisplay: add a driver for lcd2s character display") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2020-11-09auxdisplay: hd44780_common: Fix build errorLars Poeschel1-2/+1
When building the hd44780_common driver without a driver that actually uses it like panel or hd44780 you get a build error, because hd44780_common uses charlcd, but did not select it. Its users did select it. This is fixed now. hd4478_common now selects charlcd in Kconfig and panel and hd44780 do not. They only select hd44780_common. Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Lars Poeschel <poeschel@lemonage.de> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2020-11-04auxdisplay: add a driver for lcd2s character displayLars Poeschel3-0/+414
This driver allows to use a lcd2s 20x4 character display from Modtronix engineering as an auxdisplay charlcd device. Signed-off-by: Lars Poeschel <poeschel@lemonage.de> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2020-11-04auxdisplay: charlcd: Do not print chars at end of lineLars Poeschel1-0/+3
Skip printing characters at the end of a display line. This fits to the behaviour we already had, that the cursor is nailed to the last position of a line. This might slightly change behaviour. On hd44780 displays with one or two lines the previous implementation did still write characters to the buffer of the display even if they are currently not visible. The shift_display command could be used to set the "viewing window" to a new position in the buffer and then you could see the characters previously written. This described behaviour does not work for hd44780 displays with more than two display lines. There simply is not enough buffer. So the behaviour was a bit inconsistent across different displays. The new behaviour is to stop writing characters at the end of a visible line, even if there would be room in the buffer. This allows us to have an easy implementation, that should behave equal on all supported displays. This is not hd44780 hardware dependent anymore. Reviewed-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Lars Poeschel <poeschel@lemonage.de> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2020-11-04auxdisplay: Change gotoxy calling interfaceLars Poeschel4-16/+13
Change the calling interface for gotoxy from supplying the x and y coordinates in the charlcd struct to explicitly supplying x and y in the function arguments. This is more intuitive and allows for moving the cursor to positions independent from the position saved in the charlcd struct. Reviewed-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Lars Poeschel <poeschel@lemonage.de> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2020-11-04auxdisplay: charlcd: replace last device specific stuffLars Poeschel1-8/+3
These are the last bits left in charlcd.c that are device specific and they are removed now. In detail this is: * bwidth, which is the width of the display buffer per line. This is replaced by width of the display. * hwidth, which is the size of the display buffer as a whole. This is replaced by looping all chars of a line by all lines. * the hd44780_common header include can go away. Reviewed-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Lars Poeschel <poeschel@lemonage.de> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2020-11-04auxdisplay: hd44780: Remove clear_fastLars Poeschel3-87/+8
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>
2020-11-04auxdisplay: hd44780_common: Reduce clear_display timeoutLars Poeschel1-2/+2
Digging in the hd44780 datasheet revealed that the timeout needed after clearing the whole display is only 1,64ms not 15ms. So we can reduce that timeout. Link: https://lore.kernel.org/lkml/20200922092121.GG16421@1wt.eu/ Link: https://www.crystalfontz.com/controllers/Hitachi/HD44780/433/ Signed-off-by: Lars Poeschel <poeschel@lemonage.de> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2020-11-04auxdisplay: Call charlcd_backlight in placeLars Poeschel1-8/+6
This moves the call to charlcd_backlight from the end of the switch into the actual case statement that originates the change of the backlight. This is more consistent to what is now found in this switch. Reviewed-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Lars Poeschel <poeschel@lemonage.de> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2020-11-04auxdisplay: Move char redefine code to hd44780_commonLars Poeschel6-55/+70
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>
2020-11-04auxdisplay: cleanup unnecessary hd44780 code in charlcdLars Poeschel1-31/+1
This cleans up now unnecessary hd44780 specific code from charlcd. We obsoleted this with the last patch. So another chunk of hd44780 specific code can be dropped from charlcd. Reviewed-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Lars Poeschel <poeschel@lemonage.de> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2020-11-04auxdisplay: implement various hd44780_common_ functionsLars Poeschel6-27/+249
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>
2020-11-04auxdisplay: Move init_display to hd44780_commonLars Poeschel6-89/+110
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>
2020-11-04auxdisplay: Make use of enum for backlight on / offLars Poeschel1-3/+3
To turn the backlight on or off use our new enum CHARLCD_ON / CHARLCD_OFF. Reviewed-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Lars Poeschel <poeschel@lemonage.de> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2020-11-04auxdisplay: make charlcd_backlight visible to hd44780_commonLars Poeschel2-1/+3
hd44780_common wants to use the charlcd_backlight function, so make it visible. Reviewed-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Lars Poeschel <poeschel@lemonage.de> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2020-11-04auxdisplay: Move clear_display to hd44780_commonLars Poeschel6-16/+37
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>
2020-11-04auxdisplay: add home to charlcd_opsLars Poeschel6-1/+18
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>
2020-11-04auxdisplay: provide hd44780_common_gotoxyLars Poeschel6-28/+43
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>
2020-11-04auxdisplay: hd44780_common_printLars Poeschel5-13/+44
We create a hd44780_common_print function. It is derived from the original charlcd_print. charlcd_print becomes a device independent print function, that then only calls via its ops function pointers, into the print function offered by drivers. Reported-by: kernel test robot <lkp@intel.com> Reviewed-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Lars Poeschel <poeschel@lemonage.de> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2020-11-04auxdisplay: Move addr out of charlcd_privLars Poeschel2-36/+31
Move out the struct addr from struct charlcd_priv into the less private struct charlcd. This member is used to pass position information. The individual drivers need to be able to read this information, so we move this out of charlcd_priv to charlcd structure. Reviewed-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Lars Poeschel <poeschel@lemonage.de> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2020-11-04auxdisplay: Move write_cmd pointers to hd44780 driversLars Poeschel5-42/+38
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>
2020-11-04auxdisplay: Move write_data pointer to hd44780_commonLars Poeschel5-20/+22
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>
2020-11-04auxdisplay: Move ifwidth to struct hd44780_commonLars Poeschel5-8/+9
Move struct charlcd member ifwidth to our new struct hd44780_common. ifwidth is hd44780 device specific and is used by two drivers at the moment, so we move it to a common place, where both can use this. Reviewed-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Lars Poeschel <poeschel@lemonage.de> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2020-11-04auxdisplay: Move hwidth and bwidth to struct hd44780_commonLars Poeschel6-55/+67
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>
2020-11-04auxdisplay: Introduce hd44780_common.[ch]Lars Poeschel6-17/+91
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>
2020-11-04auxdisplay: Use an enum for charlcd backlight on/off opsLars Poeschel4-4/+9
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>
2020-09-05Merge tags 'auxdisplay-for-linus-v5.9-rc4', 'clang-format-for-linus-v5.9-rc4' and 'compiler-attributes-for-linus-v5.9-rc4' of git://github.com/ojeda/linuxLinus Torvalds1-1/+1
Pull misc fixes from Miguel Ojeda: "A trivial patch for auxdisplay: - Replace HTTP links with HTTPS ones (Alexander A. Klimov) The usual clang-format trivial update: - Update with the latest for_each macro list (Miguel Ojeda) And Luc requested me to pick a sparse fix on my queue, so here it goes along with other two trivial Compiler Attributes ones (also from Luc). - sparse: use static inline for __chk_{user,io}_ptr() (Luc Van Oostenryck) - Compiler Attributes: fix comment concerning GCC 4.6 (Luc Van Oostenryck) - Compiler Attributes: remove comment about sparse not supporting __has_attribute (Luc Van Oostenryck)" * tag 'auxdisplay-for-linus-v5.9-rc4' of git://github.com/ojeda/linux: auxdisplay: Replace HTTP links with HTTPS ones * tag 'clang-format-for-linus-v5.9-rc4' of git://github.com/ojeda/linux: clang-format: Update with the latest for_each macro list * tag 'compiler-attributes-for-linus-v5.9-rc4' of git://github.com/ojeda/linux: sparse: use static inline for __chk_{user,io}_ptr() Compiler Attributes: fix comment concerning GCC 4.6 Compiler Attributes: remove comment about sparse not supporting __has_attribute
2020-08-23treewide: Use fallthrough pseudo-keywordGustavo A. R. Silva1-3/+3
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>
2020-08-08auxdisplay: Replace HTTP links with HTTPS onesAlexander A. Klimov1-1/+1
Rationale: Reduces attack surface on kernel devs opening the links for MITM as HTTPS traffic is much harder to manipulate. Deterministic algorithm: For each file: If not .svg: For each line: If doesn't contain `\bxmlns\b`: For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`: If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`: If both the HTTP and HTTPS versions return 200 OK and serve the same content: Replace HTTP with HTTPS. Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
2020-08-06Merge tag 'auxdisplay-for-linus-v5.9-rc1' of git://github.com/ojeda/linuxLinus Torvalds1-11/+6
Pull auxdisplay update from Miguel Ojeda: "Minor cleanup for auxdisplay: rReuse hex_to_bin() instead of custom code (Andy Shevchenko)" * tag 'auxdisplay-for-linus-v5.9-rc1' of git://github.com/ojeda/linux: auxdisplay: charlcd: Reuse hex_to_bin() instead of custom code
2020-06-14treewide: replace '---help---' in Kconfig files with 'help'Masahiro Yamada1-27/+27
Since commit 84af7a6194e4 ("checkpatch: kconfig: prefer 'help' over '---help---'"), the number of '---help---' has been gradually decreasing, but there are still more than 2400 instances. This commit finishes the conversion. While I touched the lines, I also fixed the indentation. There are a variety of indentation styles found. a) 4 spaces + '---help---' b) 7 spaces + '---help---' c) 8 spaces + '---help---' d) 1 space + 1 tab + '---help---' e) 1 tab + '---help---' (correct indentation) f) 1 tab + 1 space + '---help---' g) 1 tab + 2 spaces + '---help---' In order to convert all of them to 1 tab + 'help', I ran the following commend: $ find . -name 'Kconfig*' | xargs sed -i 's/^[[:space:]]*---help---/\thelp/' Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-05-29auxdisplay: charlcd: Reuse hex_to_bin() instead of custom codeAndy Shevchenko1-11/+6
hex_to_bin() may be used to convert hexdecimal digit to its binary representation. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
2020-03-23Merge 5.6-rc7 into char-misc-nextGreg Kroah-Hartman3-12/+10
We need the char/misc driver fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-18misc: cleanup minor number definitions in c file into miscdevice.hZhenzhong Duan2-4/+0
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>
2020-03-06auxdisplay: charlcd: replace zero-length array with flexible-array memberGustavo A. R. Silva1-1/+1
The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member[1][2], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being inadvertently introduced[3] to the codebase from now on. Also, notice that, dynamic memory allocations won't be affected by this change: "Flexible array members have incomplete type, and so the sizeof operator may not be applied. As a quirk of the original implementation of zero-length arrays, sizeof evaluates to zero."[1] This issue was found with the help of Coccinelle. [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://github.com/KSPP/linux/issues/21 [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
2020-03-06auxdisplay: img-ascii-lcd: convert to devm_platform_ioremap_resourceYangtao Li1-3/+1
Use devm_platform_ioremap_resource() to simplify code. Signed-off-by: Yangtao Li <tiny.windzz@gmail.com> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
2020-03-06auxdisplay: Fix Kconfig indentationKrzysztof Kozlowski1-8/+8
Adjust indentation from spaces to tab (+optional two spaces) as in coding style with command like: $ sed -e 's/^ /\t/' -i */Kconfig Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
2019-12-17Merge tag 'drm-misc-next-2019-12-16' of git://anongit.freedesktop.org/drm/drm-misc into drm-nextDaniel Vetter2-2/+2
drm-misc-next for v5.6: UAPI Changes: - Add support for DMA-BUF HEAPS. Cross-subsystem Changes: - mipi dsi definition updates, pulled into drm-intel as well. - Add lockdep annotations for dma_resv vs mmap_sem and fs_reclaim. - Remove support for dma-buf kmap/kunmap. - Constify fb_ops in all fbdev drivers, including drm drivers and drm-core, and media as well. Core Changes: - Small cleanups to ttm. - Fix SCDC definition. - Assorted cleanups to core. - Add todo to remove load/unload hooks, and use generic fbdev emulation. - Assorted documentation updates. - Use blocking ww lock in ttm fault handler. - Remove drm_fb_helper_fbdev_setup/teardown. - Warning fixes with W=1 for atomic. - Use drm_debug_enabled() instead of drm_debug flag testing in various drivers. - Fallback to nontiled mode in fbdev emulation when not all tiles are present. (Later on reverted) - Various kconfig indentation fixes in core and drivers. - Fix freeing transactions in dp-mst correctly. - Sean Paul is steping down as core maintainer. :-( - Add lockdep annotations for atomic locks vs dma-resv. - Prevent use-after-free for a bad job in drm_scheduler. - Fill out all block sizes in the P01x and P210 definitions. - Avoid division by zero in drm/rect, and fix bounds. - Add drm/rect selftests. - Add aspect ratio and alternate clocks for HDMI 4k modes. - Add todo for drm_framebuffer_funcs and fb_create cleanup. - Drop DRM_AUTH for prime import/export ioctls. - Clear DP-MST payload id tables downstream when initializating. - Fix for DSC throughput definition. - Add extra FEC definitions. - Fix fake offset in drm_gem_object_funs.mmap. - Stop using encoder->bridge in core directly - Handle bridge chaining slightly better. - Add backlight support to drm/panel, and use it in many panel drivers. - Increase max number of y420 modes from 128 to 256, as preparation to add the new modes. Driver Changes: - Small fixes all over. - Fix documentation in vkms. - Fix mmap_sem vs dma_resv in nouveau. - Small cleanup in komeda. - Add page flip support in gma500 for psb/cdv. - Add ddc symlink in the connector sysfs directory for many drivers. - Add support for analogic an6345, and fix small bugs in it. - Add atomic modesetting support to ast. - Fix radeon fault handler VMA race. - Switch udl to use generic shmem helpers. - Unconditional vblank handling for mcde. - Miscellaneous fixes to mcde. - Tweak debug output from komeda using debugfs. - Add gamma and color transform support to komeda for DOU-IPS. - Add support for sony acx424AKP panel. - Various small cleanups to gma500. - Use generic fbdev emulation in udl, and replace udl_framebuffer with generic implementation. - Add support for Logic PD Type 28 panel. - Use drm_panel_* wrapper functions in exynos/tegra/msm. - Add devicetree bindings for generic DSI panels. - Don't include drm_pci.h directly in many drivers. - Add support for begin/end_cpu_access in udmabuf. - Stop using drm_get_pci_dev in gma500 and mga200. - Fixes to UDL damage handling, and use dma_buf_begin/end_cpu_access. - Add devfreq thermal support to panfrost. - Fix hotplug with daisy chained monitors by removing VCPI when disabling topology manager. - meson: Add support for OSD1 plane AFBC commit. - Stop displaying garbage when toggling ast primary plane on/off. - More cleanups and fixes to UDL. - Add D32 suport to komeda. - Remove globle copy of drm_dev in gma500. - Add support for Boe Himax8279d MIPI-DSI LCD panel. - Add support for ingenic JZ4770 panel. - Small null pointer deference fix in ingenic. - Remove support for the special tfp420 driver, as there is a generic way to do it. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/ba73535a-9334-5302-2e1f-5208bd7390bd@linux.intel.com
2019-12-11auxdisplay: constify fb opsJani Nikula2-2/+2
Now that the fbops member of struct fb_info is const, we can start making the ops const as well. Cc: Miguel Ojeda Sandonis <miguel.ojeda.sandonis@gmail.com> Cc: Robin van der Gracht <robin@protonic.nl> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> Acked-by: Robin van der Gracht <robin@protonic.nl> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/31c18e3ce9d6962aabda4799b3051039ff591c92.1575390741.git.jani.nikula@intel.com
2019-12-04auxdisplay: charlcd: deduplicate simple_strtoul()Andy Shevchenko1-27/+7
Like in commit 8b2303de399f ("serial: core: Fix handling of options after MMIO address") we may use simple_strtoul() which in comparison to kstrtoul() can do conversion in-place without additional and unnecessary code to be written. Link: http://lkml.kernel.org/r/20190801192904.41087-2-andriy.shevchenko@linux.intel.com Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Cc: Geert Uytterhoeven <geert+renesas@glider.be> Cc: Mans Rullgard <mans@mansr.com> Cc: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-09-17Merge tag 'docs-5.4' of git://git.lwn.net/linuxLinus Torvalds1-1/+1
Pull documentation updates from Jonathan Corbet: "It's a somewhat calmer cycle for docs this time, as the churn of the mass RST conversion is happily mostly behind us. - A new document on reproducible builds. - We finally got around to zapping the documentation for hardware support that was removed in 2004; one doesn't want to rush these things. - The usual assortment of fixes, typo corrections, etc" * tag 'docs-5.4' of git://git.lwn.net/linux: (67 commits) Documentation: kbuild: Add document about reproducible builds docs: printk-formats: Stop encouraging use of unnecessary %h[xudi] and %hh[xudi] Documentation: Add "earlycon=sbi" to the admin guide doc:lock: remove reference to clever use of read-write lock devices.txt: improve entry for comedi (char major 98) docs: mtd: Update spi nor reference driver doc: arm64: fix grammar dtb placed in no attributes region Documentation: sysrq: don't recommend 'S' 'U' before 'B' mailmap: Update email address for Quentin Perret docs: ftrace: clarify when tracing is disabled by the trace file docs: process: fix broken link Documentation/arm/samsung-s3c24xx: Remove stray U+FEFF character to fix title Documentation/arm/sa1100/assabet: Fix 'make assabet_defconfig' command Documentation/arm/sa1100: Remove some obsolete documentation docs/zh_CN: update Chinese howto.rst for latexdocs making Documentation: virt: Fix broken reference to virt tree's index docs: Fix typo on pull requests guide kernel-doc: Allow anonymous enum Documentation: sphinx: Don't parse socket() as identifier reference Documentation: sphinx: Add missing comma to list of strings ...