Skip to contentSkip to conversation

I2C patches for 2.6.13

PATCH In review Greg KH 2 participants 16 messages Sep 5, 2005 – Sep 8, 2005

Subsystems (3)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 I2C patches for 2.6.13

Here are a bunch of I2C and HWMON patches that have been in the -mm tree for a while. There is a bunch of hwmon and i2c driver split up changes, and some i2c api reworks to reduce the size of the structures, and the size of the kernel code (which accounts for all of the small changes to all of the sensor and i2c drivers across the whole kenel tree.) There are also a few new drivers added to the tree.

Please pull from:

	rsync://rsync.kernel.org/pub/scm/linux/kernel/git/gregkh/i2c-2.6.git/
or from:
	master.kernel.org:/pub/scm/linux/kernel/git/gregkh/i2c-2.6.git/

if it isn't synced up yet.

The full patch series will sent to the sensors mailing list, if anyone wants to see them.

thanks,

greg k-h

 Documentation/hwmon/lm78                          |    7 
 Documentation/hwmon/w83792d                       |  174 ++
 Documentation/i2c/chips/max6875                   |   98 -
 Documentation/i2c/functionality                   |    2 
 Documentation/i2c/porting-clients                 |   25 
 Documentation/i2c/writing-clients                 |  144 -
 MAINTAINERS                                       |    9 
 drivers/hwmon/Kconfig                             |   74 
 drivers/hwmon/Makefile                            |    4 
 drivers/hwmon/adm1021.c                           |   35 
 drivers/hwmon/adm1025.c                           |   31 
 drivers/hwmon/adm1026.c                           |   27 
 drivers/hwmon/adm1031.c                           |   24 
 drivers/hwmon/adm9240.c                           |   33 
 drivers/hwmon/asb100.c                            |   56 
 drivers/hwmon/atxp1.c                             |   26 
 drivers/hwmon/ds1621.c                            |   29 
 drivers/hwmon/fscher.c                            |   27 
 drivers/hwmon/fscpos.c                            |   27 
 drivers/hwmon/gl518sm.c                           |   28 
 drivers/hwmon/gl520sm.c                           |   31 
 drivers/hwmon/hwmon-vid.c                         |  211 ++
 drivers/hwmon/hwmon.c                             |   98 +
 drivers/hwmon/it87.c                              |   82 -
 drivers/hwmon/lm63.c                              |   27 
 drivers/hwmon/lm75.c                              |   41 
 drivers/hwmon/lm75.h                              |    2 
 drivers/hwmon/lm77.c                              |   24 
 drivers/hwmon/lm78.c                              |   90 -
 drivers/hwmon/lm80.c                              |   27 
 drivers/hwmon/lm83.c                              |   27 
 drivers/hwmon/lm85.c                              |   39 
 drivers/hwmon/lm87.c                              |   31 
 drivers/hwmon/lm90.c                              |   27 
 drivers/hwmon/lm92.c                              |   28 
 drivers/hwmon/max1619.c                           |   28 
 drivers/hwmon/pc87360.c                           | 1006 ++++++-------
 drivers/hwmon/sis5595.c                           |   70 
 drivers/hwmon/smsc47b397.c                        |   74 
 drivers/hwmon/smsc47m1.c                          |   72 
 drivers/hwmon/via686a.c                           |   76 
 drivers/hwmon/w83627ehf.c                         |   64 
 drivers/hwmon/w83627hf.c                          |   82 -
 drivers/hwmon/w83781d.c                           |   94 -
 drivers/hwmon/w83792d.c                           | 1677 +++++++++++++++++++++-
 drivers/hwmon/w83l785ts.c                         |   27 
 drivers/i2c/Makefile                              |    6 
 drivers/i2c/algos/i2c-algo-bit.c                  |    6 
 drivers/i2c/algos/i2c-algo-ite.c                  |    6 
 drivers/i2c/algos/i2c-algo-pca.c                  |   18 
 drivers/i2c/algos/i2c-algo-pcf.c                  |    6 
 drivers/i2c/algos/i2c-algo-sgi.c                  |    7 
 drivers/i2c/algos/i2c-algo-sibyte.c               |    6 
 drivers/i2c/busses/Kconfig                        |    8 
 drivers/i2c/busses/i2c-ali1535.c                  |    2 
 drivers/i2c/busses/i2c-ali1563.c                  |    2 
 drivers/i2c/busses/i2c-ali15x3.c                  |    2 
 drivers/i2c/busses/i2c-amd756.c                   |    2 
 drivers/i2c/busses/i2c-amd8111.c                  |    2 
 drivers/i2c/busses/i2c-au1550.c                   |    2 
 drivers/i2c/busses/i2c-i801.c                     |    2 
 drivers/i2c/busses/i2c-ibm_iic.c                  |    6 
 drivers/i2c/busses/i2c-iop3xx.c                   |    2 
 drivers/i2c/busses/i2c-isa.c                      |  163 +-
 drivers/i2c/busses/i2c-keywest.c                  |   15 
 drivers/i2c/busses/i2c-mpc.c                      |    4 
 drivers/i2c/busses/i2c-mv64xxx.c                  |   12 
 drivers/i2c/busses/i2c-nforce2.c                  |   33 
 drivers/i2c/busses/i2c-piix4.c                    |    2 
 drivers/i2c/busses/i2c-s3c2410.c                  |    1 
 drivers/i2c/busses/i2c-sis5595.c                  |    2 
 drivers/i2c/busses/i2c-sis630.c                   |    2 
 drivers/i2c/busses/i2c-sis96x.c                   |    2 
 drivers/i2c/busses/i2c-stub.c                     |    2 
 drivers/i2c/busses/i2c-viapro.c                   |    2 
 drivers/i2c/busses/scx200_acb.c                   |    4 
 drivers/i2c/chips/Kconfig                         |   10 
 drivers/i2c/chips/ds1337.c                        |   11 
 drivers/i2c/chips/ds1374.c                        |    3 
 drivers/i2c/chips/eeprom.c                        |   17 
 drivers/i2c/chips/m41t00.c                        |    3 
 drivers/i2c/chips/max6875.c                       |  478 +-----
 drivers/i2c/chips/pca9539.c                       |   12 
 drivers/i2c/chips/pcf8574.c                       |   13 
 drivers/i2c/chips/pcf8591.c                       |   13 
 drivers/i2c/chips/rtc8564.c                       |    1 
 drivers/i2c/i2c-core.c                            |  310 ++--
 drivers/i2c/i2c-dev.c                             |    5 
 drivers/i2c/i2c-sensor-detect.c                   |  185 --
 drivers/i2c/i2c-sensor-vid.c                      |  108 -
 drivers/ieee1394/pcilynx.c                        |   20 
 drivers/media/common/saa7146_i2c.c                |    4 
 drivers/media/dvb/b2c2/flexcop-i2c.c              |    3 
 drivers/media/dvb/dvb-usb/cxusb.c                 |    2 
 drivers/media/dvb/dvb-usb/dibusb-common.c         |    2 
 drivers/media/dvb/dvb-usb/digitv.c                |    2 
 drivers/media/dvb/dvb-usb/dvb-usb-i2c.c           |    1 
 drivers/media/dvb/pluto2/pluto2.c                 |    1 
 drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c |    3 
 drivers/media/video/adv7170.c                     |    1 
 drivers/media/video/adv7175.c                     |    1 
 drivers/media/video/bt819.c                       |    1 
 drivers/media/video/bt832.c                       |    4 
 drivers/media/video/bt856.c                       |    1 
 drivers/media/video/bttv-i2c.c                    |   12 
 drivers/media/video/cx88/cx88-i2c.c               |    8 
 drivers/media/video/ir-kbd-i2c.c                  |    6 
 drivers/media/video/msp3400.c                     |    4 
 drivers/media/video/ovcamchip/ov6x20.c            |    6 
 drivers/media/video/ovcamchip/ov6x30.c            |    4 
 drivers/media/video/ovcamchip/ovcamchip_core.c    |   14 
 drivers/media/video/saa7110.c                     |    1 
 drivers/media/video/saa7111.c                     |    1 
 drivers/media/video/saa7114.c                     |    1 
 drivers/media/video/saa7134/saa6752hs.c           |    2 
 drivers/media/video/saa7134/saa7134-i2c.c         |   10 
 drivers/media/video/saa7185.c                     |    1 
 drivers/media/video/tda7432.c                     |    4 
 drivers/media/video/tda9840.c                     |    4 
 drivers/media/video/tda9875.c                     |    4 
 drivers/media/video/tda9887.c                     |    8 
 drivers/media/video/tea6415c.c                    |    4 
 drivers/media/video/tea6420.c                     |    4 
 drivers/media/video/tuner-3036.c                  |    3 
 drivers/media/video/tuner-core.c                  |    2 
 drivers/media/video/tvaudio.c                     |   51 
 drivers/media/video/tveeprom.c                    |    2 
 drivers/media/video/tvmixer.c                     |   14 
 drivers/media/video/vpx3220.c                     |    1 
 drivers/media/video/zoran_card.c                  |    2 
 drivers/usb/media/w9968cf.c                       |   12 
 drivers/video/aty/radeon_i2c.c                    |    2 
 drivers/video/matrox/matroxfb_maven.c             |    2 
 drivers/video/nvidia/nv_i2c.c                     |    3 
 drivers/video/riva/rivafb-i2c.c                   |    3 
 drivers/video/savage/savagefb-i2c.c               |    3 
 include/linux/hwmon-sysfs.h                       |   15 
 include/linux/hwmon-vid.h                         |  197 +-
 include/linux/hwmon.h                             |   35 
 include/linux/i2c-id.h                            |  192 --
 include/linux/i2c-isa.h                           |   44 
 include/linux/i2c-sensor.h                        |  421 +----
 include/linux/i2c-vid.h                           |  111 -
 include/linux/i2c.h                               |  210 ++
 include/media/id.h                                |    5 
 145 files changed, 4794 insertions(+), 3113 deletions(-)

[email protected]:
I2C: update max6875 documentation
I2C: simplify max6875 driver
I2C: max6875 documentation cleanup
I2C: add kobj_to_i2c_client
I2C: max6875 code cleanup

Greg Kroah-Hartman:
I2C: fix max6875 build error

Hans-Frieder Vogt:
I2C: cleanup of i2c-nforce2

Ian Campbell:
I2C: i2c-algo-pca -- gracefully handle a busy bus

Jean Delvare:
hwmon: kill client name lm78-j
hwmon: soften lm75 initialization
hwmon: Document on the W83627EHG chip
I2C: Separate non-i2c hwmon drivers from i2c-core (2/9)
I2C: Separate non-i2c hwmon drivers from i2c-core (1/9)
I2C: Separate non-i2c hwmon drivers from i2c-core (3/9)
I2C: Separate non-i2c hwmon drivers from i2c-core (5/9)
I2C: Separate non-i2c hwmon drivers from i2c-core (4/9)
I2C: Separate non-i2c hwmon drivers from i2c-core (6/9)
I2C: Separate non-i2c hwmon drivers from i2c-core (8/9)
I2C: Separate non-i2c hwmon drivers from i2c-core (7/9)
I2C: Separate non-i2c hwmon drivers from i2c-core (9/9)
I2C: refactor message in i2c_detach_client
I2C: inline i2c_adapter_id
hwmon: tag super-i/o find functions __init
I2C: fix typo in documentation
I2C: Improve core debugging messages
hwmon: move SENSORS_LIMIT to hwmon.h
hwmon: lm85: trivial cleanups
hwmon: hwmon vs i2c, second round (01/11)
hwmon: hwmon vs i2c, second round (02/11)
hwmon: hwmon vs i2c, second round (03/11)
hwmon: hwmon vs i2c, second round (04/11)
hwmon: hwmon vs i2c, second round (05/11)
hwmon: hwmon vs i2c, second round (06/11)
hwmon: hwmon vs i2c, second round (07/11)
hwmon: hwmon vs i2c, second round (08/11)
hwmon: hwmon vs i2c, second round (10/11)
hwmon: hwmon vs i2c, second round (09/11)
hwmon: hwmon vs i2c, second round (11/11)
I2C: Centralize 24RF08 corruption prevention
I2C: Rewrite i2c_probe
I2C: Kill i2c_algorithm.name (1/7)
I2C: Kill i2c_algorithm.id (2/7)
I2C: Kill i2c_algorithm.id (4/7)
I2C: Kill i2c_algorithm.id (3/7)
I2C: Kill i2c_algorithm.id (5/7)
I2C: Kill i2c_algorithm.id (6/7)
I2C: Outdated i2c_adapter comment
I2C: Kill i2c_algorithm.id (7/7)
hwmon: separate maintainer
I2C: Drop I2C_DEVNAME and i2c_clientname
I2C: Drop debug eeprom dump code in pcilynx
I2C: Drop probe parameter of i2c-keywest
i2c: bug fix for busses/i2c-mv64xxx.c
I2C: Fix sgi_xfer return value
I2C: Drop the I2C_ACK_TEST ioctl

Jim Cromie:
hwmon: (1/3) pc87360 driver update
hwmon: (3/3) pc87360 driver update
hwmon: (2/3) pc87360 driver update

Mark A. Greer:
i2c: chips/ds1374.c fixup
i2c: chips/m41t00.c fixup

Mark M. Hoffman:
I2C hwmon: hwmon sysfs class
I2C hwmon: add hwmon sysfs class to drivers

Rudolf Marek:
I2C: W83792D driver 1/3
I2C: W83792D add hwmon class register 2/3
I2C: W83792D documentation 3/3
hwmon: VID table update

#1 lore raw

Hi Greg,

Quoted 10 lines

Here are a bunch of I2C and HWMON patches that have been in the -mm tree for a while. There is a bunch of hwmon and i2c driver split up changes, and some i2c api reworks to reduce the size of the structures, and the size of the kernel code (which accounts for all of the small changes to all of the sensor and i2c drivers across the whole kenel tree.) There are also a few new drivers added to the tree.
(...)
The full patch series will sent to the sensors mailing list, if anyone wants to see them.

I checked against my own list, and it looks all OK to me. Thanks :)

There are two old patches I have and you don't, but it turns out that I probably never sent them in the first place (I can't find a trace in the mailing list archive.) I will send them now. These are really minor changes anyway, nothing to worry about.

Thanks again,

Signature · 1 line
Jean Delvare
author
#2 lore raw

PATCH 1/1 W1: w1_netlink: New init/fini netlink callbacks.

In reply to Greg KH

[PATCH] W1: w1_netlink: New init/fini netlink callbacks.

They are guarded with NETLINK_DISABLE compile time options, so if CONFIG_NET is disabled, no linking errors occur. Bug noticed by Adrian Bunk <[email protected]>.

---
commit 2d8331792ea3f5ccfd147288afba148537337019
tree 7d144ae862363a5fd6bfa031cca04a42cc79d879
parent 1b11d78cf87a7014f96e5b7fa2e1233cc8081a00
author Evgeniy Polyakov <[email protected]> Wed, 27 Jul 2005 13:10:11 +0400 committer Greg Kroah-Hartman <[email protected]> Thu, 08 Sep 2005 14:41:25 -0700

 drivers/w1/w1_int.c     |   16 ++++++----------
 drivers/w1/w1_netlink.c |   26 ++++++++++++++++++++++++++
 drivers/w1/w1_netlink.h |    2 ++
 3 files changed, 34 insertions(+), 10 deletions(-)
drivers/w1/w1_int.c +6 -10
@@ -88,17 +88,14 @@ static struct w1_master * w1_alloc_dev(u
 
 	dev->groups = 1;
 	dev->seq = 1;
-	dev->nls = netlink_kernel_create(NETLINK_W1, 1, NULL, THIS_MODULE);
-	if (!dev->nls) {
-		printk(KERN_ERR "Failed to create new netlink socket(%u) for w1 master %s.\n",
-			NETLINK_NFLOG, dev->dev.bus_id);
-	}
+	dev_init_netlink(dev);
 
 	err = device_register(&dev->dev);
 	if (err) {
 		printk(KERN_ERR "Failed to register master device. err=%d\n", err);
-		if (dev->nls && dev->nls->sk_socket)
-			sock_release(dev->nls->sk_socket);
+
+		dev_fini_netlink(dev);
+
 		memset(dev, 0, sizeof(struct w1_master));
 		kfree(dev);
 		dev = NULL;
@@ -107,11 +104,10 @@ static struct w1_master * w1_alloc_dev(u
 	return dev;
 }
 
-static void w1_free_dev(struct w1_master *dev)
+void w1_free_dev(struct w1_master *dev)
 {
 	device_unregister(&dev->dev);
-	if (dev->nls && dev->nls->sk_socket)
-		sock_release(dev->nls->sk_socket);
+	dev_fini_netlink(dev);
 	memset(dev, 0, sizeof(struct w1_master) + sizeof(struct w1_bus_master));
 	kfree(dev);
 }
drivers/w1/w1_netlink.c +26 -0
@@ -57,10 +57,36 @@ void w1_netlink_send(struct w1_master *d
 nlmsg_failure:
 	return;
 }
+
+int dev_init_netlink(struct w1_master *dev)
+{
+	dev->nls = netlink_kernel_create(NETLINK_W1, 1, NULL, THIS_MODULE);
+	if (!dev->nls) {
+		printk(KERN_ERR "Failed to create new netlink socket(%u) for w1 master %s.\n",
+			NETLINK_W1, dev->dev.bus_id);
+	}
+
+	return 0;
+}
+
+void dev_fini_netlink(struct w1_master *dev)
+{
+	if (dev->nls && dev->nls->sk_socket)
+		sock_release(dev->nls->sk_socket);
+}
 #else
 #warning Netlink support is disabled. Please compile with NET support enabled.
 
 void w1_netlink_send(struct w1_master *dev, struct w1_netlink_msg *msg)
 {
 }
+
+int dev_init_netlink(struct w1_master *dev)
+{
+	return 0;
+}
+
+void dev_fini_netlink(struct w1_master *dev)
+{
+}
 #endif
drivers/w1/w1_netlink.h +2 -0
@@ -52,6 +52,8 @@ struct w1_netlink_msg
 #ifdef __KERNEL__
 
 void w1_netlink_send(struct w1_master *, struct w1_netlink_msg *);
+int dev_init_netlink(struct w1_master *dev);
+void dev_fini_netlink(struct w1_master *dev);
 
 #endif /* __KERNEL__ */
 #endif /* __W1_NETLINK_H */
author
#3 lore raw

PATCH 1/1 w1: Detouching bug fixed.

[PATCH] w1: Detouching bug fixed.

---
commit 3aca692d3ec7cf89da4575f598e41f74502b22d7
tree 84740dbcf1ea648b303020f2106e7f9e46f92835
parent d2a4ef6a0ce4d841293b49bf2cdc17a0ebfaaf9d
author Evgeniy Polyakov <[email protected]> Thu, 11 Aug 2005 17:27:50 +0400 committer Greg Kroah-Hartman <[email protected]> Thu, 08 Sep 2005 14:41:26 -0700

 drivers/w1/w1.c     |   93 +++++++++++++++++++++++++++------------------------
 drivers/w1/w1.h     |    3 +-
 drivers/w1/w1_int.c |    6 +--
 3 files changed, 51 insertions(+), 51 deletions(-)
drivers/w1/w1.c +49 -44
@@ -45,10 +45,12 @@ MODULE_AUTHOR("Evgeniy Polyakov <johnpol
 MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol.");
 
 static int w1_timeout = 10;
+static int w1_control_timeout = 1;
 int w1_max_slave_count = 10;
 int w1_max_slave_ttl = 10;
 
 module_param_named(timeout, w1_timeout, int, 0);
+module_param_named(control_timeout, w1_control_timeout, int, 0);
 module_param_named(max_slave_count, w1_max_slave_count, int, 0);
 module_param_named(slave_ttl, w1_max_slave_ttl, int, 0);
 
@@ -69,37 +71,51 @@ static int w1_master_probe(struct device
 	return -ENODEV;
 }
 
-static int w1_master_remove(struct device *dev)
-{
-	return 0;
-}
-
 static void w1_master_release(struct device *dev)
 {
 	struct w1_master *md = dev_to_w1_master(dev);
-	complete(&md->dev_released);
+
+	dev_dbg(dev, "%s: Releasing %s.\n", __func__, md->name);
+
+	if (md->nls && md->nls->sk_socket)
+		sock_release(md->nls->sk_socket);
+	memset(md, 0, sizeof(struct w1_master) + sizeof(struct w1_bus_master));
+	kfree(md);
 }
 
 static void w1_slave_release(struct device *dev)
 {
 	struct w1_slave *sl = dev_to_w1_slave(dev);
-	complete(&sl->dev_released);
+
+	dev_dbg(dev, "%s: Releasing %s.\n", __func__, sl->name);
+
+	while (atomic_read(&sl->refcnt)) {
+		dev_dbg(dev, "Waiting for %s to become free: refcnt=%d.\n",
+				sl->name, atomic_read(&sl->refcnt));
+		if (msleep_interruptible(1000))
+			flush_signals(current);
+	}
+
+	w1_family_put(sl->family);
+	sl->master->slave_count--;
+
+	complete(&sl->released);
 }
 
 static ssize_t w1_slave_read_name(struct device *dev, struct device_attribute *attr, char *buf)
 {
-      struct w1_slave *sl = dev_to_w1_slave(dev);
+	struct w1_slave *sl = dev_to_w1_slave(dev);
 
-      return sprintf(buf, "%s\n", sl->name);
+	return sprintf(buf, "%s\n", sl->name);
 }
 
 static ssize_t w1_slave_read_id(struct kobject *kobj, char *buf, loff_t off, size_t count)
 {
-      struct w1_slave *sl = kobj_to_w1_slave(kobj);
+	struct w1_slave *sl = kobj_to_w1_slave(kobj);
 
-      atomic_inc(&sl->refcnt);
-      if (off > 8) {
-              count = 0;
+	atomic_inc(&sl->refcnt);
+	if (off > 8) {
+		count = 0;
 	} else {
 		if (off + count > 8)
 			count = 8 - off;
@@ -109,7 +125,7 @@ static ssize_t w1_slave_read_id(struct k
 	atomic_dec(&sl->refcnt);
 
 	return count;
-  }
+}
 
 static struct device_attribute w1_slave_attr_name =
 	__ATTR(name, S_IRUGO, w1_slave_read_name, NULL);
@@ -139,7 +155,6 @@ struct device_driver w1_master_driver = 
 	.name = "w1_master_driver",
 	.bus = &w1_bus_type,
 	.probe = w1_master_probe,
-	.remove = w1_master_remove,
 };
 
 struct device w1_master_device = {
@@ -160,6 +175,7 @@ struct device w1_slave_device = {
 	.bus = &w1_bus_type,
 	.bus_id = "w1 bus slave",
 	.driver = &w1_slave_driver,
+	.release = &w1_slave_release
 };
 
 static ssize_t w1_master_attribute_show_name(struct device *dev, struct device_attribute *attr, char *buf)
@@ -406,8 +422,7 @@ static int __w1_attach_slave_device(stru
 		 (unsigned int) sl->reg_num.family,
 		 (unsigned long long) sl->reg_num.id);
 
-	dev_dbg(&sl->dev, "%s: registering %s.\n", __func__,
-		&sl->dev.bus_id[0]);
+	dev_dbg(&sl->dev, "%s: registering %s as %p.\n", __func__, &sl->dev.bus_id[0]);
 
 	err = device_register(&sl->dev);
 	if (err < 0) {
@@ -480,7 +495,7 @@ static int w1_attach_slave_device(struct
 
 	memcpy(&sl->reg_num, rn, sizeof(sl->reg_num));
 	atomic_set(&sl->refcnt, 0);
-	init_completion(&sl->dev_released);
+	init_completion(&sl->released);
 
 	spin_lock(&w1_flock);
 	f = w1_family_registered(rn->family);
@@ -512,6 +527,8 @@ static int w1_attach_slave_device(struct
 	msg.type = W1_SLAVE_ADD;
 	w1_netlink_send(dev, &msg);
 
+	dev_info(&dev->dev, "Finished %s for sl=%p.\n", __func__, sl);
+
 	return 0;
 }
 
@@ -519,29 +536,23 @@ static void w1_slave_detach(struct w1_sl
 {
 	struct w1_netlink_msg msg;
 
-	dev_info(&sl->dev, "%s: detaching %s.\n", __func__, sl->name);
+	dev_info(&sl->dev, "%s: detaching %s [%p].\n", __func__, sl->name, sl);
 
-	while (atomic_read(&sl->refcnt)) {
-		printk(KERN_INFO "Waiting for %s to become free: refcnt=%d.\n",
-				sl->name, atomic_read(&sl->refcnt));
-
-		if (msleep_interruptible(1000))
-			flush_signals(current);
-	}
+	list_del(&sl->w1_slave_entry);
 
 	if (sl->family->fops && sl->family->fops->remove_slave)
 		sl->family->fops->remove_slave(sl);
 
+	memcpy(&msg.id.id, &sl->reg_num, sizeof(msg.id.id));
+	msg.type = W1_SLAVE_REMOVE;
+	w1_netlink_send(sl->master, &msg);
+
 	sysfs_remove_bin_file(&sl->dev.kobj, &w1_slave_attr_bin_id);
 	device_remove_file(&sl->dev, &w1_slave_attr_name);
 	device_unregister(&sl->dev);
-	w1_family_put(sl->family);
 
-	sl->master->slave_count--;
-
-	memcpy(&msg.id.id, &sl->reg_num, sizeof(msg.id.id));
-	msg.type = W1_SLAVE_REMOVE;
-	w1_netlink_send(sl->master, &msg);
+	wait_for_completion(&sl->released);
+	kfree(sl);
 }
 
 static struct w1_master *w1_search_master(unsigned long data)
@@ -713,7 +724,7 @@ static int w1_control(void *data)
 		have_to_wait = 0;
 
 		try_to_freeze();
-		msleep_interruptible(w1_timeout * 1000);
+		msleep_interruptible(w1_control_timeout * 1000);
 
 		if (signal_pending(current))
 			flush_signals(current);
@@ -746,13 +757,12 @@ static int w1_control(void *data)
 				list_del(&dev->w1_master_entry);
 				spin_unlock_bh(&w1_mlock);
 
+				down(&dev->mutex);
 				list_for_each_entry_safe(sl, sln, &dev->slist, w1_slave_entry) {
-					list_del(&sl->w1_slave_entry);
-
 					w1_slave_detach(sl);
-					kfree(sl);
 				}
 				w1_destroy_master_attributes(dev);
+				up(&dev->mutex);
 				atomic_dec(&dev->refcnt);
 				continue;
 			}
@@ -760,19 +770,17 @@ static int w1_control(void *data)
 			if (test_bit(W1_MASTER_NEED_RECONNECT, &dev->flags)) {
 				dev_info(&dev->dev, "Reconnecting slaves in device %s.\n", dev->name);
 				down(&dev->mutex);
-				list_for_each_entry(sl, &dev->slist, w1_slave_entry) {
+				list_for_each_entry_safe(sl, sln, &dev->slist, w1_slave_entry) {
 					if (sl->family->fid == W1_FAMILY_DEFAULT) {
 						struct w1_reg_num rn;
-						list_del(&sl->w1_slave_entry);
-						w1_slave_detach(sl);
 
 						memcpy(&rn, &sl->reg_num, sizeof(rn));
-
-						kfree(sl);
+						w1_slave_detach(sl);
 
 						w1_attach_slave_device(dev, &rn);
 					}
 				}
+				dev_info(&dev->dev, "Reconnecting slaves in device %s has been finished.\n", dev->name);
 				clear_bit(W1_MASTER_NEED_RECONNECT, &dev->flags);
 				up(&dev->mutex);
 			}
@@ -816,10 +824,7 @@ int w1_process(void *data)
 
 		list_for_each_entry_safe(sl, sln, &dev->slist, w1_slave_entry) {
 			if (!test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags) && !--sl->ttl) {
-				list_del (&sl->w1_slave_entry);
-
 				w1_slave_detach(sl);
-				kfree(sl);
 
 				dev->slave_count--;
 			} else if (test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags))
drivers/w1/w1.h +1 -2
@@ -76,7 +76,7 @@ struct w1_slave
 	struct w1_master	*master;
 	struct w1_family	*family;
 	struct device		dev;
-	struct completion	dev_released;
+	struct completion	released;
 };
 
 typedef void (* w1_slave_found_callback)(unsigned long, u64);
@@ -176,7 +176,6 @@ struct w1_master
 
 	struct device_driver	*driver;
 	struct device		dev;
-	struct completion	dev_released;
 	struct completion	dev_exited;
 
 	struct w1_bus_master	*bus_master;
drivers/w1/w1_int.c +1 -5
@@ -76,7 +76,6 @@ static struct w1_master * w1_alloc_dev(u
 	INIT_LIST_HEAD(&dev->slist);
 	init_MUTEX(&dev->mutex);
 
-	init_completion(&dev->dev_released);
 	init_completion(&dev->dev_exited);
 
 	memcpy(&dev->dev, device, sizeof(struct device));
@@ -107,9 +106,6 @@ static struct w1_master * w1_alloc_dev(u
 void w1_free_dev(struct w1_master *dev)
 {
 	device_unregister(&dev->dev);
-	dev_fini_netlink(dev);
-	memset(dev, 0, sizeof(struct w1_master) + sizeof(struct w1_bus_master));
-	kfree(dev);
 }
 
 int w1_add_master_device(struct w1_bus_master *master)
@@ -184,7 +180,7 @@ void __w1_remove_master_device(struct w1
 			 __func__, dev->kpid);
 
 	while (atomic_read(&dev->refcnt)) {
-		printk(KERN_INFO "Waiting for %s to become free: refcnt=%d.\n",
+		dev_dbg(&dev->dev, "Waiting for %s to become free: refcnt=%d.\n",
 				dev->name, atomic_read(&dev->refcnt));
 
 		if (msleep_interruptible(1000))
author
#4 lore raw

PATCH 1/1 w1: Fixed 64bit compilation warning.

[PATCH] w1: Fixed 64bit compilation warning.

Fixed 64bit compilation warning.

---
commit 5e8eb8501212eb92826ccf191f9ca8c186f531c3
tree 20008154898e8964b12ed86ecd767eff87b462bf
parent 7f772ed8df27c6941952452330c618512389c4c7
author Evgeniy Polyakov <[email protected]> Thu, 11 Aug 2005 13:45:54 +0400 committer Greg Kroah-Hartman <[email protected]> Thu, 08 Sep 2005 14:41:26 -0700

 drivers/w1/w1.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/w1/w1.c +1 -1
@@ -373,7 +373,7 @@ static int w1_hotplug(struct device *dev
 	if (err)
 		return err;
 
-	err = add_hotplug_env_var(envp, num_envp, &cur_index, buffer, buffer_size, &cur_len, "W1_SLAVE_ID=%024llX", sl->reg_num.id);
+	err = add_hotplug_env_var(envp, num_envp, &cur_index, buffer, buffer_size, &cur_len, "W1_SLAVE_ID=%024LX", (u64)sl->reg_num.id);
 	if (err)
 		return err;
 
author
#5 lore raw

PATCH 1/1 w1: hotplug support.

[PATCH] w1: hotplug support.

Here is W1 hotplug in addition to netlink notifications.

---
commit 7f772ed8df27c6941952452330c618512389c4c7
tree 6ad8320e0ee8bd2f4709176381662460ec4b1e45
parent 8949d2aa05ddf5e9a31d738568a79915970cb38e
author Evgeniy Polyakov <[email protected]> Thu, 11 Aug 2005 13:20:07 +0400 committer Greg Kroah-Hartman <[email protected]> Thu, 08 Sep 2005 14:41:26 -0700

 drivers/w1/w1.c     |   90 +++++++++++++++++++++++++++++++++++++++++++++------
 drivers/w1/w1_int.c |    6 ++-
 2 files changed, 82 insertions(+), 14 deletions(-)
drivers/w1/w1.c +79 -11
@@ -125,27 +125,41 @@ static struct bin_attribute w1_slave_bin
 	.read = &w1_default_read_bin,
 };
 
+static int w1_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size);
 
 static struct bus_type w1_bus_type = {
 	.name = "w1",
 	.match = w1_master_match,
+	.hotplug = w1_hotplug,
 };
 
-struct device_driver w1_driver = {
-	.name = "w1_driver",
+struct device_driver w1_master_driver = {
+	.name = "w1_master_driver",
 	.bus = &w1_bus_type,
 	.probe = w1_master_probe,
 	.remove = w1_master_remove,
 };
 
-struct device w1_device = {
+struct device w1_master_device = {
 	.parent = NULL,
 	.bus = &w1_bus_type,
 	.bus_id = "w1 bus master",
-	.driver = &w1_driver,
+	.driver = &w1_master_driver,
 	.release = &w1_master_release
 };
 
+struct device_driver w1_slave_driver = {
+	.name = "w1_slave_driver",
+	.bus = &w1_bus_type,
+};
+
+struct device w1_slave_device = {
+	.parent = NULL,
+	.bus = &w1_bus_type,
+	.bus_id = "w1 bus slave",
+	.driver = &w1_slave_driver,
+};
+
 static ssize_t w1_master_attribute_show_name(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct w1_master *md = container_of(dev, struct w1_master, dev);
@@ -329,12 +343,55 @@ void w1_destroy_master_attributes(struct
 	sysfs_remove_group(&master->dev.kobj, &w1_master_defattr_group);
 }
 
+#ifdef CONFIG_HOTPLUG
+static int w1_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)
+{
+	struct w1_master *md = NULL;
+	struct w1_slave *sl = NULL;
+	char *event_owner, *name;
+	int err, cur_index=0, cur_len=0;
+
+	if (dev->driver == &w1_master_driver) {
+		md = container_of(dev, struct w1_master, dev);
+		event_owner = "master";
+		name = md->name;
+	} else if (dev->driver == &w1_slave_driver) {
+		sl = container_of(dev, struct w1_slave, dev);
+		event_owner = "slave";
+		name = sl->name;
+	} else {
+		dev_dbg(dev, "Unknown hotplug event.\n");
+		return -EINVAL;
+	}
+
+	dev_dbg(dev, "Hotplug event for %s %s, bus_id=%s.\n", event_owner, name, dev->bus_id);
+
+	if (dev->driver != &w1_slave_driver || !sl)
+		return 0;
+
+	err = add_hotplug_env_var(envp, num_envp, &cur_index, buffer, buffer_size, &cur_len, "W1_FID=%02X", sl->reg_num.family);
+	if (err)
+		return err;
+
+	err = add_hotplug_env_var(envp, num_envp, &cur_index, buffer, buffer_size, &cur_len, "W1_SLAVE_ID=%024llX", sl->reg_num.id);
+	if (err)
+		return err;
+
+	return 0;
+};
+#else
+static int w1_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)
+{
+	return 0;
+}
+#endif
+
 static int __w1_attach_slave_device(struct w1_slave *sl)
 {
 	int err;
 
 	sl->dev.parent = &sl->master->dev;
-	sl->dev.driver = sl->master->driver;
+	sl->dev.driver = &w1_slave_driver;
 	sl->dev.bus = &w1_bus_type;
 	sl->dev.release = &w1_slave_release;
 
@@ -507,7 +564,6 @@ void w1_reconnect_slaves(struct w1_famil
 	spin_unlock_bh(&w1_mlock);
 }
 
-
 static void w1_slave_found(unsigned long data, u64 rn)
 {
 	int slave_count;
@@ -783,7 +839,7 @@ static int w1_init(void)
 		goto err_out_exit_init;
 	}
 
-	retval = driver_register(&w1_driver);
+	retval = driver_register(&w1_master_driver);
 	if (retval) {
 		printk(KERN_ERR
 			"Failed to register master driver. err=%d.\n",
@@ -791,18 +847,29 @@ static int w1_init(void)
 		goto err_out_bus_unregister;
 	}
 
+	retval = driver_register(&w1_slave_driver);
+	if (retval) {
+		printk(KERN_ERR
+			"Failed to register master driver. err=%d.\n",
+			retval);
+		goto err_out_master_unregister;
+	}
+
 	control_thread = kernel_thread(&w1_control, NULL, 0);
 	if (control_thread < 0) {
 		printk(KERN_ERR "Failed to create control thread. err=%d\n",
 			control_thread);
 		retval = control_thread;
-		goto err_out_driver_unregister;
+		goto err_out_slave_unregister;
 	}
 
 	return 0;
 
-err_out_driver_unregister:
-	driver_unregister(&w1_driver);
+err_out_slave_unregister:
+	driver_unregister(&w1_slave_driver);
+
+err_out_master_unregister:
+	driver_unregister(&w1_master_driver);
 
 err_out_bus_unregister:
 	bus_unregister(&w1_bus_type);
@@ -821,7 +888,8 @@ static void w1_fini(void)
 	control_needs_exit = 1;
 	wait_for_completion(&w1_control_complete);
 
-	driver_unregister(&w1_driver);
+	driver_unregister(&w1_slave_driver);
+	driver_unregister(&w1_master_driver);
 	bus_unregister(&w1_bus_type);
 }
 
drivers/w1/w1_int.c +3 -3
@@ -29,9 +29,9 @@
 
 static u32 w1_ids = 1;
 
-extern struct device_driver w1_driver;
+extern struct device_driver w1_master_driver;
 extern struct bus_type w1_bus_type;
-extern struct device w1_device;
+extern struct device w1_master_device;
 extern int w1_max_slave_count;
 extern int w1_max_slave_ttl;
 extern struct list_head w1_masters;
@@ -125,7 +125,7 @@ int w1_add_master_device(struct w1_bus_m
 		return(-EINVAL);
         }
 
-	dev = w1_alloc_dev(w1_ids++, w1_max_slave_count, w1_max_slave_ttl, &w1_driver, &w1_device);
+	dev = w1_alloc_dev(w1_ids++, w1_max_slave_count, w1_max_slave_ttl, &w1_master_driver, &w1_master_device);
 	if (!dev)
 		return -ENOMEM;
 
author
#6 lore raw

PATCH 1/1 W1: Sync with w1/ds9490 tree.

[PATCH] W1: Sync with w1/ds9490 tree.

Whitespace, static/nonstatic cleanups.

---
commit 8949d2aa05ddf5e9a31d738568a79915970cb38e
tree bb5c18d4a5ff014a4a521fb5817ad231e8d0c81f
parent 2d8331792ea3f5ccfd147288afba148537337019
author Evgeniy Polyakov <[email protected]> Wed, 03 Aug 2005 15:14:50 +0400 committer Greg Kroah-Hartman <[email protected]> Thu, 08 Sep 2005 14:41:26 -0700

 drivers/w1/ds_w1_bridge.c |   24 +++----
 drivers/w1/dscore.c       |  161 +++++++++++++++++++++++----------------------
 drivers/w1/dscore.h       |   10 +--
 3 files changed, 99 insertions(+), 96 deletions(-)
drivers/w1/ds_w1_bridge.c +12 -12
@@ -1,8 +1,8 @@
 /*
- * 	ds_w1_bridge.c
+ *	ds_w1_bridge.c
  *
  * Copyright (c) 2004 Evgeniy Polyakov <[email protected]>
- * 
+ *
  *
  * 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
@@ -25,7 +25,7 @@
 #include "../w1/w1.h"
 #include "../w1/w1_int.h"
 #include "dscore.h"
-	
+
 static struct ds_device *ds_dev;
 static struct w1_bus_master *ds_bus_master;
 
@@ -120,7 +120,7 @@ static u8 ds9490r_reset(unsigned long da
 static int __devinit ds_w1_init(void)
 {
 	int err;
-	
+
 	ds_bus_master = kmalloc(sizeof(*ds_bus_master), GFP_KERNEL);
 	if (!ds_bus_master) {
 		printk(KERN_ERR "Failed to allocate DS9490R USB<->W1 bus_master structure.\n");
@@ -136,14 +136,14 @@ static int __devinit ds_w1_init(void)
 
 	memset(ds_bus_master, 0, sizeof(*ds_bus_master));
 
-	ds_bus_master->data 		= (unsigned long)ds_dev;
-	ds_bus_master->touch_bit 	= &ds9490r_touch_bit;
-	ds_bus_master->read_bit 	= &ds9490r_read_bit;
-	ds_bus_master->write_bit 	= &ds9490r_write_bit;
-	ds_bus_master->read_byte 	= &ds9490r_read_byte;
-	ds_bus_master->write_byte 	= &ds9490r_write_byte;
-	ds_bus_master->read_block 	= &ds9490r_read_block;
-	ds_bus_master->write_block 	= &ds9490r_write_block;
+	ds_bus_master->data		= (unsigned long)ds_dev;
+	ds_bus_master->touch_bit	= &ds9490r_touch_bit;
+	ds_bus_master->read_bit		= &ds9490r_read_bit;
+	ds_bus_master->write_bit	= &ds9490r_write_bit;
+	ds_bus_master->read_byte	= &ds9490r_read_byte;
+	ds_bus_master->write_byte	= &ds9490r_write_byte;
+	ds_bus_master->read_block	= &ds9490r_read_block;
+	ds_bus_master->write_block	= &ds9490r_write_block;
 	ds_bus_master->reset_bus	= &ds9490r_reset;
 
 	err = w1_add_master_device(ds_bus_master);
drivers/w1/dscore.c +84 -77

498 lines not on this page · raw message

drivers/w1/dscore.h +3 -7
@@ -1,8 +1,8 @@
 /*
- * 	dscore.h
+ *	dscore.h
  *
  * Copyright (c) 2004 Evgeniy Polyakov <[email protected]>
- * 
+ *
  *
  * 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
@@ -122,7 +122,7 @@
 
 struct ds_device
 {
-	struct usb_device 	*udev;
+	struct usb_device	*udev;
 	struct usb_interface	*intf;
 
 	int			ep[NUM_EP];
@@ -156,11 +156,7 @@ int ds_read_byte(struct ds_device *, u8 
 int ds_read_bit(struct ds_device *, u8 *);
 int ds_write_byte(struct ds_device *, u8);
 int ds_write_bit(struct ds_device *, u8);
-int ds_start_pulse(struct ds_device *, int);
-int ds_set_speed(struct ds_device *, int);
 int ds_reset(struct ds_device *, struct ds_status *);
-int ds_detect(struct ds_device *, struct ds_status *);
-int ds_stop_pulse(struct ds_device *, int);
 struct ds_device * ds_get_device(void);
 void ds_put_device(struct ds_device *);
 int ds_write_block(struct ds_device *, u8 *, int);
author
#7 lore raw

PATCH 1/1 w1: Added add/remove slave callbacks.

[PATCH] w1: Added add/remove slave callbacks.

Patch is based on work from Ben Gardner <[email protected]>

---
commit d2a4ef6a0ce4d841293b49bf2cdc17a0ebfaaf9d
tree 2d49373e06fd65aae5217aad864fafb849c8cda2
parent ea7d8f65c865ebfa1d7cd67c360a87333ff013c1
author Evgeniy Polyakov <[email protected]> Thu, 11 Aug 2005 17:27:50 +0400 committer Greg Kroah-Hartman <[email protected]> Thu, 08 Sep 2005 14:41:26 -0700

 drivers/w1/w1.c        |  119 +++++++++++++++++++++++++++---------------------
 drivers/w1/w1.h        |    3 -
 drivers/w1/w1_family.c |   11 ----
 drivers/w1/w1_family.h |    6 ++
 drivers/w1/w1_smem.c   |   47 -------------------
 drivers/w1/w1_therm.c  |   32 +++++++++----
 6 files changed, 93 insertions(+), 125 deletions(-)
drivers/w1/w1.c +66 -53
@@ -59,19 +59,6 @@ static pid_t control_thread;
 static int control_needs_exit;
 static DECLARE_COMPLETION(w1_control_complete);
 
-/* stuff for the default family */
-static ssize_t w1_famdefault_read_name(struct device *dev, struct device_attribute *attr, char *buf)
-{
-	struct w1_slave *sl = container_of(dev, struct w1_slave, dev);
-	return(sprintf(buf, "%s\n", sl->name));
-}
-static struct w1_family_ops w1_default_fops = {
-	.rname = &w1_famdefault_read_name,
-};
-static struct w1_family w1_default_family = {
-	.fops = &w1_default_fops,
-};
-
 static int w1_master_match(struct device *dev, struct device_driver *drv)
 {
 	return 1;
@@ -99,30 +86,47 @@ static void w1_slave_release(struct devi
 	complete(&sl->dev_released);
 }
 
-static ssize_t w1_default_read_name(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t w1_slave_read_name(struct device *dev, struct device_attribute *attr, char *buf)
 {
-	return sprintf(buf, "No family registered.\n");
+      struct w1_slave *sl = dev_to_w1_slave(dev);
+
+      return sprintf(buf, "%s\n", sl->name);
 }
 
-static ssize_t w1_default_read_bin(struct kobject *kobj, char *buf, loff_t off,
-		     size_t count)
+static ssize_t w1_slave_read_id(struct kobject *kobj, char *buf, loff_t off, size_t count)
 {
-	return sprintf(buf, "No family registered.\n");
-}
+      struct w1_slave *sl = kobj_to_w1_slave(kobj);
 
-static struct device_attribute w1_slave_attribute =
-	__ATTR(name, S_IRUGO, w1_default_read_name, NULL);
+      atomic_inc(&sl->refcnt);
+      if (off > 8) {
+              count = 0;
+	} else {
+		if (off + count > 8)
+			count = 8 - off;
 
-static struct bin_attribute w1_slave_bin_attribute = {
-	.attr = {
-		.name = "w1_slave",
-		.mode = S_IRUGO,
-		.owner = THIS_MODULE,
-	},
-	.size = W1_SLAVE_DATA_SIZE,
-	.read = &w1_default_read_bin,
+		memcpy(buf, (u8 *)&sl->reg_num, count);
+	}
+	atomic_dec(&sl->refcnt);
+
+	return count;
+  }
+
+static struct device_attribute w1_slave_attr_name =
+	__ATTR(name, S_IRUGO, w1_slave_read_name, NULL);
+
+static struct bin_attribute w1_slave_attr_bin_id = {
+      .attr = {
+              .name = "id",
+              .mode = S_IRUGO,
+              .owner = THIS_MODULE,
+      },
+      .size = 8,
+      .read = w1_slave_read_id,
 };
 
+/* Default family */
+static struct w1_family w1_default_family;
+
 static int w1_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size);
 
 static struct bus_type w1_bus_type = {
@@ -413,36 +417,44 @@ static int __w1_attach_slave_device(stru
 		return err;
 	}
 
-	memcpy(&sl->attr_bin, &w1_slave_bin_attribute, sizeof(sl->attr_bin));
-	memcpy(&sl->attr_name, &w1_slave_attribute, sizeof(sl->attr_name));
-
-	sl->attr_bin.read = sl->family->fops->rbin;
-	sl->attr_name.show = sl->family->fops->rname;
+	/* Create "name" entry */
+	err = device_create_file(&sl->dev, &w1_slave_attr_name);
+	if (err < 0) {
+		dev_err(&sl->dev,
+			"sysfs file creation for [%s] failed. err=%d\n",
+			sl->dev.bus_id, err);
+		goto out_unreg;
+	}
 
-	err = device_create_file(&sl->dev, &sl->attr_name);
+	/* Create "id" entry */
+	err = sysfs_create_bin_file(&sl->dev.kobj, &w1_slave_attr_bin_id);
 	if (err < 0) {
 		dev_err(&sl->dev,
 			"sysfs file creation for [%s] failed. err=%d\n",
 			sl->dev.bus_id, err);
-		device_unregister(&sl->dev);
-		return err;
+		goto out_rem1;
 	}
 
-	if ( sl->attr_bin.read ) {
-		err = sysfs_create_bin_file(&sl->dev.kobj, &sl->attr_bin);
-		if (err < 0) {
-			dev_err(&sl->dev,
-				"sysfs file creation for [%s] failed. err=%d\n",
-				sl->dev.bus_id, err);
-			device_remove_file(&sl->dev, &sl->attr_name);
-			device_unregister(&sl->dev);
-			return err;
-		}
+	/* if the family driver needs to initialize something... */
+	if (sl->family->fops && sl->family->fops->add_slave &&
+	    ((err = sl->family->fops->add_slave(sl)) < 0)) {
+		dev_err(&sl->dev,
+			"sysfs file creation for [%s] failed. err=%d\n",
+			sl->dev.bus_id, err);
+		goto out_rem2;
 	}
 
 	list_add_tail(&sl->w1_slave_entry, &sl->master->slist);
 
 	return 0;
+
+out_rem2:
+	sysfs_remove_bin_file(&sl->dev.kobj, &w1_slave_attr_bin_id);
+out_rem1:
+	device_remove_file(&sl->dev, &w1_slave_attr_name);
+out_unreg:
+	device_unregister(&sl->dev);
+	return err;
 }
 
 static int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)
@@ -517,10 +529,11 @@ static void w1_slave_detach(struct w1_sl
 			flush_signals(current);
 	}
 
-	if ( sl->attr_bin.read ) {
-		sysfs_remove_bin_file (&sl->dev.kobj, &sl->attr_bin);
-	}
-	device_remove_file(&sl->dev, &sl->attr_name);
+	if (sl->family->fops && sl->family->fops->remove_slave)
+		sl->family->fops->remove_slave(sl);
+
+	sysfs_remove_bin_file(&sl->dev.kobj, &w1_slave_attr_bin_id);
+	device_remove_file(&sl->dev, &w1_slave_attr_name);
 	device_unregister(&sl->dev);
 	w1_family_put(sl->family);
 
@@ -805,8 +818,8 @@ int w1_process(void *data)
 			if (!test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags) && !--sl->ttl) {
 				list_del (&sl->w1_slave_entry);
 
-				w1_slave_detach (sl);
-				kfree (sl);
+				w1_slave_detach(sl);
+				kfree(sl);
 
 				dev->slave_count--;
 			} else if (test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags))
drivers/w1/w1.h +0 -3
@@ -77,9 +77,6 @@ struct w1_slave
 	struct w1_family	*family;
 	struct device		dev;
 	struct completion	dev_released;
-
-	struct bin_attribute	attr_bin;
-	struct device_attribute	attr_name;
 };
 
 typedef void (* w1_slave_found_callback)(unsigned long, u64);
drivers/w1/w1_family.c +0 -11
@@ -29,23 +29,12 @@ DEFINE_SPINLOCK(w1_flock);
 static LIST_HEAD(w1_families);
 extern void w1_reconnect_slaves(struct w1_family *f);
 
-static int w1_check_family(struct w1_family *f)
-{
-	if (!f->fops->rname || !f->fops->rbin)
-		return -EINVAL;
-
-	return 0;
-}
-
 int w1_register_family(struct w1_family *newf)
 {
 	struct list_head *ent, *n;
 	struct w1_family *f;
 	int ret = 0;
 
-	if (w1_check_family(newf))
-		return -EINVAL;
-
 	spin_lock(&w1_flock);
 	list_for_each_safe(ent, n, &w1_families) {
 		f = list_entry(ent, struct w1_family, family_entry);
drivers/w1/w1_family.h +4 -2
@@ -35,10 +35,12 @@
 
 #define MAXNAMELEN		32
 
+struct w1_slave;
+
 struct w1_family_ops
 {
-	ssize_t (* rname)(struct device *, struct device_attribute *, char *);
-	ssize_t (* rbin)(struct kobject *, char *, loff_t, size_t);
+	int  (* add_slave)(struct w1_slave *);
+	void (* remove_slave)(struct w1_slave *);
 };
 
 struct w1_family
drivers/w1/w1_smem.c +0 -47

59 lines not on this page · raw message

drivers/w1/w1_therm.c +23 -9
@@ -42,12 +42,31 @@ static u8 bad_roms[][9] = {
 				{}
 			};
 
-static ssize_t w1_therm_read_name(struct device *, struct device_attribute *attr, char *);
 static ssize_t w1_therm_read_bin(struct kobject *, char *, loff_t, size_t);
 
+static struct bin_attribute w1_therm_bin_attr = {
+	.attr = {
+		.name = "w1_slave",
+		.mode = S_IRUGO,
+		.owner = THIS_MODULE,
+	},
+	.size = W1_SLAVE_DATA_SIZE,
+	.read = w1_therm_read_bin,
+};
+
+static int w1_therm_add_slave(struct w1_slave *sl)
+{
+	return sysfs_create_bin_file(&sl->dev.kobj, &w1_therm_bin_attr);
+}
+
+static void w1_therm_remove_slave(struct w1_slave *sl)
+{
+	sysfs_remove_bin_file(&sl->dev.kobj, &w1_therm_bin_attr);
+}
+
 static struct w1_family_ops w1_therm_fops = {
-	.rname = &w1_therm_read_name,
-	.rbin = &w1_therm_read_bin,
+	.add_slave	= w1_therm_add_slave,
+	.remove_slave	= w1_therm_remove_slave,
 };
 
 static struct w1_family w1_therm_family_DS18S20 = {
@@ -59,6 +78,7 @@ static struct w1_family w1_therm_family_
 	.fid = W1_THERM_DS18B20,
 	.fops = &w1_therm_fops,
 };
+
 static struct w1_family w1_therm_family_DS1822 = {
 	.fid = W1_THERM_DS1822,
 	.fops = &w1_therm_fops,
@@ -90,12 +110,6 @@ static struct w1_therm_family_converter 
 	},
 };
 
-static ssize_t w1_therm_read_name(struct device *dev, struct device_attribute *attr, char *buf)
-{
-	struct w1_slave *sl = dev_to_w1_slave(dev);
-	return sprintf(buf, "%s\n", sl->name);
-}
-
 static inline int w1_DS18B20_convert_temp(u8 rom[9])
 {
 	int t = (rom[1] << 8) | rom[0];
author
#8 lore raw

PATCH 1/1 w1: Added inline functions on top of container_of().

[PATCH] w1: Added inline functions on top of container_of().

---
commit db2d0008de519c5db6baec45f7831e08790301cf
tree f100b05ab42f54740b967a24ba07d79518337f8e
parent 5e8eb8501212eb92826ccf191f9ca8c186f531c3
author Evgeniy Polyakov <[email protected]> Thu, 11 Aug 2005 17:27:49 +0400 committer Greg Kroah-Hartman <[email protected]> Thu, 08 Sep 2005 14:41:26 -0700

 drivers/w1/w1.c       |   22 ++++++++++------------
 drivers/w1/w1.h       |   15 +++++++++++++++
 drivers/w1/w1_smem.c  |    6 ++----
 drivers/w1/w1_therm.c |    6 ++----
 4 files changed, 29 insertions(+), 20 deletions(-)
drivers/w1/w1.c +10 -12
@@ -89,15 +89,13 @@ static int w1_master_remove(struct devic
 
 static void w1_master_release(struct device *dev)
 {
-	struct w1_master *md = container_of(dev, struct w1_master, dev);
-
+	struct w1_master *md = dev_to_w1_master(dev);
 	complete(&md->dev_released);
 }
 
 static void w1_slave_release(struct device *dev)
 {
-	struct w1_slave *sl = container_of(dev, struct w1_slave, dev);
-
+	struct w1_slave *sl = dev_to_w1_slave(dev);
 	complete(&sl->dev_released);
 }
 
@@ -162,7 +160,7 @@ struct device w1_slave_device = {
 
 static ssize_t w1_master_attribute_show_name(struct device *dev, struct device_attribute *attr, char *buf)
 {
-	struct w1_master *md = container_of(dev, struct w1_master, dev);
+	struct w1_master *md = dev_to_w1_master(dev);
 	ssize_t count;
 
 	if (down_interruptible (&md->mutex))
@@ -179,7 +177,7 @@ static ssize_t w1_master_attribute_store
 						struct device_attribute *attr,
 						const char * buf, size_t count)
 {
-	struct w1_master *md = container_of(dev, struct w1_master, dev);
+	struct w1_master *md = dev_to_w1_master(dev);
 
 	if (down_interruptible (&md->mutex))
 		return -EBUSY;
@@ -195,7 +193,7 @@ static ssize_t w1_master_attribute_show_
 					       struct device_attribute *attr,
 					       char *buf)
 {
-	struct w1_master *md = container_of(dev, struct w1_master, dev);
+	struct w1_master *md = dev_to_w1_master(dev);
 	ssize_t count;
 
 	if (down_interruptible (&md->mutex))
@@ -210,7 +208,7 @@ static ssize_t w1_master_attribute_show_
 
 static ssize_t w1_master_attribute_show_pointer(struct device *dev, struct device_attribute *attr, char *buf)
 {
-	struct w1_master *md = container_of(dev, struct w1_master, dev);
+	struct w1_master *md = dev_to_w1_master(dev);
 	ssize_t count;
 
 	if (down_interruptible(&md->mutex))
@@ -231,7 +229,7 @@ static ssize_t w1_master_attribute_show_
 
 static ssize_t w1_master_attribute_show_max_slave_count(struct device *dev, struct device_attribute *attr, char *buf)
 {
-	struct w1_master *md = container_of(dev, struct w1_master, dev);
+	struct w1_master *md = dev_to_w1_master(dev);
 	ssize_t count;
 
 	if (down_interruptible(&md->mutex))
@@ -245,7 +243,7 @@ static ssize_t w1_master_attribute_show_
 
 static ssize_t w1_master_attribute_show_attempts(struct device *dev, struct device_attribute *attr, char *buf)
 {
-	struct w1_master *md = container_of(dev, struct w1_master, dev);
+	struct w1_master *md = dev_to_w1_master(dev);
 	ssize_t count;
 
 	if (down_interruptible(&md->mutex))
@@ -259,7 +257,7 @@ static ssize_t w1_master_attribute_show_
 
 static ssize_t w1_master_attribute_show_slave_count(struct device *dev, struct device_attribute *attr, char *buf)
 {
-	struct w1_master *md = container_of(dev, struct w1_master, dev);
+	struct w1_master *md = dev_to_w1_master(dev);
 	ssize_t count;
 
 	if (down_interruptible(&md->mutex))
@@ -273,7 +271,7 @@ static ssize_t w1_master_attribute_show_
 
 static ssize_t w1_master_attribute_show_slaves(struct device *dev, struct device_attribute *attr, char *buf)
 {
-	struct w1_master *md = container_of(dev, struct w1_master, dev);
+	struct w1_master *md = dev_to_w1_master(dev);
 	int c = PAGE_SIZE;
 
 	if (down_interruptible(&md->mutex))
drivers/w1/w1.h +15 -0
@@ -191,6 +191,21 @@ struct w1_master
 int w1_create_master_attributes(struct w1_master *);
 void w1_search(struct w1_master *dev, w1_slave_found_callback cb);
 
+static inline struct w1_slave* dev_to_w1_slave(struct device *dev)
+{
+	return container_of(dev, struct w1_slave, dev);
+}
+
+static inline struct w1_slave* kobj_to_w1_slave(struct kobject *kobj)
+{
+	return dev_to_w1_slave(container_of(kobj, struct device, kobj));
+}
+
+static inline struct w1_master* dev_to_w1_master(struct device *dev)
+{
+	return container_of(dev, struct w1_master, dev);
+}
+
 #endif /* __KERNEL__ */
 
 #endif /* __W1_H */
drivers/w1/w1_smem.c +2 -4
@@ -46,15 +46,13 @@ static struct w1_family_ops w1_smem_fops
 
 static ssize_t w1_smem_read_name(struct device *dev, struct device_attribute *attr, char *buf)
 {
-	struct w1_slave *sl = container_of(dev, struct w1_slave, dev);
-
+	struct w1_slave *sl = dev_to_w1_slave(dev);
 	return sprintf(buf, "%s\n", sl->name);
 }
 
 static ssize_t w1_smem_read_bin(struct kobject *kobj, char *buf, loff_t off, size_t count)
 {
-	struct w1_slave *sl = container_of(container_of(kobj, struct device, kobj),
-					   struct w1_slave, dev);
+	struct w1_slave *sl = kobj_to_w1_slave(kobj);
 	int i;
 
 	atomic_inc(&sl->refcnt);
drivers/w1/w1_therm.c +2 -4
@@ -92,8 +92,7 @@ static struct w1_therm_family_converter 
 
 static ssize_t w1_therm_read_name(struct device *dev, struct device_attribute *attr, char *buf)
 {
-	struct w1_slave *sl = container_of(dev, struct w1_slave, dev);
-
+	struct w1_slave *sl = dev_to_w1_slave(dev);
 	return sprintf(buf, "%s\n", sl->name);
 }
 
@@ -148,8 +147,7 @@ static int w1_therm_check_rom(u8 rom[9])
 
 static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, size_t count)
 {
-	struct w1_slave *sl = container_of(container_of(kobj, struct device, kobj),
-					   struct w1_slave, dev);
+	struct w1_slave *sl = kobj_to_w1_slave(kobj);
 	struct w1_master *dev = sl->master;
 	u8 rom[9], crc, verdict;
 	int i, max_trying = 10;
author
#9 lore raw

PATCH 1/1 w1: Added w1_reset_select_slave() - Resets the bus and then selects the slave by

[PATCH] w1: Added w1_reset_select_slave() - Resets the bus and then selects the slave by

sending either a skip rom or a rom match.

Patch from Ben Gardner <[email protected]>

---
commit ea7d8f65c865ebfa1d7cd67c360a87333ff013c1
tree 1e687c32d53a92c10a61fb23ab14763459ff5779
parent db2d0008de519c5db6baec45f7831e08790301cf
author Evgeniy Polyakov <[email protected]> Thu, 11 Aug 2005 17:27:49 +0400 committer Greg Kroah-Hartman <[email protected]> Thu, 08 Sep 2005 14:41:26 -0700

 drivers/w1/w1_io.c    |   24 ++++++++++++++++++++++++
 drivers/w1/w1_io.h    |    1 +
 drivers/w1/w1_therm.c |   11 ++---------
 3 files changed, 27 insertions(+), 9 deletions(-)
drivers/w1/w1_io.c +24 -0
@@ -277,6 +277,29 @@ void w1_search_devices(struct w1_master 
 		w1_search(dev, cb);
 }
 
+/**
+ * Resets the bus and then selects the slave by sending either a skip rom
+ * or a rom match.
+ * The w1 master lock must be held.
+ *
+ * @param sl	the slave to select
+ * @return 	0=success, anything else=error
+ */
+int w1_reset_select_slave(struct w1_slave *sl)
+{
+	if (w1_reset_bus(sl->master))
+		return -1;
+
+	if (sl->master->slave_count == 1)
+		w1_write_8(sl->master, W1_SKIP_ROM);
+	else {
+		u8 match[9] = {W1_MATCH_ROM, };
+		memcpy(&match[1], (u8 *)&sl->reg_num, 8);
+		w1_write_block(sl->master, match, 9);
+	}
+	return 0;
+}
+
 EXPORT_SYMBOL(w1_touch_bit);
 EXPORT_SYMBOL(w1_write_8);
 EXPORT_SYMBOL(w1_read_8);
@@ -286,3 +309,4 @@ EXPORT_SYMBOL(w1_delay);
 EXPORT_SYMBOL(w1_read_block);
 EXPORT_SYMBOL(w1_write_block);
 EXPORT_SYMBOL(w1_search_devices);
+EXPORT_SYMBOL(w1_reset_select_slave);
drivers/w1/w1_io.h +1 -0
@@ -34,5 +34,6 @@ u8 w1_calc_crc8(u8 *, int);
 void w1_write_block(struct w1_master *, const u8 *, int);
 u8 w1_read_block(struct w1_master *, u8 *, int);
 void w1_search_devices(struct w1_master *dev, w1_slave_found_callback cb);
+int w1_reset_select_slave(struct w1_slave *sl);
 
 #endif /* __W1_IO_H */
drivers/w1/w1_therm.c +2 -9
@@ -176,15 +176,10 @@ static ssize_t w1_therm_read_bin(struct 
 	crc = 0;
 
 	while (max_trying--) {
-		if (!w1_reset_bus (dev)) {
+		if (!w1_reset_select_slave(sl)) {
 			int count = 0;
-			u8 match[9] = {W1_MATCH_ROM, };
 			unsigned int tm = 750;
 
-			memcpy(&match[1], (u64 *) & sl->reg_num, 8);
-
-			w1_write_block(dev, match, 9);
-
 			w1_write_8(dev, W1_CONVERT_TEMP);
 
 			while (tm) {
@@ -193,8 +188,7 @@ static ssize_t w1_therm_read_bin(struct 
 					flush_signals(current);
 			}
 
-			if (!w1_reset_bus (dev)) {
-				w1_write_block(dev, match, 9);
+			if (!w1_reset_select_slave(sl)) {
 
 				w1_write_8(dev, W1_READ_SCRATCHPAD);
 				if ((count = w1_read_block(dev, rom, 9)) != 9) {
@@ -205,7 +199,6 @@ static ssize_t w1_therm_read_bin(struct 
 
 				if (rom[8] == crc && rom[0])
 					verdict = 1;
-
 			}
 		}
 
author
#10 lore raw

PATCH 1/1 w1_ds2433: Added crc16 protection and read caching.

[PATCH] w1_ds2433: Added crc16 protection and read caching.

The changes to ds2433 to add CRC16 protection and read caching.

---
commit 0a25e4d5647003a32ba5496f9d0f40ba9c1e3863
tree 678a0f192d7b72270ea3431f642baca9566a249b
parent a45f105ad4b456f99f622642056ae533f70710b7
author Evgeniy Polyakov <[email protected]> Wed, 17 Aug 2005 15:24:37 +0400 committer Greg Kroah-Hartman <[email protected]> Thu, 08 Sep 2005 14:41:27 -0700

 drivers/w1/Kconfig     |    9 ++++
 drivers/w1/Makefile    |    6 ++
 drivers/w1/w1_ds2433.c |  117 ++++++++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 125 insertions(+), 7 deletions(-)
drivers/w1/Kconfig +9 -0
@@ -61,4 +61,13 @@ config W1_DS2433
 	  Say Y here if you want to use a 1-wire
 	  4kb EEPROM family device (DS2433).
 
+config W1_DS2433_CRC
+	bool "Protect DS2433 data with a CRC16"
+	depends on W1_DS2433
+	select CRC16
+	help
+	  Say Y here to protect DS2433 data with a CRC16.
+	  Each block has 30 bytes of data and a two byte CRC16.
+	  Full block writes are only allowed if the CRC is valid.
+
 endmenu
drivers/w1/Makefile +5 -1
@@ -6,6 +6,10 @@ ifneq ($(CONFIG_NET), y)
 EXTRA_CFLAGS	+= -DNETLINK_DISABLED
 endif
 
+ifeq ($(CONFIG_W1_DS2433_CRC), y)
+EXTRA_CFLAGS	+= -DCONFIG_W1_F23_CRC
+endif
+
 obj-$(CONFIG_W1)	+= wire.o
 wire-objs		:= w1.o w1_int.o w1_family.o w1_netlink.o w1_io.o
 
@@ -13,7 +17,7 @@ obj-$(CONFIG_W1_MATROX)		+= matrox_w1.o
 obj-$(CONFIG_W1_THERM)		+= w1_therm.o
 obj-$(CONFIG_W1_SMEM)		+= w1_smem.o
 
-obj-$(CONFIG_W1_DS9490)		+= ds9490r.o 
+obj-$(CONFIG_W1_DS9490)		+= ds9490r.o
 ds9490r-objs    := dscore.o
 
 obj-$(CONFIG_W1_DS9490_BRIDGE)	+= ds_w1_bridge.o
drivers/w1/w1_ds2433.c +111 -6

189 lines not on this page · raw message

author
#11 lore raw

PATCH 1/1 lib/crc16: added crc16 algorithm.

[PATCH] lib/crc16: added crc16 algorithm.

Add the crc16 routines, as used by w1 devices.

---
commit 7657ec1fcb69e266ab876af56332d0c484ca6d00
tree 6118ceffa2f83f43c3086941d96011dc1abeb459
parent a3d65f254274567daa89d8b99ab3d481d60fcaef
author Evgeniy Polyakov <[email protected]> Wed, 17 Aug 2005 15:17:26 +0400 committer Greg Kroah-Hartman <[email protected]> Thu, 08 Sep 2005 14:41:27 -0700

 include/linux/crc16.h |   44 ++++++++++++++++++++++++++++++++
 lib/Kconfig           |    8 ++++++
 lib/Makefile          |    3 +-
 lib/crc16.c           |   67 +++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 121 insertions(+), 1 deletions(-)
include/linux/crc16.h new file +44 -0
new file mode 100644
@@ -0,0 +1,44 @@
+/*
+ *	crc16.h - CRC-16 routine
+ *
+ * Implements the standard CRC-16, as used with 1-wire devices:
+ *   Width 16
+ *   Poly  0x8005 (x^16 + x^15 + x^2 + 1)
+ *   Init  0
+ *
+ * For 1-wire devices, the CRC is stored inverted, LSB-first
+ *
+ * Example buffer with the CRC attached:
+ *   31 32 33 34 35 36 37 38 39 C2 44
+ *
+ * The CRC over a buffer with the CRC attached is 0xB001.
+ * So, if (crc16(0, buf, size) == 0xB001) then the buffer is valid.
+ *
+ * Refer to "Application Note 937: Book of iButton Standards" for details.
+ * http://www.maxim-ic.com/appnotes.cfm/appnote_number/937
+ *
+ * Copyright (c) 2005 Ben Gardner <[email protected]>
+ *
+ * This source code is licensed under the GNU General Public License,
+ * Version 2. See the file COPYING for more details.
+ */
+
+#ifndef __CRC16_H
+#define __CRC16_H
+
+#include <linux/types.h>
+
+#define CRC16_INIT		0
+#define CRC16_VALID		0xb001
+
+extern u16 const crc16_table[256];
+
+extern u16 crc16(u16 crc, const u8 *buffer, size_t len);
+
+static inline u16 crc16_byte(u16 crc, const u8 data)
+{
+	return (crc >> 8) ^ crc16_table[(crc ^ data) & 0xff];
+}
+
+#endif /* __CRC16_H */
+
lib/Kconfig +8 -0
@@ -12,6 +12,14 @@ config CRC_CCITT
 	  the kernel tree does. Such modules that use library CRC-CCITT
 	  functions require M here.
 
+config CRC16
+	tristate "CRC16 functions"
+	help
+	  This option is provided for the case where no in-kernel-tree
+	  modules require CRC16 functions, but a module built outside
+	  the kernel tree does. Such modules that use library CRC16
+	  functions require M here.
+
 config CRC32
 	tristate "CRC32 functions"
 	default y
lib/Makefile +2 -1
@@ -23,11 +23,12 @@ lib-$(CONFIG_GENERIC_FIND_NEXT_BIT) += f
 obj-$(CONFIG_LOCK_KERNEL) += kernel_lock.o
 obj-$(CONFIG_DEBUG_PREEMPT) += smp_processor_id.o
 
-ifneq ($(CONFIG_HAVE_DEC_LOCK),y) 
+ifneq ($(CONFIG_HAVE_DEC_LOCK),y)
   lib-y += dec_and_lock.o
 endif
 
 obj-$(CONFIG_CRC_CCITT)	+= crc-ccitt.o
+obj-$(CONFIG_CRC16)	+= crc16.o
 obj-$(CONFIG_CRC32)	+= crc32.o
 obj-$(CONFIG_LIBCRC32C)	+= libcrc32c.o
 obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
lib/crc16.c new file +67 -0

67 lines not on this page · raw message

author
#12 lore raw

PATCH 1/1 w1: Decreased debug level.

[PATCH] w1: Decreased debug level.

---
commit 7c8f5703de91ade517d4fd6c3cc8e08dbba2b739
tree aa01c3513c66569f9626a51978cd82b10fd6615e
parent 3aca692d3ec7cf89da4575f598e41f74502b22d7
author Evgeniy Polyakov <[email protected]> Thu, 11 Aug 2005 17:27:50 +0400 committer Greg Kroah-Hartman <[email protected]> Thu, 08 Sep 2005 14:41:27 -0700

 drivers/w1/w1.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
drivers/w1/w1.c +4 -6
@@ -527,8 +527,6 @@ static int w1_attach_slave_device(struct
 	msg.type = W1_SLAVE_ADD;
 	w1_netlink_send(dev, &msg);
 
-	dev_info(&dev->dev, "Finished %s for sl=%p.\n", __func__, sl);
-
 	return 0;
 }
 
@@ -536,7 +534,7 @@ static void w1_slave_detach(struct w1_sl
 {
 	struct w1_netlink_msg msg;
 
-	dev_info(&sl->dev, "%s: detaching %s [%p].\n", __func__, sl->name, sl);
+	dev_dbg(&sl->dev, "%s: detaching %s [%p].\n", __func__, sl->name, sl);
 
 	list_del(&sl->w1_slave_entry);
 
@@ -579,7 +577,7 @@ void w1_reconnect_slaves(struct w1_famil
 
 	spin_lock_bh(&w1_mlock);
 	list_for_each_entry(dev, &w1_masters, w1_master_entry) {
-		dev_info(&dev->dev, "Reconnecting slaves in %s into new family %02x.\n",
+		dev_dbg(&dev->dev, "Reconnecting slaves in %s into new family %02x.\n",
 				dev->name, f->fid);
 		set_bit(W1_MASTER_NEED_RECONNECT, &dev->flags);
 	}
@@ -768,7 +766,7 @@ static int w1_control(void *data)
 			}
 
 			if (test_bit(W1_MASTER_NEED_RECONNECT, &dev->flags)) {
-				dev_info(&dev->dev, "Reconnecting slaves in device %s.\n", dev->name);
+				dev_dbg(&dev->dev, "Reconnecting slaves in device %s.\n", dev->name);
 				down(&dev->mutex);
 				list_for_each_entry_safe(sl, sln, &dev->slist, w1_slave_entry) {
 					if (sl->family->fid == W1_FAMILY_DEFAULT) {
@@ -780,7 +778,7 @@ static int w1_control(void *data)
 						w1_attach_slave_device(dev, &rn);
 					}
 				}
-				dev_info(&dev->dev, "Reconnecting slaves in device %s has been finished.\n", dev->name);
+				dev_dbg(&dev->dev, "Reconnecting slaves in device %s has been finished.\n", dev->name);
 				clear_bit(W1_MASTER_NEED_RECONNECT, &dev->flags);
 				up(&dev->mutex);
 			}
author
#13 lore raw

PATCH 1/1 w1: Added DS2433 driver.

[PATCH] w1: Added DS2433 driver.

Work by Ben Gardner <[email protected]>.

---
commit 80895392c83e54653540e72e7d40573aac7ee690
tree 3fb57983caf779f0648baebf18672f232a3c8c58
parent 7c8f5703de91ade517d4fd6c3cc8e08dbba2b739
author Evgeniy Polyakov <[email protected]> Thu, 11 Aug 2005 17:27:50 +0400 committer Greg Kroah-Hartman <[email protected]> Thu, 08 Sep 2005 14:41:27 -0700

 drivers/w1/Kconfig     |    7 ++
 drivers/w1/Makefile    |    1 
 drivers/w1/w1_ds2433.c |  222 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 230 insertions(+), 0 deletions(-)
drivers/w1/Kconfig +7 -0
@@ -54,4 +54,11 @@ config W1_SMEM
 	  Say Y here if you want to connect 1-wire
 	  simple 64bit memory rom(ds2401/ds2411/ds1990*) to you wire.
 
+config W1_DS2433
+	tristate "4kb EEPROM family support (DS2433)"
+	depends on W1
+	help
+	  Say Y here if you want to use a 1-wire
+	  4kb EEPROM family device (DS2433).
+
 endmenu
drivers/w1/Makefile +1 -0
@@ -18,3 +18,4 @@ ds9490r-objs    := dscore.o
 
 obj-$(CONFIG_W1_DS9490_BRIDGE)	+= ds_w1_bridge.o
 
+obj-$(CONFIG_W1_DS2433)		+= w1_ds2433.o
drivers/w1/w1_ds2433.c new file +222 -0

222 lines not on this page · raw message

author
#14 lore raw

PATCH 1/1 w1: Added DS2433 driver - family id update.

[PATCH] w1: Added DS2433 driver - family id update.

Work by Ben Gardner <[email protected]>.

---
commit a3d65f254274567daa89d8b99ab3d481d60fcaef
tree 4cdd137a5ec753c04a8da41a0f61ef034c92fe84
parent 80895392c83e54653540e72e7d40573aac7ee690
author Evgeniy Polyakov <[email protected]> Thu, 11 Aug 2005 17:27:50 +0400 committer Greg Kroah-Hartman <[email protected]> Thu, 08 Sep 2005 14:41:27 -0700

 drivers/w1/w1_family.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/w1/w1_family.h +1 -0
@@ -31,6 +31,7 @@
 #define W1_FAMILY_SMEM_81	0x81
 #define W1_THERM_DS18S20 	0x10
 #define W1_THERM_DS1822  	0x22
+#define W1_EEPROM_DS2433  	0x23
 #define W1_THERM_DS18B20 	0x28
 
 #define MAXNAMELEN		32
author
#15 lore raw

PATCH 1/1 w1: added private family data into w1_slave strucutre.

[PATCH] w1: added private family data into w1_slave strucutre.

Add family_data to struct w1_slave.

---
commit a45f105ad4b456f99f622642056ae533f70710b7
tree 67bc83922a2bbda6ecf4131ca69ab1626fe9937b
parent 7657ec1fcb69e266ab876af56332d0c484ca6d00
author Evgeniy Polyakov <[email protected]> Wed, 17 Aug 2005 15:19:08 +0400 committer Greg Kroah-Hartman <[email protected]> Thu, 08 Sep 2005 14:41:27 -0700

 drivers/w1/w1.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/w1/w1.h +1 -0
@@ -75,6 +75,7 @@ struct w1_slave
 
 	struct w1_master	*master;
 	struct w1_family	*family;
+	void			*family_data;
 	struct device		dev;
 	struct completion	released;
 };