summaryrefslogtreecommitdiffstats
path: root/drivers/aiodev/lm75.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/aiodev/lm75.c')
-rw-r--r--drivers/aiodev/lm75.c33
1 files changed, 12 insertions, 21 deletions
diff --git a/drivers/aiodev/lm75.c b/drivers/aiodev/lm75.c
index af54227e40..13b7ac4710 100644
--- a/drivers/aiodev/lm75.c
+++ b/drivers/aiodev/lm75.c
@@ -1,21 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+// SPDX-FileCopyrightText: 1998, 1999 Frodo Looijaard <frodol@dds.nl>
+
/*
* lm75.c - Part of lm_sensors, Linux kernel modules for hardware
* monitoring
- * Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <common.h>
@@ -34,6 +22,7 @@
#define LM75_SHUTDOWN 0x01
enum lm75_type { /* keep sorted in alphabetical order */
+ unknown,
adt75,
ds1775,
ds75,
@@ -68,7 +57,7 @@ static const u8 LM75_REG_TEMP[3] = {
/* Each client has this additional data */
struct lm75_data {
struct i2c_client *client;
- struct device_d dev;
+ struct device dev;
u8 resolution; /* In bits, between 9 and 12 */
struct aiochannel aiochan;
struct aiodevice aiodev;
@@ -113,7 +102,7 @@ static int lm75_get_temp(struct aiochannel *chan, int *val)
return 0;
}
-static int lm75_probe(struct device_d *dev)
+static int lm75_probe(struct device *dev)
{
struct lm75_data *data;
int status;
@@ -121,9 +110,9 @@ static int lm75_probe(struct device_d *dev)
int new, ret;
enum lm75_type kind;
- ret = dev_get_drvdata(dev, (const void **)&kind);
- if (ret)
- return ret;
+ kind = (enum lm75_type)device_get_match_data(dev);
+ if (kind == unknown)
+ return -ENODEV;
data = xzalloc(sizeof(*data));
@@ -193,6 +182,8 @@ static int lm75_probe(struct device_d *dev)
clr_mask |= 1 << 5; /* not one-shot mode */
data->resolution = 12;
break;
+ default:
+ return -EINVAL;
}
/* configure as specified */
@@ -246,7 +237,7 @@ static const struct platform_device_id lm75_ids[] = {
{ /* LIST END */ }
};
-static struct driver_d lm75_driver = {
+static struct driver lm75_driver = {
.name = "lm75",
.probe = lm75_probe,
.id_table = lm75_ids,