All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomasz Figa <tomasz.figa@gmail.com>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: "linux-samsung-soc@vger.kernel.org"
	<linux-samsung-soc@vger.kernel.org>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 01/13] soc: samsung: pmu: Provide global function to get PMU regmap
Date: Wed, 18 Jan 2017 17:31:17 +0900	[thread overview]
Message-ID: <CA+Ln22F8JPcL35XO9sN6C+HPOeh==gm28Lt2WttW74CFQsoFLg@mail.gmail.com> (raw)
In-Reply-To: <1484657084-26227-2-git-send-email-m.szyprowski@samsung.com>

Hi Marek,

2017-01-17 21:44 GMT+09:00 Marek Szyprowski <m.szyprowski@samsung.com>:
> PMU is something like a SoC wide service, so add a helper function to get
> PMU regmap. This will be used by other Exynos device drivers. This way it
> can be avoided to model this dependency in device tree (as phandles to PMU
> node) for almost every device in the SoC.
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/soc/samsung/exynos-pmu.c       | 11 +++++++++++
>  include/linux/soc/samsung/exynos-pmu.h |  7 +++++++
>  2 files changed, 18 insertions(+)
>
> diff --git a/drivers/soc/samsung/exynos-pmu.c b/drivers/soc/samsung/exynos-pmu.c
> index 0acdfd82e751..5c269bf23210 100644
> --- a/drivers/soc/samsung/exynos-pmu.c
> +++ b/drivers/soc/samsung/exynos-pmu.c
> @@ -11,6 +11,7 @@
>
>  #include <linux/of.h>
>  #include <linux/of_address.h>
> +#include <linux/mfd/syscon.h>
>  #include <linux/platform_device.h>
>  #include <linux/delay.h>
>
> @@ -92,6 +93,16 @@ void exynos_sys_powerdown_conf(enum sys_powerdown mode)
>         { /*sentinel*/ },
>  };
>
> +struct regmap *exynos_get_pmu_regmap(void)
> +{
> +       struct device_node *np = of_find_matching_node(NULL,
> +                                                     exynos_pmu_of_device_ids);
> +       if (np)
> +               return syscon_node_to_regmap(np);
> +       return ERR_PTR(-ENODEV);
> +}
> +EXPORT_SYMBOL_GPL(exynos_get_pmu_regmap);
> +
>  static int exynos_pmu_probe(struct platform_device *pdev)
>  {
>         const struct of_device_id *match;
> diff --git a/include/linux/soc/samsung/exynos-pmu.h b/include/linux/soc/samsung/exynos-pmu.h
> index e2e9de1acc5b..2a841a474684 100644
> --- a/include/linux/soc/samsung/exynos-pmu.h
> +++ b/include/linux/soc/samsung/exynos-pmu.h
> @@ -12,6 +12,8 @@
>  #ifndef __LINUX_SOC_EXYNOS_PMU_H
>  #define __LINUX_SOC_EXYNOS_PMU_H
>
> +#include <linux/regmap.h>
> +

nit: It would save some compilation time to just add a forward
declaration of struct regmap here instead, in case of files that
include this header, but don't need regmap functionality.

>  enum sys_powerdown {
>         SYS_AFTR,
>         SYS_LPA,
> @@ -20,5 +22,10 @@ enum sys_powerdown {
>  };
>
>  extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);
> +#ifdef CONFIG_EXYNOS_PMU
> +extern struct regmap *exynos_get_pmu_regmap(void);
> +#else
> +static inline struct regmap *exynos_get_pmu_regmap(void) { return NULL; }

Shouldn't be some ERR_PTR() instead?

Best regards,
Tomasz

WARNING: multiple messages have this Message-ID (diff)
From: tomasz.figa@gmail.com (Tomasz Figa)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 01/13] soc: samsung: pmu: Provide global function to get PMU regmap
Date: Wed, 18 Jan 2017 17:31:17 +0900	[thread overview]
Message-ID: <CA+Ln22F8JPcL35XO9sN6C+HPOeh==gm28Lt2WttW74CFQsoFLg@mail.gmail.com> (raw)
In-Reply-To: <1484657084-26227-2-git-send-email-m.szyprowski@samsung.com>

Hi Marek,

2017-01-17 21:44 GMT+09:00 Marek Szyprowski <m.szyprowski@samsung.com>:
> PMU is something like a SoC wide service, so add a helper function to get
> PMU regmap. This will be used by other Exynos device drivers. This way it
> can be avoided to model this dependency in device tree (as phandles to PMU
> node) for almost every device in the SoC.
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/soc/samsung/exynos-pmu.c       | 11 +++++++++++
>  include/linux/soc/samsung/exynos-pmu.h |  7 +++++++
>  2 files changed, 18 insertions(+)
>
> diff --git a/drivers/soc/samsung/exynos-pmu.c b/drivers/soc/samsung/exynos-pmu.c
> index 0acdfd82e751..5c269bf23210 100644
> --- a/drivers/soc/samsung/exynos-pmu.c
> +++ b/drivers/soc/samsung/exynos-pmu.c
> @@ -11,6 +11,7 @@
>
>  #include <linux/of.h>
>  #include <linux/of_address.h>
> +#include <linux/mfd/syscon.h>
>  #include <linux/platform_device.h>
>  #include <linux/delay.h>
>
> @@ -92,6 +93,16 @@ void exynos_sys_powerdown_conf(enum sys_powerdown mode)
>         { /*sentinel*/ },
>  };
>
> +struct regmap *exynos_get_pmu_regmap(void)
> +{
> +       struct device_node *np = of_find_matching_node(NULL,
> +                                                     exynos_pmu_of_device_ids);
> +       if (np)
> +               return syscon_node_to_regmap(np);
> +       return ERR_PTR(-ENODEV);
> +}
> +EXPORT_SYMBOL_GPL(exynos_get_pmu_regmap);
> +
>  static int exynos_pmu_probe(struct platform_device *pdev)
>  {
>         const struct of_device_id *match;
> diff --git a/include/linux/soc/samsung/exynos-pmu.h b/include/linux/soc/samsung/exynos-pmu.h
> index e2e9de1acc5b..2a841a474684 100644
> --- a/include/linux/soc/samsung/exynos-pmu.h
> +++ b/include/linux/soc/samsung/exynos-pmu.h
> @@ -12,6 +12,8 @@
>  #ifndef __LINUX_SOC_EXYNOS_PMU_H
>  #define __LINUX_SOC_EXYNOS_PMU_H
>
> +#include <linux/regmap.h>
> +

nit: It would save some compilation time to just add a forward
declaration of struct regmap here instead, in case of files that
include this header, but don't need regmap functionality.

>  enum sys_powerdown {
>         SYS_AFTR,
>         SYS_LPA,
> @@ -20,5 +22,10 @@ enum sys_powerdown {
>  };
>
>  extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);
> +#ifdef CONFIG_EXYNOS_PMU
> +extern struct regmap *exynos_get_pmu_regmap(void);
> +#else
> +static inline struct regmap *exynos_get_pmu_regmap(void) { return NULL; }

Shouldn't be some ERR_PTR() instead?

Best regards,
Tomasz

  reply	other threads:[~2017-01-18  8:31 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170117124453eucas1p1b812596939db4c4f3298b941555eb05a@eucas1p1.samsung.com>
2017-01-17 12:44 ` [PATCH v2 00/13] Move pad retention control to Exynos pin controller driver Marek Szyprowski
2017-01-17 12:44   ` Marek Szyprowski
     [not found]   ` <CGME20170117124456eucas1p1d42d11aa2117caed8d89faa8c09e6218@eucas1p1.samsung.com>
2017-01-17 12:44     ` [PATCH v2 01/13] soc: samsung: pmu: Provide global function to get PMU regmap Marek Szyprowski
2017-01-17 12:44       ` Marek Szyprowski
2017-01-18  8:31       ` Tomasz Figa [this message]
2017-01-18  8:31         ` Tomasz Figa
     [not found]   ` <CGME20170117124457eucas1p120dac823e1cd08421cb8d7411a9eebbd@eucas1p1.samsung.com>
2017-01-17 12:44     ` [PATCH v2 02/13] soc: samsung: pmu: Use of_device_get_match_data helper Marek Szyprowski
2017-01-17 12:44       ` Marek Szyprowski
     [not found]   ` <CGME20170117124458eucas1p10463c19d77a501284c7302c3b848fecc@eucas1p1.samsung.com>
2017-01-17 12:44     ` [PATCH v2 03/13] soc: samsung: pmu: Remove messages for failed memory allocation Marek Szyprowski
2017-01-17 12:44       ` Marek Szyprowski
     [not found]   ` <CGME20170117124459eucas1p10fbae533e4900439b9a5aa32fc94182c@eucas1p1.samsung.com>
2017-01-17 12:44     ` [PATCH v2 04/13] pinctrl: samsung: Document Exynos3250 SoC support Marek Szyprowski
2017-01-17 12:44       ` Marek Szyprowski
     [not found]   ` <CGME20170117124459eucas1p160494d6c7509e0d24bfcc73087492430@eucas1p1.samsung.com>
2017-01-17 12:44     ` [PATCH v2 05/13] pinctrl: samsung: Remove messages for failed memory allocation Marek Szyprowski
2017-01-17 12:44       ` Marek Szyprowski
     [not found]   ` <CGME20170117124459eucas1p1ead13705d84054c1d69b5d7a9795f0e9@eucas1p1.samsung.com>
2017-01-17 12:44     ` [PATCH v2 06/13] pinctrl: samsung: Fix samsung_pinctrl_create_functions return value Marek Szyprowski
2017-01-17 12:44       ` Marek Szyprowski
2017-01-17 17:36       ` Krzysztof Kozlowski
2017-01-17 17:36         ` Krzysztof Kozlowski
     [not found]   ` <CGME20170117124500eucas1p1b61ec676f421eae7d28d750a0746a813@eucas1p1.samsung.com>
2017-01-17 12:44     ` [PATCH v2 07/13] pinctrl: samsung: Add missing initconst annotation Marek Szyprowski
2017-01-17 12:44       ` Marek Szyprowski
     [not found]   ` <CGME20170117124500eucas1p265447c459ad0ac0a79dc3d3c833d09f6@eucas1p2.samsung.com>
2017-01-17 12:44     ` [PATCH v2 08/13] pinctrl: samsung: Remove dead code Marek Szyprowski
2017-01-17 12:44       ` Marek Szyprowski
     [not found]   ` <CGME20170117124501eucas1p101d1468371db26b0244854e36281b9c9@eucas1p1.samsung.com>
2017-01-17 12:44     ` [PATCH v2 09/13] pinctrl: samsung: Use generic of_device_get_match_data helper Marek Szyprowski
2017-01-17 12:44       ` Marek Szyprowski
2017-01-17 17:38       ` Krzysztof Kozlowski
2017-01-17 17:38         ` Krzysztof Kozlowski
     [not found]   ` <CGME20170117124501eucas1p2ab3ec2a1dee18486878733826037d071@eucas1p2.samsung.com>
2017-01-17 12:44     ` [PATCH v2 10/13] pinctrl: samsung: Add infrastructure for pin-bank retention control Marek Szyprowski
2017-01-17 12:44       ` Marek Szyprowski
2017-01-18  8:36       ` Tomasz Figa
2017-01-18  8:36         ` Tomasz Figa
     [not found]   ` <CGME20170117124502eucas1p131b3b424454ee380b0c93899989a51f6@eucas1p1.samsung.com>
2017-01-17 12:44     ` [PATCH v2 11/13] pinctrl: samsung: Move retention control from mach-exynos to the pinctrl driver Marek Szyprowski
2017-01-17 12:44       ` Marek Szyprowski
2017-01-17 17:48       ` Krzysztof Kozlowski
2017-01-17 17:48         ` Krzysztof Kozlowski
     [not found]   ` <CGME20170117124502eucas1p19ce0cd772fc4295b207b20cdad30485e@eucas1p1.samsung.com>
2017-01-17 12:44     ` [PATCH v2 12/13] pinctrl: samsung: Move retention control from mach-s5pv210 " Marek Szyprowski
2017-01-17 12:44       ` Marek Szyprowski
2017-01-17 17:54       ` Krzysztof Kozlowski
2017-01-17 17:54         ` Krzysztof Kozlowski
     [not found]   ` <CGME20170117124503eucas1p1f63d709d794c82dcea8082dbb9c0fb3f@eucas1p1.samsung.com>
2017-01-17 12:44     ` [PATCH v2 13/13] pinctrl: samsung: Replace syscore ops with standard platform device pm_ops Marek Szyprowski
2017-01-17 12:44       ` Marek Szyprowski
2017-01-18  8:40   ` [PATCH v2 00/13] Move pad retention control to Exynos pin controller driver Tomasz Figa
2017-01-18  8:40     ` Tomasz Figa
2017-01-18 10:39   ` Linus Walleij
2017-01-18 10:39     ` Linus Walleij
2017-01-18 12:06     ` Krzysztof Kozlowski
2017-01-18 12:06       ` Krzysztof Kozlowski

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='CA+Ln22F8JPcL35XO9sN6C+HPOeh==gm28Lt2WttW74CFQsoFLg@mail.gmail.com' \
    --to=tomasz.figa@gmail.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=krzk@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=s.nawrocki@samsung.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.