* [PATCH 1/2] pwm: pwm-mxs: use devm_platform_ioremap_resource() to simplify code
@ 2019-09-24 9:42 Anson Huang
2019-09-24 9:42 ` [PATCH 2/2] pwm: pwm-mxs: Use 'dev' instead of dereferencing it repeatedly Anson Huang
2019-09-24 11:02 ` [PATCH 1/2] pwm: pwm-mxs: use devm_platform_ioremap_resource() to simplify code Thierry Reding
0 siblings, 2 replies; 4+ messages in thread
From: Anson Huang @ 2019-09-24 9:42 UTC (permalink / raw)
To: thierry.reding, shawnguo, s.hauer, kernel, festevam, linux-pwm,
linux-arm-kernel, linux-kernel
Cc: Linux-imx
Use the new helper devm_platform_ioremap_resource() which wraps the
platform_get_resource() and devm_ioremap_resource() together, to
simplify the code.
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
- This is a resend version of patch: https://patchwork.kernel.org/patch/11048365/
---
drivers/pwm/pwm-mxs.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/pwm/pwm-mxs.c b/drivers/pwm/pwm-mxs.c
index 04c0f6b..b14376b 100644
--- a/drivers/pwm/pwm-mxs.c
+++ b/drivers/pwm/pwm-mxs.c
@@ -126,15 +126,13 @@ static int mxs_pwm_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
struct mxs_pwm_chip *mxs;
- struct resource *res;
int ret;
mxs = devm_kzalloc(&pdev->dev, sizeof(*mxs), GFP_KERNEL);
if (!mxs)
return -ENOMEM;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- mxs->base = devm_ioremap_resource(&pdev->dev, res);
+ mxs->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(mxs->base))
return PTR_ERR(mxs->base);
--
2.7.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] pwm: pwm-mxs: Use 'dev' instead of dereferencing it repeatedly
2019-09-24 9:42 [PATCH 1/2] pwm: pwm-mxs: use devm_platform_ioremap_resource() to simplify code Anson Huang
@ 2019-09-24 9:42 ` Anson Huang
2019-09-24 10:53 ` Thierry Reding
2019-09-24 11:02 ` [PATCH 1/2] pwm: pwm-mxs: use devm_platform_ioremap_resource() to simplify code Thierry Reding
1 sibling, 1 reply; 4+ messages in thread
From: Anson Huang @ 2019-09-24 9:42 UTC (permalink / raw)
To: thierry.reding, shawnguo, s.hauer, kernel, festevam, linux-pwm,
linux-arm-kernel, linux-kernel
Cc: Linux-imx
Add helper variable dev = &pdev->dev to simply the code.
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
drivers/pwm/pwm-mxs.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/pwm/pwm-mxs.c b/drivers/pwm/pwm-mxs.c
index b14376b..6255ffc 100644
--- a/drivers/pwm/pwm-mxs.c
+++ b/drivers/pwm/pwm-mxs.c
@@ -124,11 +124,12 @@ static const struct pwm_ops mxs_pwm_ops = {
static int mxs_pwm_probe(struct platform_device *pdev)
{
- struct device_node *np = pdev->dev.of_node;
+ struct device *dev = &pdev->dev;
+ struct device_node *np = dev->of_node;
struct mxs_pwm_chip *mxs;
int ret;
- mxs = devm_kzalloc(&pdev->dev, sizeof(*mxs), GFP_KERNEL);
+ mxs = devm_kzalloc(dev, sizeof(*mxs), GFP_KERNEL);
if (!mxs)
return -ENOMEM;
@@ -136,23 +137,23 @@ static int mxs_pwm_probe(struct platform_device *pdev)
if (IS_ERR(mxs->base))
return PTR_ERR(mxs->base);
- mxs->clk = devm_clk_get(&pdev->dev, NULL);
+ mxs->clk = devm_clk_get(dev, NULL);
if (IS_ERR(mxs->clk))
return PTR_ERR(mxs->clk);
- mxs->chip.dev = &pdev->dev;
+ mxs->chip.dev = dev;
mxs->chip.ops = &mxs_pwm_ops;
mxs->chip.base = -1;
ret = of_property_read_u32(np, "fsl,pwm-number", &mxs->chip.npwm);
if (ret < 0) {
- dev_err(&pdev->dev, "failed to get pwm number: %d\n", ret);
+ dev_err(dev, "failed to get pwm number: %d\n", ret);
return ret;
}
ret = pwmchip_add(&mxs->chip);
if (ret < 0) {
- dev_err(&pdev->dev, "failed to add pwm chip %d\n", ret);
+ dev_err(dev, "failed to add pwm chip %d\n", ret);
return ret;
}
--
2.7.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] pwm: pwm-mxs: Use 'dev' instead of dereferencing it repeatedly
2019-09-24 9:42 ` [PATCH 2/2] pwm: pwm-mxs: Use 'dev' instead of dereferencing it repeatedly Anson Huang
@ 2019-09-24 10:53 ` Thierry Reding
0 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2019-09-24 10:53 UTC (permalink / raw)
To: Anson Huang
Cc: linux-pwm, shawnguo, s.hauer, linux-kernel, Linux-imx, kernel,
festevam, linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 327 bytes --]
On Tue, Sep 24, 2019 at 05:42:49PM +0800, Anson Huang wrote:
> Add helper variable dev = &pdev->dev to simply the code.
>
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> ---
> drivers/pwm/pwm-mxs.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
Again, lots of churn, no gain.
Thierry
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] pwm: pwm-mxs: use devm_platform_ioremap_resource() to simplify code
2019-09-24 9:42 [PATCH 1/2] pwm: pwm-mxs: use devm_platform_ioremap_resource() to simplify code Anson Huang
2019-09-24 9:42 ` [PATCH 2/2] pwm: pwm-mxs: Use 'dev' instead of dereferencing it repeatedly Anson Huang
@ 2019-09-24 11:02 ` Thierry Reding
1 sibling, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2019-09-24 11:02 UTC (permalink / raw)
To: Anson Huang
Cc: linux-pwm, shawnguo, s.hauer, linux-kernel, Linux-imx, kernel,
festevam, linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 1405 bytes --]
On Tue, Sep 24, 2019 at 05:42:48PM +0800, Anson Huang wrote:
> Use the new helper devm_platform_ioremap_resource() which wraps the
> platform_get_resource() and devm_ioremap_resource() together, to
> simplify the code.
>
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> ---
> - This is a resend version of patch: https://patchwork.kernel.org/patch/11048365/
> ---
> drivers/pwm/pwm-mxs.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
When you do resend patches, please make sure to include an Reviewed-by
or Acked-by tags that you get.
In this case that's not necessary since I had already applied the other
patch.
Thierry
>
> diff --git a/drivers/pwm/pwm-mxs.c b/drivers/pwm/pwm-mxs.c
> index 04c0f6b..b14376b 100644
> --- a/drivers/pwm/pwm-mxs.c
> +++ b/drivers/pwm/pwm-mxs.c
> @@ -126,15 +126,13 @@ static int mxs_pwm_probe(struct platform_device *pdev)
> {
> struct device_node *np = pdev->dev.of_node;
> struct mxs_pwm_chip *mxs;
> - struct resource *res;
> int ret;
>
> mxs = devm_kzalloc(&pdev->dev, sizeof(*mxs), GFP_KERNEL);
> if (!mxs)
> return -ENOMEM;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - mxs->base = devm_ioremap_resource(&pdev->dev, res);
> + mxs->base = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(mxs->base))
> return PTR_ERR(mxs->base);
>
> --
> 2.7.4
>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-09-24 11:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-24 9:42 [PATCH 1/2] pwm: pwm-mxs: use devm_platform_ioremap_resource() to simplify code Anson Huang
2019-09-24 9:42 ` [PATCH 2/2] pwm: pwm-mxs: Use 'dev' instead of dereferencing it repeatedly Anson Huang
2019-09-24 10:53 ` Thierry Reding
2019-09-24 11:02 ` [PATCH 1/2] pwm: pwm-mxs: use devm_platform_ioremap_resource() to simplify code Thierry Reding
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).