Skip to contentSkip to conversation

AsoC/s6000: use resource_size for {request/release}_mem_region and ioremap

PATCH Applied Mark Brown 4 participants 10 messages Jun 2, 2010 1 message not in the archive

lore
Share & tools
lore

Mark Brown

author
#1 lore raw
In reply to a message not in the archive
Quoted 5 lines · Wan ZongShun

The size calculation is end - start + 1. But,sometimes, the '1' can be forgotten carelessly, witch will have potential risk, so use resource_size for {request/release}_mem_region and ioremap here should be good habit.

CCing in Daniel who wrote the S6000 support. Daniel, do you want to add an entry to MAINTAINERS for this stuff or are you happy without having stuff run past you?

Quoted 109 lines
---
 sound/soc/s6000/s6000-i2s.c |   38 +++++++++++++++++---------------------
 1 files changed, 17 insertions(+), 21 deletions(-)
sound/soc/s6000/s6000-i2s.c +17 -21
index 5b9ac17..59e3fa7 100644
@@ -451,16 +451,15 @@ static int __devinit s6000_i2s_probe(struct platform_device *pdev)
 		goto err_release_none;
 	}
 
-	region = request_mem_region(scbmem->start,
-				    scbmem->end - scbmem->start + 1,
-				    pdev->name);
+	region = request_mem_region(scbmem->start, resource_size(scbmem),
+								pdev->name);
 	if (!region) {
 		dev_err(&pdev->dev, "I2S SCB region already claimed\n");
 		ret = -EBUSY;
 		goto err_release_none;
 	}
 
-	mmio = ioremap(scbmem->start, scbmem->end - scbmem->start + 1);
+	mmio = ioremap(scbmem->start, resource_size(scbmem));
 	if (!mmio) {
 		dev_err(&pdev->dev, "can't ioremap SCB region\n");
 		ret = -ENOMEM;
@@ -474,9 +473,8 @@ static int __devinit s6000_i2s_probe(struct platform_device *pdev)
 		goto err_release_map;
 	}
 
-	region = request_mem_region(sifmem->start,
-				    sifmem->end - sifmem->start + 1,
-				    pdev->name);
+	region = request_mem_region(sifmem->start, resource_size(sifmem),
+								pdev->name);
 	if (!region) {
 		dev_err(&pdev->dev, "I2S SIF region already claimed\n");
 		ret = -EBUSY;
@@ -490,8 +488,8 @@ static int __devinit s6000_i2s_probe(struct platform_device *pdev)
 		goto err_release_sif;
 	}
 
-	region = request_mem_region(dma1->start, dma1->end - dma1->start + 1,
-				    pdev->name);
+	region = request_mem_region(dma1->start, resource_size(dma1),
+								pdev->name);
 	if (!region) {
 		dev_err(&pdev->dev, "I2S DMA region already claimed\n");
 		ret = -EBUSY;
@@ -500,9 +498,8 @@ static int __devinit s6000_i2s_probe(struct platform_device *pdev)
 
 	dma2 = platform_get_resource(pdev, IORESOURCE_DMA, 1);
 	if (dma2) {
-		region = request_mem_region(dma2->start,
-					    dma2->end - dma2->start + 1,
-					    pdev->name);
+		region = request_mem_region(dma2->start, resource_size(dma2),
+								pdev->name);
 		if (!region) {
 			dev_err(&pdev->dev,
 				"I2S DMA region already claimed\n");
@@ -561,15 +558,15 @@ err_release_dev:
 	kfree(dev);
 err_release_dma2:
 	if (dma2)
-		release_mem_region(dma2->start, dma2->end - dma2->start + 1);
+		release_mem_region(dma2->start, resource_size(dma2));
 err_release_dma1:
-	release_mem_region(dma1->start, dma1->end - dma1->start + 1);
+	release_mem_region(dma1->start, resource_size(dma1));
 err_release_sif:
-	release_mem_region(sifmem->start, (sifmem->end - sifmem->start) + 1);
+	release_mem_region(sifmem->start, resource_size(sifmem));
 err_release_map:
 	iounmap(mmio);
 err_release_scb:
-	release_mem_region(scbmem->start, (scbmem->end - scbmem->start) + 1);
+	release_mem_region(scbmem->start, resource_size(scbmem));
 err_release_none:
 	return ret;
 }
@@ -590,19 +587,18 @@ static void __devexit s6000_i2s_remove(struct platform_device *pdev)
 	kfree(dev);
 
 	region = platform_get_resource(pdev, IORESOURCE_DMA, 0);
-	release_mem_region(region->start, region->end - region->start + 1);
+	release_mem_region(region->start, resource_size(region));
 
 	region = platform_get_resource(pdev, IORESOURCE_DMA, 1);
 	if (region)
-		release_mem_region(region->start,
-				   region->end - region->start + 1);
+		release_mem_region(region->start, resource_size(region));
 
 	region = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	release_mem_region(region->start, (region->end - region->start) + 1);
+	release_mem_region(region->start, resource_size(region));
 
 	iounmap(mmio);
 	region = platform_get_resource(pdev, IORESOURCE_IO, 0);
-	release_mem_region(region->start, (region->end - region->start) + 1);
+	release_mem_region(region->start, resource_size(region));
 }
 
 static struct platform_driver s6000_i2s_driver = {
Signature · 1 line
1.6.3.3
#2 lore raw
Quoted 3 lines · Mark Brown

CCing in Daniel who wrote the S6000 support. Daniel, do you want to add an entry to MAINTAINERS for this stuff or are you happy without having stuff run past you?

I don't think it is necessary to add an entry to MAINTAINERS. My name and address listed at the top of the file should be enough. It's not like I'm still working on it, but if needed I can take the device from the shelf to perform some tests, should anyone make more serious changes to the driver.

Daniel

Signature · 6 lines
Dipl.-Math. Daniel Glöckner, emlix GmbH, http://www.emlix.com
Fon +49 551 30664-0, Fax -11, Bahnhofsallee 1b, 37081 Göttingen, Germany
Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160
Geschäftsführer: Dr. Uwe Kracke, Ust-IdNr.: DE 205 198 055

emlix - your embedded linux partner
author
#3 lore raw
Quoted 5 lines · Daniel Gl?ckner

I don't think it is necessary to add an entry to MAINTAINERS. My name and address listed at the top of the file should be enough. It's not like I'm still working on it, but if needed I can take the device from the shelf to perform some tests, should anyone make more serious changes to the driver.

MAINTAINERS is used by automatic tools like get_maintainer to find who to CC so entries there are still useful - original authorship is often not a good indicator that someone is willing to take responsibility for the code. From the sounds of it though it was for a particular project and you've moved on from it so you're not particularly concerned about now so it's not worth it anyway?

#4 lore raw

PATCH 1/1 MAINTAINERS: add entry for s6000 sound driver

In reply to Mark Brown
---
 MAINTAINERS |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
MAINTAINERS +6 -0
index 2652ebc..c650d48 100644
@@ -4893,6 +4893,12 @@ L:	[email protected] (moderated for non-subscribers)
 S:	Supported
 F:	drivers/mmc/host/s3cmci.*
 
+S6000 SOUND DRIVER
+M:	Daniel Glöckner <[email protected]>
+L:	[email protected] (moderated for non-subscribers)
+S:	Odd Fixes
+F:	sound/soc/s6000/
+
 SAA7146 VIDEO4LINUX-2 DRIVER
 M:	Michael Hunold <[email protected]>
 L:	[email protected]
Signature · 6 lines
1.6.1.3

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#7 lore raw
In reply to Mark Brown

2010/6/2 Mark Brown <[email protected]>:

Quoted 8 lines · Daniel Gl?ckner
Quoted 6 lines

I don't think it is necessary to add an entry to MAINTAINERS. My name and address listed at the top of the file should be enough. It's not like I'm still working on it, but if needed I can take the device from the shelf to perform some tests, should anyone make more serious changes to the driver.

Quoted 6 lines

MAINTAINERS is used by automatic tools like get_maintainer to find who to CC so entries there are still useful - original authorship is often not a good indicator that someone is willing to take responsibility for the code.  From the sounds of it though it was for a particular project and you've moved on from it so you're not particularly concerned about now so it's not worth it anyway?

Oh, it just be my worry.
If some codes were no longer useful or valuable, what should we do for them? delete them or keep them be there yet?

If I my patch to fix a worthless codes, everything I do will be nothing.

Quoted 1 line
Signature · 14 lines
*linux-arm-kernel mailing list
mail addr:[email protected]
you can subscribe by:
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

* linux-arm-NUC900 mailing list
mail addr:[email protected]
main web: https://groups.google.com/group/NUC900
you can subscribe it by sending me mail:
[email protected]
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
author
#8 lore raw
Quoted 5 lines · Wan ZongShun

Oh, it just be my worry.
If some codes were no longer useful or valuable, what should we do for them? delete them or keep them be there yet?

If I my patch to fix a worthless codes, everything I do will be nothing.

The hardware is still very much live, it's just that Daniel isn't working on it.

#9 lore raw

2010/6/2 Mark Brown <[email protected]>:

Quoted 10 lines · Wan ZongShun
Quoted 6 lines

Oh, it just be my worry.
If some codes were no longer useful or valuable, what should we do for them? delete them or keep them be there yet?

If I my patch to fix a worthless codes, everything I do will be nothing.

The hardware is still very much live, it's just that Daniel isn't working on it.

Of course, the s6000 is live, but we cannot indentify whether other hardwares still live or not in all Linux tree.:)

Quoted 1 line
Signature · 10 lines
*linux-arm-kernel mailing list
mail addr:[email protected]
you can subscribe by:
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

* linux-arm-NUC900 mailing list
mail addr:[email protected]
main web: https://groups.google.com/group/NUC900
you can subscribe it by sending me mail:
[email protected]
Acked-by on v1 1/1
#5 lore raw

Re: [PATCH] MAINTAINERS: add entry for s6000 sound driver

In reply to Daniel Glöckner
Quoted 12 lines · Daniel Glöckner
---
 MAINTAINERS |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
MAINTAINERS +0 -0
index 2652ebc..c650d48 100644
@@ -4893,6 +4893,12 @@ L:	[email protected] (moderated for non-subscribers)
 S:	Supported
 F:	drivers/mmc/host/s3cmci.*

MAINTAINERS L: [email protected] (moderated for non-subscribers) · line 4904

Quoted 10 lines
MAINTAINERS +6 -0
 
+S6000 SOUND DRIVER
+M:	Daniel Glöckner <[email protected]>
+L:	[email protected] (moderated for non-subscribers)
+S:	Odd Fixes
+F:	sound/soc/s6000/
+
 SAA7146 VIDEO4LINUX-2 DRIVER
 M:	Michael Hunold <[email protected]>
 L:	[email protected]
Signature · 8 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel