linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Tomasz Figa <tomasz.figa@gmail.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	linux-gpio@vger.kernel.org,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 01/12] soc: samsung: pmu: Use common device name to let others to find it easily
Date: Mon, 16 Jan 2017 21:48:39 +0200	[thread overview]
Message-ID: <20170116194839.m2ot7m6yovze764v@kozik-lap> (raw)
In-Reply-To: <1484549107-5957-2-git-send-email-m.szyprowski@samsung.com>

On Mon, Jan 16, 2017 at 07:44:56AM +0100, Marek Szyprowski wrote:
> This patch always set device name to "exynos-pmu" to let other drivers to
> find PMU device easily. This is done mainly to get regmap to access PMU
> registers from other drivers. This way it can be avoided to add phandle to
> the PMU node to almost all drivers in the SoC just to get a regmap access
> in the drivers. PMU is something like a SoC wide service, so there is no
> point modeling it as hardware dependency for all devices in device tree.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/soc/samsung/exynos-pmu.c       |  1 +
>  include/linux/soc/samsung/exynos-pmu.h | 19 +++++++++++++++++++
>  2 files changed, 20 insertions(+)
> 
> diff --git a/drivers/soc/samsung/exynos-pmu.c b/drivers/soc/samsung/exynos-pmu.c
> index 0acdfd82e751..63bb471845cb 100644
> --- a/drivers/soc/samsung/exynos-pmu.c
> +++ b/drivers/soc/samsung/exynos-pmu.c
> @@ -120,6 +120,7 @@ static int exynos_pmu_probe(struct platform_device *pdev)
>  		pmu_context->pmu_data->pmu_init();
>  
>  	platform_set_drvdata(pdev, pmu_context);
> +	dev_set_name(dev, EXYNOS_PMU_DEV_NAME);
>  
>  	dev_dbg(dev, "Exynos PMU Driver probe done\n");
>  	return 0;
> diff --git a/include/linux/soc/samsung/exynos-pmu.h b/include/linux/soc/samsung/exynos-pmu.h
> index e2e9de1acc5b..90d9205805ea 100644
> --- a/include/linux/soc/samsung/exynos-pmu.h
> +++ b/include/linux/soc/samsung/exynos-pmu.h
> @@ -12,6 +12,10 @@
>  #ifndef __LINUX_SOC_EXYNOS_PMU_H
>  #define __LINUX_SOC_EXYNOS_PMU_H
>  
> +#include <linux/mfd/syscon.h>
> +#include <linux/platform_device.h>
> +#include <linux/regmap.h>
> +
>  enum sys_powerdown {
>  	SYS_AFTR,
>  	SYS_LPA,
> @@ -21,4 +25,19 @@ enum sys_powerdown {
>  
>  extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);
>  
> +#define EXYNOS_PMU_DEV_NAME "exynos-pmu"

The define is not used outside so it should not be defined in header.
You need it only for the code below (see next comment).

> +
> +static inline struct regmap *exynos_get_pmu_regs(void)
> +{
> +	struct device *dev = bus_find_device_by_name(&platform_bus_type, NULL,
> +						     EXYNOS_PMU_DEV_NAME);
> +	if (dev) {
> +		struct regmap *regs = syscon_node_to_regmap(dev->of_node);
> +		put_device(dev);
> +		if (!IS_ERR(regs))
> +			return regs;
> +	}
> +	return NULL;
> +}

Any particular reason why definion of this is in header? This rather
looks like candidate for EXPORTED_SYMBOL defined in .c (plus Kconfig
dependency).

Best regards,
Krzysztof

> +
>  #endif /* __LINUX_SOC_EXYNOS_PMU_H */
> -- 
> 1.9.1
> 

  reply	other threads:[~2017-01-16 19:48 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170116064523eucas1p161a8e060b2883c076fc470ce7b522332@eucas1p1.samsung.com>
2017-01-16  6:44 ` [PATCH 00/12] Move pad retention control to Exynos pin controller driver Marek Szyprowski
     [not found]   ` <CGME20170116064523eucas1p18a55f951566df5ddd978364486154931@eucas1p1.samsung.com>
2017-01-16  6:44     ` [PATCH 01/12] soc: samsung: pmu: Use common device name to let others to find it easily Marek Szyprowski
2017-01-16 19:48       ` Krzysztof Kozlowski [this message]
2017-01-17  4:39       ` Tomasz Figa
     [not found]   ` <CGME20170116064524eucas1p1fb1b3d080298b895d95bed106879255e@eucas1p1.samsung.com>
2017-01-16  6:44     ` [PATCH 02/12] soc: samsung: pmu: Use of_device_get_match_data helper Marek Szyprowski
     [not found]   ` <CGME20170116064524eucas1p164e0f5bd1252e8599bf2570851772493@eucas1p1.samsung.com>
2017-01-16  6:44     ` [PATCH 03/12] soc: samsung: pmu: Remove messages for failed memory allocation Marek Szyprowski
     [not found]   ` <CGME20170116064525eucas1p123df65dedceef6e3efe255e9a2ec6d07@eucas1p1.samsung.com>
2017-01-16  6:44     ` [PATCH 04/12] pinctrl: samsung: Document Exynos3250 SoC support Marek Szyprowski
2017-01-16 19:01       ` Krzysztof Kozlowski
     [not found]   ` <CGME20170116064525eucas1p1556f795af7e2323726ca9a89943c7309@eucas1p1.samsung.com>
2017-01-16  6:45     ` [PATCH 05/12] pinctrl: samsung: Remove messages for failed memory allocation Marek Szyprowski
2017-01-16 19:04       ` Krzysztof Kozlowski
     [not found]   ` <CGME20170116064526eucas1p1e3064fad71a3ab8de34d306dec531b14@eucas1p1.samsung.com>
2017-01-16  6:45     ` [PATCH 06/12] pinctrl: samsung: Add missing initconst annotation Marek Szyprowski
2017-01-16 19:14       ` Krzysztof Kozlowski
2017-01-17  4:44         ` Tomasz Figa
2017-01-17  6:34           ` Krzysztof Kozlowski
2017-01-17  7:13             ` Tomasz Figa
     [not found]   ` <CGME20170116064526eucas1p150c6653c9f1fac798ea79f6bee5631a1@eucas1p1.samsung.com>
2017-01-16  6:45     ` [PATCH 07/12] pinctrl: samsung: Remove dead code Marek Szyprowski
     [not found]   ` <CGME20170116064527eucas1p1950a217ba6563a443bb44e8e87cc26b1@eucas1p1.samsung.com>
2017-01-16  6:45     ` [PATCH 08/12] pinctrl: samsung: Use generic of_device_get_match_data helper Marek Szyprowski
2017-01-16 19:19       ` Krzysztof Kozlowski
     [not found]   ` <CGME20170116064527eucas1p1f0f78e9420e7d9d60d94b6e7381caeb1@eucas1p1.samsung.com>
2017-01-16  6:45     ` [PATCH 09/12] pinctrl: samsung: Add infrastructure for pin-bank retention control Marek Szyprowski
2017-01-16 19:37       ` Krzysztof Kozlowski
2017-01-17  4:51       ` Tomasz Figa
     [not found]   ` <CGME20170116064528eucas1p207c927835e33568e447c5a42ad18d0a7@eucas1p2.samsung.com>
2017-01-16  6:45     ` [PATCH 10/12] pinctrl: samsung: Move retention control from mach-exynos to the pinctrl driver Marek Szyprowski
     [not found]   ` <CGME20170116064528eucas1p13b12a28ae9737404d38b3f794e8c23fd@eucas1p1.samsung.com>
2017-01-16  6:45     ` [PATCH 11/12] pinctrl: samsung: Move retention control from mach-s5pv210 " Marek Szyprowski
     [not found]   ` <CGME20170116064529eucas1p15b04f901b17dfa2b02fd04745cbe3f17@eucas1p1.samsung.com>
2017-01-16  6:45     ` [PATCH 12/12] pinctrl: samsung: Replace syscore ops with standard platform device pm_ops Marek Szyprowski
2017-01-16 19:23   ` [PATCH 00/12] Move pad retention control to Exynos pin controller driver Krzysztof Kozlowski
2017-01-16 19:50     ` 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=20170116194839.m2ot7m6yovze764v@kozik-lap \
    --to=krzk@kernel.org \
    --cc=b.zolnierkie@samsung.com \
    --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 \
    --cc=tomasz.figa@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).