* [PATCH 4/4] regmap: Minor optimisation for _regmap_raw_write().
@ 2012-05-31 15:11 Krystian Garbaciak
2012-05-31 16:44 ` Mark Brown
0 siblings, 1 reply; 3+ messages in thread
From: Krystian Garbaciak @ 2012-05-31 15:11 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-kernel, Anthony Olech
Just to make things simplier inside the function.
Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
---
drivers/base/regmap/regmap.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index c32d1a6..7581ad9 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -612,17 +612,18 @@ static int _regmap_raw_write(struct regmap *map, unsigned int reg,
{
int i;
int ret;
+ unsigned int val_num = val_len / map->format.val_bytes;
/* Check for unwritable registers before we start */
if (map->writeable_reg)
- for (i = 0; i < val_len / map->format.val_bytes; i++)
+ for (i = 0; i < val_num; i++)
if (!map->writeable_reg(map->dev, reg + i))
return -EINVAL;
if (!map->cache_bypass && map->format.parse_val) {
unsigned int ival;
int val_bytes = map->format.val_bytes;
- for (i = 0; i < val_len / map->format.val_bytes; i++) {
+ for (i = 0; i < val_num; i++) {
memcpy(map->work_buf, val + (i * val_bytes), val_bytes);
ival = map->format.parse_val(map->work_buf);
ret = regcache_write(map, reg + i, ival);
@@ -639,8 +640,8 @@ static int _regmap_raw_write(struct regmap *map, unsigned int reg,
}
}
- return _regmap_range_access(_regmap_bus_write, map, reg, (void *)val,
- val_len / map->format.val_bytes);
+ return _regmap_range_access(_regmap_bus_write,
+ map, reg, (void *)val, val_num);
}
int _regmap_write(struct regmap *map, unsigned int reg,
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 4/4] regmap: Minor optimisation for _regmap_raw_write().
2012-05-31 15:11 [PATCH 4/4] regmap: Minor optimisation for _regmap_raw_write() Krystian Garbaciak
@ 2012-05-31 16:44 ` Mark Brown
2012-05-31 17:57 ` Krystian Garbaciak
0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2012-05-31 16:44 UTC (permalink / raw)
To: Krystian Garbaciak; +Cc: Greg Kroah-Hartman, linux-kernel, Anthony Olech
[-- Attachment #1: Type: text/plain, Size: 382 bytes --]
On Thu, May 31, 2012 at 05:11:38PM +0200, Krystian Garbaciak wrote:
> Just to make things simplier inside the function.
Again, what is this actually doing (ie, please improve your changelogs)?
It looks like it's just factoring constants out (which hopefully the
compiler can do but still is OK) - this looks good but should probably
be at the start rather than end of the series.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH 4/4] regmap: Minor optimisation for _regmap_raw_write().
2012-05-31 16:44 ` Mark Brown
@ 2012-05-31 17:57 ` Krystian Garbaciak
0 siblings, 0 replies; 3+ messages in thread
From: Krystian Garbaciak @ 2012-05-31 17:57 UTC (permalink / raw)
To: Mark Brown
Cc: Greg Kroah-Hartman, linux-kernel@vger.kernel.org, Anthony Olech
> On Thu, May 31, 2012 at 05:11:38PM +0200, Krystian Garbaciak wrote:
> > Just to make things simplier inside the function.
>
> Again, what is this actually doing (ie, please improve your changelogs)?
>
> It looks like it's just factoring constants out (which hopefully the compiler can do
> but still is OK) - this looks good but should probably be at the start rather than
> end of the series.
Yes, this is only to make the code a bit simpler. I will put it as a first patch then.
Legal Disclaimer: This e-mail communication (and any attachment/s) is confidential and contains proprietary information,
some or all of which may be legally privileged. It is intended solely for the use of the individual or entity to which it
is addressed. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure,
copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.
Please consider the environment before printing this e-mail
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-05-31 17:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-31 15:11 [PATCH 4/4] regmap: Minor optimisation for _regmap_raw_write() Krystian Garbaciak
2012-05-31 16:44 ` Mark Brown
2012-05-31 17:57 ` Krystian Garbaciak
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.