| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * lm70.c |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 8 | 9 | * interface. The complete datasheet is available at National's website |
|---|
| 9 | 10 | * here: |
|---|
| 10 | 11 | * 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. |
|---|
| 25 | 12 | */ |
|---|
| 26 | 13 | |
|---|
| 27 | 14 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
|---|
| .. | .. |
|---|
| 35 | 22 | #include <linux/hwmon.h> |
|---|
| 36 | 23 | #include <linux/mutex.h> |
|---|
| 37 | 24 | #include <linux/mod_devicetable.h> |
|---|
| 25 | +#include <linux/of.h> |
|---|
| 26 | +#include <linux/property.h> |
|---|
| 38 | 27 | #include <linux/spi/spi.h> |
|---|
| 39 | 28 | #include <linux/slab.h> |
|---|
| 40 | | -#include <linux/of_device.h> |
|---|
| 41 | | - |
|---|
| 42 | 29 | |
|---|
| 43 | 30 | #define DRVNAME "lm70" |
|---|
| 44 | 31 | |
|---|
| .. | .. |
|---|
| 163 | 150 | |
|---|
| 164 | 151 | static int lm70_probe(struct spi_device *spi) |
|---|
| 165 | 152 | { |
|---|
| 166 | | - const struct of_device_id *match; |
|---|
| 167 | 153 | struct device *hwmon_dev; |
|---|
| 168 | 154 | struct lm70 *p_lm70; |
|---|
| 169 | 155 | int chip; |
|---|
| 170 | 156 | |
|---|
| 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); |
|---|
| 174 | 159 | else |
|---|
| 175 | 160 | chip = spi_get_device_id(spi)->driver_data; |
|---|
| 176 | 161 | |
|---|
| 162 | + |
|---|
| 177 | 163 | /* signaling is SPI_MODE_0 */ |
|---|
| 178 | 164 | if (spi->mode & (SPI_CPOL | SPI_CPHA)) |
|---|
| 179 | 165 | return -EINVAL; |
|---|