Skip to contentSkip to conversation

Dallas 1-wire protocol implementation.

RESEND2 Evgeniy Polyakov 1 participant 1 message May 19, 2005 W1 dallas's 1-wire bus

lore
Share & tools
lore
#0 lore raw

Second resend of Dallas' 1-wire protocol implementation. Patches are against 2.6.7-rc1 kernel.
Please consider for inclusion.

Thank you.

Quoted 34 lines
Quoted 7 lines · On Fri, 14 May 2004 15:15:26 -0700 Greg KH <[email protected]> wrote:
Quoted 2 lines · Evgeniy Polyakov

This patchset is in -p1 form with minor cleanup.
Please apply instead of previous.

Your coding style is still incorect with regards to the initial placement of the { character in a number of places. Please fix this.

Grr...
I've installed <fill yourself> indent and think that even oldmen Kernighan and Ritchie would like this patch :)

Quoted 19 lines

Also:

Review

Quoted 8 lines
(quoted diff) +8 -0
+ifeq ($(CONFIG_W1),y)
+obj-$(CONFIG_W1)		+= w1.o w1_int.o w1_family.o w1_netlink.o w1_io.o
+endif
+
+ifeq ($(CONFIG_W1),m)
+obj-m				+= wire.o
+wire-objs			:= w1.o w1_int.o w1_family.o w1_netlink.o w1_io.o
+endif

Why the difference here? Can't this be written as:

obj-$(CONFIG_W1) += wire.o

wire-objs		:= w1.o		\
			   w1_int.o	\
			   w1_family.o	\
			   w1_netlink.o	\
			   w1_io.o
Quoted 10 lines
Quoted 1 line

That should do the same thing, right?

Yes it does, although the former variant doesn't generate unneded object in case of non-modular build, but your variant is more clear.

Quoted 1 line

thanks,

Thank you.

Quoted 1 line

greg k-h

Evgeniy Polyakov ( s0mbre )

Only failure makes us experts. -- Theo de Raadt
-------------- next part --------------

MAINTAINERS renamed from MAINTAINERS.orig +6 -0
@@ -2336,6 +2336,12 @@
 M:	[email protected]
 S:	Maintained
 
+W1 DALLAS'S 1-WIRE BUS
+P:	Evgeniy Polyakov
+M:	[email protected]
+L:	[email protected]
+S:	Maintained
+
 WAN ROUTER & SANGOMA WANPIPE DRIVERS & API (X.25, FRAME RELAY, PPP, CISCO HDLC)
 P:	Nenad Corbic
 M:	[email protected]

-------------- next part --------------

drivers/Kconfig renamed from drivers/Kconfig~ +2 -0
@@ -42,6 +42,8 @@
 
 source "drivers/i2c/Kconfig"
 
+source "drivers/w1/Kconfig"
+
 source "drivers/misc/Kconfig"
 
 source "drivers/media/Kconfig"

-------------- next part --------------

drivers/Makefile renamed from drivers/Makefile~ +1 -0
@@ -42,6 +42,7 @@
 obj-$(CONFIG_SERIO)		+= input/serio/
 obj-$(CONFIG_I2O)		+= message/
 obj-$(CONFIG_I2C)		+= i2c/
+obj-$(CONFIG_W1)		+= w1/
 obj-$(CONFIG_PHONE)		+= telephony/
 obj-$(CONFIG_MD)		+= md/
 obj-$(CONFIG_BT)		+= bluetooth/

-------------- next part --------------

drivers/w1/Kconfig renamed from tmp/w1/Kconfig +31 -0
diff -Nru /tmp/w1/Kconfig linux-2.6/drivers/w1/Kconfig
@@ -0,0 +1,31 @@
+menu "Dallas's 1-wire bus"
+
+config W1
+	tristate "Dallas's 1-wire support"
+	---help---
+	  Dallas's 1-wire bus is usefull to connect slow 1-pin devices 
+	  such as iButtons and thermal sensors.
+	  
+	  If you want W1 support, you should say Y here.
+
+	  This W1 support can also be built as a module.  If so, the module
+	  will be called wire.ko.
+
+config W1_MATROX
+	tristate "Matrox G400 transport layer for 1-wire"
+	depends on W1
+	help
+	  Say Y here if you want to communicate with your 1-wire devices
+	  using Matrox's G400 GPIO pins.
+	  
+	  This support is also available as a module.  If so, the module 
+	  will be called matrox_w1.ko.
+
+config W1_THERM
+	tristate "Thermal family implementation"
+	depends on W1
+	help
+	  Say Y here if you want to connect 1-wire thermal sensors to you
+	  wire.
+
+endmenu
drivers/w1/Makefile renamed from tmp/w1/Makefile +9 -0
diff -Nru /tmp/w1/Makefile linux-2.6/drivers/w1/Makefile
@@ -0,0 +1,9 @@
+#
+# Makefile for the Dallas's 1-wire bus.
+#
+
+obj-$(CONFIG_W1)	+= wire.o
+wire-objs		:= w1.o w1_int.o w1_family.o w1_netlink.o w1_io.o
+
+obj-$(CONFIG_W1_MATROX)		+= matrox_w1.o
+obj-$(CONFIG_W1_THERM)		+= w1_therm.o
drivers/w1/matrox_w1.c renamed from tmp/w1/matrox_w1.c +259 -0

259 lines not on this page · raw message

drivers/w1/w1.c renamed from tmp/w1/w1.c +623 -0

623 lines not on this page · raw message

drivers/w1/w1.h renamed from tmp/w1/w1.h +112 -0

112 lines not on this page · raw message

drivers/w1/w1_family.c renamed from tmp/w1/w1_family.c +133 -0

133 lines not on this page · raw message

drivers/w1/w1_family.h renamed from tmp/w1/w1_family.h +65 -0

65 lines not on this page · raw message

drivers/w1/w1_int.c renamed from tmp/w1/w1_int.c +208 -0

208 lines not on this page · raw message

drivers/w1/w1_int.h renamed from tmp/w1/w1_int.h +36 -0
diff -Nru /tmp/w1/w1_int.h linux-2.6/drivers/w1/w1_int.h
@@ -0,0 +1,36 @@
+/*
+ * 	w1_int.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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __W1_INT_H
+#define __W1_INT_H
+
+#include <linux/kernel.h>
+#include <linux/device.h>
+
+#include "w1.h"
+
+struct w1_master * w1_alloc_dev(int, struct device_driver *, struct device *);
+void w1_free_dev(struct w1_master *dev);
+int w1_add_master_device(struct w1_bus_master *);
+void w1_remove_master_device(struct w1_bus_master *);
+void __w1_remove_master_device(struct w1_master *);
+
+#endif /* __W1_INT_H */
drivers/w1/w1_io.c renamed from tmp/w1/w1_io.c +138 -0

138 lines not on this page · raw message

drivers/w1/w1_io.h renamed from tmp/w1/w1_io.h +35 -0
diff -Nru /tmp/w1/w1_io.h linux-2.6/drivers/w1/w1_io.h
@@ -0,0 +1,35 @@
+/*
+ * 	w1_io.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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __W1_IO_H
+#define __W1_IO_H
+
+#include "w1.h"
+
+void w1_delay(unsigned long);
+void w1_write_bit(struct w1_master *, int);
+void w1_write_8(struct w1_master *, u8);
+u8 w1_read_bit(struct w1_master *);
+u8 w1_read_8(struct w1_master *);
+int w1_reset_bus(struct w1_master *);
+u8 w1_calc_crc8(u8 *, int);
+
+#endif /* __W1_IO_H */
drivers/w1/w1_log.h renamed from tmp/w1/w1_log.h +38 -0
diff -Nru /tmp/w1/w1_log.h linux-2.6/drivers/w1/w1_log.h
@@ -0,0 +1,38 @@
+/*
+ * 	w1_log.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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __W1_LOG_H
+#define __W1_LOG_H
+
+#define DEBUG
+
+#ifdef W1_DEBUG
+#  define assert(expr) do {} while (0)
+#else
+#  define assert(expr) \
+        if(unlikely(!(expr))) {				        \
+        printk(KERN_ERR "Assertion failed! %s,%s,%s,line=%d\n",	\
+        #expr,__FILE__,__FUNCTION__,__LINE__);		        \
+        }
+#endif
+
+#endif /* __W1_LOG_H */
+
drivers/w1/w1_netlink.c renamed from tmp/w1/w1_netlink.c +55 -0

55 lines not on this page · raw message

drivers/w1/w1_netlink.h renamed from tmp/w1/w1_netlink.h +44 -0

44 lines not on this page · raw message

drivers/w1/w1_therm.c renamed from tmp/w1/w1_therm.c +177 -0

177 lines not on this page · raw message