Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1651199

Re: [PATCH 2/6] mfd: hi6421-pmic: move hi6421_regmap_config definition to header file

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject Re: [PATCH 2/6] mfd: hi6421-pmic: move hi6421_regmap_config definition to header file
Date 2017-05-26 10:40 +0200
Message-ID <tLiWR-3x5-19@gated-at.bofh.it> (permalink)
References <tLh4J-2oP-3@gated-at.bofh.it> <tLh4J-2oP-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, May 26, 2017 at 8:35 AM, Guodong Xu <guodong.xu@linaro.org> wrote:
> Move hi6421_regmap_config definition from c code to common header:
>  - include/linux/mfd/hi6421-pmic.h
>
> This is to improve code re-use for upcoming hi6421 series of MFD driver.
>
> Signed-off-by: Guodong Xu <guodong.xu@linaro.org>

> diff --git a/include/linux/mfd/hi6421-pmic.h b/include/linux/mfd/hi6421-pmic.h
> index 587273e..f4674ff 100644
> --- a/include/linux/mfd/hi6421-pmic.h
> +++ b/include/linux/mfd/hi6421-pmic.h
> @@ -38,4 +38,10 @@ struct hi6421_pmic {
>         struct regmap           *regmap;
>  };
>
> +static const struct regmap_config hi6421_regmap_config = {
> +       .reg_bits = 32,
> +       .reg_stride = 4,
> +       .val_bits = 8,
> +       .max_register = HI6421_REG_TO_BUS_ADDR(HI6421_REG_MAX),
> +};
>  #endif         /* __HI6421_PMIC_H */

Header files should not have static variables in general, it will cause warnings
about unused variables when you include the header from another file
(depending on compiler version and warning options, I think older gcc
versions don't warn about this, but clang and latest gcc do).

How about adding the new code into the existing
drivers/mfd/hi6421-pmic-core.c file, and splitting out the part that differs
(the regmap_update_bits is the only difference I see) into a callback
that you reference through the of_device_id->data pointer?

        Arnd

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/6] MFD: add driver for HiSilicon Hi6421v530 PMIC Guodong Xu <guodong.xu@linaro.org> - 2017-05-26 08:40 +0200
  [PATCH 2/6] mfd: hi6421-pmic: move hi6421_regmap_config definition to header file Guodong Xu <guodong.xu@linaro.org> - 2017-05-26 08:40 +0200
    Re: [PATCH 2/6] mfd: hi6421-pmic: move hi6421_regmap_config  definition to header file Arnd Bergmann <arnd@arndb.de> - 2017-05-26 10:40 +0200
      Re: [PATCH 2/6] mfd: hi6421-pmic: move hi6421_regmap_config  definition to header file Guodong Xu <guodong.xu@linaro.org> - 2017-05-27 05:10 +0200
  [PATCH 4/6] regulator: hi6421v530: add driver for hi6421v530 voltage regulator Guodong Xu <guodong.xu@linaro.org> - 2017-05-26 08:40 +0200
    Re: [PATCH 4/6] regulator: hi6421v530: add driver for hi6421v530  voltage regulator Mark Brown <broonie@kernel.org> - 2017-05-26 13:40 +0200
      Re: [PATCH 4/6] regulator: hi6421v530: add driver for hi6421v530  voltage regulator Guodong Xu <guodong.xu@linaro.org> - 2017-05-27 11:50 +0200
    Re: [PATCH 4/6] regulator: hi6421v530: add driver for hi6421v530  voltage regulator Javier Martinez Canillas <javier@dowhile0.org> - 2017-05-26 14:20 +0200
      Re: [PATCH 4/6] regulator: hi6421v530: add driver for hi6421v530  voltage regulator Guodong Xu <guodong.xu@linaro.org> - 2017-05-27 11:50 +0200
  [PATCH 6/6] arm64: defconfig: enable hi6421v530 MFD and regulator Guodong Xu <guodong.xu@linaro.org> - 2017-05-26 08:40 +0200
  [PATCH 5/6] arm64: dts: hikey960: add device node for pmic and regulators Guodong Xu <guodong.xu@linaro.org> - 2017-05-26 08:40 +0200
  [PATCH 1/6] dt-bindings: mfd: Add hi6421v530 bindings Guodong Xu <guodong.xu@linaro.org> - 2017-05-26 08:40 +0200
    Re: [PATCH 1/6] dt-bindings: mfd: Add hi6421v530 bindings Rob Herring <robh@kernel.org> - 2017-05-31 20:10 +0200
      Re: [PATCH 1/6] dt-bindings: mfd: Add hi6421v530 bindings Guodong Xu <guodong.xu@linaro.org> - 2017-06-02 11:10 +0200

csiph-web