netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mrf24j40: add managed API's provided by device layer
@ 2014-05-29  4:17 Varka Bhadram
  2014-05-29 17:45 ` Sergei Shtylyov
  0 siblings, 1 reply; 2+ messages in thread
From: Varka Bhadram @ 2014-05-29  4:17 UTC (permalink / raw)
  To: alan
  Cc: alex.bluesman.smirnov, dbaryshkov, linux-zigbee-devel, netdev,
	linux-kernel, davem, alex.aing, Varka Bhadram

This patch adds the managed APIs to the deriver code. By using this we need
not to worry about freeing the memory and irq numbers.

Thanks and Regards,
Varka Bhadram

Signed-off-by: Varka Bhadram <varkab@cdac.in>
---
 drivers/net/ieee802154/mrf24j40.c |   22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c
index 78a6552..729ec0f 100644
--- a/drivers/net/ieee802154/mrf24j40.c
+++ b/drivers/net/ieee802154/mrf24j40.c
@@ -618,10 +618,11 @@ static int mrf24j40_probe(struct spi_device *spi)
 
 	printk(KERN_INFO "mrf24j40: probe(). IRQ: %d\n", spi->irq);
 
-	devrec = kzalloc(sizeof(struct mrf24j40), GFP_KERNEL);
+	devrec = devm_kzalloc(spi->dev,
+			sizeof(struct mrf24j40), GFP_KERNEL);
 	if (!devrec)
 		goto err_devrec;
-	devrec->buf = kzalloc(3, GFP_KERNEL);
+	devrec->buf = devm_kzalloc(spi->dev, 3, GFP_KERNEL);
 	if (!devrec->buf)
 		goto err_buf;
 
@@ -676,12 +677,13 @@ static int mrf24j40_probe(struct spi_device *spi)
 	val &= ~0x3; /* Clear RX mode (normal) */
 	write_short_reg(devrec, REG_RXMCR, val);
 
-	ret = request_threaded_irq(spi->irq,
-				   NULL,
-				   mrf24j40_isr,
-				   IRQF_TRIGGER_LOW|IRQF_ONESHOT,
-				   dev_name(&spi->dev),
-				   devrec);
+	ret = devm_request_threaded_irq(spi->dev,
+					spi->irq,
+					NULL,
+					mrf24j40_isr,
+					IRQF_TRIGGER_LOW|IRQF_ONESHOT,
+					dev_name(&spi->dev),
+					devrec);
 
 	if (ret) {
 		dev_err(printdev(devrec), "Unable to get IRQ");
@@ -709,15 +711,11 @@ static int mrf24j40_remove(struct spi_device *spi)
 
 	dev_dbg(printdev(devrec), "remove\n");
 
-	free_irq(spi->irq, devrec);
 	ieee802154_unregister_device(devrec->dev);
 	ieee802154_free_device(devrec->dev);
 	/* TODO: Will ieee802154_free_device() wait until ->xmit() is
 	 * complete? */
 
-	/* Clean up the SPI stuff. */
-	kfree(devrec->buf);
-	kfree(devrec);
 	return 0;
 }
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mrf24j40: add managed API's provided by device layer
  2014-05-29  4:17 [PATCH] mrf24j40: add managed API's provided by device layer Varka Bhadram
@ 2014-05-29 17:45 ` Sergei Shtylyov
  0 siblings, 0 replies; 2+ messages in thread
From: Sergei Shtylyov @ 2014-05-29 17:45 UTC (permalink / raw)
  To: Varka Bhadram, alan
  Cc: alex.bluesman.smirnov, dbaryshkov, linux-zigbee-devel, netdev,
	linux-kernel, davem, alex.aing, Varka Bhadram

Hello.

On 05/29/2014 08:17 AM, Varka Bhadram wrote:

> This patch adds the managed APIs to the deriver code. By using this we need
> not to worry about freeing the memory and irq numbers.

> Thanks and Regards,
> Varka Bhadram

    This is not desirable thing in the patch changelog, maintainer will have 
to edit it out...

> Signed-off-by: Varka Bhadram <varkab@cdac.in>
> ---
>   drivers/net/ieee802154/mrf24j40.c |   22 ++++++++++------------
>   1 file changed, 10 insertions(+), 12 deletions(-)

> diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c
> index 78a6552..729ec0f 100644
> --- a/drivers/net/ieee802154/mrf24j40.c
> +++ b/drivers/net/ieee802154/mrf24j40.c
> @@ -618,10 +618,11 @@ static int mrf24j40_probe(struct spi_device *spi)
>
>   	printk(KERN_INFO "mrf24j40: probe(). IRQ: %d\n", spi->irq);
>
> -	devrec = kzalloc(sizeof(struct mrf24j40), GFP_KERNEL);
> +	devrec = devm_kzalloc(spi->dev,
> +			sizeof(struct mrf24j40), GFP_KERNEL);

    Continuation line should start under the next character after ( on the 
previous line, according to the networking coding style.

[...]

WBR, Sergei

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-05-29 17:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-29  4:17 [PATCH] mrf24j40: add managed API's provided by device layer Varka Bhadram
2014-05-29 17:45 ` Sergei Shtylyov

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).