* [PATCH] serial8250-em: Convert to devm_* managed helpers
@ 2013-07-26 14:22 ` Laurent Pinchart
0 siblings, 0 replies; 8+ messages in thread
From: Laurent Pinchart @ 2013-07-26 14:22 UTC (permalink / raw)
To: linux-serial; +Cc: linux-sh, Magnus Damm
Replace kzalloc and clk_get by their managed counterparts to simplify
error and cleanup paths.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
drivers/tty/serial/8250/8250_em.c | 27 ++++++++-------------------
1 file changed, 8 insertions(+), 19 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_em.c b/drivers/tty/serial/8250/8250_em.c
index 916cc19..5f3bba1 100644
--- a/drivers/tty/serial/8250/8250_em.c
+++ b/drivers/tty/serial/8250/8250_em.c
@@ -95,25 +95,23 @@ static int serial8250_em_probe(struct platform_device *pdev)
struct resource *irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
struct serial8250_em_priv *priv;
struct uart_8250_port up;
- int ret = -EINVAL;
+ int ret;
if (!regs || !irq) {
dev_err(&pdev->dev, "missing registers or irq\n");
- goto err0;
+ return -EINVAL;
}
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv) {
dev_err(&pdev->dev, "unable to allocate private data\n");
- ret = -ENOMEM;
- goto err0;
+ return -ENOMEM;
}
- priv->sclk = clk_get(&pdev->dev, "sclk");
+ priv->sclk = devm_clk_get(&pdev->dev, "sclk");
if (IS_ERR(priv->sclk)) {
dev_err(&pdev->dev, "unable to get clock\n");
- ret = PTR_ERR(priv->sclk);
- goto err1;
+ return PTR_ERR(priv->sclk);
}
memset(&up, 0, sizeof(up));
@@ -136,20 +134,13 @@ static int serial8250_em_probe(struct platform_device *pdev)
ret = serial8250_register_8250_port(&up);
if (ret < 0) {
dev_err(&pdev->dev, "unable to register 8250 port\n");
- goto err2;
+ clk_disable(priv->sclk);
+ return ret;
}
priv->line = ret;
platform_set_drvdata(pdev, priv);
return 0;
-
- err2:
- clk_disable(priv->sclk);
- clk_put(priv->sclk);
- err1:
- kfree(priv);
- err0:
- return ret;
}
static int serial8250_em_remove(struct platform_device *pdev)
@@ -158,8 +149,6 @@ static int serial8250_em_remove(struct platform_device *pdev)
serial8250_unregister_port(priv->line);
clk_disable(priv->sclk);
- clk_put(priv->sclk);
- kfree(priv);
return 0;
}
--
Regards,
Laurent Pinchart
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] serial8250-em: Convert to devm_* managed helpers
@ 2013-07-26 14:22 ` Laurent Pinchart
0 siblings, 0 replies; 8+ messages in thread
From: Laurent Pinchart @ 2013-07-26 14:22 UTC (permalink / raw)
To: linux-serial; +Cc: linux-sh, Magnus Damm
Replace kzalloc and clk_get by their managed counterparts to simplify
error and cleanup paths.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
drivers/tty/serial/8250/8250_em.c | 27 ++++++++-------------------
1 file changed, 8 insertions(+), 19 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_em.c b/drivers/tty/serial/8250/8250_em.c
index 916cc19..5f3bba1 100644
--- a/drivers/tty/serial/8250/8250_em.c
+++ b/drivers/tty/serial/8250/8250_em.c
@@ -95,25 +95,23 @@ static int serial8250_em_probe(struct platform_device *pdev)
struct resource *irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
struct serial8250_em_priv *priv;
struct uart_8250_port up;
- int ret = -EINVAL;
+ int ret;
if (!regs || !irq) {
dev_err(&pdev->dev, "missing registers or irq\n");
- goto err0;
+ return -EINVAL;
}
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv) {
dev_err(&pdev->dev, "unable to allocate private data\n");
- ret = -ENOMEM;
- goto err0;
+ return -ENOMEM;
}
- priv->sclk = clk_get(&pdev->dev, "sclk");
+ priv->sclk = devm_clk_get(&pdev->dev, "sclk");
if (IS_ERR(priv->sclk)) {
dev_err(&pdev->dev, "unable to get clock\n");
- ret = PTR_ERR(priv->sclk);
- goto err1;
+ return PTR_ERR(priv->sclk);
}
memset(&up, 0, sizeof(up));
@@ -136,20 +134,13 @@ static int serial8250_em_probe(struct platform_device *pdev)
ret = serial8250_register_8250_port(&up);
if (ret < 0) {
dev_err(&pdev->dev, "unable to register 8250 port\n");
- goto err2;
+ clk_disable(priv->sclk);
+ return ret;
}
priv->line = ret;
platform_set_drvdata(pdev, priv);
return 0;
-
- err2:
- clk_disable(priv->sclk);
- clk_put(priv->sclk);
- err1:
- kfree(priv);
- err0:
- return ret;
}
static int serial8250_em_remove(struct platform_device *pdev)
@@ -158,8 +149,6 @@ static int serial8250_em_remove(struct platform_device *pdev)
serial8250_unregister_port(priv->line);
clk_disable(priv->sclk);
- clk_put(priv->sclk);
- kfree(priv);
return 0;
}
--
Regards,
Laurent Pinchart
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] serial8250-em: Convert to devm_* managed helpers
2013-07-26 14:22 ` Laurent Pinchart
@ 2013-07-30 2:08 ` Simon Horman
-1 siblings, 0 replies; 8+ messages in thread
From: Simon Horman @ 2013-07-30 2:08 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: linux-serial, linux-sh, Magnus Damm, Greg Kroah-Hartman
[ CC Greg Kroah-Hartman, linux-serial@vger.kernel.org,
linux-arm-kernel@lists.infradead.org ]
On Fri, Jul 26, 2013 at 04:22:02PM +0200, Laurent Pinchart wrote:
> Replace kzalloc and clk_get by their managed counterparts to simplify
> error and cleanup paths.
Hi Laurent,
I was recently asked for shmobile clocksource patches to be reviewed
by the clocksource maintainers. I believe that means Greg Kroah-Hartman
and linux-serial@vger.kernel.org who I have CCed on this email accordingly.
I have also CCed linux-arm-kernel@lists.infradead.org as many moons ago
I was asked for all patches that will go through my tree and on to arm-soc
to be sent there.
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
> drivers/tty/serial/8250/8250_em.c | 27 ++++++++-------------------
> 1 file changed, 8 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_em.c b/drivers/tty/serial/8250/8250_em.c
> index 916cc19..5f3bba1 100644
> --- a/drivers/tty/serial/8250/8250_em.c
> +++ b/drivers/tty/serial/8250/8250_em.c
> @@ -95,25 +95,23 @@ static int serial8250_em_probe(struct platform_device *pdev)
> struct resource *irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> struct serial8250_em_priv *priv;
> struct uart_8250_port up;
> - int ret = -EINVAL;
> + int ret;
>
> if (!regs || !irq) {
> dev_err(&pdev->dev, "missing registers or irq\n");
> - goto err0;
> + return -EINVAL;
> }
>
> - priv = kzalloc(sizeof(*priv), GFP_KERNEL);
> + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> if (!priv) {
> dev_err(&pdev->dev, "unable to allocate private data\n");
> - ret = -ENOMEM;
> - goto err0;
> + return -ENOMEM;
> }
>
> - priv->sclk = clk_get(&pdev->dev, "sclk");
> + priv->sclk = devm_clk_get(&pdev->dev, "sclk");
> if (IS_ERR(priv->sclk)) {
> dev_err(&pdev->dev, "unable to get clock\n");
> - ret = PTR_ERR(priv->sclk);
> - goto err1;
> + return PTR_ERR(priv->sclk);
> }
>
> memset(&up, 0, sizeof(up));
> @@ -136,20 +134,13 @@ static int serial8250_em_probe(struct platform_device *pdev)
> ret = serial8250_register_8250_port(&up);
> if (ret < 0) {
> dev_err(&pdev->dev, "unable to register 8250 port\n");
> - goto err2;
> + clk_disable(priv->sclk);
> + return ret;
> }
>
> priv->line = ret;
> platform_set_drvdata(pdev, priv);
> return 0;
> -
> - err2:
> - clk_disable(priv->sclk);
> - clk_put(priv->sclk);
> - err1:
> - kfree(priv);
> - err0:
> - return ret;
> }
>
> static int serial8250_em_remove(struct platform_device *pdev)
> @@ -158,8 +149,6 @@ static int serial8250_em_remove(struct platform_device *pdev)
>
> serial8250_unregister_port(priv->line);
> clk_disable(priv->sclk);
> - clk_put(priv->sclk);
> - kfree(priv);
> return 0;
> }
>
> --
> Regards,
>
> Laurent Pinchart
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] serial8250-em: Convert to devm_* managed helpers
@ 2013-07-30 2:08 ` Simon Horman
0 siblings, 0 replies; 8+ messages in thread
From: Simon Horman @ 2013-07-30 2:08 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: linux-serial, linux-sh, Magnus Damm, Greg Kroah-Hartman
[ CC Greg Kroah-Hartman, linux-serial@vger.kernel.org,
linux-arm-kernel@lists.infradead.org ]
On Fri, Jul 26, 2013 at 04:22:02PM +0200, Laurent Pinchart wrote:
> Replace kzalloc and clk_get by their managed counterparts to simplify
> error and cleanup paths.
Hi Laurent,
I was recently asked for shmobile clocksource patches to be reviewed
by the clocksource maintainers. I believe that means Greg Kroah-Hartman
and linux-serial@vger.kernel.org who I have CCed on this email accordingly.
I have also CCed linux-arm-kernel@lists.infradead.org as many moons ago
I was asked for all patches that will go through my tree and on to arm-soc
to be sent there.
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
> drivers/tty/serial/8250/8250_em.c | 27 ++++++++-------------------
> 1 file changed, 8 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_em.c b/drivers/tty/serial/8250/8250_em.c
> index 916cc19..5f3bba1 100644
> --- a/drivers/tty/serial/8250/8250_em.c
> +++ b/drivers/tty/serial/8250/8250_em.c
> @@ -95,25 +95,23 @@ static int serial8250_em_probe(struct platform_device *pdev)
> struct resource *irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> struct serial8250_em_priv *priv;
> struct uart_8250_port up;
> - int ret = -EINVAL;
> + int ret;
>
> if (!regs || !irq) {
> dev_err(&pdev->dev, "missing registers or irq\n");
> - goto err0;
> + return -EINVAL;
> }
>
> - priv = kzalloc(sizeof(*priv), GFP_KERNEL);
> + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> if (!priv) {
> dev_err(&pdev->dev, "unable to allocate private data\n");
> - ret = -ENOMEM;
> - goto err0;
> + return -ENOMEM;
> }
>
> - priv->sclk = clk_get(&pdev->dev, "sclk");
> + priv->sclk = devm_clk_get(&pdev->dev, "sclk");
> if (IS_ERR(priv->sclk)) {
> dev_err(&pdev->dev, "unable to get clock\n");
> - ret = PTR_ERR(priv->sclk);
> - goto err1;
> + return PTR_ERR(priv->sclk);
> }
>
> memset(&up, 0, sizeof(up));
> @@ -136,20 +134,13 @@ static int serial8250_em_probe(struct platform_device *pdev)
> ret = serial8250_register_8250_port(&up);
> if (ret < 0) {
> dev_err(&pdev->dev, "unable to register 8250 port\n");
> - goto err2;
> + clk_disable(priv->sclk);
> + return ret;
> }
>
> priv->line = ret;
> platform_set_drvdata(pdev, priv);
> return 0;
> -
> - err2:
> - clk_disable(priv->sclk);
> - clk_put(priv->sclk);
> - err1:
> - kfree(priv);
> - err0:
> - return ret;
> }
>
> static int serial8250_em_remove(struct platform_device *pdev)
> @@ -158,8 +149,6 @@ static int serial8250_em_remove(struct platform_device *pdev)
>
> serial8250_unregister_port(priv->line);
> clk_disable(priv->sclk);
> - clk_put(priv->sclk);
> - kfree(priv);
> return 0;
> }
>
> --
> Regards,
>
> Laurent Pinchart
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] serial8250-em: Convert to devm_* managed helpers
2013-07-30 2:08 ` Simon Horman
@ 2013-07-30 10:00 ` Laurent Pinchart
-1 siblings, 0 replies; 8+ messages in thread
From: Laurent Pinchart @ 2013-07-30 9:59 UTC (permalink / raw)
To: Simon Horman
Cc: Laurent Pinchart, linux-serial, linux-sh, Magnus Damm,
Greg Kroah-Hartman
Hi Simon,
On Tuesday 30 July 2013 11:08:59 Simon Horman wrote:
> [ CC Greg Kroah-Hartman, linux-serial@vger.kernel.org,
> linux-arm-kernel@lists.infradead.org ]
>
> On Fri, Jul 26, 2013 at 04:22:02PM +0200, Laurent Pinchart wrote:
> > Replace kzalloc and clk_get by their managed counterparts to simplify
> > error and cleanup paths.
>
> Hi Laurent,
>
> I was recently asked for shmobile clocksource patches to be reviewed by the
> clocksource maintainers.
I suppose you mean serial port, not clock source.
> I believe that means Greg Kroah-Hartman and linux-serial@vger.kernel.org who
> I have CCed on this email accordingly.
linux-serial@vger.kernel.org was already CC'ed in my original e-mail.
> I have also CCed linux-arm-kernel@lists.infradead.org
Actually you haven't ;-)
> as many moons ago I was asked for all patches that will go through my tree
> and on to arm-soc to be sent there.
This patch will likely go through the serial tree, which is why I hadn't CC'ed
LAKML.
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> >
> > drivers/tty/serial/8250/8250_em.c | 27 ++++++++-------------------
> > 1 file changed, 8 insertions(+), 19 deletions(-)
> >
> > diff --git a/drivers/tty/serial/8250/8250_em.c
> > b/drivers/tty/serial/8250/8250_em.c index 916cc19..5f3bba1 100644
> > --- a/drivers/tty/serial/8250/8250_em.c
> > +++ b/drivers/tty/serial/8250/8250_em.c
> > @@ -95,25 +95,23 @@ static int serial8250_em_probe(struct platform_device
> > *pdev)>
> > struct resource *irq = platform_get_resource(pdev, IORESOURCE_IRQ,
> > 0);
> > struct serial8250_em_priv *priv;
> > struct uart_8250_port up;
> > - int ret = -EINVAL;
> > + int ret;
> >
> > if (!regs || !irq) {
> > dev_err(&pdev->dev, "missing registers or irq\n");
> > - goto err0;
> > + return -EINVAL;
> > }
> >
> > - priv = kzalloc(sizeof(*priv), GFP_KERNEL);
> > + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> > if (!priv) {
> > dev_err(&pdev->dev, "unable to allocate private data\n");
> > - ret = -ENOMEM;
> > - goto err0;
> > + return -ENOMEM;
> > }
> >
> > - priv->sclk = clk_get(&pdev->dev, "sclk");
> > + priv->sclk = devm_clk_get(&pdev->dev, "sclk");
> > if (IS_ERR(priv->sclk)) {
> > dev_err(&pdev->dev, "unable to get clock\n");
> > - ret = PTR_ERR(priv->sclk);
> > - goto err1;
> > + return PTR_ERR(priv->sclk);
> > }
> >
> > memset(&up, 0, sizeof(up));
> > @@ -136,20 +134,13 @@ static int serial8250_em_probe(struct
> > platform_device *pdev)>
> > ret = serial8250_register_8250_port(&up);
> > if (ret < 0) {
> > dev_err(&pdev->dev, "unable to register 8250 port\n");
> > - goto err2;
> > + clk_disable(priv->sclk);
> > + return ret;
> > }
> >
> > priv->line = ret;
> > platform_set_drvdata(pdev, priv);
> > return 0;
> > -
> > - err2:
> > - clk_disable(priv->sclk);
> > - clk_put(priv->sclk);
> > - err1:
> > - kfree(priv);
> > - err0:
> > - return ret;
> > }
> >
> > static int serial8250_em_remove(struct platform_device *pdev)
> >
> > @@ -158,8 +149,6 @@ static int serial8250_em_remove(struct platform_device
> > *pdev)>
> > serial8250_unregister_port(priv->line);
> > clk_disable(priv->sclk);
> >
> > - clk_put(priv->sclk);
> > - kfree(priv);
> >
> > return 0;
> >
> > }
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] serial8250-em: Convert to devm_* managed helpers
@ 2013-07-30 10:00 ` Laurent Pinchart
0 siblings, 0 replies; 8+ messages in thread
From: Laurent Pinchart @ 2013-07-30 10:00 UTC (permalink / raw)
To: Simon Horman
Cc: Laurent Pinchart, linux-serial, linux-sh, Magnus Damm,
Greg Kroah-Hartman
Hi Simon,
On Tuesday 30 July 2013 11:08:59 Simon Horman wrote:
> [ CC Greg Kroah-Hartman, linux-serial@vger.kernel.org,
> linux-arm-kernel@lists.infradead.org ]
>
> On Fri, Jul 26, 2013 at 04:22:02PM +0200, Laurent Pinchart wrote:
> > Replace kzalloc and clk_get by their managed counterparts to simplify
> > error and cleanup paths.
>
> Hi Laurent,
>
> I was recently asked for shmobile clocksource patches to be reviewed by the
> clocksource maintainers.
I suppose you mean serial port, not clock source.
> I believe that means Greg Kroah-Hartman and linux-serial@vger.kernel.org who
> I have CCed on this email accordingly.
linux-serial@vger.kernel.org was already CC'ed in my original e-mail.
> I have also CCed linux-arm-kernel@lists.infradead.org
Actually you haven't ;-)
> as many moons ago I was asked for all patches that will go through my tree
> and on to arm-soc to be sent there.
This patch will likely go through the serial tree, which is why I hadn't CC'ed
LAKML.
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> >
> > drivers/tty/serial/8250/8250_em.c | 27 ++++++++-------------------
> > 1 file changed, 8 insertions(+), 19 deletions(-)
> >
> > diff --git a/drivers/tty/serial/8250/8250_em.c
> > b/drivers/tty/serial/8250/8250_em.c index 916cc19..5f3bba1 100644
> > --- a/drivers/tty/serial/8250/8250_em.c
> > +++ b/drivers/tty/serial/8250/8250_em.c
> > @@ -95,25 +95,23 @@ static int serial8250_em_probe(struct platform_device
> > *pdev)>
> > struct resource *irq = platform_get_resource(pdev, IORESOURCE_IRQ,
> > 0);
> > struct serial8250_em_priv *priv;
> > struct uart_8250_port up;
> > - int ret = -EINVAL;
> > + int ret;
> >
> > if (!regs || !irq) {
> > dev_err(&pdev->dev, "missing registers or irq\n");
> > - goto err0;
> > + return -EINVAL;
> > }
> >
> > - priv = kzalloc(sizeof(*priv), GFP_KERNEL);
> > + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> > if (!priv) {
> > dev_err(&pdev->dev, "unable to allocate private data\n");
> > - ret = -ENOMEM;
> > - goto err0;
> > + return -ENOMEM;
> > }
> >
> > - priv->sclk = clk_get(&pdev->dev, "sclk");
> > + priv->sclk = devm_clk_get(&pdev->dev, "sclk");
> > if (IS_ERR(priv->sclk)) {
> > dev_err(&pdev->dev, "unable to get clock\n");
> > - ret = PTR_ERR(priv->sclk);
> > - goto err1;
> > + return PTR_ERR(priv->sclk);
> > }
> >
> > memset(&up, 0, sizeof(up));
> > @@ -136,20 +134,13 @@ static int serial8250_em_probe(struct
> > platform_device *pdev)>
> > ret = serial8250_register_8250_port(&up);
> > if (ret < 0) {
> > dev_err(&pdev->dev, "unable to register 8250 port\n");
> > - goto err2;
> > + clk_disable(priv->sclk);
> > + return ret;
> > }
> >
> > priv->line = ret;
> > platform_set_drvdata(pdev, priv);
> > return 0;
> > -
> > - err2:
> > - clk_disable(priv->sclk);
> > - clk_put(priv->sclk);
> > - err1:
> > - kfree(priv);
> > - err0:
> > - return ret;
> > }
> >
> > static int serial8250_em_remove(struct platform_device *pdev)
> >
> > @@ -158,8 +149,6 @@ static int serial8250_em_remove(struct platform_device
> > *pdev)>
> > serial8250_unregister_port(priv->line);
> > clk_disable(priv->sclk);
> >
> > - clk_put(priv->sclk);
> > - kfree(priv);
> >
> > return 0;
> >
> > }
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] serial8250-em: Convert to devm_* managed helpers
2013-07-30 10:00 ` Laurent Pinchart
@ 2013-07-31 0:25 ` Simon Horman
-1 siblings, 0 replies; 8+ messages in thread
From: Simon Horman @ 2013-07-31 0:25 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Laurent Pinchart, linux-serial, linux-sh, Magnus Damm,
Greg Kroah-Hartman
On Tue, Jul 30, 2013 at 12:00:37PM +0200, Laurent Pinchart wrote:
> Hi Simon,
>
> On Tuesday 30 July 2013 11:08:59 Simon Horman wrote:
> > [ CC Greg Kroah-Hartman, linux-serial@vger.kernel.org,
> > linux-arm-kernel@lists.infradead.org ]
> >
> > On Fri, Jul 26, 2013 at 04:22:02PM +0200, Laurent Pinchart wrote:
> > > Replace kzalloc and clk_get by their managed counterparts to simplify
> > > error and cleanup paths.
> >
> > Hi Laurent,
> >
> > I was recently asked for shmobile clocksource patches to be reviewed by the
> > clocksource maintainers.
>
> I suppose you mean serial port, not clock source.
>
> > I believe that means Greg Kroah-Hartman and linux-serial@vger.kernel.org who
> > I have CCed on this email accordingly.
>
> linux-serial@vger.kernel.org was already CC'ed in my original e-mail.
>
> > I have also CCed linux-arm-kernel@lists.infradead.org
>
> Actually you haven't ;-)
:^)
> > as many moons ago I was asked for all patches that will go through my tree
> > and on to arm-soc to be sent there.
>
> This patch will likely go through the serial tree, which is why I hadn't CC'ed
> LAKML.
Understood, that makes sense.
> > > Signed-off-by: Laurent Pinchart
> > > <laurent.pinchart+renesas@ideasonboard.com>
> > > ---
> > >
> > > drivers/tty/serial/8250/8250_em.c | 27 ++++++++-------------------
> > > 1 file changed, 8 insertions(+), 19 deletions(-)
> > >
> > > diff --git a/drivers/tty/serial/8250/8250_em.c
> > > b/drivers/tty/serial/8250/8250_em.c index 916cc19..5f3bba1 100644
> > > --- a/drivers/tty/serial/8250/8250_em.c
> > > +++ b/drivers/tty/serial/8250/8250_em.c
> > > @@ -95,25 +95,23 @@ static int serial8250_em_probe(struct platform_device
> > > *pdev)>
> > > struct resource *irq = platform_get_resource(pdev, IORESOURCE_IRQ,
> > > 0);
> > > struct serial8250_em_priv *priv;
> > > struct uart_8250_port up;
> > > - int ret = -EINVAL;
> > > + int ret;
> > >
> > > if (!regs || !irq) {
> > > dev_err(&pdev->dev, "missing registers or irq\n");
> > > - goto err0;
> > > + return -EINVAL;
> > > }
> > >
> > > - priv = kzalloc(sizeof(*priv), GFP_KERNEL);
> > > + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> > > if (!priv) {
> > > dev_err(&pdev->dev, "unable to allocate private data\n");
> > > - ret = -ENOMEM;
> > > - goto err0;
> > > + return -ENOMEM;
> > > }
> > >
> > > - priv->sclk = clk_get(&pdev->dev, "sclk");
> > > + priv->sclk = devm_clk_get(&pdev->dev, "sclk");
> > > if (IS_ERR(priv->sclk)) {
> > > dev_err(&pdev->dev, "unable to get clock\n");
> > > - ret = PTR_ERR(priv->sclk);
> > > - goto err1;
> > > + return PTR_ERR(priv->sclk);
> > > }
> > >
> > > memset(&up, 0, sizeof(up));
> > > @@ -136,20 +134,13 @@ static int serial8250_em_probe(struct
> > > platform_device *pdev)>
> > > ret = serial8250_register_8250_port(&up);
> > > if (ret < 0) {
> > > dev_err(&pdev->dev, "unable to register 8250 port\n");
> > > - goto err2;
> > > + clk_disable(priv->sclk);
> > > + return ret;
> > > }
> > >
> > > priv->line = ret;
> > > platform_set_drvdata(pdev, priv);
> > > return 0;
> > > -
> > > - err2:
> > > - clk_disable(priv->sclk);
> > > - clk_put(priv->sclk);
> > > - err1:
> > > - kfree(priv);
> > > - err0:
> > > - return ret;
> > > }
> > >
> > > static int serial8250_em_remove(struct platform_device *pdev)
> > >
> > > @@ -158,8 +149,6 @@ static int serial8250_em_remove(struct platform_device
> > > *pdev)>
> > > serial8250_unregister_port(priv->line);
> > > clk_disable(priv->sclk);
> > >
> > > - clk_put(priv->sclk);
> > > - kfree(priv);
> > >
> > > return 0;
> > >
> > > }
> --
> Regards,
>
> Laurent Pinchart
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] serial8250-em: Convert to devm_* managed helpers
@ 2013-07-31 0:25 ` Simon Horman
0 siblings, 0 replies; 8+ messages in thread
From: Simon Horman @ 2013-07-31 0:25 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Laurent Pinchart, linux-serial, linux-sh, Magnus Damm,
Greg Kroah-Hartman
On Tue, Jul 30, 2013 at 12:00:37PM +0200, Laurent Pinchart wrote:
> Hi Simon,
>
> On Tuesday 30 July 2013 11:08:59 Simon Horman wrote:
> > [ CC Greg Kroah-Hartman, linux-serial@vger.kernel.org,
> > linux-arm-kernel@lists.infradead.org ]
> >
> > On Fri, Jul 26, 2013 at 04:22:02PM +0200, Laurent Pinchart wrote:
> > > Replace kzalloc and clk_get by their managed counterparts to simplify
> > > error and cleanup paths.
> >
> > Hi Laurent,
> >
> > I was recently asked for shmobile clocksource patches to be reviewed by the
> > clocksource maintainers.
>
> I suppose you mean serial port, not clock source.
>
> > I believe that means Greg Kroah-Hartman and linux-serial@vger.kernel.org who
> > I have CCed on this email accordingly.
>
> linux-serial@vger.kernel.org was already CC'ed in my original e-mail.
>
> > I have also CCed linux-arm-kernel@lists.infradead.org
>
> Actually you haven't ;-)
:^)
> > as many moons ago I was asked for all patches that will go through my tree
> > and on to arm-soc to be sent there.
>
> This patch will likely go through the serial tree, which is why I hadn't CC'ed
> LAKML.
Understood, that makes sense.
> > > Signed-off-by: Laurent Pinchart
> > > <laurent.pinchart+renesas@ideasonboard.com>
> > > ---
> > >
> > > drivers/tty/serial/8250/8250_em.c | 27 ++++++++-------------------
> > > 1 file changed, 8 insertions(+), 19 deletions(-)
> > >
> > > diff --git a/drivers/tty/serial/8250/8250_em.c
> > > b/drivers/tty/serial/8250/8250_em.c index 916cc19..5f3bba1 100644
> > > --- a/drivers/tty/serial/8250/8250_em.c
> > > +++ b/drivers/tty/serial/8250/8250_em.c
> > > @@ -95,25 +95,23 @@ static int serial8250_em_probe(struct platform_device
> > > *pdev)>
> > > struct resource *irq = platform_get_resource(pdev, IORESOURCE_IRQ,
> > > 0);
> > > struct serial8250_em_priv *priv;
> > > struct uart_8250_port up;
> > > - int ret = -EINVAL;
> > > + int ret;
> > >
> > > if (!regs || !irq) {
> > > dev_err(&pdev->dev, "missing registers or irq\n");
> > > - goto err0;
> > > + return -EINVAL;
> > > }
> > >
> > > - priv = kzalloc(sizeof(*priv), GFP_KERNEL);
> > > + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> > > if (!priv) {
> > > dev_err(&pdev->dev, "unable to allocate private data\n");
> > > - ret = -ENOMEM;
> > > - goto err0;
> > > + return -ENOMEM;
> > > }
> > >
> > > - priv->sclk = clk_get(&pdev->dev, "sclk");
> > > + priv->sclk = devm_clk_get(&pdev->dev, "sclk");
> > > if (IS_ERR(priv->sclk)) {
> > > dev_err(&pdev->dev, "unable to get clock\n");
> > > - ret = PTR_ERR(priv->sclk);
> > > - goto err1;
> > > + return PTR_ERR(priv->sclk);
> > > }
> > >
> > > memset(&up, 0, sizeof(up));
> > > @@ -136,20 +134,13 @@ static int serial8250_em_probe(struct
> > > platform_device *pdev)>
> > > ret = serial8250_register_8250_port(&up);
> > > if (ret < 0) {
> > > dev_err(&pdev->dev, "unable to register 8250 port\n");
> > > - goto err2;
> > > + clk_disable(priv->sclk);
> > > + return ret;
> > > }
> > >
> > > priv->line = ret;
> > > platform_set_drvdata(pdev, priv);
> > > return 0;
> > > -
> > > - err2:
> > > - clk_disable(priv->sclk);
> > > - clk_put(priv->sclk);
> > > - err1:
> > > - kfree(priv);
> > > - err0:
> > > - return ret;
> > > }
> > >
> > > static int serial8250_em_remove(struct platform_device *pdev)
> > >
> > > @@ -158,8 +149,6 @@ static int serial8250_em_remove(struct platform_device
> > > *pdev)>
> > > serial8250_unregister_port(priv->line);
> > > clk_disable(priv->sclk);
> > >
> > > - clk_put(priv->sclk);
> > > - kfree(priv);
> > >
> > > return 0;
> > >
> > > }
> --
> Regards,
>
> Laurent Pinchart
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-07-31 0:25 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-26 14:22 [PATCH] serial8250-em: Convert to devm_* managed helpers Laurent Pinchart
2013-07-26 14:22 ` Laurent Pinchart
2013-07-30 2:08 ` Simon Horman
2013-07-30 2:08 ` Simon Horman
2013-07-30 9:59 ` Laurent Pinchart
2013-07-30 10:00 ` Laurent Pinchart
2013-07-31 0:25 ` Simon Horman
2013-07-31 0:25 ` Simon Horman
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.