aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-05 04:45:09 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:15:57 -0500
commitfd238232cd0ff4840ae6946bb338502154096d88 (patch)
treed20e8f5871f7cff9d0867a84f6ba088fbffcbe28 /drivers/scsi
parenta78f4dd331a4f6a396eb5849656a4a72a70a56d7 (diff)
[PATCH] pcmcia: embed dev_link_t into struct pcmcia_device
Embed dev_link_t into struct pcmcia_device(), as they basically address the same entity. The actual contents of dev_link_t will be cleaned up step by step. This patch includes a bugfix from and signed-off-by Andrew Morton. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/pcmcia/aha152x_stub.c21
-rw-r--r--drivers/scsi/pcmcia/fdomain_stub.c12
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.c13
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.h2
-rw-r--r--drivers/scsi/pcmcia/qlogic_stub.c11
-rw-r--r--drivers/scsi/pcmcia/sym53c500_cs.c11
6 files changed, 24 insertions, 46 deletions
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
index 12ec94d6ef14..0c196fbb3121 100644
--- a/drivers/scsi/pcmcia/aha152x_stub.c
+++ b/drivers/scsi/pcmcia/aha152x_stub.c
@@ -89,7 +89,7 @@ MODULE_LICENSE("Dual MPL/GPL");
89/*====================================================================*/ 89/*====================================================================*/
90 90
91typedef struct scsi_info_t { 91typedef struct scsi_info_t {
92 dev_link_t link; 92 struct pcmcia_device *p_dev;
93 dev_node_t node; 93 dev_node_t node;
94 struct Scsi_Host *host; 94 struct Scsi_Host *host;
95} scsi_info_t; 95} scsi_info_t;
@@ -103,7 +103,7 @@ static dev_link_t *dev_list;
103static int aha152x_attach(struct pcmcia_device *p_dev) 103static int aha152x_attach(struct pcmcia_device *p_dev)
104{ 104{
105 scsi_info_t *info; 105 scsi_info_t *info;
106 dev_link_t *link; 106 dev_link_t *link = dev_to_instance(p_dev);
107 107
108 DEBUG(0, "aha152x_attach()\n"); 108 DEBUG(0, "aha152x_attach()\n");
109 109
@@ -111,7 +111,8 @@ static int aha152x_attach(struct pcmcia_device *p_dev)
111 info = kmalloc(sizeof(*info), GFP_KERNEL); 111 info = kmalloc(sizeof(*info), GFP_KERNEL);
112 if (!info) return -ENOMEM; 112 if (!info) return -ENOMEM;
113 memset(info, 0, sizeof(*info)); 113 memset(info, 0, sizeof(*info));
114 link = &info->link; link->priv = info; 114 info->p_dev = p_dev;
115 link->priv = info;
115 116
116 link->io.NumPorts1 = 0x20; 117 link->io.NumPorts1 = 0x20;
117 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 118 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
@@ -122,9 +123,6 @@ static int aha152x_attach(struct pcmcia_device *p_dev)
122 link->conf.IntType = INT_MEMORY_AND_IO; 123 link->conf.IntType = INT_MEMORY_AND_IO;
123 link->conf.Present = PRESENT_OPTION; 124 link->conf.Present = PRESENT_OPTION;
124 125
125 link->handle = p_dev;
126 p_dev->instance = link;
127
128 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 126 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
129 aha152x_config_cs(link); 127 aha152x_config_cs(link);
130 128
@@ -136,23 +134,14 @@ static int aha152x_attach(struct pcmcia_device *p_dev)
136static void aha152x_detach(struct pcmcia_device *p_dev) 134static void aha152x_detach(struct pcmcia_device *p_dev)
137{ 135{
138 dev_link_t *link = dev_to_instance(p_dev); 136 dev_link_t *link = dev_to_instance(p_dev);
139 dev_link_t **linkp;
140 137
141 DEBUG(0, "aha152x_detach(0x%p)\n", link); 138 DEBUG(0, "aha152x_detach(0x%p)\n", link);
142
143 /* Locate device structure */
144 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
145 if (*linkp == link) break;
146 if (*linkp == NULL)
147 return;
148 139
149 if (link->state & DEV_CONFIG) 140 if (link->state & DEV_CONFIG)
150 aha152x_release_cs(link); 141 aha152x_release_cs(link);
151 142
152 /* Unlink device structure, free bits */ 143 /* Unlink device structure, free bits */
153 *linkp = link->next;
154 kfree(link->priv); 144 kfree(link->priv);
155
156} /* aha152x_detach */ 145} /* aha152x_detach */
157 146
158/*====================================================================*/ 147/*====================================================================*/
@@ -230,7 +219,7 @@ static void aha152x_config_cs(dev_link_t *link)
230 } 219 }
231 220
232 sprintf(info->node.dev_name, "scsi%d", host->host_no); 221 sprintf(info->node.dev_name, "scsi%d", host->host_no);
233 link->dev = &info->node; 222 link->dev_node = &info->node;
234 info->host = host; 223 info->host = host;
235 224
236 link->state &= ~DEV_CONFIG_PENDING; 225 link->state &= ~DEV_CONFIG_PENDING;
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c
index b3cd206ad652..94dcee9f285a 100644
--- a/drivers/scsi/pcmcia/fdomain_stub.c
+++ b/drivers/scsi/pcmcia/fdomain_stub.c
@@ -73,7 +73,7 @@ static char *version =
73/*====================================================================*/ 73/*====================================================================*/
74 74
75typedef struct scsi_info_t { 75typedef struct scsi_info_t {
76 dev_link_t link; 76 struct pcmcia_device *p_dev;
77 dev_node_t node; 77 dev_node_t node;
78 struct Scsi_Host *host; 78 struct Scsi_Host *host;
79} scsi_info_t; 79} scsi_info_t;
@@ -86,7 +86,7 @@ static void fdomain_config(dev_link_t *link);
86static int fdomain_attach(struct pcmcia_device *p_dev) 86static int fdomain_attach(struct pcmcia_device *p_dev)
87{ 87{
88 scsi_info_t *info; 88 scsi_info_t *info;
89 dev_link_t *link; 89 dev_link_t *link = dev_to_instance(p_dev);
90 90
91 DEBUG(0, "fdomain_attach()\n"); 91 DEBUG(0, "fdomain_attach()\n");
92 92
@@ -94,7 +94,8 @@ static int fdomain_attach(struct pcmcia_device *p_dev)
94 info = kmalloc(sizeof(*info), GFP_KERNEL); 94 info = kmalloc(sizeof(*info), GFP_KERNEL);
95 if (!info) return -ENOMEM; 95 if (!info) return -ENOMEM;
96 memset(info, 0, sizeof(*info)); 96 memset(info, 0, sizeof(*info));
97 link = &info->link; link->priv = info; 97 info->p_dev = p_dev;
98 link->priv = info;
98 link->io.NumPorts1 = 0x10; 99 link->io.NumPorts1 = 0x10;
99 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 100 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
100 link->io.IOAddrLines = 10; 101 link->io.IOAddrLines = 10;
@@ -104,9 +105,6 @@ static int fdomain_attach(struct pcmcia_device *p_dev)
104 link->conf.IntType = INT_MEMORY_AND_IO; 105 link->conf.IntType = INT_MEMORY_AND_IO;
105 link->conf.Present = PRESENT_OPTION; 106 link->conf.Present = PRESENT_OPTION;
106 107
107 link->handle = p_dev;
108 p_dev->instance = link;
109
110 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 108 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
111 fdomain_config(link); 109 fdomain_config(link);
112 110
@@ -191,7 +189,7 @@ static void fdomain_config(dev_link_t *link)
191 scsi_scan_host(host); 189 scsi_scan_host(host);
192 190
193 sprintf(info->node.dev_name, "scsi%d", host->host_no); 191 sprintf(info->node.dev_name, "scsi%d", host->host_no);
194 link->dev = &info->node; 192 link->dev_node = &info->node;
195 info->host = host; 193 info->host = host;
196 194
197 link->state &= ~DEV_CONFIG_PENDING; 195 link->state &= ~DEV_CONFIG_PENDING;
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index e41e1febe895..23548fbf4898 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -1596,8 +1596,8 @@ static int nsp_eh_host_reset(Scsi_Cmnd *SCpnt)
1596static int nsp_cs_attach(struct pcmcia_device *p_dev) 1596static int nsp_cs_attach(struct pcmcia_device *p_dev)
1597{ 1597{
1598 scsi_info_t *info; 1598 scsi_info_t *info;
1599 dev_link_t *link;
1600 nsp_hw_data *data = &nsp_data_base; 1599 nsp_hw_data *data = &nsp_data_base;
1600 dev_link_t *link = dev_to_instance(p_dev);
1601 1601
1602 nsp_dbg(NSP_DEBUG_INIT, "in"); 1602 nsp_dbg(NSP_DEBUG_INIT, "in");
1603 1603
@@ -1605,7 +1605,7 @@ static int nsp_cs_attach(struct pcmcia_device *p_dev)
1605 info = kmalloc(sizeof(*info), GFP_KERNEL); 1605 info = kmalloc(sizeof(*info), GFP_KERNEL);
1606 if (info == NULL) { return -ENOMEM; } 1606 if (info == NULL) { return -ENOMEM; }
1607 memset(info, 0, sizeof(*info)); 1607 memset(info, 0, sizeof(*info));
1608 link = &info->link; 1608 info->p_dev = p_dev;
1609 link->priv = info; 1609 link->priv = info;
1610 data->ScsiInfo = info; 1610 data->ScsiInfo = info;
1611 1611
@@ -1630,9 +1630,6 @@ static int nsp_cs_attach(struct pcmcia_device *p_dev)
1630 link->conf.IntType = INT_MEMORY_AND_IO; 1630 link->conf.IntType = INT_MEMORY_AND_IO;
1631 link->conf.Present = PRESENT_OPTION; 1631 link->conf.Present = PRESENT_OPTION;
1632 1632
1633 link->handle = p_dev;
1634 p_dev->instance = link;
1635
1636 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 1633 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
1637 nsp_cs_config(link); 1634 nsp_cs_config(link);
1638 1635
@@ -1853,12 +1850,12 @@ static void nsp_cs_config(dev_link_t *link)
1853 scsi_scan_host(host); 1850 scsi_scan_host(host);
1854 1851
1855 snprintf(info->node.dev_name, sizeof(info->node.dev_name), "scsi%d", host->host_no); 1852 snprintf(info->node.dev_name, sizeof(info->node.dev_name), "scsi%d", host->host_no);
1856 link->dev = &info->node; 1853 link->dev_node = &info->node;
1857 info->host = host; 1854 info->host = host;
1858 1855
1859#else 1856#else
1860 nsp_dbg(NSP_DEBUG_INIT, "GET_SCSI_INFO"); 1857 nsp_dbg(NSP_DEBUG_INIT, "GET_SCSI_INFO");
1861 tail = &link->dev; 1858 tail = &link->dev_node;
1862 info->ndev = 0; 1859 info->ndev = 0;
1863 1860
1864 nsp_dbg(NSP_DEBUG_INIT, "host=0x%p", host); 1861 nsp_dbg(NSP_DEBUG_INIT, "host=0x%p", host);
@@ -1962,7 +1959,7 @@ static void nsp_cs_release(dev_link_t *link)
1962#else 1959#else
1963 scsi_unregister_host(&nsp_driver_template); 1960 scsi_unregister_host(&nsp_driver_template);
1964#endif 1961#endif
1965 link->dev = NULL; 1962 link->dev_node = NULL;
1966 1963
1967 if (link->win) { 1964 if (link->win) {
1968 if (data != NULL) { 1965 if (data != NULL) {
diff --git a/drivers/scsi/pcmcia/nsp_cs.h b/drivers/scsi/pcmcia/nsp_cs.h
index b66b140a745e..2e1fde467c27 100644
--- a/drivers/scsi/pcmcia/nsp_cs.h
+++ b/drivers/scsi/pcmcia/nsp_cs.h
@@ -225,7 +225,7 @@
225/*====================================================================*/ 225/*====================================================================*/
226 226
227typedef struct scsi_info_t { 227typedef struct scsi_info_t {
228 dev_link_t link; 228 struct pcmcia_device *p_dev;
229 struct Scsi_Host *host; 229 struct Scsi_Host *host;
230#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,74)) 230#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,74))
231 dev_node_t node; 231 dev_node_t node;
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c
index 4f28589bbf34..c6b3e9587ff3 100644
--- a/drivers/scsi/pcmcia/qlogic_stub.c
+++ b/drivers/scsi/pcmcia/qlogic_stub.c
@@ -91,7 +91,7 @@ static struct scsi_host_template qlogicfas_driver_template = {
91/*====================================================================*/ 91/*====================================================================*/
92 92
93typedef struct scsi_info_t { 93typedef struct scsi_info_t {
94 dev_link_t link; 94 struct pcmcia_device *p_dev;
95 dev_node_t node; 95 dev_node_t node;
96 struct Scsi_Host *host; 96 struct Scsi_Host *host;
97 unsigned short manf_id; 97 unsigned short manf_id;
@@ -159,7 +159,7 @@ err:
159static int qlogic_attach(struct pcmcia_device *p_dev) 159static int qlogic_attach(struct pcmcia_device *p_dev)
160{ 160{
161 scsi_info_t *info; 161 scsi_info_t *info;
162 dev_link_t *link; 162 dev_link_t *link = dev_to_instance(p_dev);
163 163
164 DEBUG(0, "qlogic_attach()\n"); 164 DEBUG(0, "qlogic_attach()\n");
165 165
@@ -168,7 +168,7 @@ static int qlogic_attach(struct pcmcia_device *p_dev)
168 if (!info) 168 if (!info)
169 return -ENOMEM; 169 return -ENOMEM;
170 memset(info, 0, sizeof(*info)); 170 memset(info, 0, sizeof(*info));
171 link = &info->link; 171 info->p_dev = p_dev;
172 link->priv = info; 172 link->priv = info;
173 link->io.NumPorts1 = 16; 173 link->io.NumPorts1 = 16;
174 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 174 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
@@ -179,9 +179,6 @@ static int qlogic_attach(struct pcmcia_device *p_dev)
179 link->conf.IntType = INT_MEMORY_AND_IO; 179 link->conf.IntType = INT_MEMORY_AND_IO;
180 link->conf.Present = PRESENT_OPTION; 180 link->conf.Present = PRESENT_OPTION;
181 181
182 link->handle = p_dev;
183 p_dev->instance = link;
184
185 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 182 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
186 qlogic_config(link); 183 qlogic_config(link);
187 184
@@ -278,7 +275,7 @@ static void qlogic_config(dev_link_t * link)
278 } 275 }
279 276
280 sprintf(info->node.dev_name, "scsi%d", host->host_no); 277 sprintf(info->node.dev_name, "scsi%d", host->host_no);
281 link->dev = &info->node; 278 link->dev_node = &info->node;
282 info->host = host; 279 info->host = host;
283 280
284out: 281out:
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c
index 2bce7b070a4e..1ef3109418c9 100644
--- a/drivers/scsi/pcmcia/sym53c500_cs.c
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c
@@ -202,7 +202,7 @@ static char *version =
202/* ================================================================== */ 202/* ================================================================== */
203 203
204struct scsi_info_t { 204struct scsi_info_t {
205 dev_link_t link; 205 struct pcmcia_device *p_dev;
206 dev_node_t node; 206 dev_node_t node;
207 struct Scsi_Host *host; 207 struct Scsi_Host *host;
208 unsigned short manf_id; 208 unsigned short manf_id;
@@ -829,7 +829,7 @@ next_entry:
829 data->fast_pio = USE_FAST_PIO; 829 data->fast_pio = USE_FAST_PIO;
830 830
831 sprintf(info->node.dev_name, "scsi%d", host->host_no); 831 sprintf(info->node.dev_name, "scsi%d", host->host_no);
832 link->dev = &info->node; 832 link->dev_node = &info->node;
833 info->host = host; 833 info->host = host;
834 834
835 if (scsi_add_host(host, NULL)) 835 if (scsi_add_host(host, NULL))
@@ -899,7 +899,7 @@ static int
899SYM53C500_attach(struct pcmcia_device *p_dev) 899SYM53C500_attach(struct pcmcia_device *p_dev)
900{ 900{
901 struct scsi_info_t *info; 901 struct scsi_info_t *info;
902 dev_link_t *link; 902 dev_link_t *link = dev_to_instance(p_dev);
903 903
904 DEBUG(0, "SYM53C500_attach()\n"); 904 DEBUG(0, "SYM53C500_attach()\n");
905 905
@@ -908,7 +908,7 @@ SYM53C500_attach(struct pcmcia_device *p_dev)
908 if (!info) 908 if (!info)
909 return -ENOMEM; 909 return -ENOMEM;
910 memset(info, 0, sizeof(*info)); 910 memset(info, 0, sizeof(*info));
911 link = &info->link; 911 info->p_dev = p_dev;
912 link->priv = info; 912 link->priv = info;
913 link->io.NumPorts1 = 16; 913 link->io.NumPorts1 = 16;
914 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 914 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
@@ -919,9 +919,6 @@ SYM53C500_attach(struct pcmcia_device *p_dev)
919 link->conf.IntType = INT_MEMORY_AND_IO; 919 link->conf.IntType = INT_MEMORY_AND_IO;
920 link->conf.Present = PRESENT_OPTION; 920 link->conf.Present = PRESENT_OPTION;
921 921
922 link->handle = p_dev;
923 p_dev->instance = link;
924
925 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 922 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
926 SYM53C500_config(link); 923 SYM53C500_config(link);
927 924