All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [PATCH] constify drivers/block/floppy.c (2.6.17-rc1-mm3)
@ 2006-04-25 18:03 Andreas Mohr
  2006-04-26  3:19 ` Arthur Othieno
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andreas Mohr @ 2006-04-25 18:03 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1683 bytes --]

Hello all,

constify the few floppy module variables that can be constified
(see objdump -x floppy.ko).

Patch against 2.6.17-rc1-mm3.

Signed-off-by: Andreas Mohr <andi@lisas.de>

Thanks!


--- linux-2.6.17-rc1-mm3/drivers/block/floppy.c	2006-04-03 05:22:10.000000000 +0200
+++ linux-2.6.17-rc1-mm3/drivers/block/floppy.c.const	2006-04-25 19:57:40.000000000 +0200
@@ -505,7 +505,7 @@
 
 static sector_t floppy_sizes[256];
 
-static char floppy_device_name[] = "floppy";
+static const char floppy_device_name[] = "floppy";
 
 /*
  * The driver is trying to determine the correct media format
@@ -3954,7 +3954,7 @@
 	.media_changed	= check_floppy_change,
 	.revalidate_disk = floppy_revalidate,
 };
-static char *table[] = {
+static const char * const table[] = {
 	"", "d360", "h1200", "u360", "u720", "h360", "h720",
 	"u1440", "u2880", "CompaQ", "h1440", "u1680", "h410",
 	"u820", "h1476", "u1722", "h420", "u830", "h1494", "u1743",
@@ -3962,11 +3962,11 @@
 	"u3200", "u3520", "u3840", "u1840", "u800", "u1600",
 	NULL
 };
-static int t360[] = { 1, 0 },
+static const int t360[] = { 1, 0 },
 	t1200[] = { 2, 5, 6, 10, 12, 14, 16, 18, 20, 23, 0 },
 	t3in[] = { 8, 9, 26, 27, 28, 7, 11, 15, 19, 24, 25, 29, 31, 3, 4, 13,
 			17, 21, 22, 30, 0 };
-static int *table_sup[] =
+static const int * const table_sup[] =
     { NULL, t360, t1200, t3in + 5 + 8, t3in + 5, t3in, t3in };
 
 static void __init register_devfs_entries(int drive)

-- 
No programming skills!? Why not help translate many Linux applications! 
https://launchpad.ubuntu.com/rosetta
(or alternatively buy nicely packaged Linux distros/OSS software to help
support Linux developers creating shiny new things for you?)

[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] [PATCH] constify drivers/block/floppy.c (2.6.17-rc1-mm3)
  2006-04-25 18:03 [KJ] [PATCH] constify drivers/block/floppy.c (2.6.17-rc1-mm3) Andreas Mohr
@ 2006-04-26  3:19 ` Arthur Othieno
  2006-04-26  7:20 ` Andreas Mohr
  2006-04-26 14:56 ` Alexey Dobriyan
  2 siblings, 0 replies; 4+ messages in thread
From: Arthur Othieno @ 2006-04-26  3:19 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1538 bytes --]

On Tue, Apr 25, 2006 at 08:03:13PM +0200, Andreas Mohr wrote:
> Hello all,
> 
> constify the few floppy module variables that can be constified
> (see objdump -x floppy.ko).
> 
> Patch against 2.6.17-rc1-mm3.
> 
> Signed-off-by: Andreas Mohr <andi@lisas.de>
> 
> Thanks!
> 
> 
> --- linux-2.6.17-rc1-mm3/drivers/block/floppy.c	2006-04-03 05:22:10.000000000 +0200
> +++ linux-2.6.17-rc1-mm3/drivers/block/floppy.c.const	2006-04-25 19:57:40.000000000 +0200
> @@ -3954,7 +3954,7 @@
>  	.media_changed	= check_floppy_change,
>  	.revalidate_disk = floppy_revalidate,
>  };
> -static char *table[] = {
> +static const char * const table[] = {

  warning: initialization makes pointer from integer without a cast

>  	"", "d360", "h1200", "u360", "u720", "h360", "h720",
>  	"u1440", "u2880", "CompaQ", "h1440", "u1680", "h410",
>  	"u820", "h1476", "u1722", "h420", "u830", "h1494", "u1743",
> @@ -3962,11 +3962,11 @@
>  	"u3200", "u3520", "u3840", "u1840", "u800", "u1600",
>  	NULL
>  };
> -static int t360[] = { 1, 0 },
> +static const int t360[] = { 1, 0 },
>  	t1200[] = { 2, 5, 6, 10, 12, 14, 16, 18, 20, 23, 0 },
>  	t3in[] = { 8, 9, 26, 27, 28, 7, 11, 15, 19, 24, 25, 29, 31, 3, 4, 13,
>  			17, 21, 22, 30, 0 };
> -static int *table_sup[] =
> +static const int * const table_sup[] =

  warning: initialization makes pointer from integer without a cast

>      { NULL, t360, t1200, t3in + 5 + 8, t3in + 5, t3in, t3in };
>  
>  static void __init register_devfs_entries(int drive)
> 

Please at least compile test your patches. Thanks.

[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] [PATCH] constify drivers/block/floppy.c (2.6.17-rc1-mm3)
  2006-04-25 18:03 [KJ] [PATCH] constify drivers/block/floppy.c (2.6.17-rc1-mm3) Andreas Mohr
  2006-04-26  3:19 ` Arthur Othieno
@ 2006-04-26  7:20 ` Andreas Mohr
  2006-04-26 14:56 ` Alexey Dobriyan
  2 siblings, 0 replies; 4+ messages in thread
From: Andreas Mohr @ 2006-04-26  7:20 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1679 bytes --]

Hi,

On Tue, Apr 25, 2006 at 11:19:49PM -0400, Arthur Othieno wrote:
> On Tue, Apr 25, 2006 at 08:03:13PM +0200, Andreas Mohr wrote:
> > -static char *table[] = {
> > +static const char * const table[] = {
> 
>   warning: initialization makes pointer from integer without a cast

Argh.

> Please at least compile test your patches. Thanks.

Uh, I do (plus, I runtime-tested it, too):

# make modules
  CHK     include/linux/version.h
  CC [M]  drivers/block/floppy.o
  Building modules, stage 2.
  MODPOST
WARNING: "v4l_compat_translate_ioctl" [drivers/media/video/saa7134/saa7134.ko] undefined!
WARNING: "v4l_compat_translate_ioctl" [drivers/media/video/cx88/cx8800.ko] undefined!
WARNING: "v4l_compat_translate_ioctl" [drivers/media/common/saa7146_vv.ko] undefined!
  LD [M]  drivers/block/floppy.ko

# gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-49)


Should have done that testing on a machine with a less-than-medieval compiler,
though, methinks...

Sorry for the confusion! I'll submit a correct patch soon.

Nice domain name, BTW (so wonderfully fitting my patch ;-P).

Thanks for your report!

Andreas Mohr

-- 
No programming skills!? Why not help translate many Linux applications! 
https://launchpad.ubuntu.com/rosetta
(or alternatively buy nicely packaged Linux distros/OSS software to help
support Linux developers creating shiny new things for you?)

[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] [PATCH] constify drivers/block/floppy.c (2.6.17-rc1-mm3)
  2006-04-25 18:03 [KJ] [PATCH] constify drivers/block/floppy.c (2.6.17-rc1-mm3) Andreas Mohr
  2006-04-26  3:19 ` Arthur Othieno
  2006-04-26  7:20 ` Andreas Mohr
@ 2006-04-26 14:56 ` Alexey Dobriyan
  2 siblings, 0 replies; 4+ messages in thread
From: Alexey Dobriyan @ 2006-04-26 14:56 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1633 bytes --]

On Tue, Apr 25, 2006 at 11:19:49PM -0400, Arthur Othieno wrote:
> On Tue, Apr 25, 2006 at 08:03:13PM +0200, Andreas Mohr wrote:
> > constify the few floppy module variables that can be constified
> > (see objdump -x floppy.ko).

> > --- linux-2.6.17-rc1-mm3/drivers/block/floppy.c
> > +++ linux-2.6.17-rc1-mm3/drivers/block/floppy.c.const
> > @@ -3954,7 +3954,7 @@
> >  	.media_changed	= check_floppy_change,
> >  	.revalidate_disk = floppy_revalidate,
> >  };
> > -static char *table[] = {
> > +static const char * const table[] = {
>
>   warning: initialization makes pointer from integer without a cast

Curious minds want to know where is integer hiding.

>
> >  	"", "d360", "h1200", "u360", "u720", "h360", "h720",
> >  	"u1440", "u2880", "CompaQ", "h1440", "u1680", "h410",
> >  	"u820", "h1476", "u1722", "h420", "u830", "h1494", "u1743",
> > @@ -3962,11 +3962,11 @@
> >  	"u3200", "u3520", "u3840", "u1840", "u800", "u1600",
> >  	NULL
> >  };
> > -static int t360[] = { 1, 0 },
> > +static const int t360[] = { 1, 0 },
> >  	t1200[] = { 2, 5, 6, 10, 12, 14, 16, 18, 20, 23, 0 },
> >  	t3in[] = { 8, 9, 26, 27, 28, 7, 11, 15, 19, 24, 25, 29, 31, 3, 4, 13,
> >  			17, 21, 22, 30, 0 };
> > -static int *table_sup[] =
> > +static const int * const table_sup[] =
>
>   warning: initialization makes pointer from integer without a cast
>
> >      { NULL, t360, t1200, t3in + 5 + 8, t3in + 5, t3in, t3in };
> >
> >  static void __init register_devfs_entries(int drive)
> >
>
> Please at least compile test your patches. Thanks.

I did. One time with normal compiler 3.4.5, second time with 4.2.0
snapshot. No warnings in sight.


[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

end of thread, other threads:[~2006-04-26 14:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-25 18:03 [KJ] [PATCH] constify drivers/block/floppy.c (2.6.17-rc1-mm3) Andreas Mohr
2006-04-26  3:19 ` Arthur Othieno
2006-04-26  7:20 ` Andreas Mohr
2006-04-26 14:56 ` Alexey Dobriyan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.