Skip to contentSkip to conversation

W1 patches for 2.6.13

PATCH In review Greg KH 4 participants 8 messages Sep 8, 2005 – Sep 12, 2005

Subsystems (2)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 W1 patches for 2.6.13

Here are some w1 patches that have been in the -mm tree for a while. They add a new driver, and fix up the netlink logic a lot. They also add a crc16 implementation that is needed.

Please pull from:

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

if it isn't synced up yet.

The full patch series will sent to the linux-kernel mailing lists, if anyone wants to see them.

thanks,

greg k-h

 drivers/w1/Kconfig        |   16 ++
 drivers/w1/Makefile       |    7 
 drivers/w1/ds_w1_bridge.c |   24 +--
 drivers/w1/dscore.c       |  161 +++++++++++----------
 drivers/w1/dscore.h       |   10 -
 drivers/w1/w1.c           |  336 ++++++++++++++++++++++++++++-----------------
 drivers/w1/w1.h           |   22 ++
 drivers/w1/w1_ds2433.c    |  339 +++++++++++++++++++++++++++++++++++++++++++++-
 drivers/w1/w1_family.c    |   11 -
 drivers/w1/w1_family.h    |    7 
 drivers/w1/w1_int.c       |   28 +--
 drivers/w1/w1_io.c        |   24 +++
 drivers/w1/w1_io.h        |    1 
 drivers/w1/w1_netlink.c   |   26 +++
 drivers/w1/w1_netlink.h   |    2 
 drivers/w1/w1_smem.c      |   53 -------
 drivers/w1/w1_therm.c     |   49 +++---
 include/linux/crc16.h     |   44 +++++
 lib/Kconfig               |    8 +
 lib/Makefile              |    3 
 lib/crc16.c               |   67 +++++++++
 21 files changed, 898 insertions(+), 340 deletions(-)

Evgeniy Polyakov:
W1: w1_netlink: New init/fini netlink callbacks.
w1: Detouching bug fixed.
w1: Fixed 64bit compilation warning.
w1: hotplug support.
W1: Sync with w1/ds9490 tree.
w1: Added add/remove slave callbacks.
w1: Added inline functions on top of container_of().
w1: Added w1_reset_select_slave() - Resets the bus and then selects the slave by
w1_ds2433: Added crc16 protection and read caching.
lib/crc16: added crc16 algorithm.
w1: Decreased debug level.
w1: Added DS2433 driver.
w1: Added DS2433 driver - family id update.
w1: added private family data into w1_slave strucutre.

#1 lore raw

Hi Greg,

Quoted 3 lines

Here are some w1 patches that have been in the -mm tree for a while. They add a new driver, and fix up the netlink logic a lot. They also add a crc16 implementation that is needed.

adding the CRC-16 is very cool. I was just about to submit one by my own, because it is also needed for the Bluetooth L2CAP retransmission and flow control support.

What about the 1-Wire notes inside the CRC-16 code. This suppose to be generic code and so this doesn't belong there.

Regards

Marcel

author
#2 lore raw
Quoted 6 lines · Marcel Holtmann

Hi Greg,

Quoted 3 lines

Here are some w1 patches that have been in the -mm tree for a while. They add a new driver, and fix up the netlink logic a lot. They also add a crc16 implementation that is needed.

Quoted 6 lines

adding the CRC-16 is very cool. I was just about to submit one by my own, because it is also needed for the Bluetooth L2CAP retransmission and flow control support.

What about the 1-Wire notes inside the CRC-16 code. This suppose to be generic code and so this doesn't belong there.

Yes, those comments don't belong there. Evgeniy, want to fix this?

thanks,

greg k-h

#3 lore raw
Quoted 7 lines · Greg KH
Quoted 6 lines · Marcel Holtmann

Hi Greg,

Quoted 3 lines

Here are some w1 patches that have been in the -mm tree for a while. They add a new driver, and fix up the netlink logic a lot. They also add a crc16 implementation that is needed.

Quoted 8 lines
Quoted 6 lines

adding the CRC-16 is very cool. I was just about to submit one by my own, because it is also needed for the Bluetooth L2CAP retransmission and flow control support.

What about the 1-Wire notes inside the CRC-16 code. This suppose to be generic code and so this doesn't belong there.

Yes, those comments don't belong there. Evgeniy, want to fix this?

No problem. Patch attached.

Quoted 3 lines

thanks,

greg k-h

Remove w1 specific comments from generic crc16 implementation.

include/linux/crc16.h +1 -15
@@ -1,22 +1,11 @@
 /*
  *	crc16.h - CRC-16 routine
  *
- * Implements the standard CRC-16, as used with 1-wire devices:
+ * Implements the standard CRC-16:
  *   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,
@@ -28,9 +17,6 @@
 
 #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);
Signature · 1 line
	Evgeniy Polyakov
#4 lore raw
Quoted 55 lines · Evgeniy Polyakov
Quoted 7 lines · Greg KH
Quoted 6 lines · Marcel Holtmann

Hi Greg,

Quoted 3 lines

Here are some w1 patches that have been in the -mm tree for a while. They add a new driver, and fix up the netlink logic a lot. They also add a crc16 implementation that is needed.

Quoted 8 lines
Quoted 6 lines

adding the CRC-16 is very cool. I was just about to submit one by my own, because it is also needed for the Bluetooth L2CAP retransmission and flow control support.

What about the 1-Wire notes inside the CRC-16 code. This suppose to be generic code and so this doesn't belong there.

Yes, those comments don't belong there. Evgeniy, want to fix this?

No problem. Patch attached.

Quoted 3 lines

thanks,

greg k-h

Remove w1 specific comments from generic crc16 implementation.

include/linux/crc16.h +1 -12
@@ -1,22 +1,11 @@
 /*
  *	crc16.h - CRC-16 routine
  *
- * Implements the standard CRC-16, as used with 1-wire devices:
+ * Implements the standard CRC-16:
  *   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,

include/linux/crc16.h line 33

Quoted 6 lines
include/linux/crc16.h +0 -3
@@ -28,9 +17,6 @@
 
 #include <linux/types.h>
 
-#define CRC16_INIT		0
-#define CRC16_VALID		0xb001
-

This breaks your w1 code:

	    CC [M]  drivers/w1/w1_ds2433.o
	  drivers/w1/w1_ds2433.c: In function `w1_f23_refresh_block':
	  drivers/w1/w1_ds2433.c:84: error: `CRC16_INIT' undeclared (first use in this function)
	  drivers/w1/w1_ds2433.c:84: error: (Each undeclared identifier is reported only once
	  drivers/w1/w1_ds2433.c:84: error: for each function it appears in.)
	  drivers/w1/w1_ds2433.c:84: error: `CRC16_VALID' undeclared (first use in this function)
	  drivers/w1/w1_ds2433.c: In function `w1_f23_write_bin':
	  drivers/w1/w1_ds2433.c:224: error: `CRC16_INIT' undeclared (first use in this function)
	  drivers/w1/w1_ds2433.c:224: error: `CRC16_VALID' undeclared (first use in this function)

So I'm not going to apply this :(

thanks,

greg k-h

#5 lore raw
Quoted 75 lines · GregKH
Quoted 55 lines · Evgeniy Polyakov
Quoted 7 lines · Greg KH
Quoted 6 lines · Marcel Holtmann

Hi Greg,

Quoted 3 lines

Here are some w1 patches that have been in the -mm tree for a while. They add a new driver, and fix up the netlink logic a lot. They also add a crc16 implementation that is needed.

Quoted 8 lines
Quoted 6 lines

adding the CRC-16 is very cool. I was just about to submit one by my own, because it is also needed for the Bluetooth L2CAP retransmission and flow control support.

What about the 1-Wire notes inside the CRC-16 code. This suppose to be generic code and so this doesn't belong there.

Yes, those comments don't belong there. Evgeniy, want to fix this?

No problem. Patch attached.

Quoted 3 lines

thanks,

greg k-h

Remove w1 specific comments from generic crc16 implementation.

include/linux/crc16.h +1 -12
@@ -1,22 +1,11 @@
 /*
  *	crc16.h - CRC-16 routine
  *
- * Implements the standard CRC-16, as used with 1-wire devices:
+ * Implements the standard CRC-16:
  *   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,

include/linux/crc16.h line 33

Quoted 6 lines
include/linux/crc16.h +0 -3
@@ -28,9 +17,6 @@
 
 #include <linux/types.h>
 
-#define CRC16_INIT		0
-#define CRC16_VALID		0xb001
-

This breaks your w1 code:

	    CC [M]  drivers/w1/w1_ds2433.o
	  drivers/w1/w1_ds2433.c: In function `w1_f23_refresh_block':
	  drivers/w1/w1_ds2433.c:84: error: `CRC16_INIT' undeclared (first use in this function)
	  drivers/w1/w1_ds2433.c:84: error: (Each undeclared identifier is reported only once
	  drivers/w1/w1_ds2433.c:84: error: for each function it appears in.)
	  drivers/w1/w1_ds2433.c:84: error: `CRC16_VALID' undeclared (first use in this function)
	  drivers/w1/w1_ds2433.c: In function `w1_f23_write_bin':
	  drivers/w1/w1_ds2433.c:224: error: `CRC16_INIT' undeclared (first use in this function)
	  drivers/w1/w1_ds2433.c:224: error: `CRC16_VALID' undeclared (first use in this function)
Quoted 1 line

So I'm not going to apply this :(

I'm sorry - quite far from testing machines...
Here is additional patch for ds_2433.c - it adds two missing defines.

drivers/w1/w1_ds2433.c renamed from drivers/w1/w1_ds2433.c.orig +4 -0
@@ -15,6 +15,10 @@
 #include <linux/delay.h>
 #ifdef CONFIG_W1_F23_CRC
 #include <linux/crc16.h>
+
+#define CRC16_INIT		0
+#define CRC16_VALID		0xb001
+
 #endif
 
 #include "w1.h"
Quoted 3 lines

thanks,

greg k-h

Signature · 1 line
	Evgeniy Polyakov
#6 lore raw

drivers/w1/w1_ds2433.c line 21

Quoted 13 lines · Evgeniy Polyakov

I'm sorry - quite far from testing machines...
Here is additional patch for ds_2433.c - it adds two missing defines.

drivers/w1/w1_ds2433.c renamed from drivers/w1/w1_ds2433.c.orig +4 -0
@@ -15,6 +15,10 @@
 #include <linux/delay.h>
 #ifdef CONFIG_W1_F23_CRC
 #include <linux/crc16.h>
+
+#define CRC16_INIT		0
+#define CRC16_VALID		0xb001
+

Ick, care to just respin the whole patch, with a proper Subject: and signed-off-line?

thanks,

greg k-h

#7 lore raw

PATCH 1/1 crc16: remove w1 specific comments.

Remove w1 comments from crc16.h and move specific constants into w1_ds2433.c where they are used. Replace %d with %zd.

drivers/w1/w1_ds2433.c +5 -1
@@ -15,6 +15,10 @@
 #include <linux/delay.h>
 #ifdef CONFIG_W1_F23_CRC
 #include <linux/crc16.h>
+
+#define CRC16_INIT		0
+#define CRC16_VALID		0xb001
+
 #endif
 
 #include "w1.h"
@@ -214,7 +218,7 @@ static ssize_t w1_f23_write_bin(struct k
 #ifdef CONFIG_W1_F23_CRC
 	/* can only write full blocks in cached mode */
 	if ((off & W1_PAGE_MASK) || (count & W1_PAGE_MASK)) {
-		dev_err(&sl->dev, "invalid offset/count off=%d cnt=%d\n",
+		dev_err(&sl->dev, "invalid offset/count off=%d cnt=%zd\n",
 			(int)off, count);
 		return -EINVAL;
 	}
include/linux/crc16.h +1 -15
@@ -1,22 +1,11 @@
 /*
  *	crc16.h - CRC-16 routine
  *
- * Implements the standard CRC-16, as used with 1-wire devices:
+ * Implements the standard CRC-16:
  *   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,
@@ -28,9 +17,6 @@
 
 #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);
Signature · 1 line
	Evgeniy Polyakov