All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Tianfei Zhang <tianfei.zhang@intel.com>
Cc: mdf@kernel.org, yilun.xu@intel.com, linux-fpga@vger.kernel.org,
	russell.h.weight@intel.com, hao.wu@intel.com, trix@redhat.com,
	Lee Jones <lee@kernel.org>
Subject: Re: [PATCH v2 1/3] mfd: intel-m10-bmc: add m10bmc_sys_update_bits API
Date: Mon, 1 Aug 2022 15:48:55 +0100	[thread overview]
Message-ID: <Yufn13ka2TREieeh@google.com> (raw)
In-Reply-To: <20220725092836.647028-2-tianfei.zhang@intel.com>

On Mon, 25 Jul 2022, Tianfei Zhang wrote:

> Adds register access helper functions for M10BMC.
> m10bmc_raw_update_bits() uses to update m10bmc register
> bits per addr.
> m10bmc_sys_update_bits() uses to update m10bmc system
> register bits per offset.
> 
> Signed-off-by: Tianfei Zhang <tianfei.zhang@intel.com>
> ---
>  include/linux/mfd/intel-m10-bmc.h | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/include/linux/mfd/intel-m10-bmc.h b/include/linux/mfd/intel-m10-bmc.h
> index f0044b14136e..8e434886a5a1 100644
> --- a/include/linux/mfd/intel-m10-bmc.h
> +++ b/include/linux/mfd/intel-m10-bmc.h
> @@ -133,6 +133,8 @@ struct intel_m10bmc {
>   *
>   * m10bmc_raw_read - read m10bmc register per addr
>   * m10bmc_sys_read - read m10bmc system register per offset
> + * m10bmc_raw_update_bits - update m10bmc register bits per addr
> + * m10bmc_sys_update_bits - update m10bmc system register bits per offset
>   */
>  static inline int
>  m10bmc_raw_read(struct intel_m10bmc *m10bmc, unsigned int addr,
> @@ -148,6 +150,20 @@ m10bmc_raw_read(struct intel_m10bmc *m10bmc, unsigned int addr,
>  	return ret;
>  }
>  
> +static inline int
> +m10bmc_raw_update_bits(struct intel_m10bmc *m10bmc, unsigned int addr,
> +		       unsigned int msk, unsigned int val)
> +{
> +	int ret;
> +
> +	ret = regmap_update_bits(m10bmc->regmap, addr, msk, val);
> +	if (ret)
> +		dev_err(m10bmc->dev, "fail to update reg bits %x: %d\n",
> +			addr, ret);
> +
> +	return ret;
> +}

I really do dislike these 'abstraction for the sake of abstraction'
layers.  Why can't you just use the Regmap API in-place?

>  /*
>   * The base of the system registers could be configured by HW developers, and
>   * in HW SPEC, the base is not added to the addresses of the system registers.
> @@ -158,5 +174,7 @@ m10bmc_raw_read(struct intel_m10bmc *m10bmc, unsigned int addr,
>   */
>  #define m10bmc_sys_read(m10bmc, offset, val) \
>  	m10bmc_raw_read(m10bmc, M10BMC_SYS_BASE + (offset), val)
> +#define m10bmc_sys_update_bits(m10bmc, offset, msk, val) \
> +	m10bmc_raw_update_bits(m10bmc, M10BMC_SYS_BASE + (offset), msk, val)
>  
>  #endif /* __MFD_INTEL_M10_BMC_H */

-- 
Lee Jones [李琼斯]
Principal Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

  reply	other threads:[~2022-08-01 14:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-25  9:28 [PATCH v2 0/3] add Intel FPGA image reload support Tianfei Zhang
2022-07-25  9:28 ` [PATCH v2 1/3] mfd: intel-m10-bmc: add m10bmc_sys_update_bits API Tianfei Zhang
2022-08-01 14:48   ` Lee Jones [this message]
2022-07-25  9:28 ` [PATCH v2 2/3] fpga: m10bmc-sec: add sysfs to reload FPGA/BMC images Tianfei Zhang
2022-07-25  9:28 ` [PATCH v2 3/3] fpga: m10bmc-sec: add m10bmc_sec_retimer_load callback Tianfei Zhang

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=Yufn13ka2TREieeh@google.com \
    --to=lee.jones@linaro.org \
    --cc=hao.wu@intel.com \
    --cc=lee@kernel.org \
    --cc=linux-fpga@vger.kernel.org \
    --cc=mdf@kernel.org \
    --cc=russell.h.weight@intel.com \
    --cc=tianfei.zhang@intel.com \
    --cc=trix@redhat.com \
    --cc=yilun.xu@intel.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.