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 'gpio-fixes-for-v5.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux

Pull gpio fixes from Bartosz Golaszewski:

- fix module autoloading on gpio-74x164 after a revert of OF modaliases

- fix problems with the bias setting in gpio-pca953x

- fix a use-after-free bug in gpio-mockup by using software nodes

* tag 'gpio-fixes-for-v5.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
gpio: mockup: Convert to use software nodes
gpio: pca953x: Improve bias setting
gpio: 74x164: Add SPI device ID table

+35 -10
+8
drivers/gpio/gpio-74x164.c
··· 174 174 return 0; 175 175 } 176 176 177 + static const struct spi_device_id gen_74x164_spi_ids[] = { 178 + { .name = "74hc595" }, 179 + { .name = "74lvc594" }, 180 + {}, 181 + }; 182 + MODULE_DEVICE_TABLE(spi, gen_74x164_spi_ids); 183 + 177 184 static const struct of_device_id gen_74x164_dt_ids[] = { 178 185 { .compatible = "fairchild,74hc595" }, 179 186 { .compatible = "nxp,74lvc594" }, ··· 195 188 }, 196 189 .probe = gen_74x164_probe, 197 190 .remove = gen_74x164_remove, 191 + .id_table = gen_74x164_spi_ids, 198 192 }; 199 193 module_spi_driver(gen_74x164_driver); 200 194
+18 -3
drivers/gpio/gpio-mockup.c
··· 476 476 477 477 static void gpio_mockup_unregister_pdevs(void) 478 478 { 479 + struct platform_device *pdev; 480 + struct fwnode_handle *fwnode; 479 481 int i; 480 482 481 - for (i = 0; i < GPIO_MOCKUP_MAX_GC; i++) 482 - platform_device_unregister(gpio_mockup_pdevs[i]); 483 + for (i = 0; i < GPIO_MOCKUP_MAX_GC; i++) { 484 + pdev = gpio_mockup_pdevs[i]; 485 + if (!pdev) 486 + continue; 487 + 488 + fwnode = dev_fwnode(&pdev->dev); 489 + platform_device_unregister(pdev); 490 + fwnode_remove_software_node(fwnode); 491 + } 483 492 } 484 493 485 494 static __init char **gpio_mockup_make_line_names(const char *label, ··· 517 508 struct property_entry properties[GPIO_MOCKUP_MAX_PROP]; 518 509 struct platform_device_info pdevinfo; 519 510 struct platform_device *pdev; 511 + struct fwnode_handle *fwnode; 520 512 char **line_names = NULL; 521 513 char chip_label[32]; 522 514 int prop = 0, base; ··· 546 536 "gpio-line-names", line_names, ngpio); 547 537 } 548 538 539 + fwnode = fwnode_create_software_node(properties, NULL); 540 + if (IS_ERR(fwnode)) 541 + return PTR_ERR(fwnode); 542 + 549 543 pdevinfo.name = "gpio-mockup"; 550 544 pdevinfo.id = idx; 551 - pdevinfo.properties = properties; 545 + pdevinfo.fwnode = fwnode; 552 546 553 547 pdev = platform_device_register_full(&pdevinfo); 554 548 kfree_strarray(line_names, ngpio); 555 549 if (IS_ERR(pdev)) { 550 + fwnode_remove_software_node(fwnode); 556 551 pr_err("error registering device"); 557 552 return PTR_ERR(pdev); 558 553 }
+9 -7
drivers/gpio/gpio-pca953x.c
··· 559 559 560 560 mutex_lock(&chip->i2c_lock); 561 561 562 - /* Disable pull-up/pull-down */ 563 - ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, 0); 564 - if (ret) 565 - goto exit; 566 - 567 562 /* Configure pull-up/pull-down */ 568 563 if (config == PIN_CONFIG_BIAS_PULL_UP) 569 564 ret = regmap_write_bits(chip->regmap, pull_sel_reg, bit, bit); 570 565 else if (config == PIN_CONFIG_BIAS_PULL_DOWN) 571 566 ret = regmap_write_bits(chip->regmap, pull_sel_reg, bit, 0); 567 + else 568 + ret = 0; 572 569 if (ret) 573 570 goto exit; 574 571 575 - /* Enable pull-up/pull-down */ 576 - ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, bit); 572 + /* Disable/Enable pull-up/pull-down */ 573 + if (config == PIN_CONFIG_BIAS_DISABLE) 574 + ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, 0); 575 + else 576 + ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, bit); 577 577 578 578 exit: 579 579 mutex_unlock(&chip->i2c_lock); ··· 587 587 588 588 switch (pinconf_to_config_param(config)) { 589 589 case PIN_CONFIG_BIAS_PULL_UP: 590 + case PIN_CONFIG_BIAS_PULL_PIN_DEFAULT: 590 591 case PIN_CONFIG_BIAS_PULL_DOWN: 592 + case PIN_CONFIG_BIAS_DISABLE: 591 593 return pca953x_gpio_set_pull_up_down(chip, offset, config); 592 594 default: 593 595 return -ENOTSUPP;