@@ -91,7 +91,7 @@ struct charlcd_priv {
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,7 +105,7 @@ static void long_sleep(int ms)
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,7 +134,7 @@ static void charlcd_bl_off(struct work_struct *work)
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,7 +152,7 @@ EXPORT_SYMBOL_GPL(charlcd_poke);
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,7 +170,7 @@ static void charlcd_gotoxy(struct charlcd *lcd)
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,7 +179,7 @@ static void charlcd_home(struct charlcd *lcd)
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,7 +211,7 @@ static void charlcd_clear_fast(struct charlcd *lcd)
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,7 +223,7 @@ static void charlcd_clear_display(struct charlcd *lcd)
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,7 +369,7 @@ static bool parse_xy(const char *s, unsigned long *x, unsigned long *y)
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,7 +580,7 @@ static inline int handle_lcd_special_code(struct charlcd *lcd)
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,7 +705,7 @@ static ssize_t charlcd_write(struct file *file, const char __user *buf,
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,10 +763,24 @@ static void charlcd_puts(struct charlcd *lcd, const char *s)
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 ) {
@@ -784,13 +798,8 @@ static int charlcd_init(struct charlcd *lcd)
784
798
return ret ;
785
799
786
800
/* display a short message */
787
- #ifdef CONFIG_PANEL_CHANGE_MESSAGE
788
- #ifdef CONFIG_PANEL_BOOT_MESSAGE
789
- charlcd_puts (lcd , "\x1b[Lc\x1b[Lb\x1b[L*" CONFIG_PANEL_BOOT_MESSAGE );
790
- #endif
791
- #else
792
- charlcd_puts (lcd , "\x1b[Lc\x1b[Lb\x1b[L*Linux-" UTS_RELEASE "\n" );
793
- #endif
801
+ charlcd_puts (lcd , "\x1b[Lc\x1b[Lb" LCD_INIT_BL LCD_INIT_TEXT );
802
+
794
803
/* clear the display on the next device opening */
795
804
priv -> must_clear = true;
796
805
charlcd_home (lcd );
@@ -818,6 +827,12 @@ struct charlcd *charlcd_alloc(unsigned int drvdata_size)
818
827
}
819
828
EXPORT_SYMBOL_GPL (charlcd_alloc );
820
829
830
+ void charlcd_free (struct charlcd * lcd )
831
+ {
832
+ kfree (charlcd_to_priv (lcd ));
833
+ }
834
+ EXPORT_SYMBOL_GPL (charlcd_free );
835
+
821
836
static int panel_notify_sys (struct notifier_block * this , unsigned long code ,
822
837
void * unused )
823
838
{
@@ -866,7 +881,7 @@ EXPORT_SYMBOL_GPL(charlcd_register);
866
881
867
882
int charlcd_unregister (struct charlcd * lcd )
868
883
{
869
- struct charlcd_priv * priv = to_priv (lcd );
884
+ struct charlcd_priv * priv = charlcd_to_priv (lcd );
870
885
871
886
unregister_reboot_notifier (& panel_notifier );
872
887
charlcd_puts (lcd , "\x0cLCD driver unloaded.\x1b[Lc\x1b[Lb\x1b[L-" );
0 commit comments