All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: Paul Walmsley <paul@pwsan.com>
Cc: Kevin Hilman <khilman@ti.com>,
	linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/3] OMAP: change get_context_loss_count ret value to int
Date: Fri, 27 May 2011 08:24:24 +0300	[thread overview]
Message-ID: <1306473864.1905.2.camel@deskari> (raw)
In-Reply-To: <alpine.DEB.2.00.1105261234130.27782@utopia.booyaka.com>

On Thu, 2011-05-26 at 12:37 -0600, Paul Walmsley wrote:
> Hello Tomi, Kevin,
> 
> On Thu, 26 May 2011, Tomi Valkeinen wrote:
> 
> > get_context_loss_count functions return context loss count as u32, and
> > zero means an error. However, zero is also returned when context has
> > never been lost and could also be returned when the context loss count
> > has wrapped and goes to zero.
> > 
> > Change the functions to return an int, with negative value meaning an
> > error.
> > 
> > OMAP HSMMC code uses omap_pm_get_dev_context_loss_count(), but as the
> > hsmmc code handles the returned value as an int, with negative value
> > meaning an error, this patch actually fixes hsmmc code also.
> 
> Thanks, I agree this makes more sense than the previous arrangement.
> 
> One minor comment:

<snip>

> > @@ -953,7 +953,13 @@ u32 pwrdm_get_context_loss_count(struct powerdomain *pwrdm)
> >  	for (i = 0; i < pwrdm->banks; i++)
> >  		count += pwrdm->ret_mem_off_counter[i];
> >  
> > -	pr_debug("powerdomain: %s: context loss count = %u\n",
> > +	/*
> > +	 * Context loss count has to be a non-negative value. Clear the sign
> > +	 * bit to get a value range from 0 to INT_MAX.
> > +	 */
> > +	count &= ~(1 << 31);
> 
> Could you use INT_MAX here?  It seems best not to have the implicit 
> dependency on 32-bit ints, if it is not too inconvenient.

Heh, Kevin made the same comment.

I didn't want to use INT_MAX because I feel INT_MAX is just a number,
not a mask. But as that's just a gut feeling, I'm fine with changing it
to INT_MAX.

 Tomi



WARNING: multiple messages have this Message-ID (diff)
From: tomi.valkeinen@ti.com (Tomi Valkeinen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] OMAP: change get_context_loss_count ret value to int
Date: Fri, 27 May 2011 08:24:24 +0300	[thread overview]
Message-ID: <1306473864.1905.2.camel@deskari> (raw)
In-Reply-To: <alpine.DEB.2.00.1105261234130.27782@utopia.booyaka.com>

On Thu, 2011-05-26 at 12:37 -0600, Paul Walmsley wrote:
> Hello Tomi, Kevin,
> 
> On Thu, 26 May 2011, Tomi Valkeinen wrote:
> 
> > get_context_loss_count functions return context loss count as u32, and
> > zero means an error. However, zero is also returned when context has
> > never been lost and could also be returned when the context loss count
> > has wrapped and goes to zero.
> > 
> > Change the functions to return an int, with negative value meaning an
> > error.
> > 
> > OMAP HSMMC code uses omap_pm_get_dev_context_loss_count(), but as the
> > hsmmc code handles the returned value as an int, with negative value
> > meaning an error, this patch actually fixes hsmmc code also.
> 
> Thanks, I agree this makes more sense than the previous arrangement.
> 
> One minor comment:

<snip>

> > @@ -953,7 +953,13 @@ u32 pwrdm_get_context_loss_count(struct powerdomain *pwrdm)
> >  	for (i = 0; i < pwrdm->banks; i++)
> >  		count += pwrdm->ret_mem_off_counter[i];
> >  
> > -	pr_debug("powerdomain: %s: context loss count = %u\n",
> > +	/*
> > +	 * Context loss count has to be a non-negative value. Clear the sign
> > +	 * bit to get a value range from 0 to INT_MAX.
> > +	 */
> > +	count &= ~(1 << 31);
> 
> Could you use INT_MAX here?  It seems best not to have the implicit 
> dependency on 32-bit ints, if it is not too inconvenient.

Heh, Kevin made the same comment.

I didn't want to use INT_MAX because I feel INT_MAX is just a number,
not a mask. But as that's just a gut feeling, I'm fine with changing it
to INT_MAX.

 Tomi

  reply	other threads:[~2011-05-27  5:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-26 16:45 [PATCH 0/3] Some omap_device/hwmod/pwrdomain patches Tomi Valkeinen
2011-05-26 16:45 ` Tomi Valkeinen
2011-05-26 16:45 ` [PATCH 1/3] OMAP: change get_context_loss_count ret value to int Tomi Valkeinen
2011-05-26 16:45   ` Tomi Valkeinen
2011-05-26 17:23   ` Kevin Hilman
2011-05-26 17:23     ` Kevin Hilman
2011-05-26 18:37   ` Paul Walmsley
2011-05-26 18:37     ` Paul Walmsley
2011-05-27  5:24     ` Tomi Valkeinen [this message]
2011-05-27  5:24       ` Tomi Valkeinen
2011-05-26 16:45 ` [PATCH 2/3] OMAP: add omap_device_reset() Tomi Valkeinen
2011-05-26 16:45   ` Tomi Valkeinen
2011-05-26 16:45 ` [PATCH 3/3] OMAP: Add (omap_device|omap_hwmod)_can_ever_lose_context functions Tomi Valkeinen
2011-05-26 16:45   ` Tomi Valkeinen
2011-05-26 17:30 ` [PATCH 0/3] Some omap_device/hwmod/pwrdomain patches Kevin Hilman
2011-05-26 17:30   ` Kevin Hilman
2011-05-27  5:31   ` Tomi Valkeinen
2011-05-27  5:31     ` Tomi Valkeinen
2011-05-27 14:57     ` Kevin Hilman
2011-05-27 14:57       ` Kevin Hilman

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=1306473864.1905.2.camel@deskari \
    --to=tomi.valkeinen@ti.com \
    --cc=khilman@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=paul@pwsan.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.