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.18-rc1' of https://github.com/ojeda/linux

Pull auxdisplay updates from Miguel Ojeda:
"A few auxdisplay lcd2s improvements from Andy Shevchenko"

* tag 'auxdisplay-for-linus-v5.18-rc1' of https://github.com/ojeda/linux:
auxdisplay: lcd2s: Use array size explicitly in lcd2s_gotoxy()
auxdisplay: lcd2s: Switch to i2c ->probe_new()
auxdisplay: lcd2s: use module_i2c_driver to simplify the code
auxdisplay: lcd2s: make use of device property API
auxdisplay: lcd2s: Fix multi-line comment style

+17 -38
+17 -38
drivers/auxdisplay/lcd2s.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* 3 - * console driver for LCD2S 4x20 character displays connected through i2c. 4 - * The display also has a spi interface, but the driver does not support 3 + * Console driver for LCD2S 4x20 character displays connected through i2c. 4 + * The display also has a SPI interface, but the driver does not support 5 5 * this yet. 6 6 * 7 - * This is a driver allowing you to use a LCD2S 4x20 from modtronix 7 + * This is a driver allowing you to use a LCD2S 4x20 from Modtronix 8 8 * engineering as auxdisplay character device. 9 9 * 10 10 * (C) 2019 by Lemonage Software GmbH ··· 12 12 * All rights reserved. 13 13 */ 14 14 #include <linux/kernel.h> 15 + #include <linux/mod_devicetable.h> 15 16 #include <linux/module.h> 17 + #include <linux/property.h> 16 18 #include <linux/slab.h> 17 19 #include <linux/i2c.h> 18 20 #include <linux/delay.h> ··· 106 104 static int lcd2s_gotoxy(struct charlcd *lcd, unsigned int x, unsigned int y) 107 105 { 108 106 struct lcd2s_data *lcd2s = lcd->drvdata; 109 - u8 buf[] = { LCD2S_CMD_CUR_POS, y + 1, x + 1}; 107 + u8 buf[3] = { LCD2S_CMD_CUR_POS, y + 1, x + 1 }; 110 108 111 109 lcd2s_i2c_master_send(lcd2s->i2c, buf, sizeof(buf)); 112 110 ··· 216 214 return 0; 217 215 } 218 216 217 + /* 218 + * Generator: LGcxxxxx...xx; must have <c> between '0' and '7', 219 + * representing the numerical ASCII code of the redefined character, 220 + * and <xx...xx> a sequence of 16 hex digits representing 8 bytes 221 + * for each character. Most LCDs will only use 5 lower bits of 222 + * the 7 first bytes. 223 + */ 219 224 static int lcd2s_redefine_char(struct charlcd *lcd, char *esc) 220 225 { 221 - /* Generator : LGcxxxxx...xx; must have <c> between '0' 222 - * and '7', representing the numerical ASCII code of the 223 - * redefined character, and <xx...xx> a sequence of 16 224 - * hex digits representing 8 bytes for each character. 225 - * Most LCDs will only use 5 lower bits of the 7 first 226 - * bytes. 227 - */ 228 - 229 226 struct lcd2s_data *lcd2s = lcd->drvdata; 230 227 u8 buf[LCD2S_CHARACTER_SIZE + 2] = { LCD2S_CMD_DEF_CUSTOM_CHAR }; 231 228 u8 value; ··· 287 286 .redefine_char = lcd2s_redefine_char, 288 287 }; 289 288 290 - static int lcd2s_i2c_probe(struct i2c_client *i2c, 291 - const struct i2c_device_id *id) 289 + static int lcd2s_i2c_probe(struct i2c_client *i2c) 292 290 { 293 291 struct charlcd *lcd; 294 292 struct lcd2s_data *lcd2s; ··· 355 355 }; 356 356 MODULE_DEVICE_TABLE(i2c, lcd2s_i2c_id); 357 357 358 - #ifdef CONFIG_OF 359 358 static const struct of_device_id lcd2s_of_table[] = { 360 359 { .compatible = "modtronix,lcd2s" }, 361 360 { } 362 361 }; 363 362 MODULE_DEVICE_TABLE(of, lcd2s_of_table); 364 - #endif 365 363 366 364 static struct i2c_driver lcd2s_i2c_driver = { 367 365 .driver = { 368 366 .name = "lcd2s", 369 - #ifdef CONFIG_OF 370 - .of_match_table = of_match_ptr(lcd2s_of_table), 371 - #endif 367 + .of_match_table = lcd2s_of_table, 372 368 }, 373 - .probe = lcd2s_i2c_probe, 369 + .probe_new = lcd2s_i2c_probe, 374 370 .remove = lcd2s_i2c_remove, 375 371 .id_table = lcd2s_i2c_id, 376 372 }; 377 - 378 - static int __init lcd2s_modinit(void) 379 - { 380 - int ret = 0; 381 - 382 - ret = i2c_add_driver(&lcd2s_i2c_driver); 383 - if (ret != 0) 384 - pr_err("Failed to register lcd2s driver\n"); 385 - 386 - return ret; 387 - } 388 - module_init(lcd2s_modinit) 389 - 390 - static void __exit lcd2s_exit(void) 391 - { 392 - i2c_del_driver(&lcd2s_i2c_driver); 393 - } 394 - module_exit(lcd2s_exit) 373 + module_i2c_driver(lcd2s_i2c_driver); 395 374 396 375 MODULE_DESCRIPTION("LCD2S character display driver"); 397 376 MODULE_AUTHOR("Lars Poeschel");