hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/hwmon/lm70.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * lm70.c
34 *
....@@ -8,20 +9,6 @@
89 * interface. The complete datasheet is available at National's website
910 * here:
1011 * http://www.national.com/pf/LM/LM70.html
11
- *
12
- * This program is free software; you can redistribute it and/or modify
13
- * it under the terms of the GNU General Public License as published by
14
- * the Free Software Foundation; either version 2 of the License, or
15
- * (at your option) any later version.
16
- *
17
- * This program is distributed in the hope that it will be useful,
18
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
- * GNU General Public License for more details.
21
- *
22
- * You should have received a copy of the GNU General Public License
23
- * along with this program; if not, write to the Free Software
24
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2512 */
2613
2714 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
....@@ -35,10 +22,10 @@
3522 #include <linux/hwmon.h>
3623 #include <linux/mutex.h>
3724 #include <linux/mod_devicetable.h>
25
+#include <linux/of.h>
26
+#include <linux/property.h>
3827 #include <linux/spi/spi.h>
3928 #include <linux/slab.h>
40
-#include <linux/of_device.h>
41
-
4229
4330 #define DRVNAME "lm70"
4431
....@@ -163,17 +150,16 @@
163150
164151 static int lm70_probe(struct spi_device *spi)
165152 {
166
- const struct of_device_id *match;
167153 struct device *hwmon_dev;
168154 struct lm70 *p_lm70;
169155 int chip;
170156
171
- match = of_match_device(lm70_of_ids, &spi->dev);
172
- if (match)
173
- chip = (int)(uintptr_t)match->data;
157
+ if (dev_fwnode(&spi->dev))
158
+ chip = (int)(uintptr_t)device_get_match_data(&spi->dev);
174159 else
175160 chip = spi_get_device_id(spi)->driver_data;
176161
162
+
177163 /* signaling is SPI_MODE_0 */
178164 if (spi->mode & (SPI_CPOL | SPI_CPHA))
179165 return -EINVAL;