mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: David Matlack <matlackdavid@gmail.com>
Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	devel@driverdev.osuosl.org, liodot@gmail.com,
	charrer@alacritech.com
Subject: Re: [PATCH 1/2] staging: slicoss: rewrite eeprom checksum code
Date: Sat, 17 May 2014 21:12:25 -0700	[thread overview]
Message-ID: <1400386345.14720.3.camel@joe-AO725> (raw)
In-Reply-To: <1400385604-21086-2-git-send-email-matlackdavid@gmail.com>

On Sat, 2014-05-17 at 21:00 -0700, David Matlack wrote:
[]
> diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
[]
> +static inline u16 __reduce(u32 checksum)
> +{
> +	u16 lower_16 = checksum & 0xFFFF;
> +	u16 upper_16 = (checksum >> 16) & 0xFFFF;
> +
> +	checksum = lower_16 + upper_16;
> +
> +	if (checksum > 65535)
> +		checksum -= 65535;
> +
> +	return checksum;
> +}

The if seems unnecessary.

Perhaps declare a u16 return var or use

	return lower_16 + upper_16;



  reply	other threads:[~2014-05-18  4:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-18  4:00 [PATCH 0/2] staging: slicoss: cleanup checksum computation David Matlack
2014-05-18  4:00 ` [PATCH 1/2] staging: slicoss: rewrite eeprom checksum code David Matlack
2014-05-18  4:12   ` Joe Perches [this message]
2014-05-18  4:51     ` David Matlack
2014-05-18 22:43       ` David Matlack
2014-05-19  9:16   ` Dan Carpenter
2014-05-19 20:49     ` David Matlack
2014-05-19 21:15       ` Dan Carpenter
2014-05-19 21:21       ` Dan Carpenter
2014-05-18  4:00 ` [PATCH 2/2] staging: slicoss: remove slic_reg_params struct David Matlack
2014-05-19  9:21   ` Dan Carpenter
2014-05-19 15:57     ` David Matlack
2014-05-19 19:52       ` Dan Carpenter
2014-05-19 20:54         ` David Matlack

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1400386345.14720.3.camel@joe-AO725 \
    --to=joe@perches.com \
    --cc=charrer@alacritech.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liodot@gmail.com \
    --cc=matlackdavid@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®