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 'i2c-for-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c updates from Wolfram Sang:

- I2C has now a co-maintainer taking care of the host drivers. Welcome
Andi Shyti and have fun!

- platform remove callback converted to return void in drivers

- simplify drivers by using devm_clk_get_enabled()

- introduce i2c_get_match_data() to avoid more boilerplate code
(especially since the core stopped delivering an i2c_device_id)

- and the usual bunch of driver updates

* tag 'i2c-for-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (38 commits)
i2c: uniphier: Use devm_clk_get_enabled()
i2c: uniphier-f: Use devm_clk_get_enabled()
i2c: owl: Use devm_clk_get_enabled()
i2c: lpc2k: Use devm_clk_get_enabled()
i2c: hix5hd2: Use devm_clk_get_enabled()
i2c: sun6i-p2wi: Use devm_clk_get_enabled()
i2c: pasemi-platform: Use devm_clk_get_enabled()
i2c: mt7621: Use devm_clk_get_enabled()
i2c: xiic: Use devm_clk_get_enabled()
i2c: davinci: Use platform table macro over module_alias
i2c: ocores: use devm_ managed clks
i2c: nomadik: Use dev_err_probe() whenever possible
i2c: nomadik: Use devm_clk_get_enabled()
i2c: nomadik: Remove unnecessary goto label
usb: typec: ucsi: Mark dGPUs as DEVICE scope
i2c: wmt: Use devm_platform_get_and_ioremap_resource()
i2c: versatile: Use devm_platform_get_and_ioremap_resource()
i2c: hix5hd2: Add I2C_M_STOP flag support for i2c-hix5hd2 driver.
i2c: mpc: Use of_property_read_reg() to parse "reg"
i2c: imx-lpi2c: Don't open-code DIV_ROUND_UP
...

+584 -726
+1 -1
Documentation/i2c/busses/i2c-i801.rst
··· 46 46 * Intel Emmitsburg (PCH) 47 47 * Intel Alder Lake (PCH) 48 48 * Intel Raptor Lake (PCH) 49 - * Intel Meteor Lake (SOC) 49 + * Intel Meteor Lake (SOC and PCH) 50 50 51 51 Datasheets: Publicly available at the Intel website 52 52
+2 -2
drivers/i2c/busses/Kconfig
··· 157 157 Emmitsburg (PCH) 158 158 Alder Lake (PCH) 159 159 Raptor Lake (PCH) 160 - Meteor Lake (SOC) 160 + Meteor Lake (SOC and PCH) 161 161 162 162 This driver can also be built as a module. If so, the module 163 163 will be called i2c-i801. ··· 1025 1025 depends on ARCH_RENESAS || COMPILE_TEST 1026 1026 help 1027 1027 If you say yes to this option, support will be included for the 1028 - Renesas RZ/V2M I2C interface. 1028 + Renesas RZ/V2M I2C interface. 1029 1029 1030 1030 This driver can also be built as a module. If so, the module 1031 1031 will be called i2c-rzv2m.
+2 -4
drivers/i2c/busses/i2c-altera.c
··· 465 465 return 0; 466 466 } 467 467 468 - static int altr_i2c_remove(struct platform_device *pdev) 468 + static void altr_i2c_remove(struct platform_device *pdev) 469 469 { 470 470 struct altr_i2c_dev *idev = platform_get_drvdata(pdev); 471 471 472 472 clk_disable_unprepare(idev->i2c_clk); 473 473 i2c_del_adapter(&idev->adapter); 474 - 475 - return 0; 476 474 } 477 475 478 476 /* Match table for of_platform binding */ ··· 482 484 483 485 static struct platform_driver altr_i2c_driver = { 484 486 .probe = altr_i2c_probe, 485 - .remove = altr_i2c_remove, 487 + .remove_new = altr_i2c_remove, 486 488 .driver = { 487 489 .name = "altera-i2c", 488 490 .of_match_table = altr_i2c_of_match,
+2 -3
drivers/i2c/busses/i2c-amd-mp2-plat.c
··· 322 322 return ret; 323 323 } 324 324 325 - static int i2c_amd_remove(struct platform_device *pdev) 325 + static void i2c_amd_remove(struct platform_device *pdev) 326 326 { 327 327 struct amd_i2c_dev *i2c_dev = platform_get_drvdata(pdev); 328 328 struct amd_i2c_common *i2c_common = &i2c_dev->common; ··· 336 336 i2c_unlock_bus(&i2c_dev->adap, I2C_LOCK_ROOT_ADAPTER); 337 337 338 338 i2c_del_adapter(&i2c_dev->adap); 339 - return 0; 340 339 } 341 340 342 341 static const struct acpi_device_id i2c_amd_acpi_match[] = { ··· 346 347 347 348 static struct platform_driver i2c_amd_plat_driver = { 348 349 .probe = i2c_amd_probe, 349 - .remove = i2c_amd_remove, 350 + .remove_new = i2c_amd_remove, 350 351 .driver = { 351 352 .name = "i2c_amd_mp2", 352 353 .acpi_match_table = ACPI_PTR(i2c_amd_acpi_match),
+2 -4
drivers/i2c/busses/i2c-aspeed.c
··· 1061 1061 return 0; 1062 1062 } 1063 1063 1064 - static int aspeed_i2c_remove_bus(struct platform_device *pdev) 1064 + static void aspeed_i2c_remove_bus(struct platform_device *pdev) 1065 1065 { 1066 1066 struct aspeed_i2c_bus *bus = platform_get_drvdata(pdev); 1067 1067 unsigned long flags; ··· 1077 1077 reset_control_assert(bus->rst); 1078 1078 1079 1079 i2c_del_adapter(&bus->adap); 1080 - 1081 - return 0; 1082 1080 } 1083 1081 1084 1082 static struct platform_driver aspeed_i2c_bus_driver = { 1085 1083 .probe = aspeed_i2c_probe_bus, 1086 - .remove = aspeed_i2c_remove_bus, 1084 + .remove_new = aspeed_i2c_remove_bus, 1087 1085 .driver = { 1088 1086 .name = "aspeed-i2c-bus", 1089 1087 .of_match_table = aspeed_i2c_bus_of_table,
+2 -4
drivers/i2c/busses/i2c-at91-core.c
··· 273 273 return 0; 274 274 } 275 275 276 - static int at91_twi_remove(struct platform_device *pdev) 276 + static void at91_twi_remove(struct platform_device *pdev) 277 277 { 278 278 struct at91_twi_dev *dev = platform_get_drvdata(pdev); 279 279 ··· 282 282 283 283 pm_runtime_disable(dev->dev); 284 284 pm_runtime_set_suspended(dev->dev); 285 - 286 - return 0; 287 285 } 288 286 289 287 static int __maybe_unused at91_twi_runtime_suspend(struct device *dev) ··· 340 342 341 343 static struct platform_driver at91_twi_driver = { 342 344 .probe = at91_twi_probe, 343 - .remove = at91_twi_remove, 345 + .remove_new = at91_twi_remove, 344 346 .id_table = at91_twi_devtypes, 345 347 .driver = { 346 348 .name = "at91_i2c",
+2 -3
drivers/i2c/busses/i2c-au1550.c
··· 334 334 return 0; 335 335 } 336 336 337 - static int i2c_au1550_remove(struct platform_device *pdev) 337 + static void i2c_au1550_remove(struct platform_device *pdev) 338 338 { 339 339 struct i2c_au1550_data *priv = platform_get_drvdata(pdev); 340 340 341 341 i2c_del_adapter(&priv->adap); 342 342 i2c_au1550_disable(priv); 343 - return 0; 344 343 } 345 344 346 345 #ifdef CONFIG_PM ··· 378 379 .pm = AU1XPSC_SMBUS_PMOPS, 379 380 }, 380 381 .probe = i2c_au1550_probe, 381 - .remove = i2c_au1550_remove, 382 + .remove_new = i2c_au1550_remove, 382 383 }; 383 384 384 385 module_platform_driver(au1xpsc_smbus_driver);
+2 -4
drivers/i2c/busses/i2c-axxia.c
··· 804 804 return ret; 805 805 } 806 806 807 - static int axxia_i2c_remove(struct platform_device *pdev) 807 + static void axxia_i2c_remove(struct platform_device *pdev) 808 808 { 809 809 struct axxia_i2c_dev *idev = platform_get_drvdata(pdev); 810 810 811 811 clk_disable_unprepare(idev->i2c_clk); 812 812 i2c_del_adapter(&idev->adapter); 813 - 814 - return 0; 815 813 } 816 814 817 815 /* Match table for of_platform binding */ ··· 822 824 823 825 static struct platform_driver axxia_i2c_driver = { 824 826 .probe = axxia_i2c_probe, 825 - .remove = axxia_i2c_remove, 827 + .remove_new = axxia_i2c_remove, 826 828 .driver = { 827 829 .name = "axxia-i2c", 828 830 .of_match_table = axxia_i2c_of_match,
+2 -4
drivers/i2c/busses/i2c-bcm-iproc.c
··· 1107 1107 return i2c_add_adapter(adap); 1108 1108 } 1109 1109 1110 - static int bcm_iproc_i2c_remove(struct platform_device *pdev) 1110 + static void bcm_iproc_i2c_remove(struct platform_device *pdev) 1111 1111 { 1112 1112 struct bcm_iproc_i2c_dev *iproc_i2c = platform_get_drvdata(pdev); 1113 1113 ··· 1123 1123 1124 1124 i2c_del_adapter(&iproc_i2c->adapter); 1125 1125 bcm_iproc_i2c_enable_disable(iproc_i2c, false); 1126 - 1127 - return 0; 1128 1126 } 1129 1127 1130 1128 #ifdef CONFIG_PM_SLEEP ··· 1258 1260 .pm = BCM_IPROC_I2C_PM_OPS, 1259 1261 }, 1260 1262 .probe = bcm_iproc_i2c_probe, 1261 - .remove = bcm_iproc_i2c_remove, 1263 + .remove_new = bcm_iproc_i2c_remove, 1262 1264 }; 1263 1265 module_platform_driver(bcm_iproc_i2c_driver); 1264 1266
+2 -4
drivers/i2c/busses/i2c-bcm-kona.c
··· 859 859 return rc; 860 860 } 861 861 862 - static int bcm_kona_i2c_remove(struct platform_device *pdev) 862 + static void bcm_kona_i2c_remove(struct platform_device *pdev) 863 863 { 864 864 struct bcm_kona_i2c_dev *dev = platform_get_drvdata(pdev); 865 865 866 866 i2c_del_adapter(&dev->adapter); 867 - 868 - return 0; 869 867 } 870 868 871 869 static const struct of_device_id bcm_kona_i2c_of_match[] = { ··· 878 880 .of_match_table = bcm_kona_i2c_of_match, 879 881 }, 880 882 .probe = bcm_kona_i2c_probe, 881 - .remove = bcm_kona_i2c_remove, 883 + .remove_new = bcm_kona_i2c_remove, 882 884 }; 883 885 module_platform_driver(bcm_kona_i2c_driver); 884 886
+2 -4
drivers/i2c/busses/i2c-bcm2835.c
··· 503 503 return ret; 504 504 } 505 505 506 - static int bcm2835_i2c_remove(struct platform_device *pdev) 506 + static void bcm2835_i2c_remove(struct platform_device *pdev) 507 507 { 508 508 struct bcm2835_i2c_dev *i2c_dev = platform_get_drvdata(pdev); 509 509 ··· 512 512 513 513 free_irq(i2c_dev->irq, i2c_dev); 514 514 i2c_del_adapter(&i2c_dev->adapter); 515 - 516 - return 0; 517 515 } 518 516 519 517 static const struct of_device_id bcm2835_i2c_of_match[] = { ··· 523 525 524 526 static struct platform_driver bcm2835_i2c_driver = { 525 527 .probe = bcm2835_i2c_probe, 526 - .remove = bcm2835_i2c_remove, 528 + .remove_new = bcm2835_i2c_remove, 527 529 .driver = { 528 530 .name = "i2c-bcm2835", 529 531 .of_match_table = bcm2835_i2c_of_match,
+2 -3
drivers/i2c/busses/i2c-brcmstb.c
··· 690 690 return rc; 691 691 } 692 692 693 - static int brcmstb_i2c_remove(struct platform_device *pdev) 693 + static void brcmstb_i2c_remove(struct platform_device *pdev) 694 694 { 695 695 struct brcmstb_i2c_dev *dev = platform_get_drvdata(pdev); 696 696 697 697 i2c_del_adapter(&dev->adapter); 698 - return 0; 699 698 } 700 699 701 700 #ifdef CONFIG_PM_SLEEP ··· 735 736 .pm = &brcmstb_i2c_pm, 736 737 }, 737 738 .probe = brcmstb_i2c_probe, 738 - .remove = brcmstb_i2c_remove, 739 + .remove_new = brcmstb_i2c_remove, 739 740 }; 740 741 module_platform_driver(brcmstb_i2c_driver); 741 742
+2 -4
drivers/i2c/busses/i2c-cadence.c
··· 1415 1415 * 1416 1416 * Return: 0 always 1417 1417 */ 1418 - static int cdns_i2c_remove(struct platform_device *pdev) 1418 + static void cdns_i2c_remove(struct platform_device *pdev) 1419 1419 { 1420 1420 struct cdns_i2c *id = platform_get_drvdata(pdev); 1421 1421 ··· 1427 1427 clk_notifier_unregister(id->clk, &id->clk_rate_change_nb); 1428 1428 reset_control_assert(id->reset); 1429 1429 clk_disable_unprepare(id->clk); 1430 - 1431 - return 0; 1432 1430 } 1433 1431 1434 1432 static struct platform_driver cdns_i2c_drv = { ··· 1436 1438 .pm = &cdns_i2c_dev_pm_ops, 1437 1439 }, 1438 1440 .probe = cdns_i2c_probe, 1439 - .remove = cdns_i2c_remove, 1441 + .remove_new = cdns_i2c_remove, 1440 1442 }; 1441 1443 1442 1444 module_platform_driver(cdns_i2c_drv);
+2 -4
drivers/i2c/busses/i2c-cbus-gpio.c
··· 200 200 .functionality = cbus_i2c_func, 201 201 }; 202 202 203 - static int cbus_i2c_remove(struct platform_device *pdev) 203 + static void cbus_i2c_remove(struct platform_device *pdev) 204 204 { 205 205 struct i2c_adapter *adapter = platform_get_drvdata(pdev); 206 206 207 207 i2c_del_adapter(adapter); 208 - 209 - return 0; 210 208 } 211 209 212 210 static int cbus_i2c_probe(struct platform_device *pdev) ··· 264 266 265 267 static struct platform_driver cbus_i2c_driver = { 266 268 .probe = cbus_i2c_probe, 267 - .remove = cbus_i2c_remove, 269 + .remove_new = cbus_i2c_remove, 268 270 .driver = { 269 271 .name = "i2c-cbus-gpio", 270 272 .of_match_table = of_match_ptr(i2c_cbus_dt_ids),
+2 -4
drivers/i2c/busses/i2c-cht-wc.c
··· 529 529 return ret; 530 530 } 531 531 532 - static int cht_wc_i2c_adap_i2c_remove(struct platform_device *pdev) 532 + static void cht_wc_i2c_adap_i2c_remove(struct platform_device *pdev) 533 533 { 534 534 struct cht_wc_i2c_adap *adap = platform_get_drvdata(pdev); 535 535 536 536 i2c_unregister_device(adap->client); 537 537 i2c_del_adapter(&adap->adapter); 538 538 irq_domain_remove(adap->irq_domain); 539 - 540 - return 0; 541 539 } 542 540 543 541 static const struct platform_device_id cht_wc_i2c_adap_id_table[] = { ··· 546 548 547 549 static struct platform_driver cht_wc_i2c_adap_driver = { 548 550 .probe = cht_wc_i2c_adap_i2c_probe, 549 - .remove = cht_wc_i2c_adap_i2c_remove, 551 + .remove_new = cht_wc_i2c_adap_i2c_remove, 550 552 .driver = { 551 553 .name = "cht_wcove_ext_chgr", 552 554 },
+2 -4
drivers/i2c/busses/i2c-cpm.c
··· 676 676 return result; 677 677 } 678 678 679 - static int cpm_i2c_remove(struct platform_device *ofdev) 679 + static void cpm_i2c_remove(struct platform_device *ofdev) 680 680 { 681 681 struct cpm_i2c *cpm = platform_get_drvdata(ofdev); 682 682 ··· 685 685 cpm_i2c_shutdown(cpm); 686 686 687 687 kfree(cpm); 688 - 689 - return 0; 690 688 } 691 689 692 690 static const struct of_device_id cpm_i2c_match[] = { ··· 701 703 702 704 static struct platform_driver cpm_i2c_driver = { 703 705 .probe = cpm_i2c_probe, 704 - .remove = cpm_i2c_remove, 706 + .remove_new = cpm_i2c_remove, 705 707 .driver = { 706 708 .name = "fsl-i2c-cpm", 707 709 .of_match_table = cpm_i2c_match,
+2 -4
drivers/i2c/busses/i2c-cros-ec-tunnel.c
··· 283 283 return err; 284 284 } 285 285 286 - static int ec_i2c_remove(struct platform_device *dev) 286 + static void ec_i2c_remove(struct platform_device *dev) 287 287 { 288 288 struct ec_i2c_device *bus = platform_get_drvdata(dev); 289 289 290 290 i2c_del_adapter(&bus->adap); 291 - 292 - return 0; 293 291 } 294 292 295 293 static const struct of_device_id cros_ec_i2c_of_match[] __maybe_unused = { ··· 304 306 305 307 static struct platform_driver ec_i2c_tunnel_driver = { 306 308 .probe = ec_i2c_probe, 307 - .remove = ec_i2c_remove, 309 + .remove_new = ec_i2c_remove, 308 310 .driver = { 309 311 .name = "cros-ec-i2c-tunnel", 310 312 .acpi_match_table = ACPI_PTR(cros_ec_i2c_tunnel_acpi_id),
+14 -15
drivers/i2c/busses/i2c-davinci.c
··· 767 767 if (irq < 0) 768 768 return dev_err_probe(&pdev->dev, irq, "can't get irq resource\n"); 769 769 770 - dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_i2c_dev), 771 - GFP_KERNEL); 772 - if (!dev) { 773 - dev_err(&pdev->dev, "Memory allocation failed\n"); 770 + dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); 771 + if (!dev) 774 772 return -ENOMEM; 775 - } 776 773 777 774 init_completion(&dev->cmd_complete); 778 775 ··· 882 885 return r; 883 886 } 884 887 885 - static int davinci_i2c_remove(struct platform_device *pdev) 888 + static void davinci_i2c_remove(struct platform_device *pdev) 886 889 { 887 890 struct davinci_i2c_dev *dev = platform_get_drvdata(pdev); 888 891 int ret; ··· 891 894 892 895 i2c_del_adapter(&dev->adapter); 893 896 894 - ret = pm_runtime_resume_and_get(&pdev->dev); 897 + ret = pm_runtime_get_sync(&pdev->dev); 895 898 if (ret < 0) 896 - return ret; 897 - 898 - davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, 0); 899 + dev_err(&pdev->dev, "Failed to resume device\n"); 900 + else 901 + davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, 0); 899 902 900 903 pm_runtime_dont_use_autosuspend(dev->dev); 901 904 pm_runtime_put_sync(dev->dev); 902 905 pm_runtime_disable(dev->dev); 903 - 904 - return 0; 905 906 } 906 907 907 908 #ifdef CONFIG_PM ··· 935 940 #define davinci_i2c_pm_ops NULL 936 941 #endif 937 942 938 - /* work with hotplug and coldplug */ 939 - MODULE_ALIAS("platform:i2c_davinci"); 943 + static const struct platform_device_id davinci_i2c_driver_ids[] = { 944 + { .name = "i2c_davinci", }, 945 + { /* sentinel */ } 946 + }; 947 + MODULE_DEVICE_TABLE(platform, davinci_i2c_driver_ids); 940 948 941 949 static struct platform_driver davinci_i2c_driver = { 942 950 .probe = davinci_i2c_probe, 943 - .remove = davinci_i2c_remove, 951 + .remove_new = davinci_i2c_remove, 952 + .id_table = davinci_i2c_driver_ids, 944 953 .driver = { 945 954 .name = "i2c_davinci", 946 955 .pm = davinci_i2c_pm_ops,
+8
drivers/i2c/busses/i2c-designware-common.c
··· 575 575 unsigned int param; 576 576 int ret; 577 577 578 + /* DW_IC_COMP_PARAM_1 not implement for IP issue */ 579 + if ((dev->flags & MODEL_MASK) == MODEL_WANGXUN_SP) { 580 + dev->tx_fifo_depth = TXGBE_TX_FIFO_DEPTH; 581 + dev->rx_fifo_depth = TXGBE_RX_FIFO_DEPTH; 582 + 583 + return 0; 584 + } 585 + 578 586 /* 579 587 * Try to detect the FIFO depth if not set by interface driver, 580 588 * the depth could be from 2 to 256 from HW spec.
+4
drivers/i2c/busses/i2c-designware-core.h
··· 304 304 #define MODEL_MSCC_OCELOT BIT(8) 305 305 #define MODEL_BAIKAL_BT1 BIT(9) 306 306 #define MODEL_AMD_NAVI_GPU BIT(10) 307 + #define MODEL_WANGXUN_SP BIT(11) 307 308 #define MODEL_MASK GENMASK(11, 8) 308 309 309 310 /* ··· 313 312 */ 314 313 #define AMD_UCSI_INTR_REG 0x474 315 314 #define AMD_UCSI_INTR_EN 0xd 315 + 316 + #define TXGBE_TX_FIFO_DEPTH 4 317 + #define TXGBE_RX_FIFO_DEPTH 0 316 318 317 319 struct i2c_dw_semaphore_callbacks { 318 320 int (*probe)(struct dw_i2c_dev *dev);
+84 -5
drivers/i2c/busses/i2c-designware-master.c
··· 354 354 return 0; 355 355 } 356 356 357 + static int i2c_dw_poll_tx_empty(struct dw_i2c_dev *dev) 358 + { 359 + u32 val; 360 + 361 + return regmap_read_poll_timeout(dev->map, DW_IC_RAW_INTR_STAT, val, 362 + val & DW_IC_INTR_TX_EMPTY, 363 + 100, 1000); 364 + } 365 + 366 + static int i2c_dw_poll_rx_full(struct dw_i2c_dev *dev) 367 + { 368 + u32 val; 369 + 370 + return regmap_read_poll_timeout(dev->map, DW_IC_RAW_INTR_STAT, val, 371 + val & DW_IC_INTR_RX_FULL, 372 + 100, 1000); 373 + } 374 + 375 + static int txgbe_i2c_dw_xfer_quirk(struct i2c_adapter *adap, struct i2c_msg *msgs, 376 + int num_msgs) 377 + { 378 + struct dw_i2c_dev *dev = i2c_get_adapdata(adap); 379 + int msg_idx, buf_len, data_idx, ret; 380 + unsigned int val, stop = 0; 381 + u8 *buf; 382 + 383 + dev->msgs = msgs; 384 + dev->msgs_num = num_msgs; 385 + i2c_dw_xfer_init(dev); 386 + regmap_write(dev->map, DW_IC_INTR_MASK, 0); 387 + 388 + for (msg_idx = 0; msg_idx < num_msgs; msg_idx++) { 389 + buf = msgs[msg_idx].buf; 390 + buf_len = msgs[msg_idx].len; 391 + 392 + for (data_idx = 0; data_idx < buf_len; data_idx++) { 393 + if (msg_idx == num_msgs - 1 && data_idx == buf_len - 1) 394 + stop |= BIT(9); 395 + 396 + if (msgs[msg_idx].flags & I2C_M_RD) { 397 + regmap_write(dev->map, DW_IC_DATA_CMD, 0x100 | stop); 398 + 399 + ret = i2c_dw_poll_rx_full(dev); 400 + if (ret) 401 + return ret; 402 + 403 + regmap_read(dev->map, DW_IC_DATA_CMD, &val); 404 + buf[data_idx] = val; 405 + } else { 406 + ret = i2c_dw_poll_tx_empty(dev); 407 + if (ret) 408 + return ret; 409 + 410 + regmap_write(dev->map, DW_IC_DATA_CMD, 411 + buf[data_idx] | stop); 412 + } 413 + } 414 + } 415 + 416 + return num_msgs; 417 + } 418 + 357 419 /* 358 420 * Initiate (and continue) low level master read/write transaction. 359 421 * This function is only called from i2c_dw_isr, and pumping i2c_msg ··· 621 559 pm_runtime_get_sync(dev->dev); 622 560 623 561 /* 624 - * Initiate I2C message transfer when AMD NAVI GPU card is enabled, 562 + * Initiate I2C message transfer when polling mode is enabled, 625 563 * As it is polling based transfer mechanism, which does not support 626 564 * interrupt based functionalities of existing DesignWare driver. 627 565 */ 628 - if ((dev->flags & MODEL_MASK) == MODEL_AMD_NAVI_GPU) { 566 + switch (dev->flags & MODEL_MASK) { 567 + case MODEL_AMD_NAVI_GPU: 629 568 ret = amd_i2c_dw_xfer_quirk(adap, msgs, num); 630 569 goto done_nolock; 570 + case MODEL_WANGXUN_SP: 571 + ret = txgbe_i2c_dw_xfer_quirk(adap, msgs, num); 572 + goto done_nolock; 573 + default: 574 + break; 631 575 } 632 576 633 577 reinit_completion(&dev->cmd_complete); ··· 916 848 return 0; 917 849 } 918 850 919 - static int amd_i2c_adap_quirk(struct dw_i2c_dev *dev) 851 + static int i2c_dw_poll_adap_quirk(struct dw_i2c_dev *dev) 920 852 { 921 853 struct i2c_adapter *adap = &dev->adapter; 922 854 int ret; ··· 928 860 pm_runtime_put_noidle(dev->dev); 929 861 930 862 return ret; 863 + } 864 + 865 + static bool i2c_dw_is_model_poll(struct dw_i2c_dev *dev) 866 + { 867 + switch (dev->flags & MODEL_MASK) { 868 + case MODEL_AMD_NAVI_GPU: 869 + case MODEL_WANGXUN_SP: 870 + return true; 871 + default: 872 + return false; 873 + } 931 874 } 932 875 933 876 int i2c_dw_probe_master(struct dw_i2c_dev *dev) ··· 996 917 adap->dev.parent = dev->dev; 997 918 i2c_set_adapdata(adap, dev); 998 919 999 - if ((dev->flags & MODEL_MASK) == MODEL_AMD_NAVI_GPU) 1000 - return amd_i2c_adap_quirk(dev); 920 + if (i2c_dw_is_model_poll(dev)) 921 + return i2c_dw_poll_adap_quirk(dev); 1001 922 1002 923 if (dev->flags & ACCESS_NO_IRQ_SUSPEND) { 1003 924 irq_flags = IRQF_NO_SUSPEND;
+12 -1
drivers/i2c/busses/i2c-designware-pcidrv.c
··· 20 20 #include <linux/module.h> 21 21 #include <linux/pci.h> 22 22 #include <linux/pm_runtime.h> 23 + #include <linux/power_supply.h> 23 24 #include <linux/sched.h> 24 25 #include <linux/slab.h> 25 26 ··· 235 234 SET_RUNTIME_PM_OPS(i2c_dw_pci_runtime_suspend, i2c_dw_pci_runtime_resume, NULL) 236 235 }; 237 236 237 + static const struct property_entry dgpu_properties[] = { 238 + /* USB-C doesn't power the system */ 239 + PROPERTY_ENTRY_U8("scope", POWER_SUPPLY_SCOPE_DEVICE), 240 + {} 241 + }; 242 + 243 + static const struct software_node dgpu_node = { 244 + .properties = dgpu_properties, 245 + }; 246 + 238 247 static int i2c_dw_pci_probe(struct pci_dev *pdev, 239 248 const struct pci_device_id *id) 240 249 { ··· 336 325 } 337 326 338 327 if ((dev->flags & MODEL_MASK) == MODEL_AMD_NAVI_GPU) { 339 - dev->slave = i2c_new_ccgx_ucsi(&dev->adapter, dev->irq, NULL); 328 + dev->slave = i2c_new_ccgx_ucsi(&dev->adapter, dev->irq, &dgpu_node); 340 329 if (IS_ERR(dev->slave)) 341 330 return dev_err_probe(dev->dev, PTR_ERR(dev->slave), 342 331 "register UCSI failed\n");
+17 -4
drivers/i2c/busses/i2c-designware-platdrv.c
··· 168 168 } 169 169 #endif 170 170 171 + static int txgbe_i2c_request_regs(struct dw_i2c_dev *dev) 172 + { 173 + dev->map = dev_get_regmap(dev->dev->parent, NULL); 174 + if (!dev->map) 175 + return -ENODEV; 176 + 177 + return 0; 178 + } 179 + 171 180 static void dw_i2c_plat_pm_cleanup(struct dw_i2c_dev *dev) 172 181 { 173 182 pm_runtime_disable(dev->dev); ··· 193 184 switch (dev->flags & MODEL_MASK) { 194 185 case MODEL_BAIKAL_BT1: 195 186 ret = bt1_i2c_request_regs(dev); 187 + break; 188 + case MODEL_WANGXUN_SP: 189 + ret = txgbe_i2c_request_regs(dev); 196 190 break; 197 191 default: 198 192 dev->base = devm_platform_ioremap_resource(pdev, 0); ··· 289 277 return -ENOMEM; 290 278 291 279 dev->flags = (uintptr_t)device_get_match_data(&pdev->dev); 280 + if (device_property_present(&pdev->dev, "wx,i2c-snps-model")) 281 + dev->flags = MODEL_WANGXUN_SP; 282 + 292 283 dev->dev = &pdev->dev; 293 284 dev->irq = irq; 294 285 platform_set_drvdata(pdev, dev); ··· 399 384 return ret; 400 385 } 401 386 402 - static int dw_i2c_plat_remove(struct platform_device *pdev) 387 + static void dw_i2c_plat_remove(struct platform_device *pdev) 403 388 { 404 389 struct dw_i2c_dev *dev = platform_get_drvdata(pdev); 405 390 ··· 416 401 i2c_dw_remove_lock_support(dev); 417 402 418 403 reset_control_assert(dev->rst); 419 - 420 - return 0; 421 404 } 422 405 423 406 #ifdef CONFIG_PM_SLEEP ··· 494 481 495 482 static struct platform_driver dw_i2c_driver = { 496 483 .probe = dw_i2c_plat_probe, 497 - .remove = dw_i2c_plat_remove, 484 + .remove_new = dw_i2c_plat_remove, 498 485 .driver = { 499 486 .name = "i2c_designware", 500 487 .of_match_table = of_match_ptr(dw_i2c_of_match),
+2 -4
drivers/i2c/busses/i2c-digicolor.c
··· 347 347 return 0; 348 348 } 349 349 350 - static int dc_i2c_remove(struct platform_device *pdev) 350 + static void dc_i2c_remove(struct platform_device *pdev) 351 351 { 352 352 struct dc_i2c *i2c = platform_get_drvdata(pdev); 353 353 354 354 i2c_del_adapter(&i2c->adap); 355 355 clk_disable_unprepare(i2c->clk); 356 - 357 - return 0; 358 356 } 359 357 360 358 static const struct of_device_id dc_i2c_match[] = { ··· 363 365 364 366 static struct platform_driver dc_i2c_driver = { 365 367 .probe = dc_i2c_probe, 366 - .remove = dc_i2c_remove, 368 + .remove_new = dc_i2c_remove, 367 369 .driver = { 368 370 .name = "digicolor-i2c", 369 371 .of_match_table = dc_i2c_match,
+2 -4
drivers/i2c/busses/i2c-dln2.c
··· 236 236 return ret; 237 237 } 238 238 239 - static int dln2_i2c_remove(struct platform_device *pdev) 239 + static void dln2_i2c_remove(struct platform_device *pdev) 240 240 { 241 241 struct dln2_i2c *dln2 = platform_get_drvdata(pdev); 242 242 243 243 i2c_del_adapter(&dln2->adapter); 244 244 dln2_i2c_enable(dln2, false); 245 - 246 - return 0; 247 245 } 248 246 249 247 static struct platform_driver dln2_i2c_driver = { 250 248 .driver.name = "dln2-i2c", 251 249 .probe = dln2_i2c_probe, 252 - .remove = dln2_i2c_remove, 250 + .remove_new = dln2_i2c_remove, 253 251 }; 254 252 255 253 module_platform_driver(dln2_i2c_driver);
+2 -4
drivers/i2c/busses/i2c-emev2.c
··· 419 419 return ret; 420 420 } 421 421 422 - static int em_i2c_remove(struct platform_device *dev) 422 + static void em_i2c_remove(struct platform_device *dev) 423 423 { 424 424 struct em_i2c_device *priv = platform_get_drvdata(dev); 425 425 426 426 i2c_del_adapter(&priv->adap); 427 427 clk_disable_unprepare(priv->sclk); 428 - 429 - return 0; 430 428 } 431 429 432 430 static const struct of_device_id em_i2c_ids[] = { ··· 434 436 435 437 static struct platform_driver em_i2c_driver = { 436 438 .probe = em_i2c_probe, 437 - .remove = em_i2c_remove, 439 + .remove_new = em_i2c_remove, 438 440 .driver = { 439 441 .name = "em-i2c", 440 442 .of_match_table = em_i2c_ids,
+2 -4
drivers/i2c/busses/i2c-exynos5.c
··· 882 882 return ret; 883 883 } 884 884 885 - static int exynos5_i2c_remove(struct platform_device *pdev) 885 + static void exynos5_i2c_remove(struct platform_device *pdev) 886 886 { 887 887 struct exynos5_i2c *i2c = platform_get_drvdata(pdev); 888 888 ··· 890 890 891 891 clk_unprepare(i2c->clk); 892 892 clk_unprepare(i2c->pclk); 893 - 894 - return 0; 895 893 } 896 894 897 895 #ifdef CONFIG_PM_SLEEP ··· 943 945 944 946 static struct platform_driver exynos5_i2c_driver = { 945 947 .probe = exynos5_i2c_probe, 946 - .remove = exynos5_i2c_remove, 948 + .remove_new = exynos5_i2c_remove, 947 949 .driver = { 948 950 .name = "exynos5-hsi2c", 949 951 .pm = &exynos5_i2c_dev_pm_ops,
+2 -4
drivers/i2c/busses/i2c-gpio.c
··· 475 475 return 0; 476 476 } 477 477 478 - static int i2c_gpio_remove(struct platform_device *pdev) 478 + static void i2c_gpio_remove(struct platform_device *pdev) 479 479 { 480 480 struct i2c_gpio_private_data *priv; 481 481 struct i2c_adapter *adap; ··· 486 486 adap = &priv->adap; 487 487 488 488 i2c_del_adapter(adap); 489 - 490 - return 0; 491 489 } 492 490 493 491 static const struct of_device_id i2c_gpio_dt_ids[] = { ··· 508 510 .acpi_match_table = i2c_gpio_acpi_match, 509 511 }, 510 512 .probe = i2c_gpio_probe, 511 - .remove = i2c_gpio_remove, 513 + .remove_new = i2c_gpio_remove, 512 514 }; 513 515 514 516 static int __init i2c_gpio_init(void)
+2 -4
drivers/i2c/busses/i2c-gxp.c
··· 577 577 return 0; 578 578 } 579 579 580 - static int gxp_i2c_remove(struct platform_device *pdev) 580 + static void gxp_i2c_remove(struct platform_device *pdev) 581 581 { 582 582 struct gxp_i2c_drvdata *drvdata = platform_get_drvdata(pdev); 583 583 584 584 /* Disable interrupt */ 585 585 regmap_update_bits(i2cg_map, GXP_I2CINTEN, BIT(drvdata->engine), 0); 586 586 i2c_del_adapter(&drvdata->adapter); 587 - 588 - return 0; 589 587 } 590 588 591 589 static const struct of_device_id gxp_i2c_of_match[] = { ··· 594 596 595 597 static struct platform_driver gxp_i2c_driver = { 596 598 .probe = gxp_i2c_probe, 597 - .remove = gxp_i2c_remove, 599 + .remove_new = gxp_i2c_remove, 598 600 .driver = { 599 601 .name = "gxp-i2c", 600 602 .of_match_table = gxp_i2c_of_match,
+2 -4
drivers/i2c/busses/i2c-highlander.c
··· 435 435 return ret; 436 436 } 437 437 438 - static int highlander_i2c_remove(struct platform_device *pdev) 438 + static void highlander_i2c_remove(struct platform_device *pdev) 439 439 { 440 440 struct highlander_i2c_dev *dev = platform_get_drvdata(pdev); 441 441 ··· 446 446 447 447 iounmap(dev->base); 448 448 kfree(dev); 449 - 450 - return 0; 451 449 } 452 450 453 451 static struct platform_driver highlander_i2c_driver = { ··· 454 456 }, 455 457 456 458 .probe = highlander_i2c_probe, 457 - .remove = highlander_i2c_remove, 459 + .remove_new = highlander_i2c_remove, 458 460 }; 459 461 460 462 module_platform_driver(highlander_i2c_driver);
+11 -12
drivers/i2c/busses/i2c-hix5hd2.c
··· 360 360 pm_runtime_get_sync(priv->dev); 361 361 362 362 for (i = 0; i < num; i++, msgs++) { 363 - stop = (i == num - 1); 363 + if ((i == num - 1) || (msgs->flags & I2C_M_STOP)) 364 + stop = 1; 365 + else 366 + stop = 0; 367 + 364 368 ret = hix5hd2_i2c_xfer_msg(priv, msgs, stop); 365 369 if (ret < 0) 366 370 goto out; ··· 420 416 if (irq < 0) 421 417 return irq; 422 418 423 - priv->clk = devm_clk_get(&pdev->dev, NULL); 419 + priv->clk = devm_clk_get_enabled(&pdev->dev, NULL); 424 420 if (IS_ERR(priv->clk)) { 425 - dev_err(&pdev->dev, "cannot get clock\n"); 421 + dev_err(&pdev->dev, "cannot enable clock\n"); 426 422 return PTR_ERR(priv->clk); 427 423 } 428 - clk_prepare_enable(priv->clk); 429 424 430 425 strscpy(priv->adap.name, "hix5hd2-i2c", sizeof(priv->adap.name)); 431 426 priv->dev = &pdev->dev; ··· 445 442 IRQF_NO_SUSPEND, dev_name(&pdev->dev), priv); 446 443 if (ret != 0) { 447 444 dev_err(&pdev->dev, "cannot request HS-I2C IRQ %d\n", irq); 448 - goto err_clk; 445 + return ret; 449 446 } 450 447 451 448 pm_runtime_set_autosuspend_delay(priv->dev, MSEC_PER_SEC); ··· 462 459 err_runtime: 463 460 pm_runtime_disable(priv->dev); 464 461 pm_runtime_set_suspended(priv->dev); 465 - err_clk: 466 - clk_disable_unprepare(priv->clk); 462 + 467 463 return ret; 468 464 } 469 465 470 - static int hix5hd2_i2c_remove(struct platform_device *pdev) 466 + static void hix5hd2_i2c_remove(struct platform_device *pdev) 471 467 { 472 468 struct hix5hd2_i2c_priv *priv = platform_get_drvdata(pdev); 473 469 474 470 i2c_del_adapter(&priv->adap); 475 471 pm_runtime_disable(priv->dev); 476 472 pm_runtime_set_suspended(priv->dev); 477 - clk_disable_unprepare(priv->clk); 478 - 479 - return 0; 480 473 } 481 474 482 475 #ifdef CONFIG_PM ··· 510 511 511 512 static struct platform_driver hix5hd2_i2c_driver = { 512 513 .probe = hix5hd2_i2c_probe, 513 - .remove = hix5hd2_i2c_remove, 514 + .remove_new = hix5hd2_i2c_remove, 514 515 .driver = { 515 516 .name = "hix5hd2-i2c", 516 517 .pm = &hix5hd2_i2c_pm_ops,
+67 -61
drivers/i2c/busses/i2c-i801.c
··· 77 77 * Alder Lake-M (PCH) 0x54a3 32 hard yes yes yes 78 78 * Raptor Lake-S (PCH) 0x7a23 32 hard yes yes yes 79 79 * Meteor Lake-P (SOC) 0x7e22 32 hard yes yes yes 80 + * Meteor Lake SoC-S (SOC) 0xae22 32 hard yes yes yes 81 + * Meteor Lake PCH-S (PCH) 0x7f23 32 hard yes yes yes 80 82 * 81 83 * Features supported by this driver: 82 84 * Software PEC no ··· 235 233 #define PCI_DEVICE_ID_INTEL_RAPTOR_LAKE_S_SMBUS 0x7a23 236 234 #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_S_SMBUS 0x7aa3 237 235 #define PCI_DEVICE_ID_INTEL_METEOR_LAKE_P_SMBUS 0x7e22 236 + #define PCI_DEVICE_ID_INTEL_METEOR_LAKE_PCH_S_SMBUS 0x7f23 238 237 #define PCI_DEVICE_ID_INTEL_LYNXPOINT_SMBUS 0x8c22 239 238 #define PCI_DEVICE_ID_INTEL_WILDCATPOINT_SMBUS 0x8ca2 240 239 #define PCI_DEVICE_ID_INTEL_WELLSBURG_SMBUS 0x8d22 ··· 253 250 #define PCI_DEVICE_ID_INTEL_KABYLAKE_PCH_H_SMBUS 0xa2a3 254 251 #define PCI_DEVICE_ID_INTEL_CANNONLAKE_H_SMBUS 0xa323 255 252 #define PCI_DEVICE_ID_INTEL_COMETLAKE_V_SMBUS 0xa3a3 253 + #define PCI_DEVICE_ID_INTEL_METEOR_LAKE_SOC_S_SMBUS 0xae22 256 254 257 255 struct i801_mux_config { 258 256 char *gpio_chip; ··· 981 977 FEATURE_HOST_NOTIFY) 982 978 983 979 static const struct pci_device_id i801_ids[] = { 984 - { PCI_DEVICE_DATA(INTEL, 82801AA_3, 0) }, 985 - { PCI_DEVICE_DATA(INTEL, 82801AB_3, 0) }, 986 - { PCI_DEVICE_DATA(INTEL, 82801BA_2, 0) }, 987 - { PCI_DEVICE_DATA(INTEL, 82801CA_3, FEATURE_HOST_NOTIFY) }, 988 - { PCI_DEVICE_DATA(INTEL, 82801DB_3, FEATURES_ICH4) }, 989 - { PCI_DEVICE_DATA(INTEL, 82801EB_3, FEATURES_ICH5) }, 990 - { PCI_DEVICE_DATA(INTEL, ESB_4, FEATURES_ICH5) }, 991 - { PCI_DEVICE_DATA(INTEL, ICH6_16, FEATURES_ICH5) }, 992 - { PCI_DEVICE_DATA(INTEL, ICH7_17, FEATURES_ICH5) }, 993 - { PCI_DEVICE_DATA(INTEL, ESB2_17, FEATURES_ICH5) }, 994 - { PCI_DEVICE_DATA(INTEL, ICH8_5, FEATURES_ICH5) }, 995 - { PCI_DEVICE_DATA(INTEL, ICH9_6, FEATURES_ICH5) }, 996 - { PCI_DEVICE_DATA(INTEL, EP80579_1, FEATURES_ICH5) }, 997 - { PCI_DEVICE_DATA(INTEL, ICH10_4, FEATURES_ICH5) }, 998 - { PCI_DEVICE_DATA(INTEL, ICH10_5, FEATURES_ICH5) }, 999 - { PCI_DEVICE_DATA(INTEL, 5_3400_SERIES_SMBUS, FEATURES_ICH5) }, 1000 - { PCI_DEVICE_DATA(INTEL, COUGARPOINT_SMBUS, FEATURES_ICH5) }, 1001 - { PCI_DEVICE_DATA(INTEL, PATSBURG_SMBUS, FEATURES_ICH5) }, 1002 - { PCI_DEVICE_DATA(INTEL, PATSBURG_SMBUS_IDF0, FEATURES_ICH5 | FEATURE_IDF) }, 1003 - { PCI_DEVICE_DATA(INTEL, PATSBURG_SMBUS_IDF1, FEATURES_ICH5 | FEATURE_IDF) }, 1004 - { PCI_DEVICE_DATA(INTEL, PATSBURG_SMBUS_IDF2, FEATURES_ICH5 | FEATURE_IDF) }, 1005 - { PCI_DEVICE_DATA(INTEL, DH89XXCC_SMBUS, FEATURES_ICH5) }, 1006 - { PCI_DEVICE_DATA(INTEL, PANTHERPOINT_SMBUS, FEATURES_ICH5) }, 1007 - { PCI_DEVICE_DATA(INTEL, LYNXPOINT_SMBUS, FEATURES_ICH5) }, 1008 - { PCI_DEVICE_DATA(INTEL, LYNXPOINT_LP_SMBUS, FEATURES_ICH5) }, 1009 - { PCI_DEVICE_DATA(INTEL, AVOTON_SMBUS, FEATURES_ICH5) }, 1010 - { PCI_DEVICE_DATA(INTEL, WELLSBURG_SMBUS, FEATURES_ICH5) }, 1011 - { PCI_DEVICE_DATA(INTEL, WELLSBURG_SMBUS_MS0, FEATURES_ICH5 | FEATURE_IDF) }, 1012 - { PCI_DEVICE_DATA(INTEL, WELLSBURG_SMBUS_MS1, FEATURES_ICH5 | FEATURE_IDF) }, 1013 - { PCI_DEVICE_DATA(INTEL, WELLSBURG_SMBUS_MS2, FEATURES_ICH5 | FEATURE_IDF) }, 1014 - { PCI_DEVICE_DATA(INTEL, COLETOCREEK_SMBUS, FEATURES_ICH5) }, 1015 - { PCI_DEVICE_DATA(INTEL, GEMINILAKE_SMBUS, FEATURES_ICH5) }, 1016 - { PCI_DEVICE_DATA(INTEL, WILDCATPOINT_SMBUS, FEATURES_ICH5) }, 1017 - { PCI_DEVICE_DATA(INTEL, WILDCATPOINT_LP_SMBUS, FEATURES_ICH5) }, 1018 - { PCI_DEVICE_DATA(INTEL, BAYTRAIL_SMBUS, FEATURES_ICH5) }, 1019 - { PCI_DEVICE_DATA(INTEL, BRASWELL_SMBUS, FEATURES_ICH5) }, 1020 - { PCI_DEVICE_DATA(INTEL, SUNRISEPOINT_H_SMBUS, FEATURES_ICH5 | FEATURE_TCO_SPT) }, 1021 - { PCI_DEVICE_DATA(INTEL, SUNRISEPOINT_LP_SMBUS, FEATURES_ICH5 | FEATURE_TCO_SPT) }, 1022 - { PCI_DEVICE_DATA(INTEL, CDF_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1023 - { PCI_DEVICE_DATA(INTEL, DNV_SMBUS, FEATURES_ICH5 | FEATURE_TCO_SPT) }, 1024 - { PCI_DEVICE_DATA(INTEL, EBG_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1025 - { PCI_DEVICE_DATA(INTEL, BROXTON_SMBUS, FEATURES_ICH5) }, 1026 - { PCI_DEVICE_DATA(INTEL, LEWISBURG_SMBUS, FEATURES_ICH5 | FEATURE_TCO_SPT) }, 1027 - { PCI_DEVICE_DATA(INTEL, LEWISBURG_SSKU_SMBUS, FEATURES_ICH5 | FEATURE_TCO_SPT) }, 1028 - { PCI_DEVICE_DATA(INTEL, KABYLAKE_PCH_H_SMBUS, FEATURES_ICH5 | FEATURE_TCO_SPT) }, 1029 - { PCI_DEVICE_DATA(INTEL, CANNONLAKE_H_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1030 - { PCI_DEVICE_DATA(INTEL, CANNONLAKE_LP_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1031 - { PCI_DEVICE_DATA(INTEL, ICELAKE_LP_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1032 - { PCI_DEVICE_DATA(INTEL, ICELAKE_N_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1033 - { PCI_DEVICE_DATA(INTEL, COMETLAKE_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1034 - { PCI_DEVICE_DATA(INTEL, COMETLAKE_H_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1035 - { PCI_DEVICE_DATA(INTEL, COMETLAKE_V_SMBUS, FEATURES_ICH5 | FEATURE_TCO_SPT) }, 1036 - { PCI_DEVICE_DATA(INTEL, ELKHART_LAKE_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1037 - { PCI_DEVICE_DATA(INTEL, TIGERLAKE_LP_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1038 - { PCI_DEVICE_DATA(INTEL, TIGERLAKE_H_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1039 - { PCI_DEVICE_DATA(INTEL, JASPER_LAKE_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1040 - { PCI_DEVICE_DATA(INTEL, ALDER_LAKE_S_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1041 - { PCI_DEVICE_DATA(INTEL, ALDER_LAKE_P_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1042 - { PCI_DEVICE_DATA(INTEL, ALDER_LAKE_M_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1043 - { PCI_DEVICE_DATA(INTEL, RAPTOR_LAKE_S_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1044 - { PCI_DEVICE_DATA(INTEL, METEOR_LAKE_P_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 980 + { PCI_DEVICE_DATA(INTEL, 82801AA_3, 0) }, 981 + { PCI_DEVICE_DATA(INTEL, 82801AB_3, 0) }, 982 + { PCI_DEVICE_DATA(INTEL, 82801BA_2, 0) }, 983 + { PCI_DEVICE_DATA(INTEL, 82801CA_3, FEATURE_HOST_NOTIFY) }, 984 + { PCI_DEVICE_DATA(INTEL, 82801DB_3, FEATURES_ICH4) }, 985 + { PCI_DEVICE_DATA(INTEL, 82801EB_3, FEATURES_ICH5) }, 986 + { PCI_DEVICE_DATA(INTEL, ESB_4, FEATURES_ICH5) }, 987 + { PCI_DEVICE_DATA(INTEL, ICH6_16, FEATURES_ICH5) }, 988 + { PCI_DEVICE_DATA(INTEL, ICH7_17, FEATURES_ICH5) }, 989 + { PCI_DEVICE_DATA(INTEL, ESB2_17, FEATURES_ICH5) }, 990 + { PCI_DEVICE_DATA(INTEL, ICH8_5, FEATURES_ICH5) }, 991 + { PCI_DEVICE_DATA(INTEL, ICH9_6, FEATURES_ICH5) }, 992 + { PCI_DEVICE_DATA(INTEL, EP80579_1, FEATURES_ICH5) }, 993 + { PCI_DEVICE_DATA(INTEL, ICH10_4, FEATURES_ICH5) }, 994 + { PCI_DEVICE_DATA(INTEL, ICH10_5, FEATURES_ICH5) }, 995 + { PCI_DEVICE_DATA(INTEL, 5_3400_SERIES_SMBUS, FEATURES_ICH5) }, 996 + { PCI_DEVICE_DATA(INTEL, COUGARPOINT_SMBUS, FEATURES_ICH5) }, 997 + { PCI_DEVICE_DATA(INTEL, PATSBURG_SMBUS, FEATURES_ICH5) }, 998 + { PCI_DEVICE_DATA(INTEL, PATSBURG_SMBUS_IDF0, FEATURES_ICH5 | FEATURE_IDF) }, 999 + { PCI_DEVICE_DATA(INTEL, PATSBURG_SMBUS_IDF1, FEATURES_ICH5 | FEATURE_IDF) }, 1000 + { PCI_DEVICE_DATA(INTEL, PATSBURG_SMBUS_IDF2, FEATURES_ICH5 | FEATURE_IDF) }, 1001 + { PCI_DEVICE_DATA(INTEL, DH89XXCC_SMBUS, FEATURES_ICH5) }, 1002 + { PCI_DEVICE_DATA(INTEL, PANTHERPOINT_SMBUS, FEATURES_ICH5) }, 1003 + { PCI_DEVICE_DATA(INTEL, LYNXPOINT_SMBUS, FEATURES_ICH5) }, 1004 + { PCI_DEVICE_DATA(INTEL, LYNXPOINT_LP_SMBUS, FEATURES_ICH5) }, 1005 + { PCI_DEVICE_DATA(INTEL, AVOTON_SMBUS, FEATURES_ICH5) }, 1006 + { PCI_DEVICE_DATA(INTEL, WELLSBURG_SMBUS, FEATURES_ICH5) }, 1007 + { PCI_DEVICE_DATA(INTEL, WELLSBURG_SMBUS_MS0, FEATURES_ICH5 | FEATURE_IDF) }, 1008 + { PCI_DEVICE_DATA(INTEL, WELLSBURG_SMBUS_MS1, FEATURES_ICH5 | FEATURE_IDF) }, 1009 + { PCI_DEVICE_DATA(INTEL, WELLSBURG_SMBUS_MS2, FEATURES_ICH5 | FEATURE_IDF) }, 1010 + { PCI_DEVICE_DATA(INTEL, COLETOCREEK_SMBUS, FEATURES_ICH5) }, 1011 + { PCI_DEVICE_DATA(INTEL, GEMINILAKE_SMBUS, FEATURES_ICH5) }, 1012 + { PCI_DEVICE_DATA(INTEL, WILDCATPOINT_SMBUS, FEATURES_ICH5) }, 1013 + { PCI_DEVICE_DATA(INTEL, WILDCATPOINT_LP_SMBUS, FEATURES_ICH5) }, 1014 + { PCI_DEVICE_DATA(INTEL, BAYTRAIL_SMBUS, FEATURES_ICH5) }, 1015 + { PCI_DEVICE_DATA(INTEL, BRASWELL_SMBUS, FEATURES_ICH5) }, 1016 + { PCI_DEVICE_DATA(INTEL, SUNRISEPOINT_H_SMBUS, FEATURES_ICH5 | FEATURE_TCO_SPT) }, 1017 + { PCI_DEVICE_DATA(INTEL, SUNRISEPOINT_LP_SMBUS, FEATURES_ICH5 | FEATURE_TCO_SPT) }, 1018 + { PCI_DEVICE_DATA(INTEL, CDF_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1019 + { PCI_DEVICE_DATA(INTEL, DNV_SMBUS, FEATURES_ICH5 | FEATURE_TCO_SPT) }, 1020 + { PCI_DEVICE_DATA(INTEL, EBG_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1021 + { PCI_DEVICE_DATA(INTEL, BROXTON_SMBUS, FEATURES_ICH5) }, 1022 + { PCI_DEVICE_DATA(INTEL, LEWISBURG_SMBUS, FEATURES_ICH5 | FEATURE_TCO_SPT) }, 1023 + { PCI_DEVICE_DATA(INTEL, LEWISBURG_SSKU_SMBUS, FEATURES_ICH5 | FEATURE_TCO_SPT) }, 1024 + { PCI_DEVICE_DATA(INTEL, KABYLAKE_PCH_H_SMBUS, FEATURES_ICH5 | FEATURE_TCO_SPT) }, 1025 + { PCI_DEVICE_DATA(INTEL, CANNONLAKE_H_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1026 + { PCI_DEVICE_DATA(INTEL, CANNONLAKE_LP_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1027 + { PCI_DEVICE_DATA(INTEL, ICELAKE_LP_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1028 + { PCI_DEVICE_DATA(INTEL, ICELAKE_N_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1029 + { PCI_DEVICE_DATA(INTEL, COMETLAKE_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1030 + { PCI_DEVICE_DATA(INTEL, COMETLAKE_H_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1031 + { PCI_DEVICE_DATA(INTEL, COMETLAKE_V_SMBUS, FEATURES_ICH5 | FEATURE_TCO_SPT) }, 1032 + { PCI_DEVICE_DATA(INTEL, ELKHART_LAKE_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1033 + { PCI_DEVICE_DATA(INTEL, TIGERLAKE_LP_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1034 + { PCI_DEVICE_DATA(INTEL, TIGERLAKE_H_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1035 + { PCI_DEVICE_DATA(INTEL, JASPER_LAKE_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1036 + { PCI_DEVICE_DATA(INTEL, ALDER_LAKE_S_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1037 + { PCI_DEVICE_DATA(INTEL, ALDER_LAKE_P_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1038 + { PCI_DEVICE_DATA(INTEL, ALDER_LAKE_M_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1039 + { PCI_DEVICE_DATA(INTEL, RAPTOR_LAKE_S_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1040 + { PCI_DEVICE_DATA(INTEL, METEOR_LAKE_P_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1041 + { PCI_DEVICE_DATA(INTEL, METEOR_LAKE_SOC_S_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1042 + { PCI_DEVICE_DATA(INTEL, METEOR_LAKE_PCH_S_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) }, 1045 1043 { 0, } 1046 1044 }; 1047 1045
+3 -7
drivers/i2c/busses/i2c-ibm_iic.c
··· 694 694 int ret; 695 695 696 696 dev = kzalloc(sizeof(*dev), GFP_KERNEL); 697 - if (!dev) { 698 - dev_err(&ofdev->dev, "failed to allocate device data\n"); 697 + if (!dev) 699 698 return -ENOMEM; 700 - } 701 699 702 700 platform_set_drvdata(ofdev, dev); 703 701 ··· 767 769 /* 768 770 * Cleanup initialized IIC interface 769 771 */ 770 - static int iic_remove(struct platform_device *ofdev) 772 + static void iic_remove(struct platform_device *ofdev) 771 773 { 772 774 struct ibm_iic_private *dev = platform_get_drvdata(ofdev); 773 775 ··· 780 782 781 783 iounmap(dev->vaddr); 782 784 kfree(dev); 783 - 784 - return 0; 785 785 } 786 786 787 787 static const struct of_device_id ibm_iic_match[] = { ··· 794 798 .of_match_table = ibm_iic_match, 795 799 }, 796 800 .probe = iic_probe, 797 - .remove = iic_remove, 801 + .remove_new = iic_remove, 798 802 }; 799 803 800 804 module_platform_driver(ibm_iic_driver);
+3 -5
drivers/i2c/busses/i2c-img-scb.c
··· 913 913 914 914 static irqreturn_t img_i2c_isr(int irq, void *dev_id) 915 915 { 916 - struct img_i2c *i2c = (struct img_i2c *)dev_id; 916 + struct img_i2c *i2c = dev_id; 917 917 u32 int_status, line_status; 918 918 /* We handle transaction completion AFTER accessing registers */ 919 919 unsigned int hret; ··· 1413 1413 return ret; 1414 1414 } 1415 1415 1416 - static int img_i2c_remove(struct platform_device *dev) 1416 + static void img_i2c_remove(struct platform_device *dev) 1417 1417 { 1418 1418 struct img_i2c *i2c = platform_get_drvdata(dev); 1419 1419 ··· 1421 1421 pm_runtime_disable(&dev->dev); 1422 1422 if (!pm_runtime_status_suspended(&dev->dev)) 1423 1423 img_i2c_runtime_suspend(&dev->dev); 1424 - 1425 - return 0; 1426 1424 } 1427 1425 1428 1426 static int img_i2c_runtime_suspend(struct device *dev) ··· 1504 1506 .pm = &img_i2c_pm, 1505 1507 }, 1506 1508 .probe = img_i2c_probe, 1507 - .remove = img_i2c_remove, 1509 + .remove_new = img_i2c_remove, 1508 1510 }; 1509 1511 module_platform_driver(img_scb_i2c_driver); 1510 1512
+3 -5
drivers/i2c/busses/i2c-imx-lpi2c.c
··· 217 217 for (prescale = 0; prescale <= 7; prescale++) { 218 218 clk_cycle = clk_rate / ((1 << prescale) * lpi2c_imx->bitrate) 219 219 - 3 - (filt >> 1); 220 - clkhi = (clk_cycle + I2C_CLK_RATIO) / (I2C_CLK_RATIO + 1); 220 + clkhi = DIV_ROUND_UP(clk_cycle, I2C_CLK_RATIO + 1); 221 221 clklo = clk_cycle - clkhi; 222 222 if (clklo < 64) 223 223 break; ··· 623 623 return ret; 624 624 } 625 625 626 - static int lpi2c_imx_remove(struct platform_device *pdev) 626 + static void lpi2c_imx_remove(struct platform_device *pdev) 627 627 { 628 628 struct lpi2c_imx_struct *lpi2c_imx = platform_get_drvdata(pdev); 629 629 ··· 631 631 632 632 pm_runtime_disable(&pdev->dev); 633 633 pm_runtime_dont_use_autosuspend(&pdev->dev); 634 - 635 - return 0; 636 634 } 637 635 638 636 static int __maybe_unused lpi2c_runtime_suspend(struct device *dev) ··· 667 669 668 670 static struct platform_driver lpi2c_imx_driver = { 669 671 .probe = lpi2c_imx_probe, 670 - .remove = lpi2c_imx_remove, 672 + .remove_new = lpi2c_imx_remove, 671 673 .driver = { 672 674 .name = DRIVER_NAME, 673 675 .of_match_table = lpi2c_imx_of_match,
+2 -4
drivers/i2c/busses/i2c-imx.c
··· 1561 1561 return ret; 1562 1562 } 1563 1563 1564 - static int i2c_imx_remove(struct platform_device *pdev) 1564 + static void i2c_imx_remove(struct platform_device *pdev) 1565 1565 { 1566 1566 struct imx_i2c_struct *i2c_imx = platform_get_drvdata(pdev); 1567 1567 int irq, ret; ··· 1592 1592 1593 1593 pm_runtime_put_noidle(&pdev->dev); 1594 1594 pm_runtime_disable(&pdev->dev); 1595 - 1596 - return 0; 1597 1595 } 1598 1596 1599 1597 static int __maybe_unused i2c_imx_runtime_suspend(struct device *dev) ··· 1622 1624 1623 1625 static struct platform_driver i2c_imx_driver = { 1624 1626 .probe = i2c_imx_probe, 1625 - .remove = i2c_imx_remove, 1627 + .remove_new = i2c_imx_remove, 1626 1628 .driver = { 1627 1629 .name = DRIVER_NAME, 1628 1630 .pm = &i2c_imx_pm_ops,
+2 -4
drivers/i2c/busses/i2c-iop3xx.c
··· 388 388 .functionality = iop3xx_i2c_func, 389 389 }; 390 390 391 - static int 391 + static void 392 392 iop3xx_i2c_remove(struct platform_device *pdev) 393 393 { 394 394 struct i2c_adapter *padapter = platform_get_drvdata(pdev); ··· 408 408 release_mem_region(res->start, IOP3XX_I2C_IO_SIZE); 409 409 kfree(adapter_data); 410 410 kfree(padapter); 411 - 412 - return 0; 413 411 } 414 412 415 413 static int ··· 527 529 528 530 static struct platform_driver iop3xx_i2c_driver = { 529 531 .probe = iop3xx_i2c_probe, 530 - .remove = iop3xx_i2c_remove, 532 + .remove_new = iop3xx_i2c_remove, 531 533 .driver = { 532 534 .name = "IOP3xx-I2C", 533 535 .of_match_table = i2c_iop3xx_match,
+2 -4
drivers/i2c/busses/i2c-isch.c
··· 286 286 return retval; 287 287 } 288 288 289 - static int smbus_sch_remove(struct platform_device *pdev) 289 + static void smbus_sch_remove(struct platform_device *pdev) 290 290 { 291 291 if (sch_smba) { 292 292 i2c_del_adapter(&sch_adapter); 293 293 sch_smba = 0; 294 294 } 295 - 296 - return 0; 297 295 } 298 296 299 297 static struct platform_driver smbus_sch_driver = { ··· 299 301 .name = "isch_smbus", 300 302 }, 301 303 .probe = smbus_sch_probe, 302 - .remove = smbus_sch_remove, 304 + .remove_new = smbus_sch_remove, 303 305 }; 304 306 305 307 module_platform_driver(smbus_sch_driver);
+2 -3
drivers/i2c/busses/i2c-jz4780.c
··· 845 845 return ret; 846 846 } 847 847 848 - static int jz4780_i2c_remove(struct platform_device *pdev) 848 + static void jz4780_i2c_remove(struct platform_device *pdev) 849 849 { 850 850 struct jz4780_i2c *i2c = platform_get_drvdata(pdev); 851 851 852 852 clk_disable_unprepare(i2c->clk); 853 853 i2c_del_adapter(&i2c->adap); 854 - return 0; 855 854 } 856 855 857 856 static struct platform_driver jz4780_i2c_driver = { 858 857 .probe = jz4780_i2c_probe, 859 - .remove = jz4780_i2c_remove, 858 + .remove_new = jz4780_i2c_remove, 860 859 .driver = { 861 860 .name = "jz4780-i2c", 862 861 .of_match_table = jz4780_i2c_of_matches,
+2 -4
drivers/i2c/busses/i2c-kempld.c
··· 329 329 return 0; 330 330 } 331 331 332 - static int kempld_i2c_remove(struct platform_device *pdev) 332 + static void kempld_i2c_remove(struct platform_device *pdev) 333 333 { 334 334 struct kempld_i2c_data *i2c = platform_get_drvdata(pdev); 335 335 struct kempld_device_data *pld = i2c->pld; ··· 348 348 kempld_release_mutex(pld); 349 349 350 350 i2c_del_adapter(&i2c->adap); 351 - 352 - return 0; 353 351 } 354 352 355 353 #ifdef CONFIG_PM ··· 387 389 .name = "kempld-i2c", 388 390 }, 389 391 .probe = kempld_i2c_probe, 390 - .remove = kempld_i2c_remove, 392 + .remove_new = kempld_i2c_remove, 391 393 .suspend = kempld_i2c_suspend, 392 394 .resume = kempld_i2c_resume, 393 395 };
+7 -21
drivers/i2c/busses/i2c-lpc2k.c
··· 365 365 366 366 init_waitqueue_head(&i2c->wait); 367 367 368 - i2c->clk = devm_clk_get(&pdev->dev, NULL); 368 + i2c->clk = devm_clk_get_enabled(&pdev->dev, NULL); 369 369 if (IS_ERR(i2c->clk)) { 370 - dev_err(&pdev->dev, "error getting clock\n"); 370 + dev_err(&pdev->dev, "failed to enable clock.\n"); 371 371 return PTR_ERR(i2c->clk); 372 - } 373 - 374 - ret = clk_prepare_enable(i2c->clk); 375 - if (ret) { 376 - dev_err(&pdev->dev, "unable to enable clock.\n"); 377 - return ret; 378 372 } 379 373 380 374 ret = devm_request_irq(&pdev->dev, i2c->irq, i2c_lpc2k_handler, 0, 381 375 dev_name(&pdev->dev), i2c); 382 376 if (ret < 0) { 383 377 dev_err(&pdev->dev, "can't request interrupt.\n"); 384 - goto fail_clk; 378 + return ret; 385 379 } 386 380 387 381 disable_irq_nosync(i2c->irq); ··· 391 397 clkrate = clk_get_rate(i2c->clk); 392 398 if (clkrate == 0) { 393 399 dev_err(&pdev->dev, "can't get I2C base clock\n"); 394 - ret = -EINVAL; 395 - goto fail_clk; 400 + return -EINVAL; 396 401 } 397 402 398 403 /* Setup I2C dividers to generate clock with proper duty cycle */ ··· 417 424 418 425 ret = i2c_add_adapter(&i2c->adap); 419 426 if (ret < 0) 420 - goto fail_clk; 427 + return ret; 421 428 422 429 dev_info(&pdev->dev, "LPC2K I2C adapter\n"); 423 430 424 431 return 0; 425 - 426 - fail_clk: 427 - clk_disable_unprepare(i2c->clk); 428 - return ret; 429 432 } 430 433 431 - static int i2c_lpc2k_remove(struct platform_device *dev) 434 + static void i2c_lpc2k_remove(struct platform_device *dev) 432 435 { 433 436 struct lpc2k_i2c *i2c = platform_get_drvdata(dev); 434 437 435 438 i2c_del_adapter(&i2c->adap); 436 - clk_disable_unprepare(i2c->clk); 437 - 438 - return 0; 439 439 } 440 440 441 441 #ifdef CONFIG_PM ··· 469 483 470 484 static struct platform_driver i2c_lpc2k_driver = { 471 485 .probe = i2c_lpc2k_probe, 472 - .remove = i2c_lpc2k_remove, 486 + .remove_new = i2c_lpc2k_remove, 473 487 .driver = { 474 488 .name = "lpc2k-i2c", 475 489 .pm = I2C_LPC2K_DEV_PM_OPS,
+2 -4
drivers/i2c/busses/i2c-meson.c
··· 535 535 return 0; 536 536 } 537 537 538 - static int meson_i2c_remove(struct platform_device *pdev) 538 + static void meson_i2c_remove(struct platform_device *pdev) 539 539 { 540 540 struct meson_i2c *i2c = platform_get_drvdata(pdev); 541 541 542 542 i2c_del_adapter(&i2c->adap); 543 543 clk_disable_unprepare(i2c->clk); 544 - 545 - return 0; 546 544 } 547 545 548 546 static const struct meson_i2c_data i2c_meson6_data = { ··· 566 568 567 569 static struct platform_driver meson_i2c_driver = { 568 570 .probe = meson_i2c_probe, 569 - .remove = meson_i2c_remove, 571 + .remove_new = meson_i2c_remove, 570 572 .driver = { 571 573 .name = "meson-i2c", 572 574 .of_match_table = meson_i2c_match,
+2 -4
drivers/i2c/busses/i2c-microchip-corei2c.c
··· 446 446 return 0; 447 447 } 448 448 449 - static int mchp_corei2c_remove(struct platform_device *pdev) 449 + static void mchp_corei2c_remove(struct platform_device *pdev) 450 450 { 451 451 struct mchp_corei2c_dev *idev = platform_get_drvdata(pdev); 452 452 453 453 clk_disable_unprepare(idev->i2c_clk); 454 454 i2c_del_adapter(&idev->adapter); 455 - 456 - return 0; 457 455 } 458 456 459 457 static const struct of_device_id mchp_corei2c_of_match[] = { ··· 463 465 464 466 static struct platform_driver mchp_corei2c_driver = { 465 467 .probe = mchp_corei2c_probe, 466 - .remove = mchp_corei2c_remove, 468 + .remove_new = mchp_corei2c_remove, 467 469 .driver = { 468 470 .name = "microchip-corei2c", 469 471 .of_match_table = mchp_corei2c_of_match,
+2 -4
drivers/i2c/busses/i2c-mlxbf.c
··· 2433 2433 return 0; 2434 2434 } 2435 2435 2436 - static int mlxbf_i2c_remove(struct platform_device *pdev) 2436 + static void mlxbf_i2c_remove(struct platform_device *pdev) 2437 2437 { 2438 2438 struct mlxbf_i2c_priv *priv = platform_get_drvdata(pdev); 2439 2439 struct device *dev = &pdev->dev; ··· 2474 2474 devm_free_irq(dev, priv->irq, priv); 2475 2475 2476 2476 i2c_del_adapter(&priv->adap); 2477 - 2478 - return 0; 2479 2477 } 2480 2478 2481 2479 static struct platform_driver mlxbf_i2c_driver = { 2482 2480 .probe = mlxbf_i2c_probe, 2483 - .remove = mlxbf_i2c_remove, 2481 + .remove_new = mlxbf_i2c_remove, 2484 2482 .driver = { 2485 2483 .name = "i2c-mlxbf", 2486 2484 .acpi_match_table = ACPI_PTR(mlxbf_i2c_acpi_ids),
+2 -4
drivers/i2c/busses/i2c-mlxcpld.c
··· 571 571 return err; 572 572 } 573 573 574 - static int mlxcpld_i2c_remove(struct platform_device *pdev) 574 + static void mlxcpld_i2c_remove(struct platform_device *pdev) 575 575 { 576 576 struct mlxcpld_i2c_priv *priv = platform_get_drvdata(pdev); 577 577 578 578 i2c_del_adapter(&priv->adap); 579 579 mutex_destroy(&priv->lock); 580 - 581 - return 0; 582 580 } 583 581 584 582 static struct platform_driver mlxcpld_i2c_driver = { 585 583 .probe = mlxcpld_i2c_probe, 586 - .remove = mlxcpld_i2c_remove, 584 + .remove_new = mlxcpld_i2c_remove, 587 585 .driver = { 588 586 .name = MLXCPLD_I2C_DEVICE_NAME, 589 587 },
+5 -6
drivers/i2c/busses/i2c-mpc.c
··· 316 316 if (node_ctrl) { 317 317 ctrl = of_iomap(node_ctrl, 0); 318 318 if (ctrl) { 319 + u64 addr; 319 320 /* Interrupt enable bits for i2c-0/1/2: bit 24/26/28 */ 320 - pval = of_get_property(node, "reg", NULL); 321 - idx = (*pval & 0xff) / 0x20; 321 + of_property_read_reg(node, 0, &addr, NULL); 322 + idx = (addr & 0xff) / 0x20; 322 323 setbits32(ctrl, 1 << (24 + idx * 2)); 323 324 iounmap(ctrl); 324 325 } ··· 891 890 return result; 892 891 }; 893 892 894 - static int fsl_i2c_remove(struct platform_device *op) 893 + static void fsl_i2c_remove(struct platform_device *op) 895 894 { 896 895 struct mpc_i2c *i2c = platform_get_drvdata(op); 897 896 898 897 i2c_del_adapter(&i2c->adap); 899 898 900 899 clk_disable_unprepare(i2c->clk_per); 901 - 902 - return 0; 903 900 }; 904 901 905 902 static int __maybe_unused mpc_i2c_suspend(struct device *dev) ··· 958 959 /* Structure for a device driver */ 959 960 static struct platform_driver mpc_i2c_driver = { 960 961 .probe = fsl_i2c_probe, 961 - .remove = fsl_i2c_remove, 962 + .remove_new = fsl_i2c_remove, 962 963 .driver = { 963 964 .name = DRV_NAME, 964 965 .of_match_table = mpc_i2c_of_match,
+2 -4
drivers/i2c/busses/i2c-mt65xx.c
··· 1505 1505 return ret; 1506 1506 } 1507 1507 1508 - static int mtk_i2c_remove(struct platform_device *pdev) 1508 + static void mtk_i2c_remove(struct platform_device *pdev) 1509 1509 { 1510 1510 struct mtk_i2c *i2c = platform_get_drvdata(pdev); 1511 1511 1512 1512 i2c_del_adapter(&i2c->adap); 1513 1513 1514 1514 clk_bulk_unprepare(I2C_MT65XX_CLK_MAX, i2c->clocks); 1515 - 1516 - return 0; 1517 1515 } 1518 1516 1519 1517 #ifdef CONFIG_PM_SLEEP ··· 1553 1555 1554 1556 static struct platform_driver mtk_i2c_driver = { 1555 1557 .probe = mtk_i2c_probe, 1556 - .remove = mtk_i2c_remove, 1558 + .remove_new = mtk_i2c_remove, 1557 1559 .driver = { 1558 1560 .name = I2C_DRV_NAME, 1559 1561 .pm = &mtk_i2c_pm,
+6 -20
drivers/i2c/busses/i2c-mt7621.c
··· 282 282 if (IS_ERR(i2c->base)) 283 283 return PTR_ERR(i2c->base); 284 284 285 - i2c->clk = devm_clk_get(&pdev->dev, NULL); 285 + i2c->clk = devm_clk_get_enabled(&pdev->dev, NULL); 286 286 if (IS_ERR(i2c->clk)) { 287 - dev_err(&pdev->dev, "no clock defined\n"); 287 + dev_err(&pdev->dev, "Failed to enable clock\n"); 288 288 return PTR_ERR(i2c->clk); 289 - } 290 - ret = clk_prepare_enable(i2c->clk); 291 - if (ret) { 292 - dev_err(&pdev->dev, "Unable to enable clock\n"); 293 - return ret; 294 289 } 295 290 296 291 i2c->dev = &pdev->dev; ··· 296 301 297 302 if (i2c->bus_freq == 0) { 298 303 dev_warn(i2c->dev, "clock-frequency 0 not supported\n"); 299 - ret = -EINVAL; 300 - goto err_disable_clk; 304 + return -EINVAL; 301 305 } 302 306 303 307 adap = &i2c->adap; ··· 314 320 315 321 ret = i2c_add_adapter(adap); 316 322 if (ret < 0) 317 - goto err_disable_clk; 323 + return ret; 318 324 319 325 dev_info(&pdev->dev, "clock %u kHz\n", i2c->bus_freq / 1000); 320 326 321 327 return 0; 322 - 323 - err_disable_clk: 324 - clk_disable_unprepare(i2c->clk); 325 - 326 - return ret; 327 328 } 328 329 329 - static int mtk_i2c_remove(struct platform_device *pdev) 330 + static void mtk_i2c_remove(struct platform_device *pdev) 330 331 { 331 332 struct mtk_i2c *i2c = platform_get_drvdata(pdev); 332 333 333 - clk_disable_unprepare(i2c->clk); 334 334 i2c_del_adapter(&i2c->adap); 335 - 336 - return 0; 337 335 } 338 336 339 337 static struct platform_driver mtk_i2c_driver = { 340 338 .probe = mtk_i2c_probe, 341 - .remove = mtk_i2c_remove, 339 + .remove_new = mtk_i2c_remove, 342 340 .driver = { 343 341 .name = "i2c-mt7621", 344 342 .of_match_table = i2c_mtk_dt_ids,
+2 -4
drivers/i2c/busses/i2c-mv64xxx.c
··· 1084 1084 return rc; 1085 1085 } 1086 1086 1087 - static int 1087 + static void 1088 1088 mv64xxx_i2c_remove(struct platform_device *pd) 1089 1089 { 1090 1090 struct mv64xxx_i2c_data *drv_data = platform_get_drvdata(pd); ··· 1094 1094 pm_runtime_disable(&pd->dev); 1095 1095 if (!pm_runtime_status_suspended(&pd->dev)) 1096 1096 mv64xxx_i2c_runtime_suspend(&pd->dev); 1097 - 1098 - return 0; 1099 1097 } 1100 1098 1101 1099 static const struct dev_pm_ops mv64xxx_i2c_pm_ops = { ··· 1105 1107 1106 1108 static struct platform_driver mv64xxx_i2c_driver = { 1107 1109 .probe = mv64xxx_i2c_probe, 1108 - .remove = mv64xxx_i2c_remove, 1110 + .remove_new = mv64xxx_i2c_remove, 1109 1111 .driver = { 1110 1112 .name = MV64XXX_I2C_CTLR_NAME, 1111 1113 .pm = &mv64xxx_i2c_pm_ops,
+2 -4
drivers/i2c/busses/i2c-mxs.c
··· 864 864 return 0; 865 865 } 866 866 867 - static int mxs_i2c_remove(struct platform_device *pdev) 867 + static void mxs_i2c_remove(struct platform_device *pdev) 868 868 { 869 869 struct mxs_i2c_dev *i2c = platform_get_drvdata(pdev); 870 870 ··· 874 874 dma_release_channel(i2c->dmach); 875 875 876 876 writel(MXS_I2C_CTRL0_SFTRST, i2c->regs + MXS_I2C_CTRL0_SET); 877 - 878 - return 0; 879 877 } 880 878 881 879 static struct platform_driver mxs_i2c_driver = { ··· 882 884 .of_match_table = mxs_i2c_dt_ids, 883 885 }, 884 886 .probe = mxs_i2c_probe, 885 - .remove = mxs_i2c_remove, 887 + .remove_new = mxs_i2c_remove, 886 888 }; 887 889 888 890 static int __init mxs_i2c_init(void)
+14 -34
drivers/i2c/busses/i2c-nomadik.c
··· 970 970 struct i2c_vendor_data *vendor = id->data; 971 971 u32 max_fifo_threshold = (vendor->fifodepth / 2) - 1; 972 972 973 - dev = devm_kzalloc(&adev->dev, sizeof(struct nmk_i2c_dev), GFP_KERNEL); 974 - if (!dev) { 975 - dev_err(&adev->dev, "cannot allocate memory\n"); 976 - ret = -ENOMEM; 977 - goto err_no_mem; 978 - } 973 + dev = devm_kzalloc(&adev->dev, sizeof(*dev), GFP_KERNEL); 974 + if (!dev) 975 + return -ENOMEM; 976 + 979 977 dev->vendor = vendor; 980 978 dev->adev = adev; 981 979 nmk_i2c_of_probe(np, dev); ··· 994 996 995 997 dev->virtbase = devm_ioremap(&adev->dev, adev->res.start, 996 998 resource_size(&adev->res)); 997 - if (!dev->virtbase) { 998 - ret = -ENOMEM; 999 - goto err_no_mem; 1000 - } 999 + if (!dev->virtbase) 1000 + return -ENOMEM; 1001 1001 1002 1002 dev->irq = adev->irq[0]; 1003 1003 ret = devm_request_irq(&adev->dev, dev->irq, i2c_irq_handler, 0, 1004 1004 DRIVER_NAME, dev); 1005 - if (ret) { 1006 - dev_err(&adev->dev, "cannot claim the irq %d\n", dev->irq); 1007 - goto err_no_mem; 1008 - } 1005 + if (ret) 1006 + return dev_err_probe(&adev->dev, ret, 1007 + "cannot claim the irq %d\n", dev->irq); 1009 1008 1010 - dev->clk = devm_clk_get(&adev->dev, NULL); 1011 - if (IS_ERR(dev->clk)) { 1012 - dev_err(&adev->dev, "could not get i2c clock\n"); 1013 - ret = PTR_ERR(dev->clk); 1014 - goto err_no_mem; 1015 - } 1016 - 1017 - ret = clk_prepare_enable(dev->clk); 1018 - if (ret) { 1019 - dev_err(&adev->dev, "can't prepare_enable clock\n"); 1020 - goto err_no_mem; 1021 - } 1009 + dev->clk = devm_clk_get_enabled(&adev->dev, NULL); 1010 + if (IS_ERR(dev->clk)) 1011 + return dev_err_probe(&adev->dev, PTR_ERR(dev->clk), 1012 + "could enable i2c clock\n"); 1022 1013 1023 1014 init_hw(dev); 1024 1015 ··· 1029 1042 1030 1043 ret = i2c_add_adapter(adap); 1031 1044 if (ret) 1032 - goto err_no_adap; 1045 + return ret; 1033 1046 1034 1047 pm_runtime_put(&adev->dev); 1035 1048 1036 1049 return 0; 1037 - 1038 - err_no_adap: 1039 - clk_disable_unprepare(dev->clk); 1040 - err_no_mem: 1041 - 1042 - return ret; 1043 1050 } 1044 1051 1045 1052 static void nmk_i2c_remove(struct amba_device *adev) ··· 1047 1066 clear_all_interrupts(dev); 1048 1067 /* disable the controller */ 1049 1068 i2c_clr_bit(dev->virtbase + I2C_CR, I2C_CR_PE); 1050 - clk_disable_unprepare(dev->clk); 1051 1069 release_mem_region(res->start, resource_size(res)); 1052 1070 } 1053 1071
+2 -3
drivers/i2c/busses/i2c-npcm7xx.c
··· 2361 2361 return 0; 2362 2362 } 2363 2363 2364 - static int npcm_i2c_remove_bus(struct platform_device *pdev) 2364 + static void npcm_i2c_remove_bus(struct platform_device *pdev) 2365 2365 { 2366 2366 unsigned long lock_flags; 2367 2367 struct npcm_i2c *bus = platform_get_drvdata(pdev); ··· 2371 2371 npcm_i2c_disable(bus); 2372 2372 spin_unlock_irqrestore(&bus->lock, lock_flags); 2373 2373 i2c_del_adapter(&bus->adap); 2374 - return 0; 2375 2374 } 2376 2375 2377 2376 static const struct of_device_id npcm_i2c_bus_of_table[] = { ··· 2382 2383 2383 2384 static struct platform_driver npcm_i2c_bus_driver = { 2384 2385 .probe = npcm_i2c_probe_bus, 2385 - .remove = npcm_i2c_remove_bus, 2386 + .remove_new = npcm_i2c_remove_bus, 2386 2387 .driver = { 2387 2388 .name = "nuvoton-i2c", 2388 2389 .of_match_table = npcm_i2c_bus_of_table,
+3
drivers/i2c/busses/i2c-nvidia-gpu.c
··· 14 14 #include <linux/platform_device.h> 15 15 #include <linux/pm.h> 16 16 #include <linux/pm_runtime.h> 17 + #include <linux/power_supply.h> 17 18 18 19 #include <asm/unaligned.h> 19 20 ··· 262 261 static const struct property_entry ccgx_props[] = { 263 262 /* Use FW built for NVIDIA GPU only */ 264 263 PROPERTY_ENTRY_STRING("firmware-name", "nvidia,gpu"), 264 + /* USB-C doesn't power the system */ 265 + PROPERTY_ENTRY_U8("scope", POWER_SUPPLY_SCOPE_DEVICE), 265 266 { } 266 267 }; 267 268
+22 -46
drivers/i2c/busses/i2c-ocores.c
··· 552 552 &clock_frequency); 553 553 i2c->bus_clock_khz = 100; 554 554 555 - i2c->clk = devm_clk_get(&pdev->dev, NULL); 555 + i2c->clk = devm_clk_get_optional_enabled(&pdev->dev, NULL); 556 + if (IS_ERR(i2c->clk)) 557 + return dev_err_probe(&pdev->dev, PTR_ERR(i2c->clk), 558 + "devm_clk_get_optional_enabled failed\n"); 556 559 557 - if (!IS_ERR(i2c->clk)) { 558 - int ret = clk_prepare_enable(i2c->clk); 559 - 560 - if (ret) { 561 - dev_err(&pdev->dev, 562 - "clk_prepare_enable failed: %d\n", ret); 563 - return ret; 564 - } 565 - i2c->ip_clock_khz = clk_get_rate(i2c->clk) / 1000; 566 - if (clock_frequency_present) 567 - i2c->bus_clock_khz = clock_frequency / 1000; 568 - } 569 - 560 + i2c->ip_clock_khz = clk_get_rate(i2c->clk) / 1000; 561 + if (clock_frequency_present) 562 + i2c->bus_clock_khz = clock_frequency / 1000; 570 563 if (i2c->ip_clock_khz == 0) { 571 564 if (of_property_read_u32(np, "opencores,ip-clock-frequency", 572 565 &val)) { 573 566 if (!clock_frequency_present) { 574 567 dev_err(&pdev->dev, 575 568 "Missing required parameter 'opencores,ip-clock-frequency'\n"); 576 - clk_disable_unprepare(i2c->clk); 577 569 return -ENODEV; 578 570 } 579 571 i2c->ip_clock_khz = clock_frequency / 1000; ··· 670 678 default: 671 679 dev_err(&pdev->dev, "Unsupported I/O width (%d)\n", 672 680 i2c->reg_io_width); 673 - ret = -EINVAL; 674 - goto err_clk; 681 + return -EINVAL; 675 682 } 676 683 } 677 684 ··· 701 710 pdev->name, i2c); 702 711 if (ret) { 703 712 dev_err(&pdev->dev, "Cannot claim IRQ\n"); 704 - goto err_clk; 713 + return ret; 705 714 } 706 715 } 707 716 708 717 ret = ocores_init(&pdev->dev, i2c); 709 718 if (ret) 710 - goto err_clk; 719 + return ret; 711 720 712 721 /* hook up driver to tree */ 713 722 platform_set_drvdata(pdev, i2c); ··· 719 728 /* add i2c adapter to i2c tree */ 720 729 ret = i2c_add_adapter(&i2c->adap); 721 730 if (ret) 722 - goto err_clk; 731 + return ret; 723 732 724 733 /* add in known devices to the bus */ 725 734 if (pdata) { ··· 728 737 } 729 738 730 739 return 0; 731 - 732 - err_clk: 733 - clk_disable_unprepare(i2c->clk); 734 - return ret; 735 740 } 736 741 737 - static int ocores_i2c_remove(struct platform_device *pdev) 742 + static void ocores_i2c_remove(struct platform_device *pdev) 738 743 { 739 744 struct ocores_i2c *i2c = platform_get_drvdata(pdev); 740 745 u8 ctrl = oc_getreg(i2c, OCI2C_CONTROL); ··· 741 754 742 755 /* remove adapter & data */ 743 756 i2c_del_adapter(&i2c->adap); 744 - 745 - if (!IS_ERR(i2c->clk)) 746 - clk_disable_unprepare(i2c->clk); 747 - 748 - return 0; 749 757 } 750 758 751 759 #ifdef CONFIG_PM_SLEEP ··· 753 771 ctrl &= ~(OCI2C_CTRL_EN | OCI2C_CTRL_IEN); 754 772 oc_setreg(i2c, OCI2C_CONTROL, ctrl); 755 773 756 - if (!IS_ERR(i2c->clk)) 757 - clk_disable_unprepare(i2c->clk); 774 + clk_disable_unprepare(i2c->clk); 758 775 return 0; 759 776 } 760 777 761 778 static int ocores_i2c_resume(struct device *dev) 762 779 { 763 780 struct ocores_i2c *i2c = dev_get_drvdata(dev); 781 + unsigned long rate; 782 + int ret; 764 783 765 - if (!IS_ERR(i2c->clk)) { 766 - unsigned long rate; 767 - int ret = clk_prepare_enable(i2c->clk); 768 - 769 - if (ret) { 770 - dev_err(dev, 771 - "clk_prepare_enable failed: %d\n", ret); 772 - return ret; 773 - } 774 - rate = clk_get_rate(i2c->clk) / 1000; 775 - if (rate) 776 - i2c->ip_clock_khz = rate; 777 - } 784 + ret = clk_prepare_enable(i2c->clk); 785 + if (ret) 786 + return dev_err_probe(dev, ret, "clk_prepare_enable failed\n"); 787 + rate = clk_get_rate(i2c->clk) / 1000; 788 + if (rate) 789 + i2c->ip_clock_khz = rate; 778 790 return ocores_init(dev, i2c); 779 791 } 780 792 ··· 780 804 781 805 static struct platform_driver ocores_i2c_driver = { 782 806 .probe = ocores_i2c_probe, 783 - .remove = ocores_i2c_remove, 807 + .remove_new = ocores_i2c_remove, 784 808 .driver = { 785 809 .name = "ocores-i2c", 786 810 .of_match_table = ocores_i2c_match,
+2 -3
drivers/i2c/busses/i2c-octeon-platdrv.c
··· 253 253 return result; 254 254 }; 255 255 256 - static int octeon_i2c_remove(struct platform_device *pdev) 256 + static void octeon_i2c_remove(struct platform_device *pdev) 257 257 { 258 258 struct octeon_i2c *i2c = platform_get_drvdata(pdev); 259 259 260 260 i2c_del_adapter(&i2c->adap); 261 - return 0; 262 261 }; 263 262 264 263 static const struct of_device_id octeon_i2c_match[] = { ··· 269 270 270 271 static struct platform_driver octeon_i2c_driver = { 271 272 .probe = octeon_i2c_probe, 272 - .remove = octeon_i2c_remove, 273 + .remove_new = octeon_i2c_remove, 273 274 .driver = { 274 275 .name = DRV_NAME, 275 276 .of_match_table = octeon_i2c_match,
+2 -4
drivers/i2c/busses/i2c-omap.c
··· 1519 1519 return r; 1520 1520 } 1521 1521 1522 - static int omap_i2c_remove(struct platform_device *pdev) 1522 + static void omap_i2c_remove(struct platform_device *pdev) 1523 1523 { 1524 1524 struct omap_i2c_dev *omap = platform_get_drvdata(pdev); 1525 1525 int ret; ··· 1535 1535 pm_runtime_dont_use_autosuspend(&pdev->dev); 1536 1536 pm_runtime_put_sync(&pdev->dev); 1537 1537 pm_runtime_disable(&pdev->dev); 1538 - 1539 - return 0; 1540 1538 } 1541 1539 1542 1540 static int __maybe_unused omap_i2c_runtime_suspend(struct device *dev) ··· 1586 1588 1587 1589 static struct platform_driver omap_i2c_driver = { 1588 1590 .probe = omap_i2c_probe, 1589 - .remove = omap_i2c_remove, 1591 + .remove_new = omap_i2c_remove, 1590 1592 .driver = { 1591 1593 .name = "omap_i2c", 1592 1594 .pm = &omap_i2c_pm_ops,
+2 -4
drivers/i2c/busses/i2c-opal.c
··· 232 232 return rc; 233 233 } 234 234 235 - static int i2c_opal_remove(struct platform_device *pdev) 235 + static void i2c_opal_remove(struct platform_device *pdev) 236 236 { 237 237 struct i2c_adapter *adapter = platform_get_drvdata(pdev); 238 238 239 239 i2c_del_adapter(adapter); 240 - 241 - return 0; 242 240 } 243 241 244 242 static const struct of_device_id i2c_opal_of_match[] = { ··· 249 251 250 252 static struct platform_driver i2c_opal_driver = { 251 253 .probe = i2c_opal_probe, 252 - .remove = i2c_opal_remove, 254 + .remove_new = i2c_opal_remove, 253 255 .driver = { 254 256 .name = "i2c-opal", 255 257 .of_match_table = i2c_opal_of_match,
+4 -14
drivers/i2c/busses/i2c-owl.c
··· 461 461 return -EINVAL; 462 462 } 463 463 464 - i2c_dev->clk = devm_clk_get(dev, NULL); 464 + i2c_dev->clk = devm_clk_get_enabled(dev, NULL); 465 465 if (IS_ERR(i2c_dev->clk)) { 466 - dev_err(dev, "failed to get clock\n"); 466 + dev_err(dev, "failed to enable clock\n"); 467 467 return PTR_ERR(i2c_dev->clk); 468 468 } 469 - 470 - ret = clk_prepare_enable(i2c_dev->clk); 471 - if (ret) 472 - return ret; 473 469 474 470 i2c_dev->clk_rate = clk_get_rate(i2c_dev->clk); 475 471 if (!i2c_dev->clk_rate) { 476 472 dev_err(dev, "input clock rate should not be zero\n"); 477 - ret = -EINVAL; 478 - goto disable_clk; 473 + return -EINVAL; 479 474 } 480 475 481 476 init_completion(&i2c_dev->msg_complete); ··· 491 496 i2c_dev); 492 497 if (ret) { 493 498 dev_err(dev, "failed to request irq %d\n", irq); 494 - goto disable_clk; 499 + return ret; 495 500 } 496 501 497 502 return i2c_add_adapter(&i2c_dev->adap); 498 - 499 - disable_clk: 500 - clk_disable_unprepare(i2c_dev->clk); 501 - 502 - return ret; 503 503 } 504 504 505 505 static const struct of_device_id owl_i2c_of_match[] = {
+5 -20
drivers/i2c/busses/i2c-pasemi-platform.c
··· 66 66 if (of_property_read_u32(dev->of_node, "clock-frequency", &frequency)) 67 67 frequency = I2C_MAX_STANDARD_MODE_FREQ; 68 68 69 - data->clk_ref = devm_clk_get(dev, NULL); 69 + data->clk_ref = devm_clk_get_enabled(dev, NULL); 70 70 if (IS_ERR(data->clk_ref)) 71 71 return PTR_ERR(data->clk_ref); 72 72 73 - error = clk_prepare_enable(data->clk_ref); 74 - if (error) 75 - return error; 76 - 77 73 error = pasemi_platform_i2c_calc_clk_div(data, frequency); 78 74 if (error) 79 - goto out_clk_disable; 75 + return error; 80 76 81 77 smbus->adapter.dev.of_node = pdev->dev.of_node; 82 78 error = pasemi_i2c_common_probe(smbus); 83 79 if (error) 84 - goto out_clk_disable; 80 + return error; 85 81 86 82 irq_num = platform_get_irq(pdev, 0); 87 83 error = devm_request_irq(smbus->dev, irq_num, pasemi_irq_handler, 0, "pasemi_apple_i2c", (void *)smbus); ··· 87 91 platform_set_drvdata(pdev, data); 88 92 89 93 return 0; 90 - 91 - out_clk_disable: 92 - clk_disable_unprepare(data->clk_ref); 93 - 94 - return error; 95 94 } 96 95 97 - static int pasemi_platform_i2c_remove(struct platform_device *pdev) 98 - { 99 - struct pasemi_platform_i2c_data *data = platform_get_drvdata(pdev); 100 - 101 - clk_disable_unprepare(data->clk_ref); 102 - return 0; 103 - } 96 + static void pasemi_platform_i2c_remove(struct platform_device *pdev) { } 104 97 105 98 static const struct of_device_id pasemi_platform_i2c_of_match[] = { 106 99 { .compatible = "apple,t8103-i2c" }, ··· 104 119 .of_match_table = pasemi_platform_i2c_of_match, 105 120 }, 106 121 .probe = pasemi_platform_i2c_probe, 107 - .remove = pasemi_platform_i2c_remove, 122 + .remove_new = pasemi_platform_i2c_remove, 108 123 }; 109 124 module_platform_driver(pasemi_platform_i2c_driver); 110 125
+2 -4
drivers/i2c/busses/i2c-pca-platform.c
··· 221 221 return 0; 222 222 } 223 223 224 - static int i2c_pca_pf_remove(struct platform_device *pdev) 224 + static void i2c_pca_pf_remove(struct platform_device *pdev) 225 225 { 226 226 struct i2c_pca_pf_data *i2c = platform_get_drvdata(pdev); 227 227 228 228 i2c_del_adapter(&i2c->adap); 229 - 230 - return 0; 231 229 } 232 230 233 231 #ifdef CONFIG_OF ··· 239 241 240 242 static struct platform_driver i2c_pca_pf_driver = { 241 243 .probe = i2c_pca_pf_probe, 242 - .remove = i2c_pca_pf_remove, 244 + .remove_new = i2c_pca_pf_remove, 243 245 .driver = { 244 246 .name = "i2c-pca-platform", 245 247 .of_match_table = of_match_ptr(i2c_pca_of_match_table),
+2 -4
drivers/i2c/busses/i2c-pnx.c
··· 743 743 return ret; 744 744 } 745 745 746 - static int i2c_pnx_remove(struct platform_device *pdev) 746 + static void i2c_pnx_remove(struct platform_device *pdev) 747 747 { 748 748 struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev); 749 749 750 750 i2c_del_adapter(&alg_data->adapter); 751 751 clk_disable_unprepare(alg_data->clk); 752 - 753 - return 0; 754 752 } 755 753 756 754 #ifdef CONFIG_OF ··· 766 768 .pm = PNX_I2C_PM, 767 769 }, 768 770 .probe = i2c_pnx_probe, 769 - .remove = i2c_pnx_remove, 771 + .remove_new = i2c_pnx_remove, 770 772 }; 771 773 772 774 static int __init i2c_adap_pnx_init(void)
+2 -4
drivers/i2c/busses/i2c-powermac.c
··· 188 188 .max_num_msgs = 1, 189 189 }; 190 190 191 - static int i2c_powermac_remove(struct platform_device *dev) 191 + static void i2c_powermac_remove(struct platform_device *dev) 192 192 { 193 193 struct i2c_adapter *adapter = platform_get_drvdata(dev); 194 194 195 195 i2c_del_adapter(adapter); 196 196 memset(adapter, 0, sizeof(*adapter)); 197 - 198 - return 0; 199 197 } 200 198 201 199 static u32 i2c_powermac_get_addr(struct i2c_adapter *adap, ··· 437 439 438 440 static struct platform_driver i2c_powermac_driver = { 439 441 .probe = i2c_powermac_probe, 440 - .remove = i2c_powermac_remove, 442 + .remove_new = i2c_powermac_remove, 441 443 .driver = { 442 444 .name = "i2c-powermac", 443 445 .bus = &platform_bus_type,
+2 -4
drivers/i2c/busses/i2c-pxa.c
··· 1482 1482 return ret; 1483 1483 } 1484 1484 1485 - static int i2c_pxa_remove(struct platform_device *dev) 1485 + static void i2c_pxa_remove(struct platform_device *dev) 1486 1486 { 1487 1487 struct pxa_i2c *i2c = platform_get_drvdata(dev); 1488 1488 1489 1489 i2c_del_adapter(&i2c->adap); 1490 1490 1491 1491 clk_disable_unprepare(i2c->clk); 1492 - 1493 - return 0; 1494 1492 } 1495 1493 1496 1494 #ifdef CONFIG_PM ··· 1523 1525 1524 1526 static struct platform_driver i2c_pxa_driver = { 1525 1527 .probe = i2c_pxa_probe, 1526 - .remove = i2c_pxa_remove, 1528 + .remove_new = i2c_pxa_remove, 1527 1529 .driver = { 1528 1530 .name = "pxa2xx-i2c", 1529 1531 .pm = I2C_PXA_DEV_PM_OPS,
+3 -6
drivers/i2c/busses/i2c-qcom-cci.c
··· 581 581 582 582 /* Memory */ 583 583 584 - r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 585 - cci->base = devm_ioremap_resource(dev, r); 584 + cci->base = devm_platform_get_and_ioremap_resource(pdev, 0, &r); 586 585 if (IS_ERR(cci->base)) 587 586 return PTR_ERR(cci->base); 588 587 ··· 674 675 return ret; 675 676 } 676 677 677 - static int cci_remove(struct platform_device *pdev) 678 + static void cci_remove(struct platform_device *pdev) 678 679 { 679 680 struct cci *cci = platform_get_drvdata(pdev); 680 681 int i; ··· 690 691 disable_irq(cci->irq); 691 692 pm_runtime_disable(&pdev->dev); 692 693 pm_runtime_set_suspended(&pdev->dev); 693 - 694 - return 0; 695 694 } 696 695 697 696 static const struct cci_data cci_v1_data = { ··· 826 829 827 830 static struct platform_driver qcom_cci_driver = { 828 831 .probe = cci_probe, 829 - .remove = cci_remove, 832 + .remove_new = cci_remove, 830 833 .driver = { 831 834 .name = "i2c-qcom-cci", 832 835 .of_match_table = cci_dt_match,
+2 -3
drivers/i2c/busses/i2c-qcom-geni.c
··· 936 936 return ret; 937 937 } 938 938 939 - static int geni_i2c_remove(struct platform_device *pdev) 939 + static void geni_i2c_remove(struct platform_device *pdev) 940 940 { 941 941 struct geni_i2c_dev *gi2c = platform_get_drvdata(pdev); 942 942 943 943 i2c_del_adapter(&gi2c->adap); 944 944 release_gpi_dma(gi2c); 945 945 pm_runtime_disable(gi2c->se.dev); 946 - return 0; 947 946 } 948 947 949 948 static void geni_i2c_shutdown(struct platform_device *pdev) ··· 1040 1041 1041 1042 static struct platform_driver geni_i2c_driver = { 1042 1043 .probe = geni_i2c_probe, 1043 - .remove = geni_i2c_remove, 1044 + .remove_new = geni_i2c_remove, 1044 1045 .shutdown = geni_i2c_shutdown, 1045 1046 .driver = { 1046 1047 .name = "geni_i2c",
+2 -3
drivers/i2c/busses/i2c-qup.c
··· 1911 1911 return ret; 1912 1912 } 1913 1913 1914 - static int qup_i2c_remove(struct platform_device *pdev) 1914 + static void qup_i2c_remove(struct platform_device *pdev) 1915 1915 { 1916 1916 struct qup_i2c_dev *qup = platform_get_drvdata(pdev); 1917 1917 ··· 1925 1925 i2c_del_adapter(&qup->adap); 1926 1926 pm_runtime_disable(qup->dev); 1927 1927 pm_runtime_set_suspended(qup->dev); 1928 - return 0; 1929 1928 } 1930 1929 1931 1930 #ifdef CONFIG_PM ··· 1984 1985 1985 1986 static struct platform_driver qup_i2c_driver = { 1986 1987 .probe = qup_i2c_probe, 1987 - .remove = qup_i2c_remove, 1988 + .remove_new = qup_i2c_remove, 1988 1989 .driver = { 1989 1990 .name = "i2c_qup", 1990 1991 .pm = &qup_i2c_qup_pm_ops,
+2 -4
drivers/i2c/busses/i2c-rcar.c
··· 1155 1155 return ret; 1156 1156 } 1157 1157 1158 - static int rcar_i2c_remove(struct platform_device *pdev) 1158 + static void rcar_i2c_remove(struct platform_device *pdev) 1159 1159 { 1160 1160 struct rcar_i2c_priv *priv = platform_get_drvdata(pdev); 1161 1161 struct device *dev = &pdev->dev; ··· 1167 1167 if (priv->flags & ID_P_PM_BLOCKED) 1168 1168 pm_runtime_put(dev); 1169 1169 pm_runtime_disable(dev); 1170 - 1171 - return 0; 1172 1170 } 1173 1171 1174 1172 #ifdef CONFIG_PM_SLEEP ··· 1202 1204 .pm = DEV_PM_OPS, 1203 1205 }, 1204 1206 .probe = rcar_i2c_probe, 1205 - .remove = rcar_i2c_remove, 1207 + .remove_new = rcar_i2c_remove, 1206 1208 }; 1207 1209 1208 1210 module_platform_driver(rcar_i2c_driver);
+2 -4
drivers/i2c/busses/i2c-riic.c
··· 477 477 return ret; 478 478 } 479 479 480 - static int riic_i2c_remove(struct platform_device *pdev) 480 + static void riic_i2c_remove(struct platform_device *pdev) 481 481 { 482 482 struct riic_dev *riic = platform_get_drvdata(pdev); 483 483 ··· 486 486 pm_runtime_put(&pdev->dev); 487 487 i2c_del_adapter(&riic->adapter); 488 488 pm_runtime_disable(&pdev->dev); 489 - 490 - return 0; 491 489 } 492 490 493 491 static const struct of_device_id riic_i2c_dt_ids[] = { ··· 495 497 496 498 static struct platform_driver riic_i2c_driver = { 497 499 .probe = riic_i2c_probe, 498 - .remove = riic_i2c_remove, 500 + .remove_new = riic_i2c_remove, 499 501 .driver = { 500 502 .name = "i2c-riic", 501 503 .of_match_table = riic_i2c_dt_ids,
+2 -4
drivers/i2c/busses/i2c-rk3x.c
··· 1372 1372 return ret; 1373 1373 } 1374 1374 1375 - static int rk3x_i2c_remove(struct platform_device *pdev) 1375 + static void rk3x_i2c_remove(struct platform_device *pdev) 1376 1376 { 1377 1377 struct rk3x_i2c *i2c = platform_get_drvdata(pdev); 1378 1378 ··· 1381 1381 clk_notifier_unregister(i2c->clk, &i2c->clk_rate_nb); 1382 1382 clk_unprepare(i2c->pclk); 1383 1383 clk_unprepare(i2c->clk); 1384 - 1385 - return 0; 1386 1384 } 1387 1385 1388 1386 static SIMPLE_DEV_PM_OPS(rk3x_i2c_pm_ops, NULL, rk3x_i2c_resume); 1389 1387 1390 1388 static struct platform_driver rk3x_i2c_driver = { 1391 1389 .probe = rk3x_i2c_probe, 1392 - .remove = rk3x_i2c_remove, 1390 + .remove_new = rk3x_i2c_remove, 1393 1391 .driver = { 1394 1392 .name = "rk3x-i2c", 1395 1393 .of_match_table = rk3x_i2c_match,
+31 -18
drivers/i2c/busses/i2c-rzv2m.c
··· 50 50 #define IICB0MDSC BIT(7) /* Bus Mode */ 51 51 #define IICB0SLSE BIT(1) /* Start condition output */ 52 52 53 - #define bit_setl(addr, val) writel(readl(addr) | (val), (addr)) 54 - #define bit_clrl(addr, val) writel(readl(addr) & ~(val), (addr)) 55 - 56 53 struct rzv2m_i2c_priv { 57 54 void __iomem *base; 58 55 struct i2c_adapter adap; ··· 74 77 [RZV2M_I2C_100K] = { 47, 3450 }, 75 78 [RZV2M_I2C_400K] = { 52, 900 }, 76 79 }; 80 + 81 + static inline void bit_setl(void __iomem *addr, u32 val) 82 + { 83 + writel(readl(addr) | val, addr); 84 + } 85 + 86 + static inline void bit_clrl(void __iomem *addr, u32 val) 87 + { 88 + writel(readl(addr) & ~val, addr); 89 + } 77 90 78 91 static irqreturn_t rzv2m_i2c_tia_irq_handler(int this_irq, void *dev_id) 79 92 { ··· 389 382 I2C_FUNC_10BIT_ADDR; 390 383 } 391 384 385 + static int rzv2m_i2c_disable(struct device *dev, struct rzv2m_i2c_priv *priv) 386 + { 387 + int ret; 388 + 389 + ret = pm_runtime_resume_and_get(dev); 390 + if (ret < 0) 391 + return ret; 392 + 393 + bit_clrl(priv->base + IICB0CTL0, IICB0IICE); 394 + pm_runtime_put(dev); 395 + 396 + return 0; 397 + } 398 + 392 399 static const struct i2c_adapter_quirks rzv2m_i2c_quirks = { 393 400 .flags = I2C_AQ_NO_ZERO_LEN, 394 401 }; ··· 475 454 platform_set_drvdata(pdev, priv); 476 455 477 456 ret = i2c_add_numbered_adapter(adap); 478 - if (ret < 0) 457 + if (ret < 0) { 458 + rzv2m_i2c_disable(dev, priv); 479 459 pm_runtime_disable(dev); 460 + } 480 461 481 462 return ret; 482 463 } 483 464 484 - static int rzv2m_i2c_remove(struct platform_device *pdev) 465 + static void rzv2m_i2c_remove(struct platform_device *pdev) 485 466 { 486 467 struct rzv2m_i2c_priv *priv = platform_get_drvdata(pdev); 487 468 struct device *dev = priv->adap.dev.parent; 488 469 489 470 i2c_del_adapter(&priv->adap); 490 - bit_clrl(priv->base + IICB0CTL0, IICB0IICE); 471 + rzv2m_i2c_disable(dev, priv); 491 472 pm_runtime_disable(dev); 492 - 493 - return 0; 494 473 } 495 474 496 475 static int rzv2m_i2c_suspend(struct device *dev) 497 476 { 498 477 struct rzv2m_i2c_priv *priv = dev_get_drvdata(dev); 499 - int ret; 500 478 501 - ret = pm_runtime_resume_and_get(dev); 502 - if (ret < 0) 503 - return ret; 504 - 505 - bit_clrl(priv->base + IICB0CTL0, IICB0IICE); 506 - pm_runtime_put(dev); 507 - 508 - return 0; 479 + return rzv2m_i2c_disable(dev, priv); 509 480 } 510 481 511 482 static int rzv2m_i2c_resume(struct device *dev) ··· 536 523 .pm = pm_sleep_ptr(&rzv2m_i2c_pm_ops), 537 524 }, 538 525 .probe = rzv2m_i2c_probe, 539 - .remove = rzv2m_i2c_remove, 526 + .remove_new = rzv2m_i2c_remove, 540 527 }; 541 528 module_platform_driver(rzv2m_i2c_driver); 542 529
+2 -4
drivers/i2c/busses/i2c-s3c2410.c
··· 1114 1114 return 0; 1115 1115 } 1116 1116 1117 - static int s3c24xx_i2c_remove(struct platform_device *pdev) 1117 + static void s3c24xx_i2c_remove(struct platform_device *pdev) 1118 1118 { 1119 1119 struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev); 1120 1120 ··· 1123 1123 pm_runtime_disable(&pdev->dev); 1124 1124 1125 1125 i2c_del_adapter(&i2c->adap); 1126 - 1127 - return 0; 1128 1126 } 1129 1127 1130 1128 #ifdef CONFIG_PM_SLEEP ··· 1170 1172 1171 1173 static struct platform_driver s3c24xx_i2c_driver = { 1172 1174 .probe = s3c24xx_i2c_probe, 1173 - .remove = s3c24xx_i2c_remove, 1175 + .remove_new = s3c24xx_i2c_remove, 1174 1176 .id_table = s3c24xx_driver_ids, 1175 1177 .driver = { 1176 1178 .name = "s3c-i2c",
+2 -4
drivers/i2c/busses/i2c-scmi.c
··· 404 404 return ret; 405 405 } 406 406 407 - static int smbus_cmi_remove(struct platform_device *device) 407 + static void smbus_cmi_remove(struct platform_device *device) 408 408 { 409 409 struct acpi_smbus_cmi *smbus_cmi = platform_get_drvdata(device); 410 410 411 411 i2c_del_adapter(&smbus_cmi->adapter); 412 412 kfree(smbus_cmi); 413 - 414 - return 0; 415 413 } 416 414 417 415 static struct platform_driver smbus_cmi_driver = { 418 416 .probe = smbus_cmi_probe, 419 - .remove = smbus_cmi_remove, 417 + .remove_new = smbus_cmi_remove, 420 418 .driver = { 421 419 .name = "smbus_cmi", 422 420 .acpi_match_table = acpi_smbus_cmi_ids,
+3 -6
drivers/i2c/busses/i2c-sh7760.c
··· 443 443 goto out0; 444 444 } 445 445 446 - id = kzalloc(sizeof(struct cami2c), GFP_KERNEL); 446 + id = kzalloc(sizeof(*id), GFP_KERNEL); 447 447 if (!id) { 448 - dev_err(&pdev->dev, "no mem for private data\n"); 449 448 ret = -ENOMEM; 450 449 goto out0; 451 450 } ··· 535 536 return ret; 536 537 } 537 538 538 - static int sh7760_i2c_remove(struct platform_device *pdev) 539 + static void sh7760_i2c_remove(struct platform_device *pdev) 539 540 { 540 541 struct cami2c *id = platform_get_drvdata(pdev); 541 542 ··· 545 546 release_resource(id->ioarea); 546 547 kfree(id->ioarea); 547 548 kfree(id); 548 - 549 - return 0; 550 549 } 551 550 552 551 static struct platform_driver sh7760_i2c_drv = { ··· 552 555 .name = SH7760_I2C_DEVNAME, 553 556 }, 554 557 .probe = sh7760_i2c_probe, 555 - .remove = sh7760_i2c_remove, 558 + .remove_new = sh7760_i2c_remove, 556 559 }; 557 560 558 561 module_platform_driver(sh7760_i2c_drv);
+2 -3
drivers/i2c/busses/i2c-sh_mobile.c
··· 956 956 return 0; 957 957 } 958 958 959 - static int sh_mobile_i2c_remove(struct platform_device *dev) 959 + static void sh_mobile_i2c_remove(struct platform_device *dev) 960 960 { 961 961 struct sh_mobile_i2c_data *pd = platform_get_drvdata(dev); 962 962 963 963 i2c_del_adapter(&pd->adap); 964 964 sh_mobile_i2c_release_dma(pd); 965 965 pm_runtime_disable(&dev->dev); 966 - return 0; 967 966 } 968 967 969 968 #ifdef CONFIG_PM_SLEEP ··· 999 1000 .pm = DEV_PM_OPS, 1000 1001 }, 1001 1002 .probe = sh_mobile_i2c_probe, 1002 - .remove = sh_mobile_i2c_remove, 1003 + .remove_new = sh_mobile_i2c_remove, 1003 1004 }; 1004 1005 1005 1006 static int __init sh_mobile_i2c_adap_init(void)
+2 -4
drivers/i2c/busses/i2c-simtec.c
··· 126 126 return ret; 127 127 } 128 128 129 - static int simtec_i2c_remove(struct platform_device *dev) 129 + static void simtec_i2c_remove(struct platform_device *dev) 130 130 { 131 131 struct simtec_i2c_data *pd = platform_get_drvdata(dev); 132 132 ··· 135 135 iounmap(pd->reg); 136 136 release_mem_region(pd->ioarea->start, resource_size(pd->ioarea)); 137 137 kfree(pd); 138 - 139 - return 0; 140 138 } 141 139 142 140 /* device driver */ ··· 144 146 .name = "simtec-i2c", 145 147 }, 146 148 .probe = simtec_i2c_probe, 147 - .remove = simtec_i2c_remove, 149 + .remove_new = simtec_i2c_remove, 148 150 }; 149 151 150 152 module_platform_driver(simtec_i2c_driver);
+2 -4
drivers/i2c/busses/i2c-st.c
··· 876 876 return 0; 877 877 } 878 878 879 - static int st_i2c_remove(struct platform_device *pdev) 879 + static void st_i2c_remove(struct platform_device *pdev) 880 880 { 881 881 struct st_i2c_dev *i2c_dev = platform_get_drvdata(pdev); 882 882 883 883 i2c_del_adapter(&i2c_dev->adap); 884 - 885 - return 0; 886 884 } 887 885 888 886 static const struct of_device_id st_i2c_match[] = { ··· 897 899 .pm = pm_sleep_ptr(&st_i2c_pm), 898 900 }, 899 901 .probe = st_i2c_probe, 900 - .remove = st_i2c_remove, 902 + .remove_new = st_i2c_remove, 901 903 }; 902 904 903 905 module_platform_driver(st_i2c_driver);
+2 -4
drivers/i2c/busses/i2c-stm32f4.c
··· 861 861 return ret; 862 862 } 863 863 864 - static int stm32f4_i2c_remove(struct platform_device *pdev) 864 + static void stm32f4_i2c_remove(struct platform_device *pdev) 865 865 { 866 866 struct stm32f4_i2c_dev *i2c_dev = platform_get_drvdata(pdev); 867 867 868 868 i2c_del_adapter(&i2c_dev->adap); 869 869 870 870 clk_unprepare(i2c_dev->clk); 871 - 872 - return 0; 873 871 } 874 872 875 873 static const struct of_device_id stm32f4_i2c_match[] = { ··· 882 884 .of_match_table = stm32f4_i2c_match, 883 885 }, 884 886 .probe = stm32f4_i2c_probe, 885 - .remove = stm32f4_i2c_remove, 887 + .remove_new = stm32f4_i2c_remove, 886 888 }; 887 889 888 890 module_platform_driver(stm32f4_i2c_driver);
+2 -4
drivers/i2c/busses/i2c-stm32f7.c
··· 2309 2309 return ret; 2310 2310 } 2311 2311 2312 - static int stm32f7_i2c_remove(struct platform_device *pdev) 2312 + static void stm32f7_i2c_remove(struct platform_device *pdev) 2313 2313 { 2314 2314 struct stm32f7_i2c_dev *i2c_dev = platform_get_drvdata(pdev); 2315 2315 ··· 2341 2341 stm32f7_i2c_write_fm_plus_bits(i2c_dev, false); 2342 2342 2343 2343 clk_disable_unprepare(i2c_dev->clk); 2344 - 2345 - return 0; 2346 2344 } 2347 2345 2348 2346 static int __maybe_unused stm32f7_i2c_runtime_suspend(struct device *dev) ··· 2484 2486 .pm = &stm32f7_i2c_pm_ops, 2485 2487 }, 2486 2488 .probe = stm32f7_i2c_probe, 2487 - .remove = stm32f7_i2c_remove, 2489 + .remove_new = stm32f7_i2c_remove, 2488 2490 }; 2489 2491 2490 2492 module_platform_driver(stm32f7_i2c_driver);
+5 -18
drivers/i2c/busses/i2c-sun6i-p2wi.c
··· 239 239 if (irq < 0) 240 240 return irq; 241 241 242 - p2wi->clk = devm_clk_get(dev, NULL); 242 + p2wi->clk = devm_clk_get_enabled(dev, NULL); 243 243 if (IS_ERR(p2wi->clk)) { 244 244 ret = PTR_ERR(p2wi->clk); 245 - dev_err(dev, "failed to retrieve clk: %d\n", ret); 246 - return ret; 247 - } 248 - 249 - ret = clk_prepare_enable(p2wi->clk); 250 - if (ret) { 251 245 dev_err(dev, "failed to enable clk: %d\n", ret); 252 246 return ret; 253 247 } ··· 250 256 251 257 p2wi->rstc = devm_reset_control_get_exclusive(dev, NULL); 252 258 if (IS_ERR(p2wi->rstc)) { 253 - ret = PTR_ERR(p2wi->rstc); 254 259 dev_err(dev, "failed to retrieve reset controller: %d\n", ret); 255 - goto err_clk_disable; 260 + return PTR_ERR(p2wi->rstc); 256 261 } 257 262 258 263 ret = reset_control_deassert(p2wi->rstc); 259 264 if (ret) { 260 265 dev_err(dev, "failed to deassert reset line: %d\n", ret); 261 - goto err_clk_disable; 266 + return ret; 262 267 } 263 268 264 269 init_completion(&p2wi->complete); ··· 300 307 err_reset_assert: 301 308 reset_control_assert(p2wi->rstc); 302 309 303 - err_clk_disable: 304 - clk_disable_unprepare(p2wi->clk); 305 - 306 310 return ret; 307 311 } 308 312 309 - static int p2wi_remove(struct platform_device *dev) 313 + static void p2wi_remove(struct platform_device *dev) 310 314 { 311 315 struct p2wi *p2wi = platform_get_drvdata(dev); 312 316 313 317 reset_control_assert(p2wi->rstc); 314 - clk_disable_unprepare(p2wi->clk); 315 318 i2c_del_adapter(&p2wi->adapter); 316 - 317 - return 0; 318 319 } 319 320 320 321 static struct platform_driver p2wi_driver = { 321 322 .probe = p2wi_probe, 322 - .remove = p2wi_remove, 323 + .remove_new = p2wi_remove, 323 324 .driver = { 324 325 .name = "i2c-sunxi-p2wi", 325 326 .of_match_table = p2wi_of_match_table,
+2 -4
drivers/i2c/busses/i2c-synquacer.c
··· 618 618 return 0; 619 619 } 620 620 621 - static int synquacer_i2c_remove(struct platform_device *pdev) 621 + static void synquacer_i2c_remove(struct platform_device *pdev) 622 622 { 623 623 struct synquacer_i2c *i2c = platform_get_drvdata(pdev); 624 624 625 625 i2c_del_adapter(&i2c->adapter); 626 626 if (!IS_ERR(i2c->pclk)) 627 627 clk_disable_unprepare(i2c->pclk); 628 - 629 - return 0; 630 628 }; 631 629 632 630 static const struct of_device_id synquacer_i2c_dt_ids[] __maybe_unused = { ··· 643 645 644 646 static struct platform_driver synquacer_i2c_driver = { 645 647 .probe = synquacer_i2c_probe, 646 - .remove = synquacer_i2c_remove, 648 + .remove_new = synquacer_i2c_remove, 647 649 .driver = { 648 650 .name = "synquacer_i2c", 649 651 .of_match_table = of_match_ptr(synquacer_i2c_dt_ids),
+2 -4
drivers/i2c/busses/i2c-tegra-bpmp.c
··· 316 316 return i2c_add_adapter(&i2c->adapter); 317 317 } 318 318 319 - static int tegra_bpmp_i2c_remove(struct platform_device *pdev) 319 + static void tegra_bpmp_i2c_remove(struct platform_device *pdev) 320 320 { 321 321 struct tegra_bpmp_i2c *i2c = platform_get_drvdata(pdev); 322 322 323 323 i2c_del_adapter(&i2c->adapter); 324 - 325 - return 0; 326 324 } 327 325 328 326 static const struct of_device_id tegra_bpmp_i2c_of_match[] = { ··· 335 337 .of_match_table = tegra_bpmp_i2c_of_match, 336 338 }, 337 339 .probe = tegra_bpmp_i2c_probe, 338 - .remove = tegra_bpmp_i2c_remove, 340 + .remove_new = tegra_bpmp_i2c_remove, 339 341 }; 340 342 module_platform_driver(tegra_bpmp_i2c_driver); 341 343
+46 -68
drivers/i2c/busses/i2c-tegra.c
··· 249 249 * @msg_read: indicates that the transfer is a read access 250 250 * @timings: i2c timings information like bus frequency 251 251 * @multimaster_mode: indicates that I2C controller is in multi-master mode 252 - * @tx_dma_chan: DMA transmit channel 253 - * @rx_dma_chan: DMA receive channel 252 + * @dma_chan: DMA channel 254 253 * @dma_phys: handle to DMA resources 255 254 * @dma_buf: pointer to allocated DMA buffer 256 255 * @dma_buf_size: DMA buffer size ··· 282 283 u8 *msg_buf; 283 284 284 285 struct completion dma_complete; 285 - struct dma_chan *tx_dma_chan; 286 - struct dma_chan *rx_dma_chan; 286 + struct dma_chan *dma_chan; 287 287 unsigned int dma_buf_size; 288 288 struct device *dma_dev; 289 289 dma_addr_t dma_phys; ··· 295 297 bool is_dvc; 296 298 bool is_vi; 297 299 }; 300 + 301 + #define IS_DVC(dev) (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && (dev)->is_dvc) 302 + #define IS_VI(dev) (IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC) && (dev)->is_vi) 298 303 299 304 static void dvc_writel(struct tegra_i2c_dev *i2c_dev, u32 val, 300 305 unsigned int reg) ··· 316 315 */ 317 316 static u32 tegra_i2c_reg_addr(struct tegra_i2c_dev *i2c_dev, unsigned int reg) 318 317 { 319 - if (i2c_dev->is_dvc) 318 + if (IS_DVC(i2c_dev)) 320 319 reg += (reg >= I2C_TX_FIFO) ? 0x10 : 0x40; 321 - else if (i2c_dev->is_vi) 320 + else if (IS_VI(i2c_dev)) 322 321 reg = 0xc00 + (reg << 2); 323 322 324 323 return reg; ··· 331 330 /* read back register to make sure that register writes completed */ 332 331 if (reg != I2C_TX_FIFO) 333 332 readl_relaxed(i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, reg)); 334 - else if (i2c_dev->is_vi) 333 + else if (IS_VI(i2c_dev)) 335 334 readl_relaxed(i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, I2C_INT_STATUS)); 336 335 } 337 336 ··· 394 393 { 395 394 struct dma_async_tx_descriptor *dma_desc; 396 395 enum dma_transfer_direction dir; 397 - struct dma_chan *chan; 398 396 399 397 dev_dbg(i2c_dev->dev, "starting DMA for length: %zu\n", len); 400 398 401 399 reinit_completion(&i2c_dev->dma_complete); 402 400 403 401 dir = i2c_dev->msg_read ? DMA_DEV_TO_MEM : DMA_MEM_TO_DEV; 404 - chan = i2c_dev->msg_read ? i2c_dev->rx_dma_chan : i2c_dev->tx_dma_chan; 405 402 406 - dma_desc = dmaengine_prep_slave_single(chan, i2c_dev->dma_phys, 403 + dma_desc = dmaengine_prep_slave_single(i2c_dev->dma_chan, i2c_dev->dma_phys, 407 404 len, dir, DMA_PREP_INTERRUPT | 408 405 DMA_CTRL_ACK); 409 406 if (!dma_desc) { ··· 414 415 dma_desc->callback_param = i2c_dev; 415 416 416 417 dmaengine_submit(dma_desc); 417 - dma_async_issue_pending(chan); 418 + dma_async_issue_pending(i2c_dev->dma_chan); 418 419 419 420 return 0; 420 421 } ··· 427 428 i2c_dev->dma_buf = NULL; 428 429 } 429 430 430 - if (i2c_dev->tx_dma_chan) { 431 - dma_release_channel(i2c_dev->tx_dma_chan); 432 - i2c_dev->tx_dma_chan = NULL; 433 - } 434 - 435 - if (i2c_dev->rx_dma_chan) { 436 - dma_release_channel(i2c_dev->rx_dma_chan); 437 - i2c_dev->rx_dma_chan = NULL; 431 + if (i2c_dev->dma_chan) { 432 + dma_release_channel(i2c_dev->dma_chan); 433 + i2c_dev->dma_chan = NULL; 438 434 } 439 435 } 440 436 441 437 static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev) 442 438 { 443 - struct dma_chan *chan; 444 439 dma_addr_t dma_phys; 445 440 u32 *dma_buf; 446 441 int err; 447 442 448 - if (i2c_dev->is_vi) 443 + if (IS_VI(i2c_dev)) 449 444 return 0; 450 445 451 446 if (!i2c_dev->hw->has_apb_dma) { ··· 452 459 return 0; 453 460 } 454 461 455 - chan = dma_request_chan(i2c_dev->dev, "rx"); 456 - if (IS_ERR(chan)) { 457 - err = PTR_ERR(chan); 462 + /* 463 + * The same channel will be used for both RX and TX. 464 + * Keeping the name as "tx" for backward compatibility 465 + * with existing devicetrees. 466 + */ 467 + i2c_dev->dma_chan = dma_request_chan(i2c_dev->dev, "tx"); 468 + if (IS_ERR(i2c_dev->dma_chan)) { 469 + err = PTR_ERR(i2c_dev->dma_chan); 458 470 goto err_out; 459 471 } 460 472 461 - i2c_dev->rx_dma_chan = chan; 462 - 463 - chan = dma_request_chan(i2c_dev->dev, "tx"); 464 - if (IS_ERR(chan)) { 465 - err = PTR_ERR(chan); 466 - goto err_out; 467 - } 468 - 469 - i2c_dev->tx_dma_chan = chan; 470 - 471 - WARN_ON(i2c_dev->tx_dma_chan->device != i2c_dev->rx_dma_chan->device); 472 - i2c_dev->dma_dev = chan->device->dev; 473 - 473 + i2c_dev->dma_dev = i2c_dev->dma_chan->device->dev; 474 474 i2c_dev->dma_buf_size = i2c_dev->hw->quirks->max_write_len + 475 475 I2C_PACKET_HEADER_SIZE; 476 476 ··· 625 639 626 640 WARN_ON_ONCE(err); 627 641 628 - if (i2c_dev->is_dvc) 642 + if (IS_DVC(i2c_dev)) 629 643 tegra_dvc_init(i2c_dev); 630 644 631 645 val = I2C_CNFG_NEW_MASTER_FSM | I2C_CNFG_PACKET_MODE_EN | ··· 637 651 i2c_writel(i2c_dev, val, I2C_CNFG); 638 652 i2c_writel(i2c_dev, 0, I2C_INT_MASK); 639 653 640 - if (i2c_dev->is_vi) 654 + if (IS_VI(i2c_dev)) 641 655 tegra_i2c_vi_init(i2c_dev); 642 656 643 657 switch (t->bus_freq_hz) { ··· 689 703 return err; 690 704 } 691 705 692 - if (!i2c_dev->is_dvc && !i2c_dev->is_vi) { 706 + if (!IS_DVC(i2c_dev) && !IS_VI(i2c_dev)) { 693 707 u32 sl_cfg = i2c_readl(i2c_dev, I2C_SL_CNFG); 694 708 695 709 sl_cfg |= I2C_SL_CNFG_NACK | I2C_SL_CNFG_NEWSL; ··· 832 846 i2c_dev->msg_buf_remaining = buf_remaining; 833 847 i2c_dev->msg_buf = buf + words_to_transfer * BYTES_PER_FIFO_WORD; 834 848 835 - if (i2c_dev->is_vi) 849 + if (IS_VI(i2c_dev)) 836 850 i2c_writesl_vi(i2c_dev, buf, I2C_TX_FIFO, words_to_transfer); 837 851 else 838 852 i2c_writesl(i2c_dev, buf, I2C_TX_FIFO, words_to_transfer); ··· 919 933 } 920 934 921 935 i2c_writel(i2c_dev, status, I2C_INT_STATUS); 922 - if (i2c_dev->is_dvc) 936 + if (IS_DVC(i2c_dev)) 923 937 dvc_writel(i2c_dev, DVC_STATUS_I2C_DONE_INTR, DVC_STATUS); 924 938 925 939 /* ··· 958 972 959 973 i2c_writel(i2c_dev, status, I2C_INT_STATUS); 960 974 961 - if (i2c_dev->is_dvc) 975 + if (IS_DVC(i2c_dev)) 962 976 dvc_writel(i2c_dev, DVC_STATUS_I2C_DONE_INTR, DVC_STATUS); 963 977 964 978 if (i2c_dev->dma_mode) { 965 - if (i2c_dev->msg_read) 966 - dmaengine_terminate_async(i2c_dev->rx_dma_chan); 967 - else 968 - dmaengine_terminate_async(i2c_dev->tx_dma_chan); 969 - 979 + dmaengine_terminate_async(i2c_dev->dma_chan); 970 980 complete(&i2c_dev->dma_complete); 971 981 } 972 982 ··· 976 994 { 977 995 struct dma_slave_config slv_config = {0}; 978 996 u32 val, reg, dma_burst, reg_offset; 979 - struct dma_chan *chan; 980 997 int err; 981 998 982 999 if (i2c_dev->hw->has_mst_fifo) ··· 992 1011 dma_burst = 8; 993 1012 994 1013 if (i2c_dev->msg_read) { 995 - chan = i2c_dev->rx_dma_chan; 996 1014 reg_offset = tegra_i2c_reg_addr(i2c_dev, I2C_RX_FIFO); 997 1015 998 1016 slv_config.src_addr = i2c_dev->base_phys + reg_offset; ··· 1003 1023 else 1004 1024 val = I2C_FIFO_CONTROL_RX_TRIG(dma_burst); 1005 1025 } else { 1006 - chan = i2c_dev->tx_dma_chan; 1007 1026 reg_offset = tegra_i2c_reg_addr(i2c_dev, I2C_TX_FIFO); 1008 1027 1009 1028 slv_config.dst_addr = i2c_dev->base_phys + reg_offset; ··· 1016 1037 } 1017 1038 1018 1039 slv_config.device_fc = true; 1019 - err = dmaengine_slave_config(chan, &slv_config); 1040 + err = dmaengine_slave_config(i2c_dev->dma_chan, &slv_config); 1020 1041 if (err) { 1021 1042 dev_err(i2c_dev->dev, "DMA config failed: %d\n", err); 1022 1043 dev_err(i2c_dev->dev, "falling back to PIO\n"); ··· 1326 1347 * performs synchronization after the transfer's termination 1327 1348 * and we want to get a completion if transfer succeeded. 1328 1349 */ 1329 - dmaengine_synchronize(i2c_dev->msg_read ? 1330 - i2c_dev->rx_dma_chan : 1331 - i2c_dev->tx_dma_chan); 1332 - 1333 - dmaengine_terminate_sync(i2c_dev->msg_read ? 1334 - i2c_dev->rx_dma_chan : 1335 - i2c_dev->tx_dma_chan); 1350 + dmaengine_synchronize(i2c_dev->dma_chan); 1351 + dmaengine_terminate_sync(i2c_dev->dma_chan); 1336 1352 1337 1353 if (!time_left && !completion_done(&i2c_dev->dma_complete)) { 1338 1354 dev_err(i2c_dev->dev, "DMA transfer timed out\n"); ··· 1628 1654 static const struct of_device_id tegra_i2c_of_match[] = { 1629 1655 { .compatible = "nvidia,tegra194-i2c", .data = &tegra194_i2c_hw, }, 1630 1656 { .compatible = "nvidia,tegra186-i2c", .data = &tegra186_i2c_hw, }, 1657 + #if IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC) 1631 1658 { .compatible = "nvidia,tegra210-i2c-vi", .data = &tegra210_i2c_hw, }, 1659 + #endif 1632 1660 { .compatible = "nvidia,tegra210-i2c", .data = &tegra210_i2c_hw, }, 1633 1661 { .compatible = "nvidia,tegra124-i2c", .data = &tegra124_i2c_hw, }, 1634 1662 { .compatible = "nvidia,tegra114-i2c", .data = &tegra114_i2c_hw, }, 1635 1663 { .compatible = "nvidia,tegra30-i2c", .data = &tegra30_i2c_hw, }, 1636 1664 { .compatible = "nvidia,tegra20-i2c", .data = &tegra20_i2c_hw, }, 1665 + #if IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) 1637 1666 { .compatible = "nvidia,tegra20-i2c-dvc", .data = &tegra20_i2c_hw, }, 1667 + #endif 1638 1668 {}, 1639 1669 }; 1640 1670 MODULE_DEVICE_TABLE(of, tegra_i2c_of_match); ··· 1653 1675 multi_mode = device_property_read_bool(i2c_dev->dev, "multi-master"); 1654 1676 i2c_dev->multimaster_mode = multi_mode; 1655 1677 1656 - if (of_device_is_compatible(np, "nvidia,tegra20-i2c-dvc")) 1678 + if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && 1679 + of_device_is_compatible(np, "nvidia,tegra20-i2c-dvc")) 1657 1680 i2c_dev->is_dvc = true; 1658 1681 1659 - if (of_device_is_compatible(np, "nvidia,tegra210-i2c-vi")) 1682 + if (IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC) && 1683 + of_device_is_compatible(np, "nvidia,tegra210-i2c-vi")) 1660 1684 i2c_dev->is_vi = true; 1661 1685 } 1662 1686 ··· 1687 1707 if (i2c_dev->hw == &tegra20_i2c_hw || i2c_dev->hw == &tegra30_i2c_hw) 1688 1708 i2c_dev->clocks[i2c_dev->nclocks++].id = "fast-clk"; 1689 1709 1690 - if (i2c_dev->is_vi) 1710 + if (IS_VI(i2c_dev)) 1691 1711 i2c_dev->clocks[i2c_dev->nclocks++].id = "slow"; 1692 1712 1693 1713 err = devm_clk_bulk_get(i2c_dev->dev, i2c_dev->nclocks, ··· 1805 1825 * VI I2C device shouldn't be marked as IRQ-safe because VI I2C won't 1806 1826 * be used for atomic transfers. 1807 1827 */ 1808 - if (!i2c_dev->is_vi) 1828 + if (!IS_VI(i2c_dev)) 1809 1829 pm_runtime_irq_safe(i2c_dev->dev); 1810 1830 1811 1831 pm_runtime_enable(i2c_dev->dev); ··· 1848 1868 return err; 1849 1869 } 1850 1870 1851 - static int tegra_i2c_remove(struct platform_device *pdev) 1871 + static void tegra_i2c_remove(struct platform_device *pdev) 1852 1872 { 1853 1873 struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev); 1854 1874 ··· 1857 1877 1858 1878 tegra_i2c_release_dma(i2c_dev); 1859 1879 tegra_i2c_release_clocks(i2c_dev); 1860 - 1861 - return 0; 1862 1880 } 1863 1881 1864 1882 static int __maybe_unused tegra_i2c_runtime_resume(struct device *dev) ··· 1877 1899 * power ON/OFF during runtime PM resume/suspend, meaning that 1878 1900 * controller needs to be re-initialized after power ON. 1879 1901 */ 1880 - if (i2c_dev->is_vi) { 1902 + if (IS_VI(i2c_dev)) { 1881 1903 err = tegra_i2c_init(i2c_dev); 1882 1904 if (err) 1883 1905 goto disable_clocks; ··· 1965 1987 1966 1988 static struct platform_driver tegra_i2c_driver = { 1967 1989 .probe = tegra_i2c_probe, 1968 - .remove = tegra_i2c_remove, 1990 + .remove_new = tegra_i2c_remove, 1969 1991 .driver = { 1970 1992 .name = "tegra-i2c", 1971 1993 .of_match_table = tegra_i2c_of_match,
+1 -3
drivers/i2c/busses/i2c-tiny-usb.c
··· 226 226 227 227 /* allocate memory for our device state and initialize it */ 228 228 dev = kzalloc(sizeof(*dev), GFP_KERNEL); 229 - if (dev == NULL) { 230 - dev_err(&interface->dev, "Out of memory\n"); 229 + if (!dev) 231 230 goto error; 232 - } 233 231 234 232 dev->usb_dev = usb_get_dev(interface_to_usbdev(interface)); 235 233 dev->interface = interface;
+7 -20
drivers/i2c/busses/i2c-uniphier-f.c
··· 540 540 return -EINVAL; 541 541 } 542 542 543 - priv->clk = devm_clk_get(dev, NULL); 543 + priv->clk = devm_clk_get_enabled(dev, NULL); 544 544 if (IS_ERR(priv->clk)) { 545 - dev_err(dev, "failed to get clock\n"); 545 + dev_err(dev, "failed to enable clock\n"); 546 546 return PTR_ERR(priv->clk); 547 547 } 548 - 549 - ret = clk_prepare_enable(priv->clk); 550 - if (ret) 551 - return ret; 552 548 553 549 clk_rate = clk_get_rate(priv->clk); 554 550 if (!clk_rate) { 555 551 dev_err(dev, "input clock rate should not be zero\n"); 556 - ret = -EINVAL; 557 - goto disable_clk; 552 + return -EINVAL; 558 553 } 559 554 560 555 priv->clk_cycle = clk_rate / bus_speed; ··· 570 575 pdev->name, priv); 571 576 if (ret) { 572 577 dev_err(dev, "failed to request irq %d\n", irq); 573 - goto disable_clk; 578 + return ret; 574 579 } 575 580 576 - ret = i2c_add_adapter(&priv->adap); 577 - disable_clk: 578 - if (ret) 579 - clk_disable_unprepare(priv->clk); 580 - 581 - return ret; 581 + return i2c_add_adapter(&priv->adap); 582 582 } 583 583 584 - static int uniphier_fi2c_remove(struct platform_device *pdev) 584 + static void uniphier_fi2c_remove(struct platform_device *pdev) 585 585 { 586 586 struct uniphier_fi2c_priv *priv = platform_get_drvdata(pdev); 587 587 588 588 i2c_del_adapter(&priv->adap); 589 - clk_disable_unprepare(priv->clk); 590 - 591 - return 0; 592 589 } 593 590 594 591 static int __maybe_unused uniphier_fi2c_suspend(struct device *dev) ··· 618 631 619 632 static struct platform_driver uniphier_fi2c_drv = { 620 633 .probe = uniphier_fi2c_probe, 621 - .remove = uniphier_fi2c_remove, 634 + .remove_new = uniphier_fi2c_remove, 622 635 .driver = { 623 636 .name = "uniphier-fi2c", 624 637 .of_match_table = uniphier_fi2c_match,
+7 -20
drivers/i2c/busses/i2c-uniphier.c
··· 335 335 return -EINVAL; 336 336 } 337 337 338 - priv->clk = devm_clk_get(dev, NULL); 338 + priv->clk = devm_clk_get_enabled(dev, NULL); 339 339 if (IS_ERR(priv->clk)) { 340 - dev_err(dev, "failed to get clock\n"); 340 + dev_err(dev, "failed to enable clock\n"); 341 341 return PTR_ERR(priv->clk); 342 342 } 343 - 344 - ret = clk_prepare_enable(priv->clk); 345 - if (ret) 346 - return ret; 347 343 348 344 clk_rate = clk_get_rate(priv->clk); 349 345 if (!clk_rate) { 350 346 dev_err(dev, "input clock rate should not be zero\n"); 351 - ret = -EINVAL; 352 - goto disable_clk; 347 + return -EINVAL; 353 348 } 354 349 355 350 priv->clk_cycle = clk_rate / bus_speed; ··· 364 369 priv); 365 370 if (ret) { 366 371 dev_err(dev, "failed to request irq %d\n", irq); 367 - goto disable_clk; 372 + return ret; 368 373 } 369 374 370 - ret = i2c_add_adapter(&priv->adap); 371 - disable_clk: 372 - if (ret) 373 - clk_disable_unprepare(priv->clk); 374 - 375 - return ret; 375 + return i2c_add_adapter(&priv->adap); 376 376 } 377 377 378 - static int uniphier_i2c_remove(struct platform_device *pdev) 378 + static void uniphier_i2c_remove(struct platform_device *pdev) 379 379 { 380 380 struct uniphier_i2c_priv *priv = platform_get_drvdata(pdev); 381 381 382 382 i2c_del_adapter(&priv->adap); 383 - clk_disable_unprepare(priv->clk); 384 - 385 - return 0; 386 383 } 387 384 388 385 static int __maybe_unused uniphier_i2c_suspend(struct device *dev) ··· 412 425 413 426 static struct platform_driver uniphier_i2c_drv = { 414 427 .probe = uniphier_i2c_probe, 415 - .remove = uniphier_i2c_remove, 428 + .remove_new = uniphier_i2c_remove, 416 429 .driver = { 417 430 .name = "uniphier-i2c", 418 431 .of_match_table = uniphier_i2c_match,
+3 -6
drivers/i2c/busses/i2c-versatile.c
··· 64 64 static int i2c_versatile_probe(struct platform_device *dev) 65 65 { 66 66 struct i2c_versatile *i2c; 67 - struct resource *r; 68 67 int ret; 69 68 70 69 i2c = devm_kzalloc(&dev->dev, sizeof(struct i2c_versatile), GFP_KERNEL); 71 70 if (!i2c) 72 71 return -ENOMEM; 73 72 74 - r = platform_get_resource(dev, IORESOURCE_MEM, 0); 75 - i2c->base = devm_ioremap_resource(&dev->dev, r); 73 + i2c->base = devm_platform_get_and_ioremap_resource(dev, 0, NULL); 76 74 if (IS_ERR(i2c->base)) 77 75 return PTR_ERR(i2c->base); 78 76 ··· 94 96 return 0; 95 97 } 96 98 97 - static int i2c_versatile_remove(struct platform_device *dev) 99 + static void i2c_versatile_remove(struct platform_device *dev) 98 100 { 99 101 struct i2c_versatile *i2c = platform_get_drvdata(dev); 100 102 101 103 i2c_del_adapter(&i2c->adap); 102 - return 0; 103 104 } 104 105 105 106 static const struct of_device_id i2c_versatile_match[] = { ··· 109 112 110 113 static struct platform_driver i2c_versatile_driver = { 111 114 .probe = i2c_versatile_probe, 112 - .remove = i2c_versatile_remove, 115 + .remove_new = i2c_versatile_remove, 113 116 .driver = { 114 117 .name = "versatile-i2c", 115 118 .of_match_table = i2c_versatile_match,
+2 -4
drivers/i2c/busses/i2c-viperboard.c
··· 407 407 return 0; 408 408 } 409 409 410 - static int vprbrd_i2c_remove(struct platform_device *pdev) 410 + static void vprbrd_i2c_remove(struct platform_device *pdev) 411 411 { 412 412 struct vprbrd_i2c *vb_i2c = platform_get_drvdata(pdev); 413 413 414 414 i2c_del_adapter(&vb_i2c->i2c); 415 - 416 - return 0; 417 415 } 418 416 419 417 static struct platform_driver vprbrd_i2c_driver = { 420 418 .driver.name = "viperboard-i2c", 421 419 .driver.owner = THIS_MODULE, 422 420 .probe = vprbrd_i2c_probe, 423 - .remove = vprbrd_i2c_remove, 421 + .remove_new = vprbrd_i2c_remove, 424 422 }; 425 423 426 424 static int __init vprbrd_i2c_init(void)
+3 -7
drivers/i2c/busses/i2c-wmt.c
··· 372 372 struct device_node *np = pdev->dev.of_node; 373 373 struct wmt_i2c_dev *i2c_dev; 374 374 struct i2c_adapter *adap; 375 - struct resource *res; 376 375 int err; 377 376 u32 clk_rate; 378 377 ··· 379 380 if (!i2c_dev) 380 381 return -ENOMEM; 381 382 382 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 383 - i2c_dev->base = devm_ioremap_resource(&pdev->dev, res); 383 + i2c_dev->base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); 384 384 if (IS_ERR(i2c_dev->base)) 385 385 return PTR_ERR(i2c_dev->base); 386 386 ··· 434 436 return 0; 435 437 } 436 438 437 - static int wmt_i2c_remove(struct platform_device *pdev) 439 + static void wmt_i2c_remove(struct platform_device *pdev) 438 440 { 439 441 struct wmt_i2c_dev *i2c_dev = platform_get_drvdata(pdev); 440 442 ··· 442 444 writew(0, i2c_dev->base + REG_IMR); 443 445 clk_disable_unprepare(i2c_dev->clk); 444 446 i2c_del_adapter(&i2c_dev->adapter); 445 - 446 - return 0; 447 447 } 448 448 449 449 static const struct of_device_id wmt_i2c_dt_ids[] = { ··· 451 455 452 456 static struct platform_driver wmt_i2c_driver = { 453 457 .probe = wmt_i2c_probe, 454 - .remove = wmt_i2c_remove, 458 + .remove_new = wmt_i2c_remove, 455 459 .driver = { 456 460 .name = "wmt-i2c", 457 461 .of_match_table = wmt_i2c_dt_ids,
+2 -4
drivers/i2c/busses/i2c-xgene-slimpro.c
··· 560 560 return rc; 561 561 } 562 562 563 - static int xgene_slimpro_i2c_remove(struct platform_device *pdev) 563 + static void xgene_slimpro_i2c_remove(struct platform_device *pdev) 564 564 { 565 565 struct slimpro_i2c_dev *ctx = platform_get_drvdata(pdev); 566 566 ··· 570 570 mbox_free_channel(ctx->mbox_chan); 571 571 else 572 572 pcc_mbox_free_channel(ctx->pcc_chan); 573 - 574 - return 0; 575 573 } 576 574 577 575 static const struct of_device_id xgene_slimpro_i2c_dt_ids[] = { ··· 589 591 590 592 static struct platform_driver xgene_slimpro_i2c_driver = { 591 593 .probe = xgene_slimpro_i2c_probe, 592 - .remove = xgene_slimpro_i2c_remove, 594 + .remove_new = xgene_slimpro_i2c_remove, 593 595 .driver = { 594 596 .name = "xgene-slimpro-i2c", 595 597 .of_match_table = of_match_ptr(xgene_slimpro_i2c_dt_ids),
+9 -17
drivers/i2c/busses/i2c-xiic.c
··· 1256 1256 1257 1257 mutex_init(&i2c->lock); 1258 1258 1259 - i2c->clk = devm_clk_get(&pdev->dev, NULL); 1259 + i2c->clk = devm_clk_get_enabled(&pdev->dev, NULL); 1260 1260 if (IS_ERR(i2c->clk)) 1261 1261 return dev_err_probe(&pdev->dev, PTR_ERR(i2c->clk), 1262 - "input clock not found.\n"); 1262 + "failed to enable input clock.\n"); 1263 1263 1264 - ret = clk_prepare_enable(i2c->clk); 1265 - if (ret) { 1266 - dev_err(&pdev->dev, "Unable to enable clock.\n"); 1267 - return ret; 1268 - } 1269 1264 i2c->dev = &pdev->dev; 1270 1265 pm_runtime_set_autosuspend_delay(i2c->dev, XIIC_PM_TIMEOUT); 1271 1266 pm_runtime_use_autosuspend(i2c->dev); ··· 1281 1286 1282 1287 if (ret < 0) { 1283 1288 dev_err(&pdev->dev, "Cannot claim IRQ\n"); 1284 - goto err_clk_dis; 1289 + goto err_pm_disable; 1285 1290 } 1286 1291 1287 1292 i2c->singlemaster = ··· 1302 1307 ret = xiic_reinit(i2c); 1303 1308 if (ret < 0) { 1304 1309 dev_err(&pdev->dev, "Cannot xiic_reinit\n"); 1305 - goto err_clk_dis; 1310 + goto err_pm_disable; 1306 1311 } 1307 1312 1308 1313 /* add i2c adapter to i2c tree */ 1309 1314 ret = i2c_add_adapter(&i2c->adap); 1310 1315 if (ret) { 1311 1316 xiic_deinit(i2c); 1312 - goto err_clk_dis; 1317 + goto err_pm_disable; 1313 1318 } 1314 1319 1315 1320 if (pdata) { ··· 1323 1328 1324 1329 return 0; 1325 1330 1326 - err_clk_dis: 1331 + err_pm_disable: 1327 1332 pm_runtime_set_suspended(&pdev->dev); 1328 1333 pm_runtime_disable(&pdev->dev); 1329 - clk_disable_unprepare(i2c->clk); 1334 + 1330 1335 return ret; 1331 1336 } 1332 1337 1333 - static int xiic_i2c_remove(struct platform_device *pdev) 1338 + static void xiic_i2c_remove(struct platform_device *pdev) 1334 1339 { 1335 1340 struct xiic_i2c *i2c = platform_get_drvdata(pdev); 1336 1341 int ret; ··· 1347 1352 xiic_deinit(i2c); 1348 1353 1349 1354 pm_runtime_put_sync(i2c->dev); 1350 - clk_disable_unprepare(i2c->clk); 1351 1355 pm_runtime_disable(&pdev->dev); 1352 1356 pm_runtime_set_suspended(&pdev->dev); 1353 1357 pm_runtime_dont_use_autosuspend(&pdev->dev); 1354 - 1355 - return 0; 1356 1358 } 1357 1359 1358 1360 static int __maybe_unused xiic_i2c_runtime_suspend(struct device *dev) ··· 1382 1390 1383 1391 static struct platform_driver xiic_i2c_driver = { 1384 1392 .probe = xiic_i2c_probe, 1385 - .remove = xiic_i2c_remove, 1393 + .remove_new = xiic_i2c_remove, 1386 1394 .driver = { 1387 1395 .name = DRIVER_NAME, 1388 1396 .of_match_table = of_match_ptr(xiic_of_match),
+2 -4
drivers/i2c/busses/i2c-xlp9xx.c
··· 559 559 return 0; 560 560 } 561 561 562 - static int xlp9xx_i2c_remove(struct platform_device *pdev) 562 + static void xlp9xx_i2c_remove(struct platform_device *pdev) 563 563 { 564 564 struct xlp9xx_i2c_dev *priv; 565 565 ··· 568 568 synchronize_irq(priv->irq); 569 569 i2c_del_adapter(&priv->adapter); 570 570 xlp9xx_write_i2c_reg(priv, XLP9XX_I2C_CTRL, 0); 571 - 572 - return 0; 573 571 } 574 572 575 573 #ifdef CONFIG_ACPI ··· 581 583 582 584 static struct platform_driver xlp9xx_i2c_driver = { 583 585 .probe = xlp9xx_i2c_probe, 584 - .remove = xlp9xx_i2c_remove, 586 + .remove_new = xlp9xx_i2c_remove, 585 587 .driver = { 586 588 .name = "xlp9xx-i2c", 587 589 .acpi_match_table = ACPI_PTR(xlp9xx_i2c_acpi_ids),
+2 -4
drivers/i2c/busses/scx200_acb.c
··· 523 523 kfree(iface); 524 524 } 525 525 526 - static int scx200_remove(struct platform_device *pdev) 526 + static void scx200_remove(struct platform_device *pdev) 527 527 { 528 528 struct scx200_acb_iface *iface; 529 529 530 530 iface = platform_get_drvdata(pdev); 531 531 scx200_cleanup_iface(iface); 532 - 533 - return 0; 534 532 } 535 533 536 534 static struct platform_driver scx200_pci_driver = { ··· 536 538 .name = "cs5535-smb", 537 539 }, 538 540 .probe = scx200_probe, 539 - .remove = scx200_remove, 541 + .remove_new = scx200_remove, 540 542 }; 541 543 542 544 static const struct pci_device_id scx200_isa[] = {
+19
drivers/i2c/i2c-core-base.c
··· 114 114 } 115 115 EXPORT_SYMBOL_GPL(i2c_match_id); 116 116 117 + const void *i2c_get_match_data(const struct i2c_client *client) 118 + { 119 + struct i2c_driver *driver = to_i2c_driver(client->dev.driver); 120 + const struct i2c_device_id *match; 121 + const void *data; 122 + 123 + data = device_get_match_data(&client->dev); 124 + if (!data) { 125 + match = i2c_match_id(driver->id_table, client); 126 + if (!match) 127 + return NULL; 128 + 129 + data = (const void *)match->driver_data; 130 + } 131 + 132 + return data; 133 + } 134 + EXPORT_SYMBOL(i2c_get_match_data); 135 + 117 136 static int i2c_device_match(struct device *dev, struct device_driver *drv) 118 137 { 119 138 struct i2c_client *client = i2c_verify_client(dev);
+2 -3
drivers/i2c/muxes/i2c-arb-gpio-challenge.c
··· 174 174 return ret; 175 175 } 176 176 177 - static int i2c_arbitrator_remove(struct platform_device *pdev) 177 + static void i2c_arbitrator_remove(struct platform_device *pdev) 178 178 { 179 179 struct i2c_mux_core *muxc = platform_get_drvdata(pdev); 180 180 181 181 i2c_mux_del_adapters(muxc); 182 182 i2c_put_adapter(muxc->parent); 183 - return 0; 184 183 } 185 184 186 185 static const struct of_device_id i2c_arbitrator_of_match[] = { ··· 190 191 191 192 static struct platform_driver i2c_arbitrator_driver = { 192 193 .probe = i2c_arbitrator_probe, 193 - .remove = i2c_arbitrator_remove, 194 + .remove_new = i2c_arbitrator_remove, 194 195 .driver = { 195 196 .name = "i2c-arb-gpio-challenge", 196 197 .of_match_table = i2c_arbitrator_of_match,
+2 -4
drivers/i2c/muxes/i2c-demux-pinctrl.c
··· 282 282 return err; 283 283 } 284 284 285 - static int i2c_demux_pinctrl_remove(struct platform_device *pdev) 285 + static void i2c_demux_pinctrl_remove(struct platform_device *pdev) 286 286 { 287 287 struct i2c_demux_pinctrl_priv *priv = platform_get_drvdata(pdev); 288 288 int i; ··· 296 296 of_node_put(priv->chan[i].parent_np); 297 297 of_changeset_destroy(&priv->chan[i].chgset); 298 298 } 299 - 300 - return 0; 301 299 } 302 300 303 301 static const struct of_device_id i2c_demux_pinctrl_of_match[] = { ··· 310 312 .of_match_table = i2c_demux_pinctrl_of_match, 311 313 }, 312 314 .probe = i2c_demux_pinctrl_probe, 313 - .remove = i2c_demux_pinctrl_remove, 315 + .remove_new = i2c_demux_pinctrl_remove, 314 316 }; 315 317 module_platform_driver(i2c_demux_pinctrl_driver); 316 318
+2 -4
drivers/i2c/muxes/i2c-mux-gpio.c
··· 225 225 return ret; 226 226 } 227 227 228 - static int i2c_mux_gpio_remove(struct platform_device *pdev) 228 + static void i2c_mux_gpio_remove(struct platform_device *pdev) 229 229 { 230 230 struct i2c_mux_core *muxc = platform_get_drvdata(pdev); 231 231 232 232 i2c_mux_del_adapters(muxc); 233 233 i2c_put_adapter(muxc->parent); 234 - 235 - return 0; 236 234 } 237 235 238 236 static const struct of_device_id i2c_mux_gpio_of_match[] = { ··· 241 243 242 244 static struct platform_driver i2c_mux_gpio_driver = { 243 245 .probe = i2c_mux_gpio_probe, 244 - .remove = i2c_mux_gpio_remove, 246 + .remove_new = i2c_mux_gpio_remove, 245 247 .driver = { 246 248 .name = "i2c-mux-gpio", 247 249 .of_match_table = i2c_mux_gpio_of_match,
+2 -4
drivers/i2c/muxes/i2c-mux-gpmux.c
··· 142 142 return ret; 143 143 } 144 144 145 - static int i2c_mux_remove(struct platform_device *pdev) 145 + static void i2c_mux_remove(struct platform_device *pdev) 146 146 { 147 147 struct i2c_mux_core *muxc = platform_get_drvdata(pdev); 148 148 149 149 i2c_mux_del_adapters(muxc); 150 150 i2c_put_adapter(muxc->parent); 151 - 152 - return 0; 153 151 } 154 152 155 153 static struct platform_driver i2c_mux_driver = { 156 154 .probe = i2c_mux_probe, 157 - .remove = i2c_mux_remove, 155 + .remove_new = i2c_mux_remove, 158 156 .driver = { 159 157 .name = "i2c-mux-gpmux", 160 158 .of_match_table = i2c_mux_of_match,
+2 -3
drivers/i2c/muxes/i2c-mux-mlxcpld.c
··· 170 170 return err; 171 171 } 172 172 173 - static int mlxcpld_mux_remove(struct platform_device *pdev) 173 + static void mlxcpld_mux_remove(struct platform_device *pdev) 174 174 { 175 175 struct i2c_mux_core *muxc = platform_get_drvdata(pdev); 176 176 177 177 i2c_mux_del_adapters(muxc); 178 - return 0; 179 178 } 180 179 181 180 static struct platform_driver mlxcpld_mux_driver = { ··· 182 183 .name = "i2c-mux-mlxcpld", 183 184 }, 184 185 .probe = mlxcpld_mux_probe, 185 - .remove = mlxcpld_mux_remove, 186 + .remove_new = mlxcpld_mux_remove, 186 187 }; 187 188 188 189 module_platform_driver(mlxcpld_mux_driver);
+2 -4
drivers/i2c/muxes/i2c-mux-pinctrl.c
··· 166 166 return ret; 167 167 } 168 168 169 - static int i2c_mux_pinctrl_remove(struct platform_device *pdev) 169 + static void i2c_mux_pinctrl_remove(struct platform_device *pdev) 170 170 { 171 171 struct i2c_mux_core *muxc = platform_get_drvdata(pdev); 172 172 173 173 i2c_mux_del_adapters(muxc); 174 174 i2c_put_adapter(muxc->parent); 175 - 176 - return 0; 177 175 } 178 176 179 177 static const struct of_device_id i2c_mux_pinctrl_of_match[] = { ··· 186 188 .of_match_table = i2c_mux_pinctrl_of_match, 187 189 }, 188 190 .probe = i2c_mux_pinctrl_probe, 189 - .remove = i2c_mux_pinctrl_remove, 191 + .remove_new = i2c_mux_pinctrl_remove, 190 192 }; 191 193 module_platform_driver(i2c_mux_pinctrl_driver); 192 194
+2 -4
drivers/i2c/muxes/i2c-mux-reg.c
··· 233 233 return ret; 234 234 } 235 235 236 - static int i2c_mux_reg_remove(struct platform_device *pdev) 236 + static void i2c_mux_reg_remove(struct platform_device *pdev) 237 237 { 238 238 struct i2c_mux_core *muxc = platform_get_drvdata(pdev); 239 239 240 240 i2c_mux_del_adapters(muxc); 241 241 i2c_put_adapter(muxc->parent); 242 - 243 - return 0; 244 242 } 245 243 246 244 static const struct of_device_id i2c_mux_reg_of_match[] = { ··· 249 251 250 252 static struct platform_driver i2c_mux_reg_driver = { 251 253 .probe = i2c_mux_reg_probe, 252 - .remove = i2c_mux_reg_remove, 254 + .remove_new = i2c_mux_reg_remove, 253 255 .driver = { 254 256 .name = "i2c-mux-reg", 255 257 .of_match_table = of_match_ptr(i2c_mux_reg_of_match),
+2 -1
drivers/misc/eeprom/at24.c
··· 761 761 pm_runtime_disable(dev); 762 762 if (!pm_runtime_status_suspended(dev)) 763 763 regulator_disable(at24->vcc_reg); 764 - return PTR_ERR(at24->nvmem); 764 + return dev_err_probe(dev, PTR_ERR(at24->nvmem), 765 + "failed to register nvmem\n"); 765 766 } 766 767 767 768 /*
+14
drivers/usb/typec/ucsi/psy.c
··· 27 27 POWER_SUPPLY_PROP_VOLTAGE_NOW, 28 28 POWER_SUPPLY_PROP_CURRENT_MAX, 29 29 POWER_SUPPLY_PROP_CURRENT_NOW, 30 + POWER_SUPPLY_PROP_SCOPE, 30 31 }; 32 + 33 + static int ucsi_psy_get_scope(struct ucsi_connector *con, 34 + union power_supply_propval *val) 35 + { 36 + u8 scope = POWER_SUPPLY_SCOPE_UNKNOWN; 37 + struct device *dev = con->ucsi->dev; 38 + 39 + device_property_read_u8(dev, "scope", &scope); 40 + val->intval = scope; 41 + return 0; 42 + } 31 43 32 44 static int ucsi_psy_get_online(struct ucsi_connector *con, 33 45 union power_supply_propval *val) ··· 206 194 return ucsi_psy_get_current_max(con, val); 207 195 case POWER_SUPPLY_PROP_CURRENT_NOW: 208 196 return ucsi_psy_get_current_now(con, val); 197 + case POWER_SUPPLY_PROP_SCOPE: 198 + return ucsi_psy_get_scope(con, val); 209 199 default: 210 200 return -EINVAL; 211 201 }
+2
include/linux/i2c.h
··· 367 367 const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id, 368 368 const struct i2c_client *client); 369 369 370 + const void *i2c_get_match_data(const struct i2c_client *client); 371 + 370 372 static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj) 371 373 { 372 374 struct device * const dev = kobj_to_dev(kobj);