linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] brd: make rd_size static
@ 2017-03-10  7:32 Jason Yan
  2017-03-11 22:29 ` Jens Axboe
  0 siblings, 1 reply; 5+ messages in thread
From: Jason Yan @ 2017-03-10  7:32 UTC (permalink / raw)
  To: axboe, linux-block; +Cc: miaoxie, zhaohongjiang, Jason Yan

Fixes the following sparse warning:

drivers/block/brd.c:411:15: warning: symbol 'rd_size' was not declared.
Should it be static?

Signed-off-by: Jason Yan <yanaijie@huawei.com>
---
 drivers/block/brd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 3adc32a..e5d9f35 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -408,7 +408,7 @@ static int rd_nr = CONFIG_BLK_DEV_RAM_COUNT;
 module_param(rd_nr, int, S_IRUGO);
 MODULE_PARM_DESC(rd_nr, "Maximum number of brd devices");
 
-unsigned long rd_size = CONFIG_BLK_DEV_RAM_SIZE;
+static unsigned long rd_size = CONFIG_BLK_DEV_RAM_SIZE;
 module_param(rd_size, ulong, S_IRUGO);
 MODULE_PARM_DESC(rd_size, "Size of each RAM disk in kbytes.");
 
-- 
2.5.0

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

* Re: [PATCH] brd: make rd_size static
  2017-03-10  7:32 [PATCH] brd: make rd_size static Jason Yan
@ 2017-03-11 22:29 ` Jens Axboe
  2017-03-13  0:56   ` Jason Yan
  2017-03-13 20:07   ` Bart Van Assche
  0 siblings, 2 replies; 5+ messages in thread
From: Jens Axboe @ 2017-03-11 22:29 UTC (permalink / raw)
  To: Jason Yan, linux-block; +Cc: miaoxie, zhaohongjiang

On 03/10/2017 12:32 AM, Jason Yan wrote:
> Fixes the following sparse warning:
> 
> drivers/block/brd.c:411:15: warning: symbol 'rd_size' was not declared.
> Should it be static?

If you do a search on this topic, you'll find others that attempted
to do the same. Arm uses it for tag parsing, for some reason, your
patch below would break it.

It'd be great if this was fixed up for real, though.

-- 
Jens Axboe

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

* Re: [PATCH] brd: make rd_size static
  2017-03-11 22:29 ` Jens Axboe
@ 2017-03-13  0:56   ` Jason Yan
  2017-03-13  2:56     ` Jens Axboe
  2017-03-13 20:07   ` Bart Van Assche
  1 sibling, 1 reply; 5+ messages in thread
From: Jason Yan @ 2017-03-13  0:56 UTC (permalink / raw)
  To: Jens Axboe, linux-block; +Cc: miaoxie, zhaohongjiang


On 2017/3/12 6:29, Jens Axboe wrote:
> On 03/10/2017 12:32 AM, Jason Yan wrote:
>> Fixes the following sparse warning:
>>
>> drivers/block/brd.c:411:15: warning: symbol 'rd_size' was not declared.
>> Should it be static?
>
> If you do a search on this topic, you'll find others that attempted
> to do the same. Arm uses it for tag parsing, for some reason, your
> patch below would break it.
>
> It'd be great if this was fixed up for real, though.
>

how about fix this like this, looks ugly but works:

#ifndef CONFIG_ARM
static
#endif

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

* Re: [PATCH] brd: make rd_size static
  2017-03-13  0:56   ` Jason Yan
@ 2017-03-13  2:56     ` Jens Axboe
  0 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2017-03-13  2:56 UTC (permalink / raw)
  To: Jason Yan, linux-block; +Cc: miaoxie, zhaohongjiang

On 03/12/2017 06:56 PM, Jason Yan wrote:
> 
> On 2017/3/12 6:29, Jens Axboe wrote:
>> On 03/10/2017 12:32 AM, Jason Yan wrote:
>>> Fixes the following sparse warning:
>>>
>>> drivers/block/brd.c:411:15: warning: symbol 'rd_size' was not declared.
>>> Should it be static?
>>
>> If you do a search on this topic, you'll find others that attempted
>> to do the same. Arm uses it for tag parsing, for some reason, your
>> patch below would break it.
>>
>> It'd be great if this was fixed up for real, though.
>>
> 
> how about fix this like this, looks ugly but works:
> 
> #ifndef CONFIG_ARM
> static
> #endif

No, that solves nothing, and is arguably worse. Either leave it
alone, perhaps with a comment to prevent others from making the
same error, or fix it for real.

-- 
Jens Axboe

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

* Re: [PATCH] brd: make rd_size static
  2017-03-11 22:29 ` Jens Axboe
  2017-03-13  0:56   ` Jason Yan
@ 2017-03-13 20:07   ` Bart Van Assche
  1 sibling, 0 replies; 5+ messages in thread
From: Bart Van Assche @ 2017-03-13 20:07 UTC (permalink / raw)
  To: linux-block, yanaijie, axboe; +Cc: zhaohongjiang, miaoxie

On Sat, 2017-03-11 at 15:29 -0700, Jens Axboe wrote:
> On 03/10/2017 12:32 AM, Jason Yan wrote:
> > Fixes the following sparse warning:
> >=20
> > drivers/block/brd.c:411:15: warning: symbol 'rd_size' was not declared.
> > Should it be static?
>=20
> If you do a search on this topic, you'll find others that attempted
> to do the same. Arm uses it for tag parsing, for some reason, your
> patch below would break it.
>=20
> It'd be great if this was fixed up for real, though.

How about something like the (untested) patch below?


Subject: [PATCH] arch/arm/kernel/atags_parse.c: Fix rd_size declaration

Ensure that the ARM setup code treats "rd_size" as unsigned long instead of=
 int.

---
 arch/arm/kernel/atags_parse.c | 3 ++-
 drivers/block/brd.c           | 2 ++
 drivers/block/brd.h           | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)
 create mode 100644 drivers/block/brd.h

diff --git a/arch/arm/kernel/atags_parse.c b/arch/arm/kernel/atags_parse.c
index 68c6ae0b9e4c..f18b6deaf050 100644
--- a/arch/arm/kernel/atags_parse.c
+++ b/arch/arm/kernel/atags_parse.c
@@ -30,6 +30,7 @@
 #include <asm/mach/arch.h>
=20
 #include "atags.h"
+#include "../../../drivers/block/brd.h"
=20
 static char default_command_line[COMMAND_LINE_SIZE] __initdata =3D CONFIG_=
CMDLINE;
=20
@@ -91,7 +92,7 @@ __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;
+	extern int rd_image_start, rd_prompt, rd_doload;
=20
 	rd_image_start =3D tag->u.ramdisk.start;
 	rd_doload =3D (tag->u.ramdisk.flags & 1) =3D=3D 0;
diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 3adc32a3153b..f1f9f0338fbd 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -25,6 +25,8 @@
=20
 #include <linux/uaccess.h>
=20
+#include "brd.h"
+
 #define SECTOR_SHIFT		9
 #define PAGE_SECTORS_SHIFT	(PAGE_SHIFT - SECTOR_SHIFT)
 #define PAGE_SECTORS		(1 << PAGE_SECTORS_SHIFT)
diff --git a/drivers/block/brd.h b/drivers/block/brd.h
new file mode 100644
index 000000000000..dbb0f92fefc8
--- /dev/null
+++ b/drivers/block/brd.h
@@ -0,0 +1 @@
+extern unsigned long rd_size;
--=20
2.12.0

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

end of thread, other threads:[~2017-03-13 20:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-10  7:32 [PATCH] brd: make rd_size static Jason Yan
2017-03-11 22:29 ` Jens Axboe
2017-03-13  0:56   ` Jason Yan
2017-03-13  2:56     ` Jens Axboe
2017-03-13 20:07   ` Bart Van Assche

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