Skip to content

Commit b653788

Browse files
committed
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 ...
2 parents 157b6ce + 5b917a1 commit b653788

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+1327
-4135
lines changed

Documentation/pcmcia/driver-changes.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
11
This file details changes in 2.6 which affect PCMCIA card driver authors:
2+
* pcmcia_loop_config() and autoconfiguration (as of 2.6.36)
3+
If struct pcmcia_device *p_dev->config_flags is set accordingly,
4+
pcmcia_loop_config() now sets up certain configuration values
5+
automatically, though the driver may still override the settings
6+
in the callback function. The following autoconfiguration options
7+
are provided at the moment:
8+
CONF_AUTO_CHECK_VCC : check for matching Vcc
9+
CONF_AUTO_SET_VPP : set Vpp
10+
CONF_AUTO_AUDIO : auto-enable audio line, if required
11+
CONF_AUTO_SET_IO : set ioport resources (->resource[0,1])
12+
CONF_AUTO_SET_IOMEM : set first iomem resource (->resource[2])
13+
14+
* pcmcia_request_configuration -> pcmcia_enable_device (as of 2.6.36)
15+
pcmcia_request_configuration() got renamed to pcmcia_enable_device(),
16+
as it mirrors pcmcia_disable_device(). Configuration settings are now
17+
stored in struct pcmcia_device, e.g. in the fields config_flags,
18+
config_index, config_base, vpp.
19+
20+
* pcmcia_request_window changes (as of 2.6.36)
21+
Instead of win_req_t, drivers are now requested to fill out
22+
struct pcmcia_device *p_dev->resource[2,3,4,5] for up to four ioport
23+
ranges. After a call to pcmcia_request_window(), the regions found there
24+
are reserved and may be used immediately -- until pcmcia_release_window()
25+
is called.
26+
227
* pcmcia_request_io changes (as of 2.6.36)
328
Instead of io_req_t, drivers are now requested to fill out
429
struct pcmcia_device *p_dev->resource[0,1] for up to two ioport

drivers/ata/pata_pcmcia.c

Lines changed: 27 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#include <linux/ata.h>
3535
#include <linux/libata.h>
3636

37-
#include <pcmcia/cs.h>
3837
#include <pcmcia/cistpl.h>
3938
#include <pcmcia/ds.h>
4039
#include <pcmcia/cisreg.h>
@@ -168,63 +167,26 @@ static struct ata_port_operations pcmcia_8bit_port_ops = {
168167
};
169168

170169

171-
struct pcmcia_config_check {
172-
unsigned long ctl_base;
173-
int skip_vcc;
174-
int is_kme;
175-
};
176-
177-
static int pcmcia_check_one_config(struct pcmcia_device *pdev,
178-
cistpl_cftable_entry_t *cfg,
179-
cistpl_cftable_entry_t *dflt,
180-
unsigned int vcc,
181-
void *priv_data)
170+
static int pcmcia_check_one_config(struct pcmcia_device *pdev, void *priv_data)
182171
{
183-
struct pcmcia_config_check *stk = priv_data;
184-
185-
/* Check for matching Vcc, unless we're desperate */
186-
if (!stk->skip_vcc) {
187-
if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
188-
if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000)
189-
return -ENODEV;
190-
} else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
191-
if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000)
192-
return -ENODEV;
193-
}
172+
int *is_kme = priv_data;
173+
174+
if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) {
175+
pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
176+
pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
194177
}
178+
pdev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH;
179+
pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
195180

196-
if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
197-
pdev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
198-
else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
199-
pdev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
200-
201-
if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
202-
cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
203-
pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
204-
pdev->resource[0]->start = io->win[0].base;
205-
if (!(io->flags & CISTPL_IO_16BIT)) {
206-
pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
207-
pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
208-
}
209-
if (io->nwin == 2) {
210-
pdev->resource[0]->end = 8;
211-
pdev->resource[1]->start = io->win[1].base;
212-
pdev->resource[1]->end = (stk->is_kme) ? 2 : 1;
213-
if (pcmcia_request_io(pdev) != 0)
214-
return -ENODEV;
215-
stk->ctl_base = pdev->resource[1]->start;
216-
} else if ((io->nwin == 1) && (io->win[0].len >= 16)) {
217-
pdev->resource[0]->end = io->win[0].len;
218-
pdev->resource[1]->end = 0;
219-
if (pcmcia_request_io(pdev) != 0)
220-
return -ENODEV;
221-
stk->ctl_base = pdev->resource[0]->start + 0x0e;
222-
} else
181+
if (pdev->resource[1]->end) {
182+
pdev->resource[0]->end = 8;
183+
pdev->resource[1]->end = (*is_kme) ? 2 : 1;
184+
} else {
185+
if (pdev->resource[0]->end < 16)
223186
return -ENODEV;
224-
/* If we've got this far, we're done */
225-
return 0;
226187
}
227-
return -ENODEV;
188+
189+
return pcmcia_request_io(pdev);
228190
}
229191

230192
/**
@@ -239,44 +201,37 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
239201
{
240202
struct ata_host *host;
241203
struct ata_port *ap;
242-
struct pcmcia_config_check *stk = NULL;
243204
int is_kme = 0, ret = -ENOMEM, p;
244205
unsigned long io_base, ctl_base;
245206
void __iomem *io_addr, *ctl_addr;
246207
int n_ports = 1;
247208
struct ata_port_operations *ops = &pcmcia_port_ops;
248209

249210
/* Set up attributes in order to probe card and get resources */
250-
pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
251-
pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
252-
pdev->conf.Attributes = CONF_ENABLE_IRQ;
253-
pdev->conf.IntType = INT_MEMORY_AND_IO;
211+
pdev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO |
212+
CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC;
254213

255214
/* See if we have a manufacturer identifier. Use it to set is_kme for
256215
vendor quirks */
257216
is_kme = ((pdev->manf_id == MANFID_KME) &&
258217
((pdev->card_id == PRODID_KME_KXLC005_A) ||
259218
(pdev->card_id == PRODID_KME_KXLC005_B)));
260219

261-
/* Allocate resoure probing structures */
262-
263-
stk = kzalloc(sizeof(*stk), GFP_KERNEL);
264-
if (!stk)
265-
goto out1;
266-
stk->is_kme = is_kme;
267-
stk->skip_vcc = io_base = ctl_base = 0;
268-
269-
if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) {
270-
stk->skip_vcc = 1;
271-
if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk))
220+
if (pcmcia_loop_config(pdev, pcmcia_check_one_config, &is_kme)) {
221+
pdev->config_flags &= ~CONF_AUTO_CHECK_VCC;
222+
if (pcmcia_loop_config(pdev, pcmcia_check_one_config, &is_kme))
272223
goto failed; /* No suitable config found */
273224
}
274225
io_base = pdev->resource[0]->start;
275-
ctl_base = stk->ctl_base;
226+
if (pdev->resource[1]->end)
227+
ctl_base = pdev->resource[1]->start;
228+
else
229+
ctl_base = pdev->resource[0]->start + 0x0e;
230+
276231
if (!pdev->irq)
277232
goto failed;
278233

279-
ret = pcmcia_request_configuration(pdev, &pdev->conf);
234+
ret = pcmcia_enable_device(pdev);
280235
if (ret)
281236
goto failed;
282237

@@ -329,13 +284,10 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
329284
goto failed;
330285

331286
pdev->priv = host;
332-
kfree(stk);
333287
return 0;
334288

335289
failed:
336-
kfree(stk);
337290
pcmcia_disable_device(pdev);
338-
out1:
339291
return ret;
340292
}
341293

@@ -430,9 +382,7 @@ MODULE_DEVICE_TABLE(pcmcia, pcmcia_devices);
430382

431383
static struct pcmcia_driver pcmcia_driver = {
432384
.owner = THIS_MODULE,
433-
.drv = {
434-
.name = DRV_NAME,
435-
},
385+
.name = DRV_NAME,
436386
.id_table = pcmcia_devices,
437387
.probe = pcmcia_init_one,
438388
.remove = pcmcia_remove_one,

drivers/bluetooth/bluecard_cs.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#include <linux/skbuff.h>
4040
#include <linux/io.h>
4141

42-
#include <pcmcia/cs.h>
4342
#include <pcmcia/cistpl.h>
4443
#include <pcmcia/ciscode.h>
4544
#include <pcmcia/ds.h>
@@ -865,8 +864,7 @@ static int bluecard_probe(struct pcmcia_device *link)
865864
info->p_dev = link;
866865
link->priv = info;
867866

868-
link->conf.Attributes = CONF_ENABLE_IRQ;
869-
link->conf.IntType = INT_MEMORY_AND_IO;
867+
link->config_flags |= CONF_ENABLE_IRQ;
870868

871869
return bluecard_config(link);
872870
}
@@ -886,7 +884,7 @@ static int bluecard_config(struct pcmcia_device *link)
886884
bluecard_info_t *info = link->priv;
887885
int i, n;
888886

889-
link->conf.ConfigIndex = 0x20;
887+
link->config_index = 0x20;
890888

891889
link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
892890
link->resource[0]->end = 64;
@@ -906,7 +904,7 @@ static int bluecard_config(struct pcmcia_device *link)
906904
if (i != 0)
907905
goto failed;
908906

909-
i = pcmcia_request_configuration(link, &link->conf);
907+
i = pcmcia_enable_device(link);
910908
if (i != 0)
911909
goto failed;
912910

@@ -942,9 +940,7 @@ MODULE_DEVICE_TABLE(pcmcia, bluecard_ids);
942940

943941
static struct pcmcia_driver bluecard_driver = {
944942
.owner = THIS_MODULE,
945-
.drv = {
946-
.name = "bluecard_cs",
947-
},
943+
.name = "bluecard_cs",
948944
.probe = bluecard_probe,
949945
.remove = bluecard_detach,
950946
.id_table = bluecard_ids,

drivers/bluetooth/bt3c_cs.c

Lines changed: 28 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
#include <linux/device.h>
4646
#include <linux/firmware.h>
4747

48-
#include <pcmcia/cs.h>
4948
#include <pcmcia/cistpl.h>
5049
#include <pcmcia/ciscode.h>
5150
#include <pcmcia/ds.h>
@@ -657,11 +656,8 @@ static int bt3c_probe(struct pcmcia_device *link)
657656
info->p_dev = link;
658657
link->priv = info;
659658

660-
link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
661-
link->resource[0]->end = 8;
662-
663-
link->conf.Attributes = CONF_ENABLE_IRQ;
664-
link->conf.IntType = INT_MEMORY_AND_IO;
659+
link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP |
660+
CONF_AUTO_SET_IO;
665661

666662
return bt3c_config(link);
667663
}
@@ -675,43 +671,41 @@ static void bt3c_detach(struct pcmcia_device *link)
675671
kfree(info);
676672
}
677673

678-
static int bt3c_check_config(struct pcmcia_device *p_dev,
679-
cistpl_cftable_entry_t *cf,
680-
cistpl_cftable_entry_t *dflt,
681-
unsigned int vcc,
682-
void *priv_data)
674+
static int bt3c_check_config(struct pcmcia_device *p_dev, void *priv_data)
683675
{
684-
unsigned long try = (unsigned long) priv_data;
676+
int *try = priv_data;
685677

686-
p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
678+
if (try == 0)
679+
p_dev->io_lines = 16;
687680

688-
if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))
689-
p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
690-
if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) &&
691-
(cf->io.win[0].base != 0)) {
692-
p_dev->resource[0]->start = cf->io.win[0].base;
693-
if (!pcmcia_request_io(p_dev))
694-
return 0;
695-
}
696-
return -ENODEV;
681+
if ((p_dev->resource[0]->end != 8) || (p_dev->resource[0]->start == 0))
682+
return -EINVAL;
683+
684+
p_dev->resource[0]->end = 8;
685+
p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
686+
p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
687+
688+
return pcmcia_request_io(p_dev);
697689
}
698690

699691
static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev,
700-
cistpl_cftable_entry_t *cf,
701-
cistpl_cftable_entry_t *dflt,
702-
unsigned int vcc,
703692
void *priv_data)
704693
{
705694
static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
706695
int j;
707696

708-
if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
709-
for (j = 0; j < 5; j++) {
710-
p_dev->resource[0]->start = base[j];
711-
p_dev->io_lines = base[j] ? 16 : 3;
712-
if (!pcmcia_request_io(p_dev))
713-
return 0;
714-
}
697+
if (p_dev->io_lines > 3)
698+
return -ENODEV;
699+
700+
p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
701+
p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
702+
p_dev->resource[0]->end = 8;
703+
704+
for (j = 0; j < 5; j++) {
705+
p_dev->resource[0]->start = base[j];
706+
p_dev->io_lines = base[j] ? 16 : 3;
707+
if (!pcmcia_request_io(p_dev))
708+
return 0;
715709
}
716710
return -ENODEV;
717711
}
@@ -742,7 +736,7 @@ static int bt3c_config(struct pcmcia_device *link)
742736
if (i != 0)
743737
goto failed;
744738

745-
i = pcmcia_request_configuration(link, &link->conf);
739+
i = pcmcia_enable_device(link);
746740
if (i != 0)
747741
goto failed;
748742

@@ -775,9 +769,7 @@ MODULE_DEVICE_TABLE(pcmcia, bt3c_ids);
775769

776770
static struct pcmcia_driver bt3c_driver = {
777771
.owner = THIS_MODULE,
778-
.drv = {
779-
.name = "bt3c_cs",
780-
},
772+
.name = "bt3c_cs",
781773
.probe = bt3c_probe,
782774
.remove = bt3c_detach,
783775
.id_table = bt3c_ids,

0 commit comments

Comments
 (0)