hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/drivers/i2c/busses/i2c-pca-platform.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * i2c_pca_platform.c
34 *
....@@ -5,9 +6,6 @@
56 *
67 * Copyright (C) 2008 Pengutronix
78 *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License version 2 as
10
- * published by the Free Software Foundation.
119
1210 */
1311 #include <linux/kernel.h>
....@@ -142,7 +140,7 @@
142140 int ret = 0;
143141 int irq;
144142
145
- irq = platform_get_irq(pdev, 0);
143
+ irq = platform_get_irq_optional(pdev, 0);
146144 /* If irq is 0, we do polling. */
147145 if (irq < 0)
148146 irq = 0;
....@@ -151,8 +149,7 @@
151149 if (!i2c)
152150 return -ENOMEM;
153151
154
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
155
- i2c->reg_base = devm_ioremap_resource(&pdev->dev, res);
152
+ i2c->reg_base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
156153 if (IS_ERR(i2c->reg_base))
157154 return PTR_ERR(i2c->reg_base);
158155