Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-fixe…
Browse files Browse the repository at this point in the history
…s-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-fixes-2.6:
  [PATCH] PCMCIA: fix __must_check warnings
  [PATCH] PCMCIA: handle sysfs, PCI errors
  [PATCH] Export soc_common_drv_pcmcia_remove to allow modular PCMCIA.
  [PATCH] ioremap balanced with iounmap for drivers/pcmcia
  [PATCH] pcmcia: au1000_generic fix
  [PATCH] i82092: wire up errors from pci_register_driver()
  [PATCH] CONFIG_PM=n slim: drivers/pcmcia/*
  [PATCH] pcmcia/ds: driver layer error checking
  [PATCH] pcmcia: update alloc_io_space for conflict checking for multifunction PC card
  [PATCH] pcmcia: add more IDs to hostap_cs.c
  [PATCH] pcmcia: at91_cf update
  • Loading branch information
Linus Torvalds committed Oct 30, 2006
2 parents 7a20655 + f901b8c commit c0f79c4
Show file tree
Hide file tree
Showing 12 changed files with 105 additions and 48 deletions.
7 changes: 7 additions & 0 deletions drivers/net/wireless/hostap/hostap_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,13 @@ static struct pcmcia_device_id hostap_cs_ids[] = {
PCMCIA_DEVICE_PROD_ID123(
"U.S. Robotics", "IEEE 802.11b PC-CARD", "Version 01.02",
0xc7b8df9d, 0x1700d087, 0x4b74baa0),
PCMCIA_DEVICE_PROD_ID123(
"Allied Telesyn", "AT-WCL452 Wireless PCMCIA Radio",
"Ver. 1.00",
0x5cd01705, 0x4271660f, 0x9d08ee12),
PCMCIA_DEVICE_PROD_ID123(
"corega", "WL PCCL-11", "ISL37300P",
0xa21501a, 0x59868926, 0xc9049a39),
PCMCIA_DEVICE_NULL
};
MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids);
Expand Down
28 changes: 9 additions & 19 deletions drivers/pcmcia/at91_cf.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,6 @@ static int __init at91_cf_probe(struct platform_device *pdev)
csa = at91_sys_read(AT91_EBI_CSA);
at91_sys_write(AT91_EBI_CSA, csa | AT91_EBI_CS4A_SMC_COMPACTFLASH);

/* force poweron defaults for these pins ... */
(void) at91_set_A_periph(AT91_PIN_PC9, 0); /* A25/CFRNW */
(void) at91_set_A_periph(AT91_PIN_PC10, 0); /* NCS4/CFCS */
(void) at91_set_A_periph(AT91_PIN_PC11, 0); /* NCS5/CFCE1 */
(void) at91_set_A_periph(AT91_PIN_PC12, 0); /* NCS6/CFCE2 */

/* nWAIT is _not_ a default setting */
(void) at91_set_A_periph(AT91_PIN_PC6, 1); /* nWAIT */

Expand Down Expand Up @@ -316,12 +310,14 @@ static int __init at91_cf_probe(struct platform_device *pdev)
return 0;

fail2:
iounmap((void __iomem *) cf->socket.io_offset);
release_mem_region(io->start, io->end + 1 - io->start);
fail1:
if (cf->socket.io_offset)
iounmap((void __iomem *) cf->socket.io_offset);
if (board->irq_pin)
free_irq(board->irq_pin, cf);
fail0a:
device_init_wakeup(&pdev->dev, 0);
free_irq(board->det_pin, cf);
device_init_wakeup(&pdev->dev, 0);
fail0:
Expand Down Expand Up @@ -360,26 +356,20 @@ static int at91_cf_suspend(struct platform_device *pdev, pm_message_t mesg)
struct at91_cf_data *board = cf->board;

pcmcia_socket_dev_suspend(&pdev->dev, mesg);
if (device_may_wakeup(&pdev->dev))
if (device_may_wakeup(&pdev->dev)) {
enable_irq_wake(board->det_pin);
else {
if (board->irq_pin)
enable_irq_wake(board->irq_pin);
} else {
disable_irq_wake(board->det_pin);
disable_irq(board->det_pin);
if (board->irq_pin)
disable_irq_wake(board->irq_pin);
}
if (board->irq_pin)
disable_irq(board->irq_pin);
return 0;
}

static int at91_cf_resume(struct platform_device *pdev)
{
struct at91_cf_socket *cf = platform_get_drvdata(pdev);
struct at91_cf_data *board = cf->board;

if (board->irq_pin)
enable_irq(board->irq_pin);
if (!device_may_wakeup(&pdev->dev))
enable_irq(board->det_pin);
pcmcia_socket_dev_resume(&pdev->dev);
return 0;
}
Expand Down
25 changes: 19 additions & 6 deletions drivers/pcmcia/au1000_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ struct skt_dev_info {
int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr)
{
struct skt_dev_info *sinfo;
struct au1000_pcmcia_socket *skt;
int ret, i;

sinfo = kzalloc(sizeof(struct skt_dev_info), GFP_KERNEL);
Expand All @@ -365,7 +366,7 @@ int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops,
* Initialise the per-socket structure.
*/
for (i = 0; i < nr; i++) {
struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i);
skt = PCMCIA_SOCKET(i);
memset(skt, 0, sizeof(*skt));

skt->socket.resource_ops = &pccard_static_ops;
Expand Down Expand Up @@ -438,17 +439,29 @@ int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops,
dev_set_drvdata(dev, sinfo);
return 0;

do {
struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i);

out_err:
flush_scheduled_work();
ops->hw_shutdown(skt);
while (i-- > 0) {
skt = PCMCIA_SOCKET(i);

del_timer_sync(&skt->poll_timer);
pcmcia_unregister_socket(&skt->socket);
out_err:
flush_scheduled_work();
if (i == 0) {
iounmap(skt->virt_io + (u32)mips_io_port_base);
skt->virt_io = NULL;
}
#ifndef CONFIG_MIPS_XXS1500
else {
iounmap(skt->virt_io + (u32)mips_io_port_base);
skt->virt_io = NULL;
}
#endif
ops->hw_shutdown(skt);

i--;
} while (i > 0);
}
kfree(sinfo);
out:
return ret;
Expand Down
29 changes: 24 additions & 5 deletions drivers/pcmcia/ds.c
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,7 @@ static int pcmcia_requery(struct device *dev, void * _data)
static void pcmcia_bus_rescan(struct pcmcia_socket *skt)
{
int no_devices=0;
int ret = 0;
unsigned long flags;

/* must be called with skt_mutex held */
Expand All @@ -729,7 +730,7 @@ static void pcmcia_bus_rescan(struct pcmcia_socket *skt)
* missing resource information or other trouble, we need to
* do this now. */
if (no_devices) {
int ret = pcmcia_card_add(skt);
ret = pcmcia_card_add(skt);
if (ret)
return;
}
Expand All @@ -741,7 +742,9 @@ static void pcmcia_bus_rescan(struct pcmcia_socket *skt)

/* we re-scan all devices, not just the ones connected to this
* socket. This does not matter, though. */
bus_rescan_devices(&pcmcia_bus_type);
ret = bus_rescan_devices(&pcmcia_bus_type);
if (ret)
printk(KERN_INFO "pcmcia: bus_rescan_devices failed\n");
}

static inline int pcmcia_devmatch(struct pcmcia_device *dev,
Expand Down Expand Up @@ -1001,6 +1004,7 @@ static ssize_t pcmcia_store_allow_func_id_match(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
int ret;

if (!count)
return -EINVAL;
Expand All @@ -1009,7 +1013,10 @@ static ssize_t pcmcia_store_allow_func_id_match(struct device *dev,
p_dev->allow_func_id_match = 1;
mutex_unlock(&p_dev->socket->skt_mutex);

bus_rescan_devices(&pcmcia_bus_type);
ret = bus_rescan_devices(&pcmcia_bus_type);
if (ret)
printk(KERN_INFO "pcmcia: bus_rescan_devices failed after "
"allowing func_id matches\n");

return count;
}
Expand Down Expand Up @@ -1292,10 +1299,22 @@ struct bus_type pcmcia_bus_type = {

static int __init init_pcmcia_bus(void)
{
int ret;

spin_lock_init(&pcmcia_dev_list_lock);

bus_register(&pcmcia_bus_type);
class_interface_register(&pcmcia_bus_interface);
ret = bus_register(&pcmcia_bus_type);
if (ret < 0) {
printk(KERN_WARNING "pcmcia: bus_register error: %d\n", ret);
return ret;
}
ret = class_interface_register(&pcmcia_bus_interface);
if (ret < 0) {
printk(KERN_WARNING
"pcmcia: class_interface_register error: %d\n", ret);
bus_unregister(&pcmcia_bus_type);
return ret;
}

pcmcia_setup_ioctl();

Expand Down
9 changes: 5 additions & 4 deletions drivers/pcmcia/i82092.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ static struct pci_device_id i82092aa_pci_ids[] = {
};
MODULE_DEVICE_TABLE(pci, i82092aa_pci_ids);

#ifdef CONFIG_PM
static int i82092aa_socket_suspend (struct pci_dev *dev, pm_message_t state)
{
return pcmcia_socket_dev_suspend(&dev->dev, state);
Expand All @@ -50,14 +51,17 @@ static int i82092aa_socket_resume (struct pci_dev *dev)
{
return pcmcia_socket_dev_resume(&dev->dev);
}
#endif

static struct pci_driver i82092aa_pci_drv = {
.name = "i82092aa",
.id_table = i82092aa_pci_ids,
.probe = i82092aa_pci_probe,
.remove = __devexit_p(i82092aa_pci_remove),
#ifdef CONFIG_PM
.suspend = i82092aa_socket_suspend,
.resume = i82092aa_socket_resume,
#endif
};


Expand Down Expand Up @@ -705,10 +709,7 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_

static int i82092aa_module_init(void)
{
enter("i82092aa_module_init");
pci_register_driver(&i82092aa_pci_drv);
leave("i82092aa_module_init");
return 0;
return pci_register_driver(&i82092aa_pci_drv);
}

static void i82092aa_module_exit(void)
Expand Down
12 changes: 8 additions & 4 deletions drivers/pcmcia/m8xx_pcmcia.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ static int voltage_set(int slot, int vcc, int vpp)
reg |= BCSR1_PCCVCC1;
break;
default:
return 1;
goto out_unmap;
}

switch(vpp) {
Expand All @@ -438,15 +438,15 @@ static int voltage_set(int slot, int vcc, int vpp)
if(vcc == vpp)
reg |= BCSR1_PCCVPP1;
else
return 1;
goto out_unmap;
break;
case 120:
if ((vcc == 33) || (vcc == 50))
reg |= BCSR1_PCCVPP0;
else
return 1;
goto out_unmap;
default:
return 1;
goto out_unmap;
}

/* first, turn off all power */
Expand All @@ -457,6 +457,10 @@ static int voltage_set(int slot, int vcc, int vpp)

iounmap(bcsr_io);
return 0;

out_unmap:
iounmap(bcsr_io);
return 1;
}

#define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V
Expand Down
3 changes: 2 additions & 1 deletion drivers/pcmcia/omap_cf.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,10 @@ static int __devinit omap_cf_probe(struct device *dev)
return 0;

fail2:
iounmap((void __iomem *) cf->socket.io_offset);
release_mem_region(cf->phys_cf, SZ_8K);
fail1:
if (cf->socket.io_offset)
iounmap((void __iomem *) cf->socket.io_offset);
free_irq(irq, cf);
fail0:
kfree(cf);
Expand Down
11 changes: 8 additions & 3 deletions drivers/pcmcia/pcmcia_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,12 @@ static int proc_read_drivers(char *buf, char **start, off_t pos,
int count, int *eof, void *data)
{
char *p = buf;
int rc;

bus_for_each_drv(&pcmcia_bus_type, NULL,
(void *) &p, proc_read_drivers_callback);
rc = bus_for_each_drv(&pcmcia_bus_type, NULL,
(void *) &p, proc_read_drivers_callback);
if (rc < 0)
return rc;

return (p - buf);
}
Expand Down Expand Up @@ -269,8 +272,10 @@ static int bind_request(struct pcmcia_socket *s, bind_info_t *bind_info)
* Prevent this racing with a card insertion.
*/
mutex_lock(&s->skt_mutex);
bus_rescan_devices(&pcmcia_bus_type);
ret = bus_rescan_devices(&pcmcia_bus_type);
mutex_unlock(&s->skt_mutex);
if (ret)
goto err_put_module;

/* check whether the driver indeed matched. I don't care if this
* is racy or not, because it can only happen on cardmgr access
Expand Down
2 changes: 1 addition & 1 deletion drivers/pcmcia/pcmcia_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static int alloc_io_space(struct pcmcia_socket *s, u_int attr, ioaddr_t *base,
* potential conflicts, just the most obvious ones.
*/
for (i = 0; i < MAX_IO_WIN; i++)
if ((s->io[i].res) &&
if ((s->io[i].res) && *base &&
((s->io[i].res->start & (align-1)) == *base))
return 1;
for (i = 0; i < MAX_IO_WIN; i++) {
Expand Down
4 changes: 4 additions & 0 deletions drivers/pcmcia/pd6729.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,7 @@ static void __devexit pd6729_pci_remove(struct pci_dev *dev)
kfree(socket);
}

#ifdef CONFIG_PM
static int pd6729_socket_suspend(struct pci_dev *dev, pm_message_t state)
{
return pcmcia_socket_dev_suspend(&dev->dev, state);
Expand All @@ -764,6 +765,7 @@ static int pd6729_socket_resume(struct pci_dev *dev)
{
return pcmcia_socket_dev_resume(&dev->dev);
}
#endif

static struct pci_device_id pd6729_pci_ids[] = {
{
Expand All @@ -781,8 +783,10 @@ static struct pci_driver pd6729_pci_drv = {
.id_table = pd6729_pci_ids,
.probe = pd6729_pci_probe,
.remove = __devexit_p(pd6729_pci_remove),
#ifdef CONFIG_PM
.suspend = pd6729_socket_suspend,
.resume = pd6729_socket_resume,
#endif
};

static int pd6729_module_init(void)
Expand Down
1 change: 1 addition & 0 deletions drivers/pcmcia/soc_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,3 +824,4 @@ int soc_common_drv_pcmcia_remove(struct device *dev)

return 0;
}
EXPORT_SYMBOL(soc_common_drv_pcmcia_remove);
Loading

0 comments on commit c0f79c4

Please sign in to comment.