Skip to contentSkip to conversation

small IDE cleanup: void * should not be used unless neccessary

PATCH Pavel Machek 5 participants 11 messages Feb 12, 2002 – Feb 16, 2002

lore
Share & tools
lore
#0 lore raw

Hi!

This is really easy, please apply. (It will allow me to kill few casts in future).
Pavel

include/linux/ide.h +1 -1
@@ -529,7 +531,7 @@
 
 typedef struct hwif_s {
 	struct hwif_s	*next;		/* for linked-list in ide_hwgroup_t */
-	void		*hwgroup;	/* actually (ide_hwgroup_t *) */
+	struct hwgroup_s *hwgroup;	/* actually (ide_hwgroup_t *) */
 	ide_ioreg_t	io_ports[IDE_NR_PORTS];	/* task file registers */
 	hw_regs_t	hw;		/* Hardware info */
 	ide_drive_t	drives[MAX_DRIVES];	/* drive info */
Signature · 2 lines
(about SSSCA) "I don't say this lightly.  However, I really think that the U.S.
no longer is classifiable as a democracy, but rather as a plutocracy." --hpa
#1 lore raw
Quoted 9 lines · Pavel Machek

Hi!

This is really easy, please apply. (It will allow me to kill few casts in future).
Pavel

include/linux/ide.h line 537

Quoted 8 lines
include/linux/ide.h +1 -1
@@ -529,7 +531,7 @@
 
 typedef struct hwif_s {
 	struct hwif_s	*next;		/* for linked-list in ide_hwgroup_t */
-	void		*hwgroup;	/* actually (ide_hwgroup_t *) */
+	struct hwgroup_s *hwgroup;	/* actually (ide_hwgroup_t *) */
 	ide_ioreg_t	io_ports[IDE_NR_PORTS];	/* task file registers */
 	hw_regs_t	hw;		/* Hardware info */
 	ide_drive_t	drives[MAX_DRIVES];	/* drive info */

Now I'm confused about the comment on the end of the line.

Should the comment be changed, or should the type be ide_hwgroup_t instead of struct hwgroup_s?

Rob

#2 lore raw
Quoted 6 lines · Rob Landley

Now I'm confused about the comment on the end of the line.

Should the comment be changed, or should the type be ide_hwgroup_t instead of struct hwgroup_s?

Rob

the ide_hwgroup_t typedef is not declared until later in ide.h

Regards,
Rob Radez

#3 lore raw
In reply to Pavel Machek
Quoted 9 lines · Pavel Machek

Hi!

This is really easy, please apply. (It will allow me to kill few casts in future).
Pavel

include/linux/ide.h line 537

Quoted 8 lines
include/linux/ide.h +1 -1
@@ -529,7 +531,7 @@
 
 typedef struct hwif_s {
 	struct hwif_s	*next;		/* for linked-list in ide_hwgroup_t */
-	void		*hwgroup;	/* actually (ide_hwgroup_t *) */
+	struct hwgroup_s *hwgroup;	/* actually (ide_hwgroup_t *) */
 	ide_ioreg_t	io_ports[IDE_NR_PORTS];	/* task file registers */
 	hw_regs_t	hw;		/* Hardware info */
 	ide_drive_t	drives[MAX_DRIVES];	/* drive info */

If you're doing this, would it make sense to get rid of the useless casting of the hwgroup member?

Regards,
Rob Radez

#4 lore raw
In reply to Pavel Machek
Quoted 13 lines · Rob Radez
Quoted 10 lines · Pavel Machek

Hi!

This is really easy, please apply. (It will allow me to kill few casts in future).
Pavel

include/linux/ide.h +0 -0
@@ -529,7 +531,7 @@
 
Quoted 10 lines

include/linux/ide.h line 537

Quoted 7 lines
include/linux/ide.h +1 -1
 typedef struct hwif_s {
 	struct hwif_s	*next;		/* for linked-list in ide_hwgroup_t */
-	void		*hwgroup;	/* actually (ide_hwgroup_t *) */
+	struct hwgroup_s *hwgroup;	/* actually (ide_hwgroup_t *) */
 	ide_ioreg_t	io_ports[IDE_NR_PORTS];	/* task file registers */
 	hw_regs_t	hw;		/* Hardware info */
 	ide_drive_t	drives[MAX_DRIVES];	/* drive info */

If you're doing this, would it make sense to get rid of the useless casting of the hwgroup member?

Yes, that's also planned.

Signature · 2 lines
Vojtech Pavlik
SuSE Labs
#5 lore raw
In reply to Pavel Machek

Hi!

Quoted 8 lines
Quoted 8 lines

This is really easy, please apply. (It will allow me to kill few casts in future).
Pavel

include/linux/ide.h +0 -0
@@ -529,7 +531,7 @@
 
Quoted 10 lines

include/linux/ide.h line 537

Quoted 7 lines
include/linux/ide.h +1 -1
 typedef struct hwif_s {
 	struct hwif_s	*next;		/* for linked-list in ide_hwgroup_t */
-	void		*hwgroup;	/* actually (ide_hwgroup_t *) */
+	struct hwgroup_s *hwgroup;	/* actually (ide_hwgroup_t *) */
 	ide_ioreg_t	io_ports[IDE_NR_PORTS];	/* task file registers */
 	hw_regs_t	hw;		/* Hardware info */
 	ide_drive_t	drives[MAX_DRIVES];	/* drive info */

If you're doing this, would it make sense to get rid of the useless casting of the hwgroup member?

You just guessed why I did it ;-).
Pavel

Signature · 2 lines
Casualities in World Trade Center: ~3k dead inside the building,
cryptography in U.S.A. and free speech in Czech Republic.
#6 lore raw
In reply to Pavel Machek

Hi!

Quoted 18 lines
Quoted 7 lines

This is really easy, please apply. (It will allow me to kill few casts in future).
Pavel

include/linux/ide.h line 537

Quoted 8 lines
include/linux/ide.h +1 -1
@@ -529,7 +531,7 @@
 
 typedef struct hwif_s {
 	struct hwif_s	*next;		/* for linked-list in ide_hwgroup_t */
-	void		*hwgroup;	/* actually (ide_hwgroup_t *) */
+	struct hwgroup_s *hwgroup;	/* actually (ide_hwgroup_t *) */
 	ide_ioreg_t	io_ports[IDE_NR_PORTS];	/* task file registers */
 	hw_regs_t	hw;		/* Hardware info */
 	ide_drive_t	drives[MAX_DRIVES];	/* drive info */

Now I'm confused about the comment on the end of the line.

Quoted 2 lines

Should the comment be changed, or should the type be ide_hwgroup_t instead of struct hwgroup_s?

struct hwgroup_s == ide_hwgroup_t. That's infection by hungarian notation, and yes it would be nice to clean it up. For now, I'm killing worst stuff.
Pavel

Signature · 2 lines
Casualities in World Trade Center: ~3k dead inside the building,
cryptography in U.S.A. and free speech in Czech Republic.
#7 lore raw
In reply to Pavel Machek
Quoted 20 lines · Pavel Machek

Hi!

Quoted 18 lines
Quoted 7 lines

This is really easy, please apply. (It will allow me to kill few casts in future).
Pavel

include/linux/ide.h line 537

Quoted 8 lines
include/linux/ide.h +1 -1
@@ -529,7 +531,7 @@
 
 typedef struct hwif_s {
 	struct hwif_s	*next;		/* for linked-list in ide_hwgroup_t */
-	void		*hwgroup;	/* actually (ide_hwgroup_t *) */
+	struct hwgroup_s *hwgroup;	/* actually (ide_hwgroup_t *) */
 	ide_ioreg_t	io_ports[IDE_NR_PORTS];	/* task file registers */
 	hw_regs_t	hw;		/* Hardware info */
 	ide_drive_t	drives[MAX_DRIVES];	/* drive info */

Now I'm confused about the comment on the end of the line.

Quoted 7 lines
Quoted 2 lines

Should the comment be changed, or should the type be ide_hwgroup_t instead of struct hwgroup_s?

struct hwgroup_s == ide_hwgroup_t. That's infection by hungarian notation, and yes it would be nice to clean it up. For now, I'm killing worst stuff.
Pavel

I know they're functionally equivalent, but so was the original void *. :)

Just an "as long as you're touching this line anyway, why leave the old comment?" thing. A minor, in-passing nit at best...

Rob

#8 lore raw
In reply to Pavel Machek

Hi!

Quoted 21 lines
Quoted 21 lines
Quoted 20 lines
Quoted 7 lines

This is really easy, please apply. (It will allow me to kill few casts in future).
Pavel

include/linux/ide.h line 537

Quoted 8 lines
include/linux/ide.h +1 -1
@@ -529,7 +531,7 @@
 
 typedef struct hwif_s {
 	struct hwif_s	*next;		/* for linked-list in ide_hwgroup_t */
-	void		*hwgroup;	/* actually (ide_hwgroup_t *) */
+	struct hwgroup_s *hwgroup;	/* actually (ide_hwgroup_t *) */
 	ide_ioreg_t	io_ports[IDE_NR_PORTS];	/* task file registers */
 	hw_regs_t	hw;		/* Hardware info */
 	ide_drive_t	drives[MAX_DRIVES];	/* drive info */

Now I'm confused about the comment on the end of the line.

Should the comment be changed, or should the type be ide_hwgroup_t instead of struct hwgroup_s?

Quoted 7 lines
Quoted 4 lines

struct hwgroup_s == ide_hwgroup_t. That's infection by hungarian notation, and yes it would be nice to clean it up. For now, I'm killing worst stuff.
Pavel

I know they're functionally equivalent, but so was the original void *. :)

Well, void * hides real errors.

Quoted 2 lines

Just an "as long as you're touching this line anyway, why leave the old comment?" thing. A minor, in-passing nit at best...

ide_hwgroup_t is used in 90% of rest of code, so I thought I better leave it there.
Pavel

Signature · 2 lines
(about SSSCA) "I don't say this lightly.  However, I really think that the U.S.
no longer is classifiable as a democracy, but rather as a plutocracy." --hpa
#9 lore raw
Quoted 31 lines · Pavel Machek

Hi!

Quoted 21 lines
Quoted 21 lines
Quoted 20 lines
Quoted 7 lines

This is really easy, please apply. (It will allow me to kill few casts in future).
Pavel

include/linux/ide.h line 537

Quoted 8 lines
include/linux/ide.h +1 -1
@@ -529,7 +531,7 @@
 
 typedef struct hwif_s {
 	struct hwif_s	*next;		/* for linked-list in ide_hwgroup_t */
-	void		*hwgroup;	/* actually (ide_hwgroup_t *) */
+	struct hwgroup_s *hwgroup;	/* actually (ide_hwgroup_t *) */
 	ide_ioreg_t	io_ports[IDE_NR_PORTS];	/* task file registers */
 	hw_regs_t	hw;		/* Hardware info */
 	ide_drive_t	drives[MAX_DRIVES];	/* drive info */

Now I'm confused about the comment on the end of the line.

Should the comment be changed, or should the type be ide_hwgroup_t instead of struct hwgroup_s?

Quoted 7 lines
Quoted 4 lines

struct hwgroup_s == ide_hwgroup_t. That's infection by hungarian notation, and yes it would be nice to clean it up. For now, I'm killing worst stuff.
Pavel

I know they're functionally equivalent, but so was the original void *. :)

Quoted 7 lines

Well, void * hides real errors.

Quoted 2 lines

Just an "as long as you're touching this line anyway, why leave the old comment?" thing. A minor, in-passing nit at best...

ide_hwgroup_t is used in 90% of rest of code, so I thought I better leave it there.

So what do we do with the other 10% break it? Sheesh :-/

Andre Hedrick
Linux Disk Certification Project Linux ATA Development

#10 lore raw
In reply to Pavel Machek
Quoted 5 lines · Andre Hedrick
Quoted 5 lines
Quoted 2 lines

I know they're functionally equivalent, but so was the original void *. :)

Well, void * hides real errors.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Just an "as long as you're touching this line anyway, why leave the old comment?" thing. A minor, in-passing nit at best...

ide_hwgroup_t is used in 90% of rest of code, so I thought I better leave it there.

So what do we do with the other 10% break it? Sheesh :-/

The other 10% won't break by the change, of course.

Signature · 2 lines
Vojtech Pavlik
SuSE Labs