forked from Minki/linux
Merge branch 'urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6
* 'urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6: pcmcia: use dev_pm_ops for class pcmcia_socket_class power: support _noirq actions on device types and classes pcmcia: allow for four multifunction subdevices (again) pcmcia: do not use ioports < 0x100 on x86 pd6729: Coding Style fixes
This commit is contained in:
commit
6f063aea55
@ -439,8 +439,23 @@ static int device_resume_noirq(struct device *dev, pm_message_t state)
|
||||
if (dev->bus && dev->bus->pm) {
|
||||
pm_dev_dbg(dev, state, "EARLY ");
|
||||
error = pm_noirq_op(dev, dev->bus->pm, state);
|
||||
if (error)
|
||||
goto End;
|
||||
}
|
||||
|
||||
if (dev->type && dev->type->pm) {
|
||||
pm_dev_dbg(dev, state, "EARLY type ");
|
||||
error = pm_noirq_op(dev, dev->type->pm, state);
|
||||
if (error)
|
||||
goto End;
|
||||
}
|
||||
|
||||
if (dev->class && dev->class->pm) {
|
||||
pm_dev_dbg(dev, state, "EARLY class ");
|
||||
error = pm_noirq_op(dev, dev->class->pm, state);
|
||||
}
|
||||
|
||||
End:
|
||||
TRACE_RESUME(error);
|
||||
return error;
|
||||
}
|
||||
@ -735,10 +750,26 @@ static int device_suspend_noirq(struct device *dev, pm_message_t state)
|
||||
{
|
||||
int error = 0;
|
||||
|
||||
if (dev->class && dev->class->pm) {
|
||||
pm_dev_dbg(dev, state, "LATE class ");
|
||||
error = pm_noirq_op(dev, dev->class->pm, state);
|
||||
if (error)
|
||||
goto End;
|
||||
}
|
||||
|
||||
if (dev->type && dev->type->pm) {
|
||||
pm_dev_dbg(dev, state, "LATE type ");
|
||||
error = pm_noirq_op(dev, dev->type->pm, state);
|
||||
if (error)
|
||||
goto End;
|
||||
}
|
||||
|
||||
if (dev->bus && dev->bus->pm) {
|
||||
pm_dev_dbg(dev, state, "LATE ");
|
||||
error = pm_noirq_op(dev, dev->bus->pm, state);
|
||||
}
|
||||
|
||||
End:
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -361,7 +361,6 @@ static int at91_cf_suspend(struct platform_device *pdev, pm_message_t mesg)
|
||||
struct at91_cf_socket *cf = platform_get_drvdata(pdev);
|
||||
struct at91_cf_data *board = cf->board;
|
||||
|
||||
pcmcia_socket_dev_suspend(&pdev->dev);
|
||||
if (device_may_wakeup(&pdev->dev)) {
|
||||
enable_irq_wake(board->det_pin);
|
||||
if (board->irq_pin)
|
||||
@ -381,7 +380,6 @@ static int at91_cf_resume(struct platform_device *pdev)
|
||||
disable_irq_wake(board->irq_pin);
|
||||
}
|
||||
|
||||
pcmcia_socket_dev_resume(&pdev->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -510,17 +510,6 @@ static int au1x00_drv_pcmcia_probe(struct platform_device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int au1x00_drv_pcmcia_suspend(struct platform_device *dev,
|
||||
pm_message_t state)
|
||||
{
|
||||
return pcmcia_socket_dev_suspend(&dev->dev);
|
||||
}
|
||||
|
||||
static int au1x00_drv_pcmcia_resume(struct platform_device *dev)
|
||||
{
|
||||
return pcmcia_socket_dev_resume(&dev->dev);
|
||||
}
|
||||
|
||||
static struct platform_driver au1x00_pcmcia_driver = {
|
||||
.driver = {
|
||||
.name = "au1x00-pcmcia",
|
||||
@ -528,8 +517,6 @@ static struct platform_driver au1x00_pcmcia_driver = {
|
||||
},
|
||||
.probe = au1x00_drv_pcmcia_probe,
|
||||
.remove = au1x00_drv_pcmcia_remove,
|
||||
.suspend = au1x00_drv_pcmcia_suspend,
|
||||
.resume = au1x00_drv_pcmcia_resume,
|
||||
};
|
||||
|
||||
|
||||
|
@ -300,16 +300,6 @@ static int __devexit bfin_cf_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bfin_cf_suspend(struct platform_device *pdev, pm_message_t mesg)
|
||||
{
|
||||
return pcmcia_socket_dev_suspend(&pdev->dev);
|
||||
}
|
||||
|
||||
static int bfin_cf_resume(struct platform_device *pdev)
|
||||
{
|
||||
return pcmcia_socket_dev_resume(&pdev->dev);
|
||||
}
|
||||
|
||||
static struct platform_driver bfin_cf_driver = {
|
||||
.driver = {
|
||||
.name = (char *)driver_name,
|
||||
@ -317,8 +307,6 @@ static struct platform_driver bfin_cf_driver = {
|
||||
},
|
||||
.probe = bfin_cf_probe,
|
||||
.remove = __devexit_p(bfin_cf_remove),
|
||||
.suspend = bfin_cf_suspend,
|
||||
.resume = bfin_cf_resume,
|
||||
};
|
||||
|
||||
static int __init bfin_cf_init(void)
|
||||
|
@ -76,65 +76,6 @@ DECLARE_RWSEM(pcmcia_socket_list_rwsem);
|
||||
EXPORT_SYMBOL(pcmcia_socket_list_rwsem);
|
||||
|
||||
|
||||
/*
|
||||
* Low-level PCMCIA socket drivers need to register with the PCCard
|
||||
* core using pcmcia_register_socket.
|
||||
*
|
||||
* socket drivers are expected to use the following callbacks in their
|
||||
* .drv struct:
|
||||
* - pcmcia_socket_dev_suspend
|
||||
* - pcmcia_socket_dev_resume
|
||||
* These functions check for the appropriate struct pcmcia_soket arrays,
|
||||
* and pass them to the low-level functions pcmcia_{suspend,resume}_socket
|
||||
*/
|
||||
static int socket_early_resume(struct pcmcia_socket *skt);
|
||||
static int socket_late_resume(struct pcmcia_socket *skt);
|
||||
static int socket_resume(struct pcmcia_socket *skt);
|
||||
static int socket_suspend(struct pcmcia_socket *skt);
|
||||
|
||||
static void pcmcia_socket_dev_run(struct device *dev,
|
||||
int (*cb)(struct pcmcia_socket *))
|
||||
{
|
||||
struct pcmcia_socket *socket;
|
||||
|
||||
down_read(&pcmcia_socket_list_rwsem);
|
||||
list_for_each_entry(socket, &pcmcia_socket_list, socket_list) {
|
||||
if (socket->dev.parent != dev)
|
||||
continue;
|
||||
mutex_lock(&socket->skt_mutex);
|
||||
cb(socket);
|
||||
mutex_unlock(&socket->skt_mutex);
|
||||
}
|
||||
up_read(&pcmcia_socket_list_rwsem);
|
||||
}
|
||||
|
||||
int pcmcia_socket_dev_suspend(struct device *dev)
|
||||
{
|
||||
pcmcia_socket_dev_run(dev, socket_suspend);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(pcmcia_socket_dev_suspend);
|
||||
|
||||
void pcmcia_socket_dev_early_resume(struct device *dev)
|
||||
{
|
||||
pcmcia_socket_dev_run(dev, socket_early_resume);
|
||||
}
|
||||
EXPORT_SYMBOL(pcmcia_socket_dev_early_resume);
|
||||
|
||||
void pcmcia_socket_dev_late_resume(struct device *dev)
|
||||
{
|
||||
pcmcia_socket_dev_run(dev, socket_late_resume);
|
||||
}
|
||||
EXPORT_SYMBOL(pcmcia_socket_dev_late_resume);
|
||||
|
||||
int pcmcia_socket_dev_resume(struct device *dev)
|
||||
{
|
||||
pcmcia_socket_dev_run(dev, socket_resume);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(pcmcia_socket_dev_resume);
|
||||
|
||||
|
||||
struct pcmcia_socket *pcmcia_get_socket(struct pcmcia_socket *skt)
|
||||
{
|
||||
struct device *dev = get_device(&skt->dev);
|
||||
@ -578,12 +519,18 @@ static int socket_early_resume(struct pcmcia_socket *skt)
|
||||
|
||||
static int socket_late_resume(struct pcmcia_socket *skt)
|
||||
{
|
||||
int ret;
|
||||
|
||||
mutex_lock(&skt->ops_mutex);
|
||||
skt->state &= ~SOCKET_SUSPEND;
|
||||
mutex_unlock(&skt->ops_mutex);
|
||||
|
||||
if (!(skt->state & SOCKET_PRESENT))
|
||||
return socket_insert(skt);
|
||||
if (!(skt->state & SOCKET_PRESENT)) {
|
||||
ret = socket_insert(skt);
|
||||
if (ret == -ENODEV)
|
||||
ret = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (skt->resume_status) {
|
||||
socket_shutdown(skt);
|
||||
@ -919,11 +866,66 @@ static void pcmcia_release_socket_class(struct class *data)
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
||||
static int __pcmcia_pm_op(struct device *dev,
|
||||
int (*callback) (struct pcmcia_socket *skt))
|
||||
{
|
||||
struct pcmcia_socket *s = container_of(dev, struct pcmcia_socket, dev);
|
||||
int ret;
|
||||
|
||||
mutex_lock(&s->skt_mutex);
|
||||
ret = callback(s);
|
||||
mutex_unlock(&s->skt_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int pcmcia_socket_dev_suspend_noirq(struct device *dev)
|
||||
{
|
||||
return __pcmcia_pm_op(dev, socket_suspend);
|
||||
}
|
||||
|
||||
static int pcmcia_socket_dev_resume_noirq(struct device *dev)
|
||||
{
|
||||
return __pcmcia_pm_op(dev, socket_early_resume);
|
||||
}
|
||||
|
||||
static int pcmcia_socket_dev_resume(struct device *dev)
|
||||
{
|
||||
return __pcmcia_pm_op(dev, socket_late_resume);
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops pcmcia_socket_pm_ops = {
|
||||
/* dev_resume may be called with IRQs enabled */
|
||||
SET_SYSTEM_SLEEP_PM_OPS(NULL,
|
||||
pcmcia_socket_dev_resume)
|
||||
|
||||
/* late suspend must be called with IRQs disabled */
|
||||
.suspend_noirq = pcmcia_socket_dev_suspend_noirq,
|
||||
.freeze_noirq = pcmcia_socket_dev_suspend_noirq,
|
||||
.poweroff_noirq = pcmcia_socket_dev_suspend_noirq,
|
||||
|
||||
/* early resume must be called with IRQs disabled */
|
||||
.resume_noirq = pcmcia_socket_dev_resume_noirq,
|
||||
.thaw_noirq = pcmcia_socket_dev_resume_noirq,
|
||||
.restore_noirq = pcmcia_socket_dev_resume_noirq,
|
||||
};
|
||||
|
||||
#define PCMCIA_SOCKET_CLASS_PM_OPS (&pcmcia_socket_pm_ops)
|
||||
|
||||
#else /* CONFIG_PM */
|
||||
|
||||
#define PCMCIA_SOCKET_CLASS_PM_OPS NULL
|
||||
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
struct class pcmcia_socket_class = {
|
||||
.name = "pcmcia_socket",
|
||||
.dev_uevent = pcmcia_socket_uevent,
|
||||
.dev_release = pcmcia_release_socket,
|
||||
.class_release = pcmcia_release_socket_class,
|
||||
.pm = PCMCIA_SOCKET_CLASS_PM_OPS,
|
||||
};
|
||||
EXPORT_SYMBOL(pcmcia_socket_class);
|
||||
|
||||
|
@ -558,37 +558,10 @@ static int __devexit db1x_pcmcia_socket_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int db1x_pcmcia_suspend(struct device *dev)
|
||||
{
|
||||
return pcmcia_socket_dev_suspend(dev);
|
||||
}
|
||||
|
||||
static int db1x_pcmcia_resume(struct device *dev)
|
||||
{
|
||||
return pcmcia_socket_dev_resume(dev);
|
||||
}
|
||||
|
||||
static struct dev_pm_ops db1x_pcmcia_pmops = {
|
||||
.resume = db1x_pcmcia_resume,
|
||||
.suspend = db1x_pcmcia_suspend,
|
||||
.thaw = db1x_pcmcia_resume,
|
||||
.freeze = db1x_pcmcia_suspend,
|
||||
};
|
||||
|
||||
#define DB1XXX_SS_PMOPS &db1x_pcmcia_pmops
|
||||
|
||||
#else
|
||||
|
||||
#define DB1XXX_SS_PMOPS NULL
|
||||
|
||||
#endif
|
||||
|
||||
static struct platform_driver db1x_pcmcia_socket_driver = {
|
||||
.driver = {
|
||||
.name = "db1xxx_pcmcia",
|
||||
.owner = THIS_MODULE,
|
||||
.pm = DB1XXX_SS_PMOPS
|
||||
},
|
||||
.probe = db1x_pcmcia_socket_probe,
|
||||
.remove = __devexit_p(db1x_pcmcia_socket_remove),
|
||||
|
@ -509,8 +509,12 @@ struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int fu
|
||||
p_dev->device_no = (s->device_count++);
|
||||
mutex_unlock(&s->ops_mutex);
|
||||
|
||||
/* max of 2 devices per card */
|
||||
if (p_dev->device_no >= 2)
|
||||
/* max of 2 PFC devices */
|
||||
if ((p_dev->device_no >= 2) && (function == 0))
|
||||
goto err_free;
|
||||
|
||||
/* max of 4 devices overall */
|
||||
if (p_dev->device_no >= 4)
|
||||
goto err_free;
|
||||
|
||||
p_dev->socket = s;
|
||||
|
@ -39,27 +39,11 @@ 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);
|
||||
}
|
||||
|
||||
static int i82092aa_socket_resume (struct pci_dev *dev)
|
||||
{
|
||||
return pcmcia_socket_dev_resume(&dev->dev);
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct pci_driver i82092aa_pci_driver = {
|
||||
.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
|
||||
};
|
||||
|
||||
|
||||
|
@ -1223,16 +1223,7 @@ static int pcic_init(struct pcmcia_socket *s)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int i82365_drv_pcmcia_suspend(struct platform_device *dev,
|
||||
pm_message_t state)
|
||||
{
|
||||
return pcmcia_socket_dev_suspend(&dev->dev);
|
||||
}
|
||||
|
||||
static int i82365_drv_pcmcia_resume(struct platform_device *dev)
|
||||
{
|
||||
return pcmcia_socket_dev_resume(&dev->dev);
|
||||
}
|
||||
static struct pccard_operations pcic_operations = {
|
||||
.init = pcic_init,
|
||||
.get_status = pcic_get_status,
|
||||
@ -1248,8 +1239,6 @@ static struct platform_driver i82365_driver = {
|
||||
.name = "i82365",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.suspend = i82365_drv_pcmcia_suspend,
|
||||
.resume = i82365_drv_pcmcia_resume,
|
||||
};
|
||||
|
||||
static struct platform_device *i82365_device;
|
||||
|
@ -685,16 +685,7 @@ static struct pccard_operations pcc_operations = {
|
||||
.set_mem_map = pcc_set_mem_map,
|
||||
};
|
||||
|
||||
static int cfc_drv_pcmcia_suspend(struct platform_device *dev,
|
||||
pm_message_t state)
|
||||
{
|
||||
return pcmcia_socket_dev_suspend(&dev->dev);
|
||||
}
|
||||
|
||||
static int cfc_drv_pcmcia_resume(struct platform_device *dev)
|
||||
{
|
||||
return pcmcia_socket_dev_resume(&dev->dev);
|
||||
}
|
||||
/*====================================================================*/
|
||||
|
||||
static struct platform_driver pcc_driver = {
|
||||
@ -702,8 +693,6 @@ static struct platform_driver pcc_driver = {
|
||||
.name = "cfc",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.suspend = cfc_drv_pcmcia_suspend,
|
||||
.resume = cfc_drv_pcmcia_resume,
|
||||
};
|
||||
|
||||
static struct platform_device pcc_device = {
|
||||
|
@ -663,16 +663,6 @@ static struct pccard_operations pcc_operations = {
|
||||
.set_mem_map = pcc_set_mem_map,
|
||||
};
|
||||
|
||||
static int pcc_drv_pcmcia_suspend(struct platform_device *dev,
|
||||
pm_message_t state)
|
||||
{
|
||||
return pcmcia_socket_dev_suspend(&dev->dev);
|
||||
}
|
||||
|
||||
static int pcc_drv_pcmcia_resume(struct platform_device *dev)
|
||||
{
|
||||
return pcmcia_socket_dev_resume(&dev->dev);
|
||||
}
|
||||
/*====================================================================*/
|
||||
|
||||
static struct platform_driver pcc_driver = {
|
||||
@ -680,8 +670,6 @@ static struct platform_driver pcc_driver = {
|
||||
.name = "pcc",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.suspend = pcc_drv_pcmcia_suspend,
|
||||
.resume = pcc_drv_pcmcia_resume,
|
||||
};
|
||||
|
||||
static struct platform_device pcc_device = {
|
||||
|
@ -1288,21 +1288,6 @@ static int m8xx_remove(struct of_device *ofdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int m8xx_suspend(struct platform_device *pdev, pm_message_t state)
|
||||
{
|
||||
return pcmcia_socket_dev_suspend(&pdev->dev);
|
||||
}
|
||||
|
||||
static int m8xx_resume(struct platform_device *pdev)
|
||||
{
|
||||
return pcmcia_socket_dev_resume(&pdev->dev);
|
||||
}
|
||||
#else
|
||||
#define m8xx_suspend NULL
|
||||
#define m8xx_resume NULL
|
||||
#endif
|
||||
|
||||
static const struct of_device_id m8xx_pcmcia_match[] = {
|
||||
{
|
||||
.type = "pcmcia",
|
||||
@ -1318,8 +1303,6 @@ static struct of_platform_driver m8xx_pcmcia_driver = {
|
||||
.match_table = m8xx_pcmcia_match,
|
||||
.probe = m8xx_probe,
|
||||
.remove = m8xx_remove,
|
||||
.suspend = m8xx_suspend,
|
||||
.resume = m8xx_resume,
|
||||
};
|
||||
|
||||
static int __init m8xx_init(void)
|
||||
|
@ -330,24 +330,12 @@ static int __exit omap_cf_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap_cf_suspend(struct platform_device *pdev, pm_message_t mesg)
|
||||
{
|
||||
return pcmcia_socket_dev_suspend(&pdev->dev);
|
||||
}
|
||||
|
||||
static int omap_cf_resume(struct platform_device *pdev)
|
||||
{
|
||||
return pcmcia_socket_dev_resume(&pdev->dev);
|
||||
}
|
||||
|
||||
static struct platform_driver omap_cf_driver = {
|
||||
.driver = {
|
||||
.name = (char *) driver_name,
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.remove = __exit_p(omap_cf_remove),
|
||||
.suspend = omap_cf_suspend,
|
||||
.resume = omap_cf_resume,
|
||||
};
|
||||
|
||||
static int __init omap_cf_init(void)
|
||||
|
@ -14,13 +14,13 @@
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <pcmcia/cs_types.h>
|
||||
#include <pcmcia/ss.h>
|
||||
#include <pcmcia/cs.h>
|
||||
|
||||
#include <asm/system.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#include "pd6729.h"
|
||||
#include "i82365.h"
|
||||
@ -222,9 +222,9 @@ static irqreturn_t pd6729_interrupt(int irq, void *dev)
|
||||
? SS_READY : 0;
|
||||
}
|
||||
|
||||
if (events) {
|
||||
if (events)
|
||||
pcmcia_parse_events(&socket[i].socket, events);
|
||||
}
|
||||
|
||||
active |= events;
|
||||
}
|
||||
|
||||
@ -256,9 +256,8 @@ static int pd6729_get_status(struct pcmcia_socket *sock, u_int *value)
|
||||
status = indirect_read(socket, I365_STATUS);
|
||||
*value = 0;
|
||||
|
||||
if ((status & I365_CS_DETECT) == I365_CS_DETECT) {
|
||||
if ((status & I365_CS_DETECT) == I365_CS_DETECT)
|
||||
*value |= SS_DETECT;
|
||||
}
|
||||
|
||||
/*
|
||||
* IO cards have a different meaning of bits 0,1
|
||||
@ -308,7 +307,7 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
|
||||
socket->card_irq = state->io_irq;
|
||||
|
||||
reg = 0;
|
||||
/* The reset bit has "inverse" logic */
|
||||
/* The reset bit has "inverse" logic */
|
||||
if (!(state->flags & SS_RESET))
|
||||
reg |= I365_PC_RESET;
|
||||
if (state->flags & SS_IOCARD)
|
||||
@ -380,7 +379,7 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
|
||||
indirect_write(socket, I365_POWER, reg);
|
||||
|
||||
if (irq_mode == 1) {
|
||||
/* all interrupts are to be done as PCI interrupts */
|
||||
/* all interrupts are to be done as PCI interrupts */
|
||||
data = PD67_EC1_INV_MGMT_IRQ | PD67_EC1_INV_CARD_IRQ;
|
||||
} else
|
||||
data = 0;
|
||||
@ -391,9 +390,9 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
|
||||
/* Enable specific interrupt events */
|
||||
|
||||
reg = 0x00;
|
||||
if (state->csc_mask & SS_DETECT) {
|
||||
if (state->csc_mask & SS_DETECT)
|
||||
reg |= I365_CSC_DETECT;
|
||||
}
|
||||
|
||||
if (state->flags & SS_IOCARD) {
|
||||
if (state->csc_mask & SS_STSCHG)
|
||||
reg |= I365_CSC_STSCHG;
|
||||
@ -450,9 +449,12 @@ static int pd6729_set_io_map(struct pcmcia_socket *sock,
|
||||
|
||||
ioctl = indirect_read(socket, I365_IOCTL) & ~I365_IOCTL_MASK(map);
|
||||
|
||||
if (io->flags & MAP_0WS) ioctl |= I365_IOCTL_0WS(map);
|
||||
if (io->flags & MAP_16BIT) ioctl |= I365_IOCTL_16BIT(map);
|
||||
if (io->flags & MAP_AUTOSZ) ioctl |= I365_IOCTL_IOCS16(map);
|
||||
if (io->flags & MAP_0WS)
|
||||
ioctl |= I365_IOCTL_0WS(map);
|
||||
if (io->flags & MAP_16BIT)
|
||||
ioctl |= I365_IOCTL_16BIT(map);
|
||||
if (io->flags & MAP_AUTOSZ)
|
||||
ioctl |= I365_IOCTL_IOCS16(map);
|
||||
|
||||
indirect_write(socket, I365_IOCTL, ioctl);
|
||||
|
||||
@ -497,7 +499,7 @@ static int pd6729_set_mem_map(struct pcmcia_socket *sock,
|
||||
|
||||
/* write the stop address */
|
||||
|
||||
i= (mem->res->end >> 12) & 0x0fff;
|
||||
i = (mem->res->end >> 12) & 0x0fff;
|
||||
switch (to_cycles(mem->speed)) {
|
||||
case 0:
|
||||
break;
|
||||
@ -563,7 +565,7 @@ static int pd6729_init(struct pcmcia_socket *sock)
|
||||
|
||||
/* the pccard structure and its functions */
|
||||
static struct pccard_operations pd6729_operations = {
|
||||
.init = pd6729_init,
|
||||
.init = pd6729_init,
|
||||
.get_status = pd6729_get_status,
|
||||
.set_socket = pd6729_set_socket,
|
||||
.set_io_map = pd6729_set_io_map,
|
||||
@ -578,8 +580,13 @@ static irqreturn_t pd6729_test(int irq, void *dev)
|
||||
|
||||
static int pd6729_check_irq(int irq)
|
||||
{
|
||||
if (request_irq(irq, pd6729_test, IRQF_PROBE_SHARED, "x", pd6729_test)
|
||||
!= 0) return -1;
|
||||
int ret;
|
||||
|
||||
ret = request_irq(irq, pd6729_test, IRQF_PROBE_SHARED, "x",
|
||||
pd6729_test);
|
||||
if (ret)
|
||||
return -1;
|
||||
|
||||
free_irq(irq, pd6729_test);
|
||||
return 0;
|
||||
}
|
||||
@ -591,7 +598,7 @@ static u_int __devinit pd6729_isa_scan(void)
|
||||
|
||||
if (irq_mode == 1) {
|
||||
printk(KERN_INFO "pd6729: PCI card interrupts, "
|
||||
"PCI status changes\n");
|
||||
"PCI status changes\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -607,9 +614,10 @@ static u_int __devinit pd6729_isa_scan(void)
|
||||
if (mask & (1<<i))
|
||||
printk("%s%d", ((mask & ((1<<i)-1)) ? "," : ""), i);
|
||||
|
||||
if (mask == 0) printk("none!");
|
||||
|
||||
printk(" polling status changes.\n");
|
||||
if (mask == 0)
|
||||
printk("none!");
|
||||
else
|
||||
printk(" polling status changes.\n");
|
||||
|
||||
return mask;
|
||||
}
|
||||
@ -624,11 +632,16 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,
|
||||
|
||||
socket = kzalloc(sizeof(struct pd6729_socket) * MAX_SOCKETS,
|
||||
GFP_KERNEL);
|
||||
if (!socket)
|
||||
if (!socket) {
|
||||
dev_warn(&dev->dev, "failed to kzalloc socket.\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if ((ret = pci_enable_device(dev)))
|
||||
ret = pci_enable_device(dev);
|
||||
if (ret) {
|
||||
dev_warn(&dev->dev, "failed to enable pci_device.\n");
|
||||
goto err_out_free_mem;
|
||||
}
|
||||
|
||||
if (!pci_resource_start(dev, 0)) {
|
||||
dev_warn(&dev->dev, "refusing to load the driver as the "
|
||||
@ -639,7 +652,7 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,
|
||||
dev_info(&dev->dev, "Cirrus PD6729 PCI to PCMCIA Bridge at 0x%llx "
|
||||
"on irq %d\n",
|
||||
(unsigned long long)pci_resource_start(dev, 0), dev->irq);
|
||||
/*
|
||||
/*
|
||||
* Since we have no memory BARs some firmware may not
|
||||
* have had PCI_COMMAND_MEMORY enabled, yet the device needs it.
|
||||
*/
|
||||
@ -685,8 +698,9 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,
|
||||
pci_set_drvdata(dev, socket);
|
||||
if (irq_mode == 1) {
|
||||
/* Register the interrupt handler */
|
||||
if ((ret = request_irq(dev->irq, pd6729_interrupt, IRQF_SHARED,
|
||||
"pd6729", socket))) {
|
||||
ret = request_irq(dev->irq, pd6729_interrupt, IRQF_SHARED,
|
||||
"pd6729", socket);
|
||||
if (ret) {
|
||||
dev_err(&dev->dev, "Failed to register irq %d\n",
|
||||
dev->irq);
|
||||
goto err_out_free_res;
|
||||
@ -750,18 +764,6 @@ 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);
|
||||
}
|
||||
|
||||
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[] = {
|
||||
{
|
||||
.vendor = PCI_VENDOR_ID_CIRRUS,
|
||||
@ -778,10 +780,6 @@ static struct pci_driver pd6729_pci_driver = {
|
||||
.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)
|
||||
|
@ -325,19 +325,13 @@ static int pxa2xx_drv_pcmcia_remove(struct platform_device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pxa2xx_drv_pcmcia_suspend(struct device *dev)
|
||||
{
|
||||
return pcmcia_socket_dev_suspend(dev);
|
||||
}
|
||||
|
||||
static int pxa2xx_drv_pcmcia_resume(struct device *dev)
|
||||
{
|
||||
pxa2xx_configure_sockets(dev);
|
||||
return pcmcia_socket_dev_resume(dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops pxa2xx_drv_pcmcia_pm_ops = {
|
||||
.suspend = pxa2xx_drv_pcmcia_suspend,
|
||||
.resume = pxa2xx_drv_pcmcia_resume,
|
||||
};
|
||||
|
||||
|
@ -810,6 +810,13 @@ static int adjust_io(struct pcmcia_socket *s, unsigned int action, unsigned long
|
||||
unsigned long size = end - start + 1;
|
||||
int ret = 0;
|
||||
|
||||
#if defined(CONFIG_X86)
|
||||
/* on x86, avoid anything < 0x100 for it is often used for
|
||||
* legacy platform devices */
|
||||
if (start < 0x100)
|
||||
start = 0x100;
|
||||
#endif
|
||||
|
||||
if (end < start)
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -95,17 +95,6 @@ static int sa11x0_drv_pcmcia_remove(struct platform_device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sa11x0_drv_pcmcia_suspend(struct platform_device *dev,
|
||||
pm_message_t state)
|
||||
{
|
||||
return pcmcia_socket_dev_suspend(&dev->dev);
|
||||
}
|
||||
|
||||
static int sa11x0_drv_pcmcia_resume(struct platform_device *dev)
|
||||
{
|
||||
return pcmcia_socket_dev_resume(&dev->dev);
|
||||
}
|
||||
|
||||
static struct platform_driver sa11x0_pcmcia_driver = {
|
||||
.driver = {
|
||||
.name = "sa11x0-pcmcia",
|
||||
@ -113,8 +102,6 @@ static struct platform_driver sa11x0_pcmcia_driver = {
|
||||
},
|
||||
.probe = sa11x0_drv_pcmcia_probe,
|
||||
.remove = sa11x0_drv_pcmcia_remove,
|
||||
.suspend = sa11x0_drv_pcmcia_suspend,
|
||||
.resume = sa11x0_drv_pcmcia_resume,
|
||||
};
|
||||
|
||||
/* sa11x0_pcmcia_init()
|
||||
|
@ -213,16 +213,6 @@ static int __devexit pcmcia_remove(struct sa1111_dev *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pcmcia_suspend(struct sa1111_dev *dev, pm_message_t state)
|
||||
{
|
||||
return pcmcia_socket_dev_suspend(&dev->dev);
|
||||
}
|
||||
|
||||
static int pcmcia_resume(struct sa1111_dev *dev)
|
||||
{
|
||||
return pcmcia_socket_dev_resume(&dev->dev);
|
||||
}
|
||||
|
||||
static struct sa1111_driver pcmcia_driver = {
|
||||
.drv = {
|
||||
.name = "sa1111-pcmcia",
|
||||
@ -230,8 +220,6 @@ static struct sa1111_driver pcmcia_driver = {
|
||||
.devid = SA1111_DEVID_PCMCIA,
|
||||
.probe = pcmcia_probe,
|
||||
.remove = __devexit_p(pcmcia_remove),
|
||||
.suspend = pcmcia_suspend,
|
||||
.resume = pcmcia_resume,
|
||||
};
|
||||
|
||||
static int __init sa1111_drv_pcmcia_init(void)
|
||||
|
@ -348,16 +348,6 @@ static int __init get_tcic_id(void)
|
||||
return id;
|
||||
}
|
||||
|
||||
static int tcic_drv_pcmcia_suspend(struct platform_device *dev,
|
||||
pm_message_t state)
|
||||
{
|
||||
return pcmcia_socket_dev_suspend(&dev->dev);
|
||||
}
|
||||
|
||||
static int tcic_drv_pcmcia_resume(struct platform_device *dev)
|
||||
{
|
||||
return pcmcia_socket_dev_resume(&dev->dev);
|
||||
}
|
||||
/*====================================================================*/
|
||||
|
||||
static struct platform_driver tcic_driver = {
|
||||
@ -365,8 +355,6 @@ static struct platform_driver tcic_driver = {
|
||||
.name = "tcic-pcmcia",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.suspend = tcic_drv_pcmcia_suspend,
|
||||
.resume = tcic_drv_pcmcia_resume,
|
||||
};
|
||||
|
||||
static struct platform_device tcic_device = {
|
||||
|
@ -705,24 +705,11 @@ static int __devinit vrc4171_card_setup(char *options)
|
||||
|
||||
__setup("vrc4171_card=", vrc4171_card_setup);
|
||||
|
||||
static int vrc4171_card_suspend(struct platform_device *dev,
|
||||
pm_message_t state)
|
||||
{
|
||||
return pcmcia_socket_dev_suspend(&dev->dev);
|
||||
}
|
||||
|
||||
static int vrc4171_card_resume(struct platform_device *dev)
|
||||
{
|
||||
return pcmcia_socket_dev_resume(&dev->dev);
|
||||
}
|
||||
|
||||
static struct platform_driver vrc4171_card_driver = {
|
||||
.driver = {
|
||||
.name = vrc4171_card_name,
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.suspend = vrc4171_card_suspend,
|
||||
.resume = vrc4171_card_resume,
|
||||
};
|
||||
|
||||
static int __devinit vrc4171_card_init(void)
|
||||
|
@ -1290,12 +1290,9 @@ static int yenta_dev_suspend_noirq(struct device *dev)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(dev);
|
||||
struct yenta_socket *socket = pci_get_drvdata(pdev);
|
||||
int ret;
|
||||
|
||||
ret = pcmcia_socket_dev_suspend(dev);
|
||||
|
||||
if (!socket)
|
||||
return ret;
|
||||
return 0;
|
||||
|
||||
if (socket->type && socket->type->save_state)
|
||||
socket->type->save_state(socket);
|
||||
@ -1312,7 +1309,7 @@ static int yenta_dev_suspend_noirq(struct device *dev)
|
||||
*/
|
||||
/* pci_set_power_state(dev, 3); */
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int yenta_dev_resume_noirq(struct device *dev)
|
||||
@ -1336,26 +1333,16 @@ static int yenta_dev_resume_noirq(struct device *dev)
|
||||
if (socket->type && socket->type->restore_state)
|
||||
socket->type->restore_state(socket);
|
||||
|
||||
pcmcia_socket_dev_early_resume(dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int yenta_dev_resume(struct device *dev)
|
||||
{
|
||||
pcmcia_socket_dev_late_resume(dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops yenta_pm_ops = {
|
||||
.suspend_noirq = yenta_dev_suspend_noirq,
|
||||
.resume_noirq = yenta_dev_resume_noirq,
|
||||
.resume = yenta_dev_resume,
|
||||
.freeze_noirq = yenta_dev_suspend_noirq,
|
||||
.thaw_noirq = yenta_dev_resume_noirq,
|
||||
.thaw = yenta_dev_resume,
|
||||
.poweroff_noirq = yenta_dev_suspend_noirq,
|
||||
.restore_noirq = yenta_dev_resume_noirq,
|
||||
.restore = yenta_dev_resume,
|
||||
};
|
||||
|
||||
#define YENTA_PM_OPS (¥ta_pm_ops)
|
||||
|
@ -277,12 +277,6 @@ extern struct pccard_resource_ops pccard_nonstatic_ops;
|
||||
#endif
|
||||
|
||||
|
||||
/* socket drivers are expected to use these callbacks in their .drv struct */
|
||||
extern int pcmcia_socket_dev_suspend(struct device *dev);
|
||||
extern void pcmcia_socket_dev_early_resume(struct device *dev);
|
||||
extern void pcmcia_socket_dev_late_resume(struct device *dev);
|
||||
extern int pcmcia_socket_dev_resume(struct device *dev);
|
||||
|
||||
/* socket drivers use this callback in their IRQ handler */
|
||||
extern void pcmcia_parse_events(struct pcmcia_socket *socket,
|
||||
unsigned int events);
|
||||
|
Loading…
Reference in New Issue
Block a user