spi: s3c24xx: Convert to use devm_kzalloc
Subsystems (3)
PATCH 1/1 spi: s3c24xx: Convert to use devm_kzalloc
Simplify the cleanup code.
Signed-off-by Axel Lin <[email protected]>
--- drivers/spi/spi-s3c24xx.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/spi/spi-s3c24xx.c +3 -7
@@ -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);
Signature · 8 lines
1.8.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 4 lines · Axel Lin
Simplify the cleanup code.
Signed-off-by Axel Lin <[email protected]>
Reviewed-by Jingoo Han <[email protected]>
Best regards,
Jingoo Han
Quoted 40 lines
--- drivers/spi/spi-s3c24xx.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)drivers/spi/spi-s3c24xx.c +3
-8@@ -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); --
Quoted 1 line
1.8.3.2
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 1 line · Axel Lin
Simplify the cleanup code.
Applied, thanks.
Quoted 3 lines · Axel Lin
Simplify the cleanup code.
Signed-off-by Axel Lin <[email protected]>
Acked-by Ben Dooks <[email protected]>
Quoted 44 lines
--- drivers/spi/spi-s3c24xx.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)drivers/spi/spi-s3c24xx.c +3
-7@@ -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);Signature · 1 line
1.8.3.2
Signature · 8 lines
Ben Dooks, [email protected], 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html