Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'auxdisplay-for-linus-v5.1-rc2' of git://github.com/ojeda/linux

Pull auxdisplay updates from Miguel Ojeda:
"A few fixes and improvements for auxdisplay:

- Series to fix a memory leak in hd44780 while introducing
charlcd_free(). From Andy Shevchenko

- Series to clean up the Kconfig menus and a couple of improvements
for charlcd. From Mans Rullgard"

* tag 'auxdisplay-for-linus-v5.1-rc2' of git://github.com/ojeda/linux:
auxdisplay: charlcd: make backlight initial state configurable
auxdisplay: charlcd: simplify init message display
auxdisplay: deconfuse configuration
auxdisplay: hd44780: Convert to use charlcd_free()
auxdisplay: panel: Convert to use charlcd_free()
auxdisplay: charlcd: Introduce charlcd_free() helper
auxdisplay: charlcd: Move to_priv() to charlcd namespace
auxdisplay: hd44780: Fix memory leak on ->remove()

+75 -29
+33 -5
drivers/auxdisplay/Kconfig
··· 164 164 line and the Linux version on the second line, but that's 165 165 still useful. 166 166 167 - endif # AUXDISPLAY 168 - 169 - menuconfig PANEL 167 + menuconfig PARPORT_PANEL 170 168 tristate "Parallel port LCD/Keypad Panel support" 171 169 depends on PARPORT 172 170 select CHARLCD ··· 176 178 compiled as a module, or linked into the kernel and started at boot. 177 179 If you don't understand what all this is about, say N. 178 180 179 - if PANEL 181 + if PARPORT_PANEL 180 182 181 183 config PANEL_PARPORT 182 184 int "Default parallel port number (0=LPT1)" ··· 417 419 418 420 Default for the 'BL' pin in custom profile is '0' (uncontrolled). 419 421 422 + endif # PARPORT_PANEL 423 + 420 424 config PANEL_CHANGE_MESSAGE 421 425 bool "Change LCD initialization message ?" 426 + depends on CHARLCD 422 427 default "n" 423 428 ---help--- 424 429 This allows you to replace the boot message indicating the kernel version ··· 445 444 An empty message will only clear the display at driver init time. Any other 446 445 printf()-formatted message is valid with newline and escape codes. 447 446 448 - endif # PANEL 447 + choice 448 + prompt "Backlight initial state" 449 + default CHARLCD_BL_FLASH 450 + 451 + config CHARLCD_BL_OFF 452 + bool "Off" 453 + help 454 + Backlight is initially turned off 455 + 456 + config CHARLCD_BL_ON 457 + bool "On" 458 + help 459 + Backlight is initially turned on 460 + 461 + config CHARLCD_BL_FLASH 462 + bool "Flash" 463 + help 464 + Backlight is flashed briefly on init 465 + 466 + endchoice 467 + 468 + endif # AUXDISPLAY 469 + 470 + config PANEL 471 + tristate "Parallel port LCD/Keypad Panel support (OLD OPTION)" 472 + depends on PARPORT 473 + select AUXDISPLAY 474 + select PARPORT_PANEL 449 475 450 476 config CHARLCD 451 477 tristate "Character LCD core support" if COMPILE_TEST
+1 -1
drivers/auxdisplay/Makefile
··· 10 10 obj-$(CONFIG_IMG_ASCII_LCD) += img-ascii-lcd.o 11 11 obj-$(CONFIG_HD44780) += hd44780.o 12 12 obj-$(CONFIG_HT16K33) += ht16k33.o 13 - obj-$(CONFIG_PANEL) += panel.o 13 + obj-$(CONFIG_PARPORT_PANEL) += panel.o
+35 -20
drivers/auxdisplay/charlcd.c
··· 91 91 unsigned long long drvdata[0]; 92 92 }; 93 93 94 - #define to_priv(p) container_of(p, struct charlcd_priv, lcd) 94 + #define charlcd_to_priv(p) container_of(p, struct charlcd_priv, lcd) 95 95 96 96 /* Device single-open policy control */ 97 97 static atomic_t charlcd_available = ATOMIC_INIT(1); ··· 105 105 /* turn the backlight on or off */ 106 106 static void charlcd_backlight(struct charlcd *lcd, int on) 107 107 { 108 - struct charlcd_priv *priv = to_priv(lcd); 108 + struct charlcd_priv *priv = charlcd_to_priv(lcd); 109 109 110 110 if (!lcd->ops->backlight) 111 111 return; ··· 134 134 /* turn the backlight on for a little while */ 135 135 void charlcd_poke(struct charlcd *lcd) 136 136 { 137 - struct charlcd_priv *priv = to_priv(lcd); 137 + struct charlcd_priv *priv = charlcd_to_priv(lcd); 138 138 139 139 if (!lcd->ops->backlight) 140 140 return; ··· 152 152 153 153 static void charlcd_gotoxy(struct charlcd *lcd) 154 154 { 155 - struct charlcd_priv *priv = to_priv(lcd); 155 + struct charlcd_priv *priv = charlcd_to_priv(lcd); 156 156 unsigned int addr; 157 157 158 158 /* ··· 170 170 171 171 static void charlcd_home(struct charlcd *lcd) 172 172 { 173 - struct charlcd_priv *priv = to_priv(lcd); 173 + struct charlcd_priv *priv = charlcd_to_priv(lcd); 174 174 175 175 priv->addr.x = 0; 176 176 priv->addr.y = 0; ··· 179 179 180 180 static void charlcd_print(struct charlcd *lcd, char c) 181 181 { 182 - struct charlcd_priv *priv = to_priv(lcd); 182 + struct charlcd_priv *priv = charlcd_to_priv(lcd); 183 183 184 184 if (priv->addr.x < lcd->bwidth) { 185 185 if (lcd->char_conv) ··· 211 211 /* clears the display and resets X/Y */ 212 212 static void charlcd_clear_display(struct charlcd *lcd) 213 213 { 214 - struct charlcd_priv *priv = to_priv(lcd); 214 + struct charlcd_priv *priv = charlcd_to_priv(lcd); 215 215 216 216 lcd->ops->write_cmd(lcd, LCD_CMD_DISPLAY_CLEAR); 217 217 priv->addr.x = 0; ··· 223 223 static int charlcd_init_display(struct charlcd *lcd) 224 224 { 225 225 void (*write_cmd_raw)(struct charlcd *lcd, int cmd); 226 - struct charlcd_priv *priv = to_priv(lcd); 226 + struct charlcd_priv *priv = charlcd_to_priv(lcd); 227 227 u8 init; 228 228 229 229 if (lcd->ifwidth != 4 && lcd->ifwidth != 8) ··· 369 369 370 370 static inline int handle_lcd_special_code(struct charlcd *lcd) 371 371 { 372 - struct charlcd_priv *priv = to_priv(lcd); 372 + struct charlcd_priv *priv = charlcd_to_priv(lcd); 373 373 374 374 /* LCD special codes */ 375 375 ··· 580 580 581 581 static void charlcd_write_char(struct charlcd *lcd, char c) 582 582 { 583 - struct charlcd_priv *priv = to_priv(lcd); 583 + struct charlcd_priv *priv = charlcd_to_priv(lcd); 584 584 585 585 /* first, we'll test if we're in escape mode */ 586 586 if ((c != '\n') && priv->esc_seq.len >= 0) { ··· 705 705 706 706 static int charlcd_open(struct inode *inode, struct file *file) 707 707 { 708 - struct charlcd_priv *priv = to_priv(the_charlcd); 708 + struct charlcd_priv *priv = charlcd_to_priv(the_charlcd); 709 709 int ret; 710 710 711 711 ret = -EBUSY; ··· 763 763 } 764 764 } 765 765 766 + #ifdef CONFIG_PANEL_BOOT_MESSAGE 767 + #define LCD_INIT_TEXT CONFIG_PANEL_BOOT_MESSAGE 768 + #else 769 + #define LCD_INIT_TEXT "Linux-" UTS_RELEASE "\n" 770 + #endif 771 + 772 + #ifdef CONFIG_CHARLCD_BL_ON 773 + #define LCD_INIT_BL "\x1b[L+" 774 + #elif defined(CONFIG_CHARLCD_BL_FLASH) 775 + #define LCD_INIT_BL "\x1b[L*" 776 + #else 777 + #define LCD_INIT_BL "\x1b[L-" 778 + #endif 779 + 766 780 /* initialize the LCD driver */ 767 781 static int charlcd_init(struct charlcd *lcd) 768 782 { 769 - struct charlcd_priv *priv = to_priv(lcd); 783 + struct charlcd_priv *priv = charlcd_to_priv(lcd); 770 784 int ret; 771 785 772 786 if (lcd->ops->backlight) { ··· 798 784 return ret; 799 785 800 786 /* display a short message */ 801 - #ifdef CONFIG_PANEL_CHANGE_MESSAGE 802 - #ifdef CONFIG_PANEL_BOOT_MESSAGE 803 - charlcd_puts(lcd, "\x1b[Lc\x1b[Lb\x1b[L*" CONFIG_PANEL_BOOT_MESSAGE); 804 - #endif 805 - #else 806 - charlcd_puts(lcd, "\x1b[Lc\x1b[Lb\x1b[L*Linux-" UTS_RELEASE "\n"); 807 - #endif 787 + charlcd_puts(lcd, "\x1b[Lc\x1b[Lb" LCD_INIT_BL LCD_INIT_TEXT); 788 + 808 789 /* clear the display on the next device opening */ 809 790 priv->must_clear = true; 810 791 charlcd_home(lcd); ··· 826 817 return lcd; 827 818 } 828 819 EXPORT_SYMBOL_GPL(charlcd_alloc); 820 + 821 + void charlcd_free(struct charlcd *lcd) 822 + { 823 + kfree(charlcd_to_priv(lcd)); 824 + } 825 + EXPORT_SYMBOL_GPL(charlcd_free); 829 826 830 827 static int panel_notify_sys(struct notifier_block *this, unsigned long code, 831 828 void *unused) ··· 881 866 882 867 int charlcd_unregister(struct charlcd *lcd) 883 868 { 884 - struct charlcd_priv *priv = to_priv(lcd); 869 + struct charlcd_priv *priv = charlcd_to_priv(lcd); 885 870 886 871 unregister_reboot_notifier(&panel_notifier); 887 872 charlcd_puts(lcd, "\x0cLCD driver unloaded.\x1b[Lc\x1b[Lb\x1b[L-");
+3 -1
drivers/auxdisplay/hd44780.c
··· 271 271 return 0; 272 272 273 273 fail: 274 - kfree(lcd); 274 + charlcd_free(lcd); 275 275 return ret; 276 276 } 277 277 ··· 280 280 struct charlcd *lcd = platform_get_drvdata(pdev); 281 281 282 282 charlcd_unregister(lcd); 283 + 284 + charlcd_free(lcd); 283 285 return 0; 284 286 } 285 287
+2 -2
drivers/auxdisplay/panel.c
··· 1620 1620 if (lcd.enabled) 1621 1621 charlcd_unregister(lcd.charlcd); 1622 1622 err_unreg_device: 1623 - kfree(lcd.charlcd); 1623 + charlcd_free(lcd.charlcd); 1624 1624 lcd.charlcd = NULL; 1625 1625 parport_unregister_device(pprt); 1626 1626 pprt = NULL; ··· 1647 1647 if (lcd.enabled) { 1648 1648 charlcd_unregister(lcd.charlcd); 1649 1649 lcd.initialized = false; 1650 - kfree(lcd.charlcd); 1650 + charlcd_free(lcd.charlcd); 1651 1651 lcd.charlcd = NULL; 1652 1652 } 1653 1653
+1
include/misc/charlcd.h
··· 35 35 }; 36 36 37 37 struct charlcd *charlcd_alloc(unsigned int drvdata_size); 38 + void charlcd_free(struct charlcd *lcd); 38 39 39 40 int charlcd_register(struct charlcd *lcd); 40 41 int charlcd_unregister(struct charlcd *lcd);