* [PATCH] spi: s3c24xx: Convert to use devm_kzalloc
@ 2014-03-31 3:37 Axel Lin
2014-04-01 2:02 ` Jingoo Han
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Axel Lin @ 2014-03-31 3:37 UTC (permalink / raw)
To: Mark Brown
Cc: Ben Dooks, Kukjin Kim, linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA,
linux-spi-u79uwXL29TY76Z2rM5mHXA
Simplify the cleanup code.
Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
---
drivers/spi/spi-s3c24xx.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/spi/spi-s3c24xx.c b/drivers/spi/spi-s3c24xx.c
index bed2338..6db14e5 100644
--- a/drivers/spi/spi-s3c24xx.c
+++ b/drivers/spi/spi-s3c24xx.c
@@ -183,7 +183,9 @@ static int s3c24xx_spi_setup(struct spi_device *spi)
/* allocate settings on the first call */
if (!cs) {
- cs = kzalloc(sizeof(struct s3c24xx_spi_devstate), GFP_KERNEL);
+ cs = devm_kzalloc(&spi->dev,
+ sizeof(struct s3c24xx_spi_devstate),
+ GFP_KERNEL);
if (!cs) {
dev_err(&spi->dev, "no memory for controller state\n");
return -ENOMEM;
@@ -209,11 +211,6 @@ static int s3c24xx_spi_setup(struct spi_device *spi)
return 0;
}
-static void s3c24xx_spi_cleanup(struct spi_device *spi)
-{
- kfree(spi->controller_state);
-}
-
static inline unsigned int hw_txbyte(struct s3c24xx_spi *hw, int count)
{
return hw->tx ? hw->tx[count] : 0;
@@ -543,7 +540,6 @@ static int s3c24xx_spi_probe(struct platform_device *pdev)
hw->bitbang.txrx_bufs = s3c24xx_spi_txrx;
hw->master->setup = s3c24xx_spi_setup;
- hw->master->cleanup = s3c24xx_spi_cleanup;
dev_dbg(hw->dev, "bitbang at %p\n", &hw->bitbang);
--
1.8.3.2
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] spi: s3c24xx: Convert to use devm_kzalloc
2014-03-31 3:37 [PATCH] spi: s3c24xx: Convert to use devm_kzalloc Axel Lin
@ 2014-04-01 2:02 ` Jingoo Han
2014-04-01 11:10 ` Mark Brown
2014-04-03 13:26 ` Ben Dooks
2 siblings, 0 replies; 4+ messages in thread
From: Jingoo Han @ 2014-04-01 2:02 UTC (permalink / raw)
To: 'Axel Lin', 'Mark Brown'
Cc: 'Ben Dooks', 'Kukjin Kim',
linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA,
linux-spi-u79uwXL29TY76Z2rM5mHXA, 'Jingoo Han'
On Monday, March 31, 2014 12:37 PM, Axel Lin wrote:
>
> Simplify the cleanup code.
>
> Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
Reviewed-by: Jingoo Han <jg1.han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Best regards,
Jingoo Han
> ---
> drivers/spi/spi-s3c24xx.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/spi/spi-s3c24xx.c b/drivers/spi/spi-s3c24xx.c
> index bed2338..6db14e5 100644
> --- a/drivers/spi/spi-s3c24xx.c
> +++ b/drivers/spi/spi-s3c24xx.c
> @@ -183,7 +183,9 @@ static int s3c24xx_spi_setup(struct spi_device *spi)
>
> /* allocate settings on the first call */
> if (!cs) {
> - cs = kzalloc(sizeof(struct s3c24xx_spi_devstate), GFP_KERNEL);
> + cs = devm_kzalloc(&spi->dev,
> + sizeof(struct s3c24xx_spi_devstate),
> + GFP_KERNEL);
> if (!cs) {
> dev_err(&spi->dev, "no memory for controller state\n");
> return -ENOMEM;
> @@ -209,11 +211,6 @@ static int s3c24xx_spi_setup(struct spi_device *spi)
> return 0;
> }
>
> -static void s3c24xx_spi_cleanup(struct spi_device *spi)
> -{
> - kfree(spi->controller_state);
> -}
> -
> static inline unsigned int hw_txbyte(struct s3c24xx_spi *hw, int count)
> {
> return hw->tx ? hw->tx[count] : 0;
> @@ -543,7 +540,6 @@ static int s3c24xx_spi_probe(struct platform_device *pdev)
> hw->bitbang.txrx_bufs = s3c24xx_spi_txrx;
>
> hw->master->setup = s3c24xx_spi_setup;
> - hw->master->cleanup = s3c24xx_spi_cleanup;
>
> dev_dbg(hw->dev, "bitbang at %p\n", &hw->bitbang);
>
> --
> 1.8.3.2
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] spi: s3c24xx: Convert to use devm_kzalloc
2014-03-31 3:37 [PATCH] spi: s3c24xx: Convert to use devm_kzalloc Axel Lin
2014-04-01 2:02 ` Jingoo Han
@ 2014-04-01 11:10 ` Mark Brown
2014-04-03 13:26 ` Ben Dooks
2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2014-04-01 11:10 UTC (permalink / raw)
To: Axel Lin; +Cc: Ben Dooks, Kukjin Kim, linux-samsung-soc, linux-spi
[-- Attachment #1: Type: text/plain, Size: 105 bytes --]
On Mon, Mar 31, 2014 at 11:37:29AM +0800, Axel Lin wrote:
> Simplify the cleanup code.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] spi: s3c24xx: Convert to use devm_kzalloc
2014-03-31 3:37 [PATCH] spi: s3c24xx: Convert to use devm_kzalloc Axel Lin
2014-04-01 2:02 ` Jingoo Han
2014-04-01 11:10 ` Mark Brown
@ 2014-04-03 13:26 ` Ben Dooks
2 siblings, 0 replies; 4+ messages in thread
From: Ben Dooks @ 2014-04-03 13:26 UTC (permalink / raw)
To: Axel Lin
Cc: Mark Brown, Ben Dooks, Kukjin Kim,
linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA,
linux-spi-u79uwXL29TY76Z2rM5mHXA
On Mon, Mar 31, 2014 at 11:37:29AM +0800, Axel Lin wrote:
> Simplify the cleanup code.
>
> Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
Acked-by: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
> ---
> drivers/spi/spi-s3c24xx.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/spi/spi-s3c24xx.c b/drivers/spi/spi-s3c24xx.c
> index bed2338..6db14e5 100644
> --- a/drivers/spi/spi-s3c24xx.c
> +++ b/drivers/spi/spi-s3c24xx.c
> @@ -183,7 +183,9 @@ static int s3c24xx_spi_setup(struct spi_device *spi)
>
> /* allocate settings on the first call */
> if (!cs) {
> - cs = kzalloc(sizeof(struct s3c24xx_spi_devstate), GFP_KERNEL);
> + cs = devm_kzalloc(&spi->dev,
> + sizeof(struct s3c24xx_spi_devstate),
> + GFP_KERNEL);
> if (!cs) {
> dev_err(&spi->dev, "no memory for controller state\n");
> return -ENOMEM;
> @@ -209,11 +211,6 @@ static int s3c24xx_spi_setup(struct spi_device *spi)
> return 0;
> }
>
> -static void s3c24xx_spi_cleanup(struct spi_device *spi)
> -{
> - kfree(spi->controller_state);
> -}
> -
> static inline unsigned int hw_txbyte(struct s3c24xx_spi *hw, int count)
> {
> return hw->tx ? hw->tx[count] : 0;
> @@ -543,7 +540,6 @@ static int s3c24xx_spi_probe(struct platform_device *pdev)
> hw->bitbang.txrx_bufs = s3c24xx_spi_txrx;
>
> hw->master->setup = s3c24xx_spi_setup;
> - hw->master->cleanup = s3c24xx_spi_cleanup;
>
> dev_dbg(hw->dev, "bitbang at %p\n", &hw->bitbang);
>
> --
> 1.8.3.2
>
>
>
--
Ben Dooks, ben-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, http://www.fluff.org/ben/
Large Hadron Colada: A large Pina Colada that makes the universe disappear.
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-04-03 13:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-31 3:37 [PATCH] spi: s3c24xx: Convert to use devm_kzalloc Axel Lin
2014-04-01 2:02 ` Jingoo Han
2014-04-01 11:10 ` Mark Brown
2014-04-03 13:26 ` Ben Dooks
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.