All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Marc Reilly <marc@cpdesign.com.au>
Cc: "Shawn Guo" <shawn.guo@freescale.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Fabio Estevam" <festevam@gmail.com>,
	"Samuel Ortiz" <sameo@linux.intel.com>,
	"Sascha Hauer" <kernel@pengutronix.de>,
	"Philippe Rétornaz" <philippe.retornaz@epfl.ch>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: mc13xxx-core: kernel hangs after 'regmap_read'
Date: Thu, 24 May 2012 13:14:52 +0100	[thread overview]
Message-ID: <20120524121451.GL5361@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <201205242122.29648.marc@cpdesign.com.au>

On Thu, May 24, 2012 at 09:22:29PM +1000, Marc Reilly wrote:

> > > 	map->reg_shift = config->pad_bits % 8;
> > > 	map->format.buf_size = (config->reg_bits
> > > 	
> > >                           + config->val_bits
> > > 					         
> > > 					         + map->reg_shift) / 8;

> > Yes, that's been missed in the addition of padding.  We should also be
> > using DIV_ROUND_UP() which we aren't at the minute.  

> That would break, in _regmap_read_raw():

> 	ret = map->bus->read(map->bus_context, map->work_buf,
> 			     map->format.reg_bytes + map->format.pad_bytes,
> 			     val, val_len);

> If pad_bytes was 1 here, then the register size would end up being 2 bytes.

The above is about buf_size...  pad_bytes isn't in the quoted text which
is the issue.

> The way I understood the pad_bytes field was it was the number of _complete_ 
> padding bytes (ie, full 8 bits) between the register address and value. Any 
> remainder of padding bits is incorporated into the register and shifted by 
> shift bits.

Yes.

> > We could also do
> > reg_bytes + pad_bytes + val_bytes which should cover everything I think?

> If we want to cover everything, we could do reg_bytes + pad_bytes + val_bytes 
> + 3 ... :) (I'm not seriously suggesting that).

Yes, but the above should be the total that goes onto the wire.

  reply	other threads:[~2012-05-24 12:14 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-21 16:06 mc13xxx-core: kernel hangs after 'regmap_read' Fabio Estevam
2012-05-22  0:53 ` Marc Reilly
2012-05-22  9:25   ` Mark Brown
2012-05-22 11:40     ` Fabio Estevam
2012-05-22 12:48       ` Philippe Rétornaz
2012-05-22 14:45     ` Fabio Estevam
2012-05-23  1:12   ` Fabio Estevam
2012-05-23  2:05     ` Fabio Estevam
2012-05-23  8:49       ` Mark Brown
2012-05-23 14:18         ` Fabio Estevam
2012-05-23 15:29           ` Fabio Estevam
2012-05-23 17:36           ` Mark Brown
2012-05-23 19:32             ` Fabio Estevam
2012-05-23 16:42         ` Shawn Guo
2012-05-23 16:34           ` Fabio Estevam
2012-05-24  0:48             ` Shawn Guo
2012-05-24  4:07               ` Fabio Estevam
2012-05-24  6:04                 ` Shawn Guo
2012-05-24  6:39                 ` Shawn Guo
2012-05-24  6:46                   ` Uwe Kleine-König
2012-05-24  7:33                     ` Shawn Guo
2012-05-24  9:08                       ` Marc Reilly
2012-05-24 10:37                         ` Mark Brown
2012-05-24 11:22                           ` Marc Reilly
2012-05-24 12:14                             ` Mark Brown [this message]
2012-05-24 13:06                               ` Marc Reilly
2012-05-24 16:37                                 ` Mark Brown
2012-05-24 13:01                         ` Fabio Estevam
2012-05-24 13:38                           ` Marc Reilly
2012-05-24 16:16                             ` Philippe Rétornaz
2012-05-24 16:36                               ` Mark Brown
2012-05-24 16:41                                 ` Uwe Kleine-König
2012-05-24 17:39                                   ` Fabio Estevam
2012-05-24 18:03                                     ` Mark Brown
2012-05-24 19:42                                       ` philippe.retornaz
2012-05-24 22:21                                         ` Mark Brown
2012-05-25  8:56                         ` Shawn Guo

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=20120524121451.GL5361@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc@cpdesign.com.au \
    --cc=philippe.retornaz@epfl.ch \
    --cc=sameo@linux.intel.com \
    --cc=shawn.guo@freescale.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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.