diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-21 17:25:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-21 17:25:16 -0400 |
commit | b65378898c2eefb20f419632c1199bc0592e2f79 (patch) | |
tree | 052bb72d329c44790f91fc8097b8500d4774d02c /drivers/parport | |
parent | 157b6ceb13e4b4148ee03dd517dbe88748943125 (diff) | |
parent | 5b917a1420d3d1a9c8da49fb0090692dc9aaee86 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6: (22 commits)
pcmcia: synclink_cs: fix information leak to userland
pcmcia: don't call flush_scheduled_work() spuriously
serial_cs: drop spurious flush_scheduled_work() call
pcmcia/yenta: guide users in case of problems with O2-bridges
pcmcia: fix unused function compile warning
pcmcia: vrc4173_cardu: Fix error path for pci_release_regions and pci_disable_device
pcmcia: add a few debug statements
pcmcia: remove obsolete and wrong comments
pcmcia: avoid messages on module (un)loading
pcmcia: move driver name to struct pcmcia_driver
pcmcia: remove the "Finally, report what we've done" message
pcmcia: use autoconfiguration feature for ioports and iomem
pcmcia: introduce autoconfiguration feature
pcmcia: Documentation update
pcmcia: convert pcmcia_request_configuration to pcmcia_enable_device
pcmcia: move config_{base,index,regs} to struct pcmcia_device
pcmcia: simplify IntType
pcmcia: simplify Status, ExtStatus register access
pcmcia: remove Pin, Copy configuration register access
pcmcia: move Vpp setup to struct pcmcia_device
...
Diffstat (limited to 'drivers/parport')
-rw-r--r-- | drivers/parport/parport_cs.c | 76 |
1 files changed, 13 insertions, 63 deletions
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c index 23e50f4a27c5..787ebdeae310 100644 --- a/drivers/parport/parport_cs.c +++ b/drivers/parport/parport_cs.c | |||
@@ -48,7 +48,6 @@ | |||
48 | #include <linux/parport.h> | 48 | #include <linux/parport.h> |
49 | #include <linux/parport_pc.h> | 49 | #include <linux/parport_pc.h> |
50 | 50 | ||
51 | #include <pcmcia/cs.h> | ||
52 | #include <pcmcia/cistpl.h> | 51 | #include <pcmcia/cistpl.h> |
53 | #include <pcmcia/ds.h> | 52 | #include <pcmcia/ds.h> |
54 | #include <pcmcia/cisreg.h> | 53 | #include <pcmcia/cisreg.h> |
@@ -81,14 +80,6 @@ static void parport_detach(struct pcmcia_device *p_dev); | |||
81 | static int parport_config(struct pcmcia_device *link); | 80 | static int parport_config(struct pcmcia_device *link); |
82 | static void parport_cs_release(struct pcmcia_device *); | 81 | static void parport_cs_release(struct pcmcia_device *); |
83 | 82 | ||
84 | /*====================================================================== | ||
85 | |||
86 | parport_attach() creates an "instance" of the driver, allocating | ||
87 | local data structures for one device. The device is registered | ||
88 | with Card Services. | ||
89 | |||
90 | ======================================================================*/ | ||
91 | |||
92 | static int parport_probe(struct pcmcia_device *link) | 83 | static int parport_probe(struct pcmcia_device *link) |
93 | { | 84 | { |
94 | parport_info_t *info; | 85 | parport_info_t *info; |
@@ -101,23 +92,11 @@ static int parport_probe(struct pcmcia_device *link) | |||
101 | link->priv = info; | 92 | link->priv = info; |
102 | info->p_dev = link; | 93 | info->p_dev = link; |
103 | 94 | ||
104 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; | 95 | link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; |
105 | link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; | ||
106 | link->conf.Attributes = CONF_ENABLE_IRQ; | ||
107 | link->conf.IntType = INT_MEMORY_AND_IO; | ||
108 | 96 | ||
109 | return parport_config(link); | 97 | return parport_config(link); |
110 | } /* parport_attach */ | 98 | } /* parport_attach */ |
111 | 99 | ||
112 | /*====================================================================== | ||
113 | |||
114 | This deletes a driver "instance". The device is de-registered | ||
115 | with Card Services. If it has been released, all local data | ||
116 | structures are freed. Otherwise, the structures will be freed | ||
117 | when the device is released. | ||
118 | |||
119 | ======================================================================*/ | ||
120 | |||
121 | static void parport_detach(struct pcmcia_device *link) | 100 | static void parport_detach(struct pcmcia_device *link) |
122 | { | 101 | { |
123 | dev_dbg(&link->dev, "parport_detach\n"); | 102 | dev_dbg(&link->dev, "parport_detach\n"); |
@@ -127,36 +106,14 @@ static void parport_detach(struct pcmcia_device *link) | |||
127 | kfree(link->priv); | 106 | kfree(link->priv); |
128 | } /* parport_detach */ | 107 | } /* parport_detach */ |
129 | 108 | ||
130 | /*====================================================================== | 109 | static int parport_config_check(struct pcmcia_device *p_dev, void *priv_data) |
131 | |||
132 | parport_config() is scheduled to run after a CARD_INSERTION event | ||
133 | is received, to configure the PCMCIA socket, and to make the | ||
134 | parport device available to the system. | ||
135 | |||
136 | ======================================================================*/ | ||
137 | |||
138 | static int parport_config_check(struct pcmcia_device *p_dev, | ||
139 | cistpl_cftable_entry_t *cfg, | ||
140 | cistpl_cftable_entry_t *dflt, | ||
141 | unsigned int vcc, | ||
142 | void *priv_data) | ||
143 | { | 110 | { |
144 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 111 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
145 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 112 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
146 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; | 113 | p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; |
147 | if (epp_mode) | 114 | p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; |
148 | p_dev->conf.ConfigIndex |= FORCE_EPP_MODE; | 115 | |
149 | p_dev->resource[0]->start = io->win[0].base; | 116 | return pcmcia_request_io(p_dev); |
150 | p_dev->resource[0]->end = io->win[0].len; | ||
151 | if (io->nwin == 2) { | ||
152 | p_dev->resource[1]->start = io->win[1].base; | ||
153 | p_dev->resource[1]->end = io->win[1].len; | ||
154 | } | ||
155 | if (pcmcia_request_io(p_dev) != 0) | ||
156 | return -ENODEV; | ||
157 | return 0; | ||
158 | } | ||
159 | return -ENODEV; | ||
160 | } | 117 | } |
161 | 118 | ||
162 | static int parport_config(struct pcmcia_device *link) | 119 | static int parport_config(struct pcmcia_device *link) |
@@ -167,13 +124,16 @@ static int parport_config(struct pcmcia_device *link) | |||
167 | 124 | ||
168 | dev_dbg(&link->dev, "parport_config\n"); | 125 | dev_dbg(&link->dev, "parport_config\n"); |
169 | 126 | ||
127 | if (epp_mode) | ||
128 | link->config_index |= FORCE_EPP_MODE; | ||
129 | |||
170 | ret = pcmcia_loop_config(link, parport_config_check, NULL); | 130 | ret = pcmcia_loop_config(link, parport_config_check, NULL); |
171 | if (ret) | 131 | if (ret) |
172 | goto failed; | 132 | goto failed; |
173 | 133 | ||
174 | if (!link->irq) | 134 | if (!link->irq) |
175 | goto failed; | 135 | goto failed; |
176 | ret = pcmcia_request_configuration(link, &link->conf); | 136 | ret = pcmcia_enable_device(link); |
177 | if (ret) | 137 | if (ret) |
178 | goto failed; | 138 | goto failed; |
179 | 139 | ||
@@ -202,14 +162,6 @@ failed: | |||
202 | return -ENODEV; | 162 | return -ENODEV; |
203 | } /* parport_config */ | 163 | } /* parport_config */ |
204 | 164 | ||
205 | /*====================================================================== | ||
206 | |||
207 | After a card is removed, parport_cs_release() will unregister the | ||
208 | device, and release the PCMCIA configuration. If the device is | ||
209 | still open, this will be postponed until it is closed. | ||
210 | |||
211 | ======================================================================*/ | ||
212 | |||
213 | static void parport_cs_release(struct pcmcia_device *link) | 165 | static void parport_cs_release(struct pcmcia_device *link) |
214 | { | 166 | { |
215 | parport_info_t *info = link->priv; | 167 | parport_info_t *info = link->priv; |
@@ -236,9 +188,7 @@ MODULE_DEVICE_TABLE(pcmcia, parport_ids); | |||
236 | 188 | ||
237 | static struct pcmcia_driver parport_cs_driver = { | 189 | static struct pcmcia_driver parport_cs_driver = { |
238 | .owner = THIS_MODULE, | 190 | .owner = THIS_MODULE, |
239 | .drv = { | 191 | .name = "parport_cs", |
240 | .name = "parport_cs", | ||
241 | }, | ||
242 | .probe = parport_probe, | 192 | .probe = parport_probe, |
243 | .remove = parport_detach, | 193 | .remove = parport_detach, |
244 | .id_table = parport_ids, | 194 | .id_table = parport_ids, |