2005-09-08 22:21:32

by Greg KH

[permalink] [raw]
Subject: [GIT PATCH] 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.



2005-09-08 23:30:32

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [GIT PATCH] W1 patches for 2.6.13

Hi Greg,

> 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


2005-09-09 03:31:09

by Greg KH

[permalink] [raw]
Subject: Re: [GIT PATCH] W1 patches for 2.6.13

On Fri, Sep 09, 2005 at 01:30:09AM +0200, Marcel Holtmann wrote:
> Hi Greg,
>
> > 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.

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

thanks,

greg k-h

2005-09-09 05:08:43

by Evgeniy Polyakov

[permalink] [raw]
Subject: Re: [GIT PATCH] W1 patches for 2.6.13

On Thu, Sep 08, 2005 at 08:30:36PM -0700, Greg KH ([email protected]) wrote:
> On Fri, Sep 09, 2005 at 01:30:09AM +0200, Marcel Holtmann wrote:
> > Hi Greg,
> >
> > > 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.
>
> Yes, those comments don't belong there. Evgeniy, want to fix this?

No problem. Patch attached.

> thanks,
>
> greg k-h

Remove w1 specific comments from generic crc16 implementation.

Signed-off-by: Evgeniy Polyakov <[email protected]>

diff --git a/include/linux/crc16.h b/include/linux/crc16.h
--- a/include/linux/crc16.h
+++ b/include/linux/crc16.h
@@ -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);

--
Evgeniy Polyakov

2005-09-09 21:38:19

by Greg KH

[permalink] [raw]
Subject: Re: [GIT PATCH] W1 patches for 2.6.13

On Fri, Sep 09, 2005 at 09:08:25AM +0400, Evgeniy Polyakov wrote:
> On Thu, Sep 08, 2005 at 08:30:36PM -0700, Greg KH ([email protected]) wrote:
> > On Fri, Sep 09, 2005 at 01:30:09AM +0200, Marcel Holtmann wrote:
> > > Hi Greg,
> > >
> > > > 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.
> >
> > Yes, those comments don't belong there. Evgeniy, want to fix this?
>
> No problem. Patch attached.
>
> > thanks,
> >
> > greg k-h
>
> Remove w1 specific comments from generic crc16 implementation.
>
> Signed-off-by: Evgeniy Polyakov <[email protected]>
>
> diff --git a/include/linux/crc16.h b/include/linux/crc16.h
> --- a/include/linux/crc16.h
> +++ b/include/linux/crc16.h
> @@ -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
> -

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

2005-09-09 22:00:57

by Evgeniy Polyakov

[permalink] [raw]
Subject: Re: [GIT PATCH] W1 patches for 2.6.13

On Fri, Sep 09, 2005 at 02:16:19PM -0700, GregKH ([email protected]) wrote:
> On Fri, Sep 09, 2005 at 09:08:25AM +0400, Evgeniy Polyakov wrote:
> > On Thu, Sep 08, 2005 at 08:30:36PM -0700, Greg KH ([email protected]) wrote:
> > > On Fri, Sep 09, 2005 at 01:30:09AM +0200, Marcel Holtmann wrote:
> > > > Hi Greg,
> > > >
> > > > > 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.
> > >
> > > Yes, those comments don't belong there. Evgeniy, want to fix this?
> >
> > No problem. Patch attached.
> >
> > > thanks,
> > >
> > > greg k-h
> >
> > Remove w1 specific comments from generic crc16 implementation.
> >
> > Signed-off-by: Evgeniy Polyakov <[email protected]>
> >
> > diff --git a/include/linux/crc16.h b/include/linux/crc16.h
> > --- a/include/linux/crc16.h
> > +++ b/include/linux/crc16.h
> > @@ -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
> > -
>
> 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 :(

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.orig 2005-09-10 01:59:41.000000000 +0400
+++ ./drivers/w1/w1_ds2433.c 2005-09-10 01:57:41.000000000 +0400
@@ -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"

> thanks,
>
> greg k-h

--
Evgeniy Polyakov

2005-09-09 22:20:30

by Greg KH

[permalink] [raw]
Subject: Re: [GIT PATCH] W1 patches for 2.6.13

On Sat, Sep 10, 2005 at 01:58:14AM +0400, Evgeniy Polyakov wrote:
> 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.orig 2005-09-10 01:59:41.000000000 +0400
> +++ ./drivers/w1/w1_ds2433.c 2005-09-10 01:57:41.000000000 +0400
> @@ -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

2005-09-12 13:13:11

by Evgeniy Polyakov

[permalink] [raw]
Subject: [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.

Signed-off-by: Evgeniy Polyakov <[email protected]>

diff --git a/drivers/w1/w1_ds2433.c b/drivers/w1/w1_ds2433.c
--- a/drivers/w1/w1_ds2433.c
+++ b/drivers/w1/w1_ds2433.c
@@ -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;
}
diff --git a/include/linux/crc16.h b/include/linux/crc16.h
--- a/include/linux/crc16.h
+++ b/include/linux/crc16.h
@@ -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);

--
Evgeniy Polyakov