public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nenghua Cao <nhcao@marvell.com>
To: Nenghua Cao <nhcao@marvell.com>
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	Mark Brown <broonie@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] driver: regmap: add regmap_parse_val api
Date: Thu, 20 Feb 2014 16:24:06 +0800	[thread overview]
Message-ID: <5305BBA6.3070105@marvell.com> (raw)
In-Reply-To: <1392806653-29604-1-git-send-email-nhcao@marvell.com>

Hi, Mark:

     Do you still have any other problem which have impact on evaluating
these two patches?

BR
Nenghua

On 02/19/2014 06:44 PM, Nenghua Cao wrote:
> From: Nenghua Cao <nhcao@marvell.com>
> 
>     In some cases, we need regmap's format parse_val function
> to do be/le translation according to the bus configuration.
> For example, snd_soc_bytes_put() uses regmap to write/read values,
> and use cpu_to_be() directly to covert MASK into big endian. This
> is a defect, and should use regmap's format function to do it according
> to bus configuration.
> 
> Signed-off-by: Nenghua Cao <nhcao@marvell.com>
> ---
>  drivers/base/regmap/regmap.c |   12 ++++++++++++
>  include/linux/regmap.h       |    9 +++++++++
>  2 files changed, 21 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
> index 6a19515..4b2ed0c 100644
> --- a/drivers/base/regmap/regmap.c
> +++ b/drivers/base/regmap/regmap.c
> @@ -2240,6 +2240,18 @@ int regmap_get_val_bytes(struct regmap *map)
>  }
>  EXPORT_SYMBOL_GPL(regmap_get_val_bytes);
>  
> +int regmap_parse_val(struct regmap *map, const void *buf,
> +			unsigned int *val)
> +{
> +	if (!map->format.parse_val)
> +		return -EINVAL;
> +
> +	*val = map->format.parse_val(buf);
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(regmap_parse_val);
> +
>  static int __init regmap_initcall(void)
>  {
>  	regmap_debugfs_initcall();
> diff --git a/include/linux/regmap.h b/include/linux/regmap.h
> index 4149f1a..3e1a2e4 100644
> --- a/include/linux/regmap.h
> +++ b/include/linux/regmap.h
> @@ -423,6 +423,8 @@ bool regmap_check_range_table(struct regmap *map, unsigned int reg,
>  
>  int regmap_register_patch(struct regmap *map, const struct reg_default *regs,
>  			  int num_regs);
> +int regmap_parse_val(struct regmap *map, const void *buf,
> +				unsigned int *val);
>  
>  static inline bool regmap_reg_in_range(unsigned int reg,
>  				       const struct regmap_range *range)
> @@ -695,6 +697,13 @@ static inline int regmap_register_patch(struct regmap *map,
>  	return -EINVAL;
>  }
>  
> +static inline int regmap_parse_val(struct regmap *map, const void *buf,
> +				unsigned int *val)
> +{
> +	WARN_ONCE(1, "regmap API is disabled");
> +	return -EINVAL;
> +}
> +
>  static inline struct regmap *dev_get_regmap(struct device *dev,
>  					    const char *name)
>  {
> 


  reply	other threads:[~2014-02-20  8:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-19 10:44 [PATCH 1/2] driver: regmap: add regmap_parse_val api Nenghua Cao
2014-02-20  8:24 ` Nenghua Cao [this message]
2014-02-20  8:55   ` Mark Brown
2014-02-20 12:09     ` Nenghua Cao
2014-02-20 13:42       ` Mark Brown
2014-03-03 10:44         ` Nenghua Cao
2014-03-05  2:03           ` Mark Brown
2014-03-06  9:41 ` Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2014-02-19  5:19 Nenghua Cao
2014-02-19  5:28 ` Nenghua Cao
2014-02-19  7:50   ` Mark Brown
2014-02-19 10:50     ` Nenghua Cao

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=5305BBA6.3070105@marvell.com \
    --to=nhcao@marvell.com \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    /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