Skip to contentSkip to conversation

ARM: Fix rd_size declaration

PATCH In review Bart Van Assche 3 participants 7 messages Apr 17, 2017 – May 3, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: Fix rd_size declaration

The global variable 'rd_size' is declared as 'int' in source file arch/arm/kernel/atags_parse.c and as 'unsigned long' in drivers/block/brd.c. Fix this inconsistency.

Cc Russell King <[email protected]>
Cc Jens Axboe <[email protected]>
Cc Jan Kara <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc linux-block at vger.kernel.org
---
 arch/arm/kernel/atags_parse.c | 4 ++--
 drivers/block/brd.c           | 1 +
 include/linux/brd.h           | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)
 create mode 100644 include/linux/brd.h
arch/arm/kernel/atags_parse.c +2 -2
index 68c6ae0b9e4c..85cb659e622a 100644
@@ -23,6 +23,8 @@
 #include <linux/root_dev.h>
 #include <linux/screen_info.h>
 #include <linux/memblock.h>
+#include <linux/brd.h>		/* rd_size */
+#include <linux/initrd.h>	/* rd_image_start, rd_prompt, rd_doload */
 
 #include <asm/setup.h>
 #include <asm/system_info.h>
@@ -91,8 +93,6 @@ __tagtable(ATAG_VIDEOTEXT, parse_tag_videotext);
 #ifdef CONFIG_BLK_DEV_RAM
 static int __init parse_tag_ramdisk(const struct tag *tag)
 {
-	extern int rd_size, rd_image_start, rd_prompt, rd_doload;
-
 	rd_image_start = tag->u.ramdisk.start;
 	rd_doload = (tag->u.ramdisk.flags & 1) == 0;
 	rd_prompt = (tag->u.ramdisk.flags & 2) == 0;
drivers/block/brd.c +1 -0
index 3adc32a3153b..6d4bd38a9b7c 100644
@@ -24,6 +24,7 @@
 #endif
 
 #include <linux/uaccess.h>
+#include <linux/brd.h>
 
 #define SECTOR_SHIFT		9
 #define PAGE_SECTORS_SHIFT	(PAGE_SHIFT - SECTOR_SHIFT)
include/linux/brd.h new file +1 -0
new file mode 100644
index 000000000000..dbb0f92fefc8
@@ -0,0 +1 @@
+extern unsigned long rd_size;
Signature · 1 line
2.12.2
#1 lore raw
Quoted 20 lines · Bart Van Assche

The global variable 'rd_size' is declared as 'int' in source file arch/arm/kernel/atags_parse.c and as 'unsigned long' in drivers/block/brd.c. Fix this inconsistency.

Cc Russell King <[email protected]>
Cc Jens Axboe <[email protected]>
Cc Jan Kara <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc linux-block at vger.kernel.org

---

include/linux/brd.h new file +0 -0
new file mode 100644
index 000000000000..dbb0f92fefc8

include/linux/brd.h line 1

Quoted 1 line
include/linux/brd.h new file +1 -0
@@ -0,0 +1 @@
+extern unsigned long rd_size;

Small nit, can you add an include guard here as well?

Thanks,
Johannes

Signature · 6 lines
Johannes Thumshirn                                          Storage
jthumshirn at suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
#2 lore raw
Quoted 16 lines · Johannes Thumshirn
Quoted 15 lines · Bart Van Assche

The global variable 'rd_size' is declared as 'int' in source file arch/arm/kernel/atags_parse.c and as 'unsigned long' in drivers/block/brd.c. Fix this inconsistency.

Cc Russell King <[email protected]>
Cc Jens Axboe <[email protected]>
Cc Jan Kara <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc linux-block at vger.kernel.org

---

include/linux/brd.h +0 -0
Quoted 8 lines

include/linux/brd.h line 1

Quoted 6 lines

new file mode 100644
index 000000000000..dbb0f92fefc8

include/linux/brd.h new file +1 -0
@@ -0,0 +1 @@
+extern unsigned long rd_size;

Small nit, can you add an include guard here as well?

Hello Johannes,

Thanks for the review. But are you aware that with the current content an include guard is overkill because it is safe to evaluate the "extern unsigned long rd_size" declaration multiple times?

Bart.

#3 lore raw
Quoted 5 lines · Bart Van Assche

Hello Johannes,

Thanks for the review. But are you aware that with the current content an include guard is overkill because it is safe to evaluate the "extern unsigned long rd_size" declaration multiple times?

Yes I am. But once someone does changes to this header and forgets the include guard as well it may cause errors.

I am aware that this is rather cosmetic than needed, that's why I declared it as a nit.

Byte,
Johannes

Signature · 6 lines
Johannes Thumshirn                                          Storage
jthumshirn at suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
#4 lore raw
In reply to Bart Van Assche
Quoted 4 lines · Bart Van Assche

The global variable 'rd_size' is declared as 'int' in source file arch/arm/kernel/atags_parse.c and as 'unsigned long' in drivers/block/brd.c. Fix this inconsistency.
[ ... ]

Hello Russell,

Have I sent this patch to the right maintainer?

Thanks,

Bart.

#5 lore raw
Quoted 9 lines · Bart Van Assche
Quoted 4 lines · Bart Van Assche

The global variable 'rd_size' is declared as 'int' in source file arch/arm/kernel/atags_parse.c and as 'unsigned long' in drivers/block/brd.c. Fix this inconsistency.
[ ... ]

Hello Russell,

Have I sent this patch to the right maintainer?

There were comments on the patch which seemed to be unresolved.

I, too, don't like the idea of a single-line header file. I'm also wondering what the right solution here is - we're the only architecture in the modern kernel that writes to rd_size, no one else does that. I haven't been able to dig into the history to find out whether other architectures used to, or what.

However, it would be nice if rd_size could go with some other related declarations somewhere (if there are any.)

Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
#6 lore raw
Quoted 1 line · Russell King - ARM Linux

There were comments on the patch which seemed to be unresolved.

Do you mean the header guard? That's easy to resolve.

Quoted 2 lines

However, it would be nice if rd_size could go with some other related declarations somewhere (if there are any.)

Sorry but I don't know about any other declarations that should be moved into a brd header file.

Bart.