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-v6.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-auxdisplay

Pull auxdisplay updates from Andy Shevchenko:

- Refactor a couple of APIs to reduce amount of calls to memory
allocator

- Miscellaneous small fixes and improvements

* tag 'auxdisplay-v6.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-auxdisplay:
auxdisplay: hd44780: Rename hd to hdc in hd44780_common_alloc()
auxdisplay: hd44780: Call charlcd_alloc() from hd44780_common_alloc()
auxdisplay: panel: Make use of hd44780_common_free()
auxdisplay: hd44780: Make use of hd44780_common_free()
auxdisplay: hd44780: Introduce hd44780_common_free()
auxdisplay: lcd2s: Allocate memory for custom data in charlcd_alloc()
auxdisplay: charlcd: Partially revert "Move hwidth and bwidth to struct hd44780_common"
auxdisplay: panel: Fix an API misuse in panel.c
auxdisplay: hd44780: Fix an API misuse in hd44780.c
auxdisplay: MAX6959 should select BITREVERSE
auxdisplay: seg-led-gpio: use gpiod_multi_set_value_cansleep

+42 -48
+1
drivers/auxdisplay/Kconfig
··· 503 503 config MAX6959 504 504 tristate "Maxim MAX6958/6959 7-segment LED controller" 505 505 depends on I2C 506 + select BITREVERSE 506 507 select REGMAP_I2C 507 508 select LINEDISP 508 509 help
+3 -2
drivers/auxdisplay/charlcd.c
··· 595 595 return 0; 596 596 } 597 597 598 - struct charlcd *charlcd_alloc(void) 598 + struct charlcd *charlcd_alloc(unsigned int drvdata_size) 599 599 { 600 600 struct charlcd_priv *priv; 601 601 struct charlcd *lcd; 602 602 603 - priv = kzalloc(sizeof(*priv), GFP_KERNEL); 603 + priv = kzalloc(sizeof(*priv) + drvdata_size, GFP_KERNEL); 604 604 if (!priv) 605 605 return NULL; 606 606 607 607 priv->esc_seq.len = -1; 608 608 609 609 lcd = &priv->lcd; 610 + lcd->drvdata = priv->drvdata; 610 611 611 612 return lcd; 612 613 }
+3 -2
drivers/auxdisplay/charlcd.h
··· 51 51 unsigned long y; 52 52 } addr; 53 53 54 - void *drvdata; 54 + void *drvdata; /* Set by charlcd_alloc() */ 55 55 }; 56 56 57 57 /** ··· 95 95 }; 96 96 97 97 void charlcd_backlight(struct charlcd *lcd, enum charlcd_onoff on); 98 - struct charlcd *charlcd_alloc(void); 98 + 99 + struct charlcd *charlcd_alloc(unsigned int drvdata_size); 99 100 void charlcd_free(struct charlcd *lcd); 100 101 101 102 int charlcd_register(struct charlcd *lcd);
+6 -13
drivers/auxdisplay/hd44780.c
··· 222 222 return -EINVAL; 223 223 } 224 224 225 - hdc = hd44780_common_alloc(); 226 - if (!hdc) 227 - return -ENOMEM; 228 - 229 - lcd = charlcd_alloc(); 225 + lcd = hd44780_common_alloc(); 230 226 if (!lcd) 231 - goto fail1; 227 + return -ENOMEM; 232 228 233 229 hd = kzalloc(sizeof(*hd), GFP_KERNEL); 234 230 if (!hd) 235 231 goto fail2; 236 232 233 + hdc = lcd->drvdata; 237 234 hdc->hd44780 = hd; 238 - lcd->drvdata = hdc; 235 + 239 236 for (i = 0; i < ifwidth; i++) { 240 237 hd->pins[base + i] = devm_gpiod_get_index(dev, "data", i, 241 238 GPIOD_OUT_LOW); ··· 310 313 fail3: 311 314 kfree(hd); 312 315 fail2: 313 - kfree(lcd); 314 - fail1: 315 - kfree(hdc); 316 + hd44780_common_free(lcd); 316 317 return ret; 317 318 } 318 319 ··· 321 326 322 327 charlcd_unregister(lcd); 323 328 kfree(hdc->hd44780); 324 - kfree(lcd->drvdata); 325 - 326 - kfree(lcd); 329 + hd44780_common_free(lcd); 327 330 } 328 331 329 332 static const struct of_device_id hd44780_of_match[] = {
+16 -8
drivers/auxdisplay/hd44780_common.c
··· 351 351 } 352 352 EXPORT_SYMBOL_GPL(hd44780_common_redefine_char); 353 353 354 - struct hd44780_common *hd44780_common_alloc(void) 354 + struct charlcd *hd44780_common_alloc(void) 355 355 { 356 - struct hd44780_common *hd; 356 + struct hd44780_common *hdc; 357 + struct charlcd *lcd; 357 358 358 - hd = kzalloc(sizeof(*hd), GFP_KERNEL); 359 - if (!hd) 359 + lcd = charlcd_alloc(sizeof(*hdc)); 360 + if (!lcd) 360 361 return NULL; 361 362 362 - hd->ifwidth = 8; 363 - hd->bwidth = DEFAULT_LCD_BWIDTH; 364 - hd->hwidth = DEFAULT_LCD_HWIDTH; 365 - return hd; 363 + hdc = lcd->drvdata; 364 + hdc->ifwidth = 8; 365 + hdc->bwidth = DEFAULT_LCD_BWIDTH; 366 + hdc->hwidth = DEFAULT_LCD_HWIDTH; 367 + return lcd; 366 368 } 367 369 EXPORT_SYMBOL_GPL(hd44780_common_alloc); 370 + 371 + void hd44780_common_free(struct charlcd *lcd) 372 + { 373 + charlcd_free(lcd); 374 + } 375 + EXPORT_SYMBOL_GPL(hd44780_common_free); 368 376 369 377 MODULE_DESCRIPTION("Common functions for HD44780 (and compatibles) LCD displays"); 370 378 MODULE_LICENSE("GPL");
+3 -1
drivers/auxdisplay/hd44780_common.h
··· 30 30 int hd44780_common_fontsize(struct charlcd *lcd, enum charlcd_fontsize size); 31 31 int hd44780_common_lines(struct charlcd *lcd, enum charlcd_lines lines); 32 32 int hd44780_common_redefine_char(struct charlcd *lcd, char *esc); 33 - struct hd44780_common *hd44780_common_alloc(void); 33 + 34 + struct charlcd *hd44780_common_alloc(void); 35 + void hd44780_common_free(struct charlcd *lcd);
+4 -8
drivers/auxdisplay/lcd2s.c
··· 298 298 I2C_FUNC_SMBUS_WRITE_BLOCK_DATA)) 299 299 return -EIO; 300 300 301 - lcd2s = devm_kzalloc(&i2c->dev, sizeof(*lcd2s), GFP_KERNEL); 302 - if (!lcd2s) 303 - return -ENOMEM; 304 - 305 301 /* Test, if the display is responding */ 306 302 err = lcd2s_i2c_smbus_write_byte(i2c, LCD2S_CMD_DISPLAY_OFF); 307 303 if (err < 0) 308 304 return err; 309 305 310 - lcd = charlcd_alloc(); 306 + lcd = charlcd_alloc(sizeof(*lcd2s)); 311 307 if (!lcd) 312 308 return -ENOMEM; 313 309 314 - lcd->drvdata = lcd2s; 310 + lcd->ops = &lcd2s_ops; 311 + 312 + lcd2s = lcd->drvdata; 315 313 lcd2s->i2c = i2c; 316 314 lcd2s->charlcd = lcd; 317 315 ··· 323 325 &lcd->width); 324 326 if (err) 325 327 goto fail1; 326 - 327 - lcd->ops = &lcd2s_ops; 328 328 329 329 err = charlcd_register(lcd2s->charlcd); 330 330 if (err)
+5 -12
drivers/auxdisplay/panel.c
··· 831 831 struct charlcd *charlcd; 832 832 struct hd44780_common *hdc; 833 833 834 - hdc = hd44780_common_alloc(); 835 - if (!hdc) 834 + charlcd = hd44780_common_alloc(); 835 + if (!charlcd) 836 836 return; 837 837 838 - charlcd = charlcd_alloc(); 839 - if (!charlcd) { 840 - kfree(hdc); 841 - return; 842 - } 843 - 838 + hdc = charlcd->drvdata; 844 839 hdc->hd44780 = &lcd; 845 - charlcd->drvdata = hdc; 846 840 847 841 /* 848 842 * Init lcd struct with load-time values to preserve exact ··· 1658 1664 if (lcd.enabled) 1659 1665 charlcd_unregister(lcd.charlcd); 1660 1666 err_unreg_device: 1661 - kfree(lcd.charlcd); 1667 + hd44780_common_free(lcd.charlcd); 1662 1668 lcd.charlcd = NULL; 1663 1669 parport_unregister_device(pprt); 1664 1670 pprt = NULL; ··· 1685 1691 if (lcd.enabled) { 1686 1692 charlcd_unregister(lcd.charlcd); 1687 1693 lcd.initialized = false; 1688 - kfree(lcd.charlcd->drvdata); 1689 - kfree(lcd.charlcd); 1694 + hd44780_common_free(lcd.charlcd); 1690 1695 lcd.charlcd = NULL; 1691 1696 } 1692 1697
+1 -2
drivers/auxdisplay/seg-led-gpio.c
··· 36 36 37 37 bitmap_set_value8(values, map_to_seg7(&map->map.seg7, linedisp->buf[0]), 0); 38 38 39 - gpiod_set_array_value_cansleep(priv->segment_gpios->ndescs, priv->segment_gpios->desc, 40 - priv->segment_gpios->info, values); 39 + gpiod_multi_set_value_cansleep(priv->segment_gpios, values); 41 40 } 42 41 43 42 static int seg_led_linedisp_get_map_type(struct linedisp *linedisp)