public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] crc-itu-t: add bit-reversed calculation
@ 2009-04-13  2:33 Ben Hutchings
  2009-04-22 16:56 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Ben Hutchings @ 2009-04-13  2:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, David Woodhouse, Darren Salt

Signed-off-by: Darren Salt <linux@youmustbejoking.demon.co.uk>
---
 include/linux/crc-itu-t.h |   10 ++++++++++
 lib/crc-itu-t.c           |   18 ++++++++++++++++++
 2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/include/linux/crc-itu-t.h b/include/linux/crc-itu-t.h
index 84920f3..7b2b7ba 100644
--- a/include/linux/crc-itu-t.h
+++ b/include/linux/crc-itu-t.h
@@ -6,6 +6,9 @@
  *   Poly  0x0x1021 (x^16 + x^12 + x^15 + 1)
  *   Init  0
  *
+ * The bit-reversed buffer variants may be non-standard, but some firmware
+ * loaders require them.
+ *
  * This source code is licensed under the GNU General Public License,
  * Version 2. See the file COPYING for more details.
  */
@@ -14,15 +17,22 @@
 #define CRC_ITU_T_H
 
 #include <linux/types.h>
+#include <linux/bitrev.h>
 
 extern u16 const crc_itu_t_table[256];
 
 extern u16 crc_itu_t(u16 crc, const u8 *buffer, size_t len);
+extern u16 crc_itu_t_bitreversed(u16 crc, const u8 *buffer, size_t len);
 
 static inline u16 crc_itu_t_byte(u16 crc, const u8 data)
 {
 	return (crc << 8) ^ crc_itu_t_table[((crc >> 8) ^ data) & 0xff];
 }
 
+static inline u16 crc_itu_t_bitreversed_byte(u16 crc, const u8 data)
+{
+	return (crc << 8) ^ crc_itu_t_table[((crc >> 8) ^ bitrev8(data)) & 0xff];
+}
+
 #endif /* CRC_ITU_T_H */
 
diff --git a/lib/crc-itu-t.c b/lib/crc-itu-t.c
index a63472b..886981e 100644
--- a/lib/crc-itu-t.c
+++ b/lib/crc-itu-t.c
@@ -64,6 +64,24 @@ u16 crc_itu_t(u16 crc, const u8 *buffer, size_t len)
 }
 EXPORT_SYMBOL(crc_itu_t);
 
+/**
+ * crc_itu_t_byte_reversed - Compute the CRC-ITU-T for the data buffer;
+ * the buffer content is assumed to be bit-reversed
+ *
+ * @crc:     previous CRC value
+ * @buffer:  data pointer
+ * @len:     number of bytes in the buffer
+ *
+ * Returns the updated CRC value
+ */
+u16 crc_itu_t_bitreversed(u16 crc, const u8 *buffer, size_t len)
+{
+	while (len--)
+		crc = crc_itu_t_bitreversed_byte(crc, *buffer++);
+	return crc;
+}
+EXPORT_SYMBOL(crc_itu_t_bitreversed);
+
 MODULE_DESCRIPTION("CRC ITU-T V.41 calculations");
 MODULE_LICENSE("GPL");
 
-- 
1.5.6.5



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/3] crc-itu-t: add bit-reversed calculation
  2009-04-13  2:33 [PATCH 1/3] crc-itu-t: add bit-reversed calculation Ben Hutchings
@ 2009-04-22 16:56 ` Greg KH
  2009-04-22 18:32   ` Darren Salt
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2009-04-22 16:56 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: Greg Kroah-Hartman, linux-kernel, David Woodhouse, Darren Salt

On Mon, Apr 13, 2009 at 03:33:37AM +0100, Ben Hutchings wrote:
> Signed-off-by: Darren Salt <linux@youmustbejoking.demon.co.uk>

Who wrote this patch, you or Darren?

If you, do you "sign off" on it?  And if you did it, does Darren really
also sign off on it?

I see that David has added the firmware to the linux-firmware tree and
done a release, so I'll be glad to take these patches now.  Care to
respin them with the proper authorship and signed-off-by information
again?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/3] crc-itu-t: add bit-reversed calculation
  2009-04-22 16:56 ` Greg KH
@ 2009-04-22 18:32   ` Darren Salt
  2009-04-22 18:44     ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Darren Salt @ 2009-04-22 18:32 UTC (permalink / raw)
  To: Greg KH; +Cc: Ben Hutchings, Greg Kroah-Hartman, linux-kernel, David Woodhouse

I demand that Greg KH may or may not have written...

> On Mon, Apr 13, 2009 at 03:33:37AM +0100, Ben Hutchings wrote:
>> Signed-off-by: Darren Salt <linux@youmustbejoking.demon.co.uk>

> Who wrote this patch, you or Darren?

I did.
 
[snip]
-- 
| Darren Salt    | linux or ds at              | nr. Ashington, | Toon
| RISC OS, Linux | youmustbejoking,demon,co,uk | Northumberland | Army
|   Let's keep the pound sterling

He hath eaten me out of house and home.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/3] crc-itu-t: add bit-reversed calculation
  2009-04-22 18:32   ` Darren Salt
@ 2009-04-22 18:44     ` Greg KH
  2009-04-22 18:54       ` Ben Hutchings
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2009-04-22 18:44 UTC (permalink / raw)
  To: Greg KH, Ben Hutchings, linux-kernel, David Woodhouse,
	Darren Salt

On Wed, Apr 22, 2009 at 07:32:23PM +0100, Darren Salt wrote:
> I demand that Greg KH may or may not have written...
> 
> > On Mon, Apr 13, 2009 at 03:33:37AM +0100, Ben Hutchings wrote:
> >> Signed-off-by: Darren Salt <linux@youmustbejoking.demon.co.uk>
> 
> > Who wrote this patch, you or Darren?
> 
> I did.

Thanks.

Then Ben should keep that authorship information properly when he
forwards patches onward.  You can do this by putting:
	From: Darren Salt <email_address_here>
as the first line in the body of the email.  Our tools will properly
pick it up there and give the correct attribution.

Ben, does this make sense?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/3] crc-itu-t: add bit-reversed calculation
  2009-04-22 18:44     ` Greg KH
@ 2009-04-22 18:54       ` Ben Hutchings
  0 siblings, 0 replies; 5+ messages in thread
From: Ben Hutchings @ 2009-04-22 18:54 UTC (permalink / raw)
  To: Greg KH; +Cc: Greg KH, linux-kernel, David Woodhouse, Darren Salt

On Wed, Apr 22, 2009 at 11:44:09AM -0700, Greg KH wrote:
> On Wed, Apr 22, 2009 at 07:32:23PM +0100, Darren Salt wrote:
> > I demand that Greg KH may or may not have written...
> > 
> > > On Mon, Apr 13, 2009 at 03:33:37AM +0100, Ben Hutchings wrote:
> > >> Signed-off-by: Darren Salt <linux@youmustbejoking.demon.co.uk>
> > 
> > > Who wrote this patch, you or Darren?
> > 
> > I did.
> 
> Thanks.
> 
> Then Ben should keep that authorship information properly when he
> forwards patches onward.  You can do this by putting:
> 	From: Darren Salt <email_address_here>
> as the first line in the body of the email.  Our tools will properly
> pick it up there and give the correct attribution.
> 
> Ben, does this make sense?
 
Yes, that's what I usually do with other people's patches.  It was an
oversight in this case.

Ben.

-- 
Ben Hutchings
Reality is just a crutch for people who can't handle science fiction.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-04-22 18:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-13  2:33 [PATCH 1/3] crc-itu-t: add bit-reversed calculation Ben Hutchings
2009-04-22 16:56 ` Greg KH
2009-04-22 18:32   ` Darren Salt
2009-04-22 18:44     ` Greg KH
2009-04-22 18:54       ` Ben Hutchings

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox