Skip to contentSkip to conversation

W1: Change the type 'unsigned long' member of 'struct w1_bus_master' to 'void *'.

PATCH New Greg KH 1 participant 6 messages Jan 20, 2006 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
author
#5 lore raw

PATCH 1/1 W1: Change the type 'unsigned long' member of 'struct w1_bus_master' to 'void *'.

In reply to Greg KH

[PATCH] W1: Change the type 'unsigned long' member of 'struct w1_bus_master' to 'void *'.

---
commit dc66784cd427bffa52cad9c615c409b1a597ed08
tree 7a79f765314178dbf716313537bf8dc6d5ed1940
parent 0f36b018b2e314d45af86449f1a97facb1fbe300
author Evgeniy Polyakov <[email protected]> Tue, 06 Dec 2005 13:38:27 +0300 committer Greg Kroah-Hartman <[email protected]> Thu, 19 Jan 2006 21:53:26 -0800

 drivers/w1/ds_w1_bridge.c |   34 +++++++++++++++++-----------------
 drivers/w1/matrox_w1.c    |   14 +++++++-------
 drivers/w1/w1.c           |    8 ++++----
 drivers/w1/w1.h           |   24 ++++++++++++------------
 4 files changed, 40 insertions(+), 40 deletions(-)
drivers/w1/ds_w1_bridge.c +17 -17
index a79d16d..29e01d5 100644
@@ -29,10 +29,10 @@
 static struct ds_device *ds_dev;
 static struct w1_bus_master *ds_bus_master;
 
-static u8 ds9490r_touch_bit(unsigned long data, u8 bit)
+static u8 ds9490r_touch_bit(void *data, u8 bit)
 {
 	u8 ret;
-	struct ds_device *dev = (struct ds_device *)data;
+	struct ds_device *dev = data;
 
 	if (ds_touch_bit(dev, bit, &ret))
 		return 0;
@@ -40,23 +40,23 @@ static u8 ds9490r_touch_bit(unsigned lon
 	return ret;
 }
 
-static void ds9490r_write_bit(unsigned long data, u8 bit)
+static void ds9490r_write_bit(void *data, u8 bit)
 {
-	struct ds_device *dev = (struct ds_device *)data;
+	struct ds_device *dev = data;
 
 	ds_write_bit(dev, bit);
 }
 
-static void ds9490r_write_byte(unsigned long data, u8 byte)
+static void ds9490r_write_byte(void *data, u8 byte)
 {
-	struct ds_device *dev = (struct ds_device *)data;
+	struct ds_device *dev = data;
 
 	ds_write_byte(dev, byte);
 }
 
-static u8 ds9490r_read_bit(unsigned long data)
+static u8 ds9490r_read_bit(void *data)
 {
-	struct ds_device *dev = (struct ds_device *)data;
+	struct ds_device *dev = data;
 	int err;
 	u8 bit = 0;
 
@@ -70,9 +70,9 @@ static u8 ds9490r_read_bit(unsigned long
 	return bit & 1;
 }
 
-static u8 ds9490r_read_byte(unsigned long data)
+static u8 ds9490r_read_byte(void *data)
 {
-	struct ds_device *dev = (struct ds_device *)data;
+	struct ds_device *dev = data;
 	int err;
 	u8 byte = 0;
 
@@ -83,16 +83,16 @@ static u8 ds9490r_read_byte(unsigned lon
 	return byte;
 }
 
-static void ds9490r_write_block(unsigned long data, const u8 *buf, int len)
+static void ds9490r_write_block(void *data, const u8 *buf, int len)
 {
-	struct ds_device *dev = (struct ds_device *)data;
+	struct ds_device *dev = data;
 
 	ds_write_block(dev, (u8 *)buf, len);
 }
 
-static u8 ds9490r_read_block(unsigned long data, u8 *buf, int len)
+static u8 ds9490r_read_block(void *data, u8 *buf, int len)
 {
-	struct ds_device *dev = (struct ds_device *)data;
+	struct ds_device *dev = data;
 	int err;
 
 	err = ds_read_block(dev, buf, len);
@@ -102,9 +102,9 @@ static u8 ds9490r_read_block(unsigned lo
 	return len;
 }
 
-static u8 ds9490r_reset(unsigned long data)
+static u8 ds9490r_reset(void *data)
 {
-	struct ds_device *dev = (struct ds_device *)data;
+	struct ds_device *dev = data;
 	struct ds_status st;
 	int err;
 
@@ -136,7 +136,7 @@ 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->data		= 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;
drivers/w1/matrox_w1.c +7 -7
index 0b03f8f..750a1aa 100644
@@ -90,8 +90,8 @@ struct matrox_device
 	struct w1_bus_master *bus_master;
 };
 
-static u8 matrox_w1_read_ddc_bit(unsigned long);
-static void matrox_w1_write_ddc_bit(unsigned long, u8);
+static u8 matrox_w1_read_ddc_bit(void *);
+static void matrox_w1_write_ddc_bit(void *, u8);
 
 /*
  * These functions read and write DDC Data bit.
@@ -122,10 +122,10 @@ static __inline__ void matrox_w1_write_r
 	wmb();
 }
 
-static void matrox_w1_write_ddc_bit(unsigned long data, u8 bit)
+static void matrox_w1_write_ddc_bit(void *data, u8 bit)
 {
 	u8 ret;
-	struct matrox_device *dev = (struct matrox_device *) data;
+	struct matrox_device *dev = data;
 
 	if (bit)
 		bit = 0;
@@ -137,10 +137,10 @@ static void matrox_w1_write_ddc_bit(unsi
 	matrox_w1_write_reg(dev, MATROX_GET_DATA, 0x00);
 }
 
-static u8 matrox_w1_read_ddc_bit(unsigned long data)
+static u8 matrox_w1_read_ddc_bit(void *data)
 {
 	u8 ret;
-	struct matrox_device *dev = (struct matrox_device *) data;
+	struct matrox_device *dev = data;
 
 	ret = matrox_w1_read_reg(dev, MATROX_GET_DATA);
 
@@ -198,7 +198,7 @@ static int __devinit matrox_w1_probe(str
 
 	matrox_w1_hw_init(dev);
 
-	dev->bus_master->data = (unsigned long) dev;
+	dev->bus_master->data = dev;
 	dev->bus_master->read_bit = &matrox_w1_read_ddc_bit;
 	dev->bus_master->write_bit = &matrox_w1_write_ddc_bit;
 
drivers/w1/w1.c +4 -4
index 024206c..f0b47fe 100644
@@ -552,7 +552,7 @@ static void w1_slave_detach(struct w1_sl
 	kfree(sl);
 }
 
-static struct w1_master *w1_search_master(unsigned long data)
+static struct w1_master *w1_search_master(void *data)
 {
 	struct w1_master *dev;
 	int found = 0;
@@ -583,7 +583,7 @@ void w1_reconnect_slaves(struct w1_famil
 	spin_unlock_bh(&w1_mlock);
 }
 
-static void w1_slave_found(unsigned long data, u64 rn)
+static void w1_slave_found(void *data, u64 rn)
 {
 	int slave_count;
 	struct w1_slave *sl;
@@ -595,8 +595,8 @@ static void w1_slave_found(unsigned long
 
 	dev = w1_search_master(data);
 	if (!dev) {
-		printk(KERN_ERR "Failed to find w1 master device for data %08lx, it is impossible.\n",
-				data);
+		printk(KERN_ERR "Failed to find w1 master device for data %p, "
+		       "it is impossible.\n", data);
 		return;
 	}
 
drivers/w1/w1.h +12 -12
index d890078..b62e771 100644
@@ -80,7 +80,7 @@ struct w1_slave
 	struct completion	released;
 };
 
-typedef void (* w1_slave_found_callback)(unsigned long, u64);
+typedef void (* w1_slave_found_callback)(void *, u64);
 
 
 /**
@@ -93,16 +93,16 @@ typedef void (* w1_slave_found_callback)
 struct w1_bus_master
 {
 	/** the first parameter in all the functions below */
-	unsigned long	data;
+	void		*data;
 
 	/**
 	 * Sample the line level
 	 * @return the level read (0 or 1)
 	 */
-	u8		(*read_bit)(unsigned long);
+	u8		(*read_bit)(void *);
 
 	/** Sets the line level */
-	void		(*write_bit)(unsigned long, u8);
+	void		(*write_bit)(void *, u8);
 
 	/**
 	 * touch_bit is the lowest-level function for devices that really
@@ -111,42 +111,42 @@ struct w1_bus_master
 	 * touch_bit(1) = write-1 / read cycle
 	 * @return the bit read (0 or 1)
 	 */
-	u8		(*touch_bit)(unsigned long, u8);
+	u8		(*touch_bit)(void *, u8);
 
 	/**
 	 * Reads a bytes. Same as 8 touch_bit(1) calls.
 	 * @return the byte read
 	 */
-	u8		(*read_byte)(unsigned long);
+	u8		(*read_byte)(void *);
 
 	/**
 	 * Writes a byte. Same as 8 touch_bit(x) calls.
 	 */
-	void		(*write_byte)(unsigned long, u8);
+	void		(*write_byte)(void *, u8);
 
 	/**
 	 * Same as a series of read_byte() calls
 	 * @return the number of bytes read
 	 */
-	u8		(*read_block)(unsigned long, u8 *, int);
+	u8		(*read_block)(void *, u8 *, int);
 
 	/** Same as a series of write_byte() calls */
-	void		(*write_block)(unsigned long, const u8 *, int);
+	void		(*write_block)(void *, const u8 *, int);
 
 	/**
 	 * Combines two reads and a smart write for ROM searches
 	 * @return bit0=Id bit1=comp_id bit2=dir_taken
 	 */
-	u8		(*triplet)(unsigned long, u8);
+	u8		(*triplet)(void *, u8);
 
 	/**
 	 * long write-0 with a read for the presence pulse detection
 	 * @return -1=Error, 0=Device present, 1=No device present
 	 */
-	u8		(*reset_bus)(unsigned long);
+	u8		(*reset_bus)(void *);
 
 	/** Really nice hardware can handles the ROM searches */
-	void		(*search)(unsigned long, w1_slave_found_callback);
+	void		(*search)(void *, w1_slave_found_callback);
 };
 
 #define W1_MASTER_NEED_EXIT		0
author
#2 lore raw

PATCH 1/1 W1: misc cleanups

In reply to Greg KH

[PATCH] W1: misc cleanups

This patch contains the following cleanups:
- make needlessly global code static
- declarations for global code belong into header files
- w1.c: #if 0 the unused struct w1_slave_device

---
commit 41e00d8d7535fc78425b8ac2436a7be3d4d2ccdf
tree c9947399f54f028ea739dc4d550bd0d1a1e702c0
parent 165f27bfefd691cb7d854379ea5ba9b4450ee510
author Adrian Bunk <[email protected]> Tue, 13 Dec 2005 14:04:33 -0800 committer Greg Kroah-Hartman <[email protected]> Thu, 19 Jan 2006 21:53:26 -0800

 drivers/w1/w1.c        |    6 ++++--
 drivers/w1/w1.h        |   10 ++++++++++
 drivers/w1/w1_family.c |    2 +-
 drivers/w1/w1_int.c    |   13 ++-----------
 drivers/w1/w1_io.c     |    2 +-
 5 files changed, 18 insertions(+), 15 deletions(-)
drivers/w1/w1.c +4 -2
index f0b47fe..5def7fb 100644
@@ -164,11 +164,12 @@ struct device w1_master_device = {
 	.release = &w1_master_release
 };
 
-struct device_driver w1_slave_driver = {
+static struct device_driver w1_slave_driver = {
 	.name = "w1_slave_driver",
 	.bus = &w1_bus_type,
 };
 
+#if 0
 struct device w1_slave_device = {
 	.parent = NULL,
 	.bus = &w1_bus_type,
@@ -176,6 +177,7 @@ struct device w1_slave_device = {
 	.driver = &w1_slave_driver,
 	.release = &w1_slave_release
 };
+#endif  /*  0  */
 
 static ssize_t w1_master_attribute_show_name(struct device *dev, struct device_attribute *attr, char *buf)
 {
@@ -355,7 +357,7 @@ int w1_create_master_attributes(struct w
 	return sysfs_create_group(&master->dev.kobj, &w1_master_defattr_group);
 }
 
-void w1_destroy_master_attributes(struct w1_master *master)
+static void w1_destroy_master_attributes(struct w1_master *master)
 {
 	sysfs_remove_group(&master->dev.kobj, &w1_master_defattr_group);
 }
drivers/w1/w1.h +10 -0
index b62e771..5f09213 100644
@@ -203,6 +203,16 @@ static inline struct w1_master* dev_to_w
 	return container_of(dev, struct w1_master, dev);
 }
 
+extern int w1_max_slave_count;
+extern int w1_max_slave_ttl;
+extern spinlock_t w1_mlock;
+extern struct list_head w1_masters;
+extern struct device_driver w1_master_driver;
+extern struct device w1_master_device;
+
+int w1_process(void *data);
+void w1_reconnect_slaves(struct w1_family *f);
+
 #endif /* __KERNEL__ */
 
 #endif /* __W1_H */
drivers/w1/w1_family.c +1 -1
index 9e293e1..0e32c11 100644
@@ -25,10 +25,10 @@
 #include <linux/delay.h>
 
 #include "w1_family.h"
+#include "w1.h"
 
 DEFINE_SPINLOCK(w1_flock);
 static LIST_HEAD(w1_families);
-extern void w1_reconnect_slaves(struct w1_family *f);
 
 int w1_register_family(struct w1_family *newf)
 {
drivers/w1/w1_int.c +2 -11
index c3f67ea..4724693 100644
@@ -26,19 +26,10 @@
 #include "w1.h"
 #include "w1_log.h"
 #include "w1_netlink.h"
+#include "w1_int.h"
 
 static u32 w1_ids = 1;
 
-extern struct device_driver w1_master_driver;
-extern struct bus_type w1_bus_type;
-extern struct device w1_master_device;
-extern int w1_max_slave_count;
-extern int w1_max_slave_ttl;
-extern struct list_head w1_masters;
-extern spinlock_t w1_mlock;
-
-extern int w1_process(void *);
-
 static struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl,
 				       struct device_driver *driver,
 				       struct device *device)
@@ -103,7 +94,7 @@ static struct w1_master * w1_alloc_dev(u
 	return dev;
 }
 
-void w1_free_dev(struct w1_master *dev)
+static void w1_free_dev(struct w1_master *dev)
 {
 	device_unregister(&dev->dev);
 }
drivers/w1/w1_io.c +1 -1
index e2a0433..f7f7e8b 100644
@@ -28,7 +28,7 @@
 #include "w1_log.h"
 #include "w1_io.h"
 
-int w1_delay_parm = 1;
+static int w1_delay_parm = 1;
 module_param_named(delay_coef, w1_delay_parm, int, 0);
 
 static u8 w1_crc8_table[] = {
author
#4 lore raw

PATCH 1/1 W1: Remove incorrect MODULE_ALIAS

In reply to Greg KH

[PATCH] W1: Remove incorrect MODULE_ALIAS

The w1 netlink socket is created by a hardware specific driver calling w1_add_master_device, so there is no point in including a module alias for netlink autoloading in the core.

---
commit c8d1a16495d65c58ac1454e33b124105db9eb4fd
tree d184d519cee36d595685abbcde303f4e9d2f164a
parent b6036c958a190777a16e89dc53088bd9fabfc2ff
author Patrick McHardy <[email protected]> Sun, 08 Jan 2006 00:44:15 +0100 committer Greg Kroah-Hartman <[email protected]> Thu, 19 Jan 2006 21:53:26 -0800

 drivers/w1/w1_int.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/w1/w1_int.c +0 -2
index 4724693..a2f9065 100644
@@ -208,5 +208,3 @@ void w1_remove_master_device(struct w1_b
 
 EXPORT_SYMBOL(w1_add_master_device);
 EXPORT_SYMBOL(w1_remove_master_device);
-
-MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_W1);

Greg KH

author
#1 lore raw

PATCH 1/1 W1: Add the DS2482 I2C-to-w1 bridge driver.

In reply to a message not in the archive

[PATCH] W1: Add the DS2482 I2C-to-w1 bridge driver.

---
commit 165f27bfefd691cb7d854379ea5ba9b4450ee510
tree 0ce370c7919f9646a25dc0db8729682a0ebadc0c
parent 136853f9a8a390aa80f3725613ee3c75dc027802
author Evgeniy Polyakov <[email protected]> Tue, 06 Dec 2005 13:38:28 +0300 committer Greg Kroah-Hartman <[email protected]> Thu, 19 Jan 2006 21:53:26 -0800

 Documentation/w1/masters/ds2482 |   31 ++
 drivers/w1/masters/Kconfig      |   10 +
 drivers/w1/masters/Makefile     |    2 
 drivers/w1/masters/ds2482.c     |  564 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 607 insertions(+), 0 deletions(-)
Documentation/w1/masters/ds2482 new file +31 -0
new file mode 100644
index 0000000..c5d5478
@@ -0,0 +1,31 @@
+Kernel driver ds2482
+====================
+
+Supported chips:
+  * Maxim DS2482-100, Maxim DS2482-800
+    Prefix: 'ds2482'
+    Addresses scanned: None
+    Datasheets:
+        http://pdfserv.maxim-ic.com/en/ds/DS2482-100-DS2482S-100.pdf
+        http://pdfserv.maxim-ic.com/en/ds/DS2482-800-DS2482S-800.pdf
+
+Author: Ben Gardner <[email protected]>
+
+
+Description
+-----------
+
+The Maixm/Dallas Semiconductor DS2482 is a I2C device that provides
+one (DS2482-100) or eight (DS2482-800) 1-wire busses.
+
+
+General Remarks
+---------------
+
+Valid addresses are 0x18, 0x19, 0x1a, and 0x1b.
+However, the device cannot be detected without writing to the i2c bus, so no
+detection is done.
+You should force the device address.
+
+$ modprobe ds2482 force=0,0x18
+
drivers/w1/masters/Kconfig +10 -0
index 51bd64d..1ff11b5 100644
@@ -34,5 +34,15 @@ config W1_MASTER_DS9490_BRIDGE
 	  This support is also available as a module.  If so, the module
 	  will be called ds_w1_bridge.ko.
 
+config W1_MASTER_DS2482
+	tristate "Maxim DS2482 I2C to 1-Wire bridge"
+	depends on I2C && W1 && EXPERIMENTAL
+	help
+	  If you say yes here you get support for the Maxim DS2482
+	  I2C to 1-Wire bridge.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called ds2482.
+
 endmenu
 
drivers/w1/masters/Makefile +2 -0
index d9b84e5..1f3c8b9 100644
@@ -9,3 +9,5 @@ ds9490r-objs    := dscore.o
 
 obj-$(CONFIG_W1_MASTER_DS9490_BRIDGE)	+= ds_w1_bridge.o
 
+obj-$(CONFIG_W1_MASTER_DS2482)		+= ds2482.o
+
drivers/w1/masters/ds2482.c new file +564 -0

564 lines not on this page · raw message

author
#3 lore raw

PATCH 1/1 W1: fix W1_MASTER_DS9490_BRIDGE dependencies

In reply to Greg KH

[PATCH] W1: fix W1_MASTER_DS9490_BRIDGE dependencies

W1_DS9490 was renamed to W1_MASTER_DS9490, but the entry in the dependencies of W1_MASTER_DS9490_BRIDGE was forgotten.

---
commit b6036c958a190777a16e89dc53088bd9fabfc2ff
tree 1583be4e025a9574b08ae7d8041edee0dafd7dc9
parent 41e00d8d7535fc78425b8ac2436a7be3d4d2ccdf
author Adrian Bunk <[email protected]> Fri, 06 Jan 2006 18:41:01 +0100 committer Greg Kroah-Hartman <[email protected]> Thu, 19 Jan 2006 21:53:26 -0800

 drivers/w1/masters/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/w1/masters/Kconfig +1 -1
index 1ff11b5..c6bad4d 100644
@@ -26,7 +26,7 @@ config W1_MASTER_DS9490
 
 config W1_MASTER_DS9490_BRIDGE
 	tristate "DS9490R USB <-> W1 transport layer for 1-wire"
-	depends on W1_DS9490
+	depends on W1_MASTER_DS9490
 	help
 	  Say Y here if you want to communicate with your 1-wire devices
 	  using DS9490R USB bridge.
author
#6 lore raw

PATCH 1/1 W1: u64 is not long long

In reply to Greg KH

[PATCH] W1: u64 is not long long

You don't know what type a u64 is, hence you cannot print it without a cast.

---
commit 607d7b2cdf6922fe9f567db52115c62d22ba4925
tree 5d9072e66c18a92c35def2e55c0450c3cb9ef6d7
parent c8d1a16495d65c58ac1454e33b124105db9eb4fd
author Andrew Morton <[email protected]> Sat, 14 Jan 2006 00:05:59 -0800 committer Greg Kroah-Hartman <[email protected]> Thu, 19 Jan 2006 21:53:27 -0800

 drivers/w1/w1.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
drivers/w1/w1.c +5 -2
index 5def7fb..d640c1e 100644
@@ -388,11 +388,14 @@ static int w1_uevent(struct device *dev,
 	if (dev->driver != &w1_slave_driver || !sl)
 		return 0;
 
-	err = add_uevent_var(envp, num_envp, &cur_index, buffer, buffer_size, &cur_len, "W1_FID=%02X", sl->reg_num.family);
+	err = add_uevent_var(envp, num_envp, &cur_index, buffer, buffer_size,
+			&cur_len, "W1_FID=%02X", sl->reg_num.family);
 	if (err)
 		return err;
 
-	err = add_uevent_var(envp, num_envp, &cur_index, buffer, buffer_size, &cur_len, "W1_SLAVE_ID=%024LX", (u64)sl->reg_num.id);
+	err = add_uevent_var(envp, num_envp, &cur_index, buffer, buffer_size,
+			&cur_len, "W1_SLAVE_ID=%024LX",
+			(unsigned long long)sl->reg_num.id);
 	if (err)
 		return err;