Skip to contentSkip to conversation

C99 designated initializers for drivers/scsi

PATCH In review Art Haas 2 participants 2 messages Oct 12, 2002

Subsystems (6)
lore
Share & tools
lore

Art Haas

author
#0 lore raw

PATCH 1/1 C99 designated initializers for drivers/scsi

Hi.

Here's a set of patches for switching drivers/scsi to use C99 named initializers. The patches are all against 2.5.42.

Art Haas

drivers/scsi/dpt_i2o.c renamed from drivers/scsi/dpt_i2o.c.old +3 -3
@@ -113,9 +113,9 @@
 static int hba_count = 0;
 
 static struct file_operations adpt_fops = {
-	ioctl: adpt_ioctl,
-	open: adpt_open,
-	release: adpt_close
+	.ioctl = adpt_ioctl,
+	.open = adpt_open,
+	.release = adpt_close
 };
 
 #ifdef REBOOT_NOTIFIER
drivers/scsi/ide-scsi.c renamed from drivers/scsi/ide-scsi.c.old +39 -39

90 lines not on this page · raw message

drivers/scsi/imm.c renamed from drivers/scsi/imm.c.old +11 -11
@@ -47,17 +47,17 @@
 } imm_struct;
 
 #define IMM_EMPTY \
-{	dev:		NULL,		\
-	base:		-1,		\
-	base_hi:	0,		\
-	mode:		IMM_AUTODETECT,	\
-	host:		-1,		\
-	cur_cmd:	NULL,		\
-	jstart:		0,		\
-	failed:		0,		\
-	dp:		0,		\
-	rd:		0,		\
-	p_busy:		0		\
+{	.dev		= NULL,		\
+	.base		= -1,		\
+	.base_hi	= 0,		\
+	.mode		= IMM_AUTODETECT,	\
+	.host		= -1,		\
+	.cur_cmd	= NULL,		\
+	.jstart		= 0,		\
+	.failed		= 0,		\
+	.dp		= 0,		\
+	.rd		= 0,		\
+	.p_busy		= 0		\
 }
 
 #include "imm.h"
drivers/scsi/ips.c renamed from drivers/scsi/ips.c.old +12 -12
@@ -318,24 +318,24 @@
    static void __devexit ips_remove_device(struct pci_dev *pci_dev);
    
    struct pci_driver ips_pci_driver = {
-       name:		ips_hot_plug_name,
-       id_table:	ips_pci_table,
-       probe:		ips_insert_device,
-       remove:		__devexit_p(ips_remove_device),
+       .name		= ips_hot_plug_name,
+       .id_table	= ips_pci_table,
+       .probe		= ips_insert_device,
+       .remove		= __devexit_p(ips_remove_device),
    }; 
            
    struct pci_driver ips_pci_driver_5i = {
-       name:		ips_hot_plug_name,
-       id_table:	ips_pci_table_5i,
-       probe:		ips_insert_device,
-       remove:		__devexit_p(ips_remove_device),
+       .name		= ips_hot_plug_name,
+       .id_table	= ips_pci_table_5i,
+       .probe		= ips_insert_device,
+       .remove		= __devexit_p(ips_remove_device),
    };
 
    struct pci_driver ips_pci_driver_i960 = {
-       name:		ips_hot_plug_name,
-       id_table:	ips_pci_table_i960,
-       probe:		ips_insert_device,
-       remove:		__devexit_p(ips_remove_device),
+       .name		= ips_hot_plug_name,
+       .id_table	= ips_pci_table_i960,
+       .probe		= ips_insert_device,
+       .remove		= __devexit_p(ips_remove_device),
    };
 
 #endif
drivers/scsi/megaraid.c renamed from drivers/scsi/megaraid.c.old +3 -3
@@ -762,9 +762,9 @@
 /* For controller re-ordering */ 
 
 static struct file_operations megadev_fops = {
-	ioctl:megadev_ioctl_entry,
-	open:megadev_open,
-	release:megadev_close,
+	.ioctl = megadev_ioctl_entry,
+	.open = megadev_open,
+	.release = megadev_close,
 };
 
 /*
drivers/scsi/nsp32.c renamed from drivers/scsi/nsp32.c.old +35 -35

88 lines not on this page · raw message

drivers/scsi/osst.c renamed from drivers/scsi/osst.c.old +15 -15
@@ -158,15 +158,15 @@
 
 struct Scsi_Device_Template osst_template =
 {
-       module:		THIS_MODULE,
-       name:		"OnStream tape",
-       tag:		"osst",
-       scsi_type:	TYPE_TAPE,
-       major:		OSST_MAJOR,
-       detect:		osst_detect,
-       init:		osst_init,
-       attach:		osst_attach,
-       detach:		osst_detach
+       .module		= THIS_MODULE,
+       .name		= "OnStream tape",
+       .tag		= "osst",
+       .scsi_type	= TYPE_TAPE,
+       .major		= OSST_MAJOR,
+       .detect		= osst_detect,
+       .init		= osst_init,
+       .attach		= osst_attach,
+       .detach		= osst_detach
 };
 
 static int osst_int_ioctl(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt, unsigned int cmd_in,unsigned long arg);
@@ -5381,12 +5381,12 @@
 
 
 static struct file_operations osst_fops = {
-	read:		osst_read,
-	write:		osst_write,
-	ioctl:		osst_ioctl,
-	open:		os_scsi_tape_open,
-	flush:		os_scsi_tape_flush,
-	release:	os_scsi_tape_close,
+	.read		= osst_read,
+	.write		= osst_write,
+	.ioctl		= osst_ioctl,
+	.open		= os_scsi_tape_open,
+	.flush		= os_scsi_tape_flush,
+	.release	= os_scsi_tape_close,
 };
 
 static int osst_supports(Scsi_Device * SDp)
drivers/scsi/pluto.c renamed from drivers/scsi/pluto.c.old +1 -1
@@ -91,7 +91,7 @@
 	int i, retry, nplutos;
 	fc_channel *fc;
 	Scsi_Device dev;
-	struct timer_list fc_timer = { function: pluto_detect_timeout };
+	struct timer_list fc_timer = { .function = pluto_detect_timeout };
 
 	tpnt->proc_name = "pluto";
 	fcscount = 0;
drivers/scsi/ppa.c renamed from drivers/scsi/ppa.c.old +10 -10
@@ -38,16 +38,16 @@
 } ppa_struct;
 
 #define PPA_EMPTY	\
-{	dev:		NULL,		\
-	base:		-1,		\
-	mode:		PPA_AUTODETECT,	\
-	host:		-1,		\
-	cur_cmd:	NULL,		\
-	ppa_tq:		{ func: ppa_interrupt },	\
-	jstart:		0,		\
-	recon_tmo:      PPA_RECON_TMO,	\
-	failed:		0,		\
-	p_busy:		0		\
+{	.dev		= NULL,		\
+	.base		= -1,		\
+	.mode		= PPA_AUTODETECT,	\
+	.host		= -1,		\
+	.cur_cmd	= NULL,		\
+	.ppa_tq		= { .func = ppa_interrupt },	\
+	.jstart		= 0,		\
+	.recon_tmo      = PPA_RECON_TMO,	\
+	.failed		= 0,		\
+	.p_busy		= 0		\
 }
 
 #include  "ppa.h"
drivers/scsi/scsi.c renamed from drivers/scsi/scsi.c.old +2 -2
@@ -2684,8 +2684,8 @@
 }
 
 struct bus_type scsi_driverfs_bus_type = {
-        name: "scsi",
-        match: scsi_bus_match,
+        .name = "scsi",
+        .match = scsi_bus_match,
 };
 
 static int __init init_scsi(void)
drivers/scsi/sd.c renamed from drivers/scsi/sd.c.old +20 -20
@@ -104,23 +104,23 @@
 static struct notifier_block sd_notifier_block = {sd_notifier, NULL, 0}; 
 
 static struct Scsi_Device_Template sd_template = {
-	module:THIS_MODULE,
-	name:"disk",
-	tag:"sd",
-	scsi_type:TYPE_DISK,
-	major:SCSI_DISK0_MAJOR,
+	.module = THIS_MODULE,
+	.name = "disk",
+	.tag = "sd",
+	.scsi_type = TYPE_DISK,
+	.major = SCSI_DISK0_MAJOR,
         /*
          * Secondary range of majors that this driver handles.
          */
-	min_major:SCSI_DISK1_MAJOR,
-	max_major:SCSI_DISK7_MAJOR,
-	blk:1,
-	detect:sd_detect,
-	init:sd_init,
-	finish:sd_finish,
-	attach:sd_attach,
-	detach:sd_detach,
-	init_command:sd_init_command,
+	.min_major = SCSI_DISK1_MAJOR,
+	.max_major = SCSI_DISK7_MAJOR,
+	.blk = 1,
+	.detect = sd_detect,
+	.init = sd_init,
+	.finish = sd_finish,
+	.attach = sd_attach,
+	.detach = sd_detach,
+	.init_command = sd_init_command,
 };
 
 static void sd_rw_intr(Scsi_Cmnd * SCpnt);
@@ -585,12 +585,12 @@
 
 static struct block_device_operations sd_fops =
 {
-	owner:			THIS_MODULE,
-	open:			sd_open,
-	release:		sd_release,
-	ioctl:			sd_ioctl,
-	check_media_change:	check_scsidisk_media_change,
-	revalidate:		sd_revalidate
+	.owner			= THIS_MODULE,
+	.open			= sd_open,
+	.release		= sd_release,
+	.ioctl			= sd_ioctl,
+	.check_media_change	= check_scsidisk_media_change,
+	.revalidate		= sd_revalidate
 };
 
 /**
drivers/scsi/sr.c renamed from drivers/scsi/sr.c.old +31 -31

86 lines not on this page · raw message

drivers/scsi/st.c renamed from drivers/scsi/st.c.old +7 -7
@@ -3642,13 +3642,13 @@
 
 static struct file_operations st_fops =
 {
-	owner:		THIS_MODULE,
-	read:		st_read,
-	write:		st_write,
-	ioctl:		st_ioctl,
-	open:		st_open,
-	flush:		st_flush,
-	release:	st_release,
+	.owner		= THIS_MODULE,
+	.read		= st_read,
+	.write		= st_write,
+	.ioctl		= st_ioctl,
+	.open		= st_open,
+	.flush		= st_flush,
+	.release	= st_release,
 };
 
 static int st_attach(Scsi_Device * SDp)
drivers/scsi/tmscsim.c renamed from drivers/scsi/tmscsim.c.old +4 -4
@@ -276,10 +276,10 @@
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,99)
 static struct pci_device_id tmscsim_pci_tbl[] __initdata = {
 	{
-		vendor: PCI_VENDOR_ID_AMD,
-		device: PCI_DEVICE_ID_AMD53C974,
-		subvendor: PCI_ANY_ID,
-		subdevice: PCI_ANY_ID,
+		.vendor = PCI_VENDOR_ID_AMD,
+		.device = PCI_DEVICE_ID_AMD53C974,
+		.subvendor = PCI_ANY_ID,
+		.subdevice = PCI_ANY_ID,
 	},
 	{ }		/* Terminating entry */
 };
Signature · 3 lines
They that can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety.
 -- Benjamin Franklin, Historical Review of Pennsylvania, 1759
#1 lore raw

Em Sat, Oct 12, 2002 at 11:59:01AM -0500, Art Haas escreveu:

Quoted 9 lines

Art Haas

drivers/scsi/ide-scsi.c renamed from drivers/scsi/ide-scsi.c.old +0 -0
@@ -574,29 +574,29 @@
  *	IDE subdriver functions, registered with ide.c
  */
 static ide_driver_t idescsi_driver = {

drivers/scsi/ide-scsi.c line 586

Quoted 10 lines
drivers/scsi/ide-scsi.c renamed from drivers/scsi/ide-scsi.c.old +10 -0
+	.busy			= 0,
+	.supports_dsc_overlap	= 0,
+	.standby		= NULL,
+	.flushcache		= NULL,
+	.media_change		= NULL,
+	.revalidate		= NULL,
+	.pre_reset		= NULL,
+	.capacity		= NULL,
+	.special		= NULL,
+	.proc			= NULL,

Art, I suggest that you simply delete the lines that initializes to 0 or NULL, as the compiler will take care of zeroing it and the source code gets a bit smaller.

- Arnaldo