From d25221525e0e2cfd70e4ec7216549c06609a8bd2 Mon Sep 17 00:00:00 2001 From: Alexander Stein Date: Sat, 25 Oct 2014 14:26:13 +0200 Subject: W1: ds2490: Increase timeout when waiting for status Adjust the bulk message timeout to the other ones (1000ms). Otherwise the following dmesg errors can be seen on a Raspberry Pi: [ 31.492386] Failed to read 1-wire data from 0x81: err=-110. [ 31.504168] 0x81: count=-110, status: [ 31.613404] Failed to read 1-wire data from 0x81: err=-110. [ 31.621915] 0x81: count=-110, status: [ 43.260968] Failed to read 1-wire data from 0x81: err=-110. [ 43.270998] 0x81: count=-110, status: [ 43.379959] Failed to read 1-wire data from 0x81: err=-110. [ 43.388854] 0x81: count=-110, status: Signed-off-by: Alexander Stein Acked-by: Evgeniy Polyakov Signed-off-by: Greg Kroah-Hartman --- drivers/w1/masters/ds2490.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/w1') diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c index 1de6df87bfa3..049a884a756f 100644 --- a/drivers/w1/masters/ds2490.c +++ b/drivers/w1/masters/ds2490.c @@ -253,7 +253,7 @@ static int ds_recv_status_nodump(struct ds_device *dev, struct ds_status *st, count = 0; err = usb_interrupt_msg(dev->udev, usb_rcvintpipe(dev->udev, - dev->ep[EP_STATUS]), buf, size, &count, 100); + dev->ep[EP_STATUS]), buf, size, &count, 1000); if (err < 0) { pr_err("Failed to read 1-wire data from 0x%x: err=%d.\n", dev->ep[EP_STATUS], err); -- cgit v1.2.3 From 4b97b27939dd9b9ddbd4058efc96d45bc7163601 Mon Sep 17 00:00:00 2001 From: David Fries Date: Mon, 10 Nov 2014 20:19:37 -0600 Subject: w1: avoid potential u16 overflow Reported-by: Dan Carpenter Acked-by: Evgeniy Polyakov Signed-off-by: David Fries Signed-off-by: Greg Kroah-Hartman --- drivers/w1/w1_netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/w1') diff --git a/drivers/w1/w1_netlink.c b/drivers/w1/w1_netlink.c index dd9656237274..881597a191b8 100644 --- a/drivers/w1/w1_netlink.c +++ b/drivers/w1/w1_netlink.c @@ -598,7 +598,7 @@ static void w1_cn_callback(struct cn_msg *cn, struct netlink_skb_parms *nsp) msg = (struct w1_netlink_msg *)(cn + 1); if (node_count) { int size; - u16 reply_size = sizeof(*cn) + cn->len + slave_len; + int reply_size = sizeof(*cn) + cn->len + slave_len; if (cn->flags & W1_CN_BUNDLE) { /* bundling duplicats some of the messages */ reply_size += 2 * cmd_count * (sizeof(struct cn_msg) + -- cgit v1.2.3 From 4b7e4f8289c1ca60accb6c1baf31984f69bc2771 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Wed, 19 Nov 2014 14:04:20 +1100 Subject: w1: support auto-load of w1_bq27000 module. 1/ change request_module call to zero-pad single digit family numbers. This appears to be the intention of the code, but not what it actually does. This means that the alias created for W1_FAMILY_SMEM_01 might actually be useful. 2/ Define a family name for the BQ27000 battery charge monitor. Unfortunately this is the same number as W1_FAMILY_SMEM_01 so if both a compiled on a system, one module might need to be blacklisted. 3/ Add a MODULE_ALIAS for the bq27000. Acked-by: Evgeniy Polyakov Signed-off-by: NeilBrown Signed-off-by: Greg Kroah-Hartman --- drivers/w1/slaves/w1_bq27000.c | 4 ++-- drivers/w1/w1.c | 2 +- drivers/w1/w1_family.h | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/w1') diff --git a/drivers/w1/slaves/w1_bq27000.c b/drivers/w1/slaves/w1_bq27000.c index afbefed5f2c9..caafb1722783 100644 --- a/drivers/w1/slaves/w1_bq27000.c +++ b/drivers/w1/slaves/w1_bq27000.c @@ -88,7 +88,7 @@ static struct w1_family_ops w1_bq27000_fops = { }; static struct w1_family w1_bq27000_family = { - .fid = 1, + .fid = W1_FAMILY_BQ27000, .fops = &w1_bq27000_fops, }; @@ -111,7 +111,7 @@ module_exit(w1_bq27000_exit); module_param(F_ID, int, S_IRUSR); MODULE_PARM_DESC(F_ID, "1-wire slave FID for BQ device"); - +MODULE_ALIAS("w1-family-" __stringify(W1_FAMILY_BQ27000)); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Texas Instruments Ltd"); MODULE_DESCRIPTION("HDQ/1-wire slave driver bq27000 battery monitor chip"); diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index 592f7edc671e..181f41cb960b 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c @@ -727,7 +727,7 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn) /* slave modules need to be loaded in a context with unlocked mutex */ mutex_unlock(&dev->mutex); - request_module("w1-family-0x%0x", rn->family); + request_module("w1-family-0x%02x", rn->family); mutex_lock(&dev->mutex); spin_lock(&w1_flock); diff --git a/drivers/w1/w1_family.h b/drivers/w1/w1_family.h index 0d18365b61ad..ed5dcb80a1f7 100644 --- a/drivers/w1/w1_family.h +++ b/drivers/w1/w1_family.h @@ -27,6 +27,7 @@ #include #define W1_FAMILY_DEFAULT 0 +#define W1_FAMILY_BQ27000 0x01 #define W1_FAMILY_SMEM_01 0x01 #define W1_FAMILY_SMEM_81 0x81 #define W1_THERM_DS18S20 0x10 -- cgit v1.2.3