diff options
Diffstat (limited to 'drivers/w1/masters')
-rw-r--r-- | drivers/w1/masters/Kconfig | 2 | ||||
-rw-r--r-- | drivers/w1/masters/ds2482.c | 13 | ||||
-rw-r--r-- | drivers/w1/masters/ds2490.c | 13 | ||||
-rw-r--r-- | drivers/w1/masters/matrox_w1.c | 16 | ||||
-rw-r--r-- | drivers/w1/masters/omap_hdq.c | 14 | ||||
-rw-r--r-- | drivers/w1/masters/w1-gpio.c | 4 |
6 files changed, 25 insertions, 37 deletions
diff --git a/drivers/w1/masters/Kconfig b/drivers/w1/masters/Kconfig index 692cac3ff0ee..ad316573288a 100644 --- a/drivers/w1/masters/Kconfig +++ b/drivers/w1/masters/Kconfig @@ -53,7 +53,7 @@ config W1_MASTER_GPIO config HDQ_MASTER_OMAP tristate "OMAP HDQ driver" - depends on ARCH_OMAP + depends on ARCH_OMAP || COMPILE_TEST help Say Y here if you want support for the 1-wire or HDQ Interface on an OMAP processor. diff --git a/drivers/w1/masters/ds2482.c b/drivers/w1/masters/ds2482.c index 3d8b51316bef..c1de8a92e144 100644 --- a/drivers/w1/masters/ds2482.c +++ b/drivers/w1/masters/ds2482.c @@ -15,7 +15,6 @@ #include <linux/slab.h> #include <linux/i2c.h> #include <linux/delay.h> -#include <asm/delay.h> #include <linux/w1.h> @@ -36,7 +35,7 @@ MODULE_PARM_DESC(active_pullup, "Active pullup (apply to all buses): " \ /* extra configurations - e.g. 1WS */ static int extra_config; -module_param(extra_config, int, S_IRUGO | S_IWUSR); +module_param(extra_config, int, 0644); MODULE_PARM_DESC(extra_config, "Extra Configuration settings 1=APU,2=PPM,3=SPU,8=1WS"); /* @@ -78,10 +77,8 @@ MODULE_PARM_DESC(extra_config, "Extra Configuration settings 1=APU,2=PPM,3=SPU,8 * To set the channel, write the value at the index of the channel. * Read and compare against the corresponding value to verify the change. */ -static const u8 ds2482_chan_wr[8] = - { 0xF0, 0xE1, 0xD2, 0xC3, 0xB4, 0xA5, 0x96, 0x87 }; -static const u8 ds2482_chan_rd[8] = - { 0xB8, 0xB1, 0xAA, 0xA3, 0x9C, 0x95, 0x8E, 0x87 }; +static const u8 ds2482_chan_wr[8] = { 0xF0, 0xE1, 0xD2, 0xC3, 0xB4, 0xA5, 0x96, 0x87 }; +static const u8 ds2482_chan_rd[8] = { 0xB8, 0xB1, 0xAA, 0xA3, 0x9C, 0x95, 0x8E, 0x87 }; /* @@ -454,7 +451,8 @@ static int ds2482_probe(struct i2c_client *client) I2C_FUNC_SMBUS_BYTE)) return -ENODEV; - if (!(data = kzalloc(sizeof(struct ds2482_data), GFP_KERNEL))) { + data = kzalloc(sizeof(struct ds2482_data), GFP_KERNEL); + if (!data) { err = -ENOMEM; goto exit; } @@ -544,6 +542,7 @@ static void ds2482_remove(struct i2c_client *client) */ static const struct i2c_device_id ds2482_id[] = { { "ds2482", 0 }, + { "ds2484", 0 }, { } }; MODULE_DEVICE_TABLE(i2c, ds2482_id); diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c index 0eb560fc0153..5f5b97e24700 100644 --- a/drivers/w1/masters/ds2490.c +++ b/drivers/w1/masters/ds2490.c @@ -304,6 +304,7 @@ static void ds_reset_device(struct ds_device *dev) if (dev->spu_sleep) { /* lower 4 bits are 0, see ds_set_pullup */ u8 del = dev->spu_sleep>>4; + if (ds_send_control(dev, COMM_SET_DURATION | COMM_IM, del)) dev_err(&dev->udev->dev, "%s: Error setting duration\n", __func__); @@ -731,7 +732,8 @@ static void ds9490r_search(void *data, struct w1_master *master, break; if (st.data_in_buffer_status) { - /* Bulk in can receive partial ids, but when it does + /* + * Bulk in can receive partial ids, but when it does * they fail crc and will be discarded anyway. * That has only been seen when status in buffer * is 0 and bulk is read anyway, so don't read @@ -743,8 +745,10 @@ static void ds9490r_search(void *data, struct w1_master *master, break; for (i = 0; i < err/8; ++i) { found_ids[found++] = buf[i]; - /* can't know if there will be a discrepancy - * value after until the next id */ + /* + * can't know if there will be a discrepancy + * value after until the next id + */ if (found == search_limit) { master->search_id = buf[i]; break; @@ -760,7 +764,8 @@ static void ds9490r_search(void *data, struct w1_master *master, if (found <= search_limit) { master->search_id = 0; } else if (!test_bit(W1_WARN_MAX_COUNT, &master->flags)) { - /* Only max_slave_count will be scanned in a search, + /* + * Only max_slave_count will be scanned in a search, * but it will start where it left off next search * until all ids are identified and then it will start * over. A continued search will report the previous diff --git a/drivers/w1/masters/matrox_w1.c b/drivers/w1/masters/matrox_w1.c index ee716c715710..2852cd2dc67c 100644 --- a/drivers/w1/masters/matrox_w1.c +++ b/drivers/w1/masters/matrox_w1.c @@ -7,7 +7,7 @@ #include <asm/types.h> #include <linux/atomic.h> -#include <asm/io.h> +#include <linux/io.h> #include <linux/delay.h> #include <linux/kernel.h> @@ -39,8 +39,7 @@ #define MATROX_GET_DATA 0x2B #define MATROX_CURSOR_CTL 0x06 -struct matrox_device -{ +struct matrox_device { void __iomem *base_addr; void __iomem *port_index; void __iomem *port_data; @@ -64,7 +63,7 @@ struct matrox_device * * Port mapping. */ -static __inline__ u8 matrox_w1_read_reg(struct matrox_device *dev, u8 reg) +static inline u8 matrox_w1_read_reg(struct matrox_device *dev, u8 reg) { u8 ret; @@ -75,7 +74,7 @@ static __inline__ u8 matrox_w1_read_reg(struct matrox_device *dev, u8 reg) return ret; } -static __inline__ void matrox_w1_write_reg(struct matrox_device *dev, u8 reg, u8 val) +static inline void matrox_w1_write_reg(struct matrox_device *dev, u8 reg, u8 val) { writeb(reg, dev->port_index); writeb(val, dev->port_data); @@ -123,13 +122,8 @@ static int matrox_w1_probe(struct pci_dev *pdev, const struct pci_device_id *ent dev = kzalloc(sizeof(struct matrox_device) + sizeof(struct w1_bus_master), GFP_KERNEL); - if (!dev) { - dev_err(&pdev->dev, - "%s: Failed to create new matrox_device object.\n", - __func__); + if (!dev) return -ENOMEM; - } - dev->bus_master = (struct w1_bus_master *)(dev + 1); diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c index bf2ec59c1f9d..6a39b71eb718 100644 --- a/drivers/w1/masters/omap_hdq.c +++ b/drivers/w1/masters/omap_hdq.c @@ -1,12 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0-only /* - * drivers/w1/masters/omap_hdq.c - * * Copyright (C) 2007,2012 Texas Instruments, Inc. - * - * This file is licensed under the terms of the GNU General Public License - * version 2. This program is licensed "as is" without any warranty of any - * kind, whether express or implied. - * */ #include <linux/kernel.h> #include <linux/module.h> @@ -48,7 +42,7 @@ static DECLARE_WAIT_QUEUE_HEAD(hdq_wait_queue); static int w1_id; -module_param(w1_id, int, S_IRUSR); +module_param(w1_id, int, 0400); MODULE_PARM_DESC(w1_id, "1-wire id for the slave detection in HDQ mode"); struct hdq_data { @@ -579,10 +573,8 @@ static int omap_hdq_probe(struct platform_device *pdev) const char *mode; hdq_data = devm_kzalloc(dev, sizeof(*hdq_data), GFP_KERNEL); - if (!hdq_data) { - dev_dbg(&pdev->dev, "unable to allocate memory\n"); + if (!hdq_data) return -ENOMEM; - } hdq_data->dev = dev; platform_set_drvdata(pdev, hdq_data); diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c index 530c77b8d062..e45acb6d916e 100644 --- a/drivers/w1/masters/w1-gpio.c +++ b/drivers/w1/masters/w1-gpio.c @@ -101,10 +101,8 @@ static int w1_gpio_probe(struct platform_device *pdev) master = devm_kzalloc(dev, sizeof(struct w1_bus_master), GFP_KERNEL); - if (!master) { - dev_err(dev, "Out of memory\n"); + if (!master) return -ENOMEM; - } pdata->gpiod = devm_gpiod_get_index(dev, NULL, 0, gflags); if (IS_ERR(pdata->gpiod)) { |