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:
  pcmcia: avoid buffer overflow in pcmcia_setup_isa_irq
  pcmcia: do not request windows if you don't need to
  pcmcia: insert PCMCIA device resources into resource tree
  pcmcia: export resource information to sysfs
  pcmcia: use struct resource for PCMCIA devices, part 2
  pcmcia: remove memreq_t
  pcmcia: move local definitions out of include/pcmcia/cs.h
  pcmcia: do not use io_req_t when calling pcmcia_request_io()
  pcmcia: do not use io_req_t after call to pcmcia_request_io()
  pcmcia: use struct resource for PCMCIA devices
  pcmcia: clean up cs.h
  pcmcia: use pcmica_{read,write}_config_byte
  pcmcia: remove cs_types.h
  pcmcia: remove unused flag, simplify headers
  pcmcia: remove obsolete CS_EVENT_ definitions
  pcmcia: split up central event handler
  pcmcia: simplify event callback
  pcmcia: remove obsolete ioctl

Conflicts in:
 - drivers/staging/comedi/drivers/*
 - drivers/staging/wlags49_h2/wl_cs.c
due to dev_info_t and whitespace changes
This commit is contained in:
Linus Torvalds 2010-08-06 12:25:06 -07:00
commit 1685e633b3
97 changed files with 1197 additions and 3195 deletions

View file

@ -7,7 +7,6 @@ pcmcia_core-$(CONFIG_CARDBUS) += cardbus.o
obj-$(CONFIG_PCCARD) += pcmcia_core.o
pcmcia-y += ds.o pcmcia_resource.o cistpl.o pcmcia_cis.o
pcmcia-$(CONFIG_PCMCIA_IOCTL) += pcmcia_ioctl.o
obj-$(CONFIG_PCMCIA) += pcmcia.o
pcmcia_rsrc-y += rsrc_mgr.o

View file

@ -23,7 +23,6 @@
/* include the world */
#include <pcmcia/cs_types.h>
#include <pcmcia/cs.h>
#include <pcmcia/ss.h>
#include <pcmcia/cistpl.h>

View file

@ -31,11 +31,9 @@
#include <linux/proc_fs.h>
#include <linux/types.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/cs.h>
#include <pcmcia/ss.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/bus_ops.h>
#include <asm/io.h>
#include <asm/irq.h>

View file

@ -27,7 +27,6 @@
#include <asm/byteorder.h>
#include <asm/unaligned.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/ss.h>
#include <pcmcia/cs.h>
#include <pcmcia/cisreg.h>
@ -54,6 +53,9 @@ static const u_int exponent[] = {
/* Upper limit on reasonable # of tuples */
#define MAX_TUPLES 200
/* Bits in IRQInfo1 field */
#define IRQ_INFO2_VALID 0x10
/* 16-bit CIS? */
static int cis_width;
module_param(cis_width, int, 0444);
@ -210,7 +212,7 @@ int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
* Probably only useful for writing one-byte registers. Must be called
* with ops_mutex held.
*/
void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
int pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
u_int len, void *ptr)
{
void __iomem *sys, *end;
@ -232,7 +234,7 @@ void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
((cis_width) ? MAP_16BIT : 0));
if (!sys) {
dev_dbg(&s->dev, "could not map memory\n");
return; /* FIXME: Error */
return -EINVAL;
}
writeb(flags, sys+CISREG_ICTRL0);
@ -257,7 +259,7 @@ void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
sys = set_cis_map(s, card_offset, flags);
if (!sys) {
dev_dbg(&s->dev, "could not map memory\n");
return; /* FIXME: error */
return -EINVAL;
}
end = sys + s->map_size;
@ -271,6 +273,7 @@ void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
addr = 0;
}
}
return 0;
}

View file

@ -32,7 +32,6 @@
#include <asm/system.h>
#include <asm/irq.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/ss.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h>
@ -252,38 +251,6 @@ struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr)
}
EXPORT_SYMBOL(pcmcia_get_socket_by_nr);
/*
* The central event handler. Send_event() sends an event to the
* 16-bit subsystem, which then calls the relevant device drivers.
* Parse_events() interprets the event bits from
* a card status change report. Do_shutdown() handles the high
* priority stuff associated with a card removal.
*/
/* NOTE: send_event needs to be called with skt->sem held. */
static int send_event(struct pcmcia_socket *s, event_t event, int priority)
{
int ret;
if ((s->state & SOCKET_CARDBUS) && (event != CS_EVENT_CARD_REMOVAL))
return 0;
dev_dbg(&s->dev, "send_event(event %d, pri %d, callback 0x%p)\n",
event, priority, s->callback);
if (!s->callback)
return 0;
if (!try_module_get(s->callback->owner))
return 0;
ret = s->callback->event(s, event, priority);
module_put(s->callback->owner);
return ret;
}
static int socket_reset(struct pcmcia_socket *skt)
{
int status, i;
@ -326,7 +293,8 @@ static void socket_shutdown(struct pcmcia_socket *s)
dev_dbg(&s->dev, "shutdown\n");
send_event(s, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH);
if (s->callback)
s->callback->remove(s);
mutex_lock(&s->ops_mutex);
s->state &= SOCKET_INUSE | SOCKET_PRESENT;
@ -477,7 +445,8 @@ static int socket_insert(struct pcmcia_socket *skt)
dev_dbg(&skt->dev, "insert done\n");
mutex_unlock(&skt->ops_mutex);
send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW);
if (!(skt->state & SOCKET_CARDBUS) && (skt->callback))
skt->callback->add(skt);
} else {
mutex_unlock(&skt->ops_mutex);
socket_shutdown(skt);
@ -494,7 +463,6 @@ static int socket_suspend(struct pcmcia_socket *skt)
mutex_lock(&skt->ops_mutex);
skt->suspended_state = skt->state;
send_event(skt, CS_EVENT_PM_SUSPEND, CS_EVENT_PRI_LOW);
skt->socket = dead_socket;
skt->ops->set_socket(skt, &skt->socket);
if (skt->ops->suspend)
@ -555,8 +523,8 @@ static int socket_late_resume(struct pcmcia_socket *skt)
return 0;
}
#endif
send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW);
if (!(skt->state & SOCKET_CARDBUS) && (skt->callback))
skt->callback->early_resume(skt);
return 0;
}
@ -654,16 +622,8 @@ static int pccardd(void *__skt)
spin_unlock_irqrestore(&skt->thread_lock, flags);
mutex_lock(&skt->skt_mutex);
if (events) {
if (events & SS_DETECT)
socket_detect_change(skt);
if (events & SS_BATDEAD)
send_event(skt, CS_EVENT_BATTERY_DEAD, CS_EVENT_PRI_LOW);
if (events & SS_BATWARN)
send_event(skt, CS_EVENT_BATTERY_LOW, CS_EVENT_PRI_LOW);
if (events & SS_READY)
send_event(skt, CS_EVENT_READY_CHANGE, CS_EVENT_PRI_LOW);
}
if (events & SS_DETECT)
socket_detect_change(skt);
if (sysfs_events) {
if (sysfs_events & PCMCIA_UEVENT_EJECT)
@ -783,7 +743,7 @@ int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c)
s->callback = c;
if ((s->state & (SOCKET_PRESENT|SOCKET_CARDBUS)) == SOCKET_PRESENT)
send_event(s, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW);
s->callback->add(s);
} else
s->callback = NULL;
err:
@ -823,20 +783,13 @@ int pcmcia_reset_card(struct pcmcia_socket *skt)
break;
}
ret = send_event(skt, CS_EVENT_RESET_REQUEST, CS_EVENT_PRI_LOW);
if (ret == 0) {
send_event(skt, CS_EVENT_RESET_PHYSICAL, CS_EVENT_PRI_LOW);
if (skt->callback)
skt->callback->suspend(skt);
mutex_lock(&skt->ops_mutex);
ret = socket_reset(skt);
mutex_unlock(&skt->ops_mutex);
if (ret == 0) {
send_event(skt, CS_EVENT_CARD_RESET, CS_EVENT_PRI_LOW);
if (skt->callback)
skt->callback->resume(skt);
}
}
if (skt->callback)
skt->callback->suspend(skt);
mutex_lock(&skt->ops_mutex);
ret = socket_reset(skt);
mutex_unlock(&skt->ops_mutex);
if ((ret == 0) && (skt->callback))
skt->callback->resume(skt);
ret = 0;
} while (0);

View file

@ -10,7 +10,7 @@
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
*
* (C) 1999 David A. Hinds
* (C) 2003 - 2008 Dominik Brodowski
* (C) 2003 - 2010 Dominik Brodowski
*
*
* This file contains definitions _only_ needed by the PCMCIA core modules.
@ -26,6 +26,9 @@
/* Flags in client state */
#define CLIENT_WIN_REQ(i) (0x1<<(i))
/* Flag to access all functions */
#define BIND_FN_ALL 0xff
/* Each card function gets one of these guys */
typedef struct config_t {
struct kref ref;
@ -35,7 +38,10 @@ typedef struct config_t {
unsigned int ConfigBase;
unsigned char Status, Pin, Copy, Option, ExtStatus;
unsigned int CardValues;
io_req_t io;
struct resource io[MAX_IO_WIN]; /* io ports */
struct resource mem[MAX_WIN]; /* mem areas */
struct {
u_int Attributes;
} irq;
@ -56,18 +62,11 @@ struct pccard_resource_ops {
unsigned int attr,
unsigned int *base,
unsigned int num,
unsigned int align);
unsigned int align,
struct resource **parent);
struct resource* (*find_mem) (unsigned long base, unsigned long num,
unsigned long align, int low,
struct pcmcia_socket *s);
int (*add_io) (struct pcmcia_socket *s,
unsigned int action,
unsigned long r_start,
unsigned long r_end);
int (*add_mem) (struct pcmcia_socket *s,
unsigned int action,
unsigned long r_start,
unsigned long r_end);
int (*init) (struct pcmcia_socket *s);
void (*exit) (struct pcmcia_socket *s);
};
@ -114,11 +113,12 @@ void cb_free(struct pcmcia_socket *s);
struct pcmcia_callback{
struct module *owner;
int (*event) (struct pcmcia_socket *s,
event_t event, int priority);
int (*add) (struct pcmcia_socket *s);
int (*remove) (struct pcmcia_socket *s);
void (*requery) (struct pcmcia_socket *s);
int (*validate) (struct pcmcia_socket *s, unsigned int *i);
int (*suspend) (struct pcmcia_socket *s);
int (*early_resume) (struct pcmcia_socket *s);
int (*resume) (struct pcmcia_socket *s);
};
@ -146,6 +146,8 @@ void pcmcia_put_socket(struct pcmcia_socket *skt);
/* ds.c */
extern struct bus_type pcmcia_bus_type;
struct pcmcia_device;
/* pcmcia_resource.c */
extern int pcmcia_release_configuration(struct pcmcia_device *p_dev);
extern int pcmcia_validate_mem(struct pcmcia_socket *s);
@ -163,8 +165,8 @@ extern struct bin_attribute pccard_cis_attr;
int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr,
u_int addr, u_int len, void *ptr);
void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr,
u_int addr, u_int len, void *ptr);
int pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr,
u_int addr, u_int len, void *ptr);
void release_cis_mem(struct pcmcia_socket *s);
void destroy_cis_cache(struct pcmcia_socket *s);
int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function,
@ -188,34 +190,4 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function,
int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple);
#ifdef CONFIG_PCMCIA_IOCTL
/* ds.c */
extern struct pcmcia_device *pcmcia_get_dev(struct pcmcia_device *p_dev);
extern void pcmcia_put_dev(struct pcmcia_device *p_dev);
struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s,
unsigned int function);
/* pcmcia_ioctl.c */
extern void __init pcmcia_setup_ioctl(void);
extern void __exit pcmcia_cleanup_ioctl(void);
extern void handle_event(struct pcmcia_socket *s, event_t event);
extern int handle_request(struct pcmcia_socket *s, event_t event);
#else /* CONFIG_PCMCIA_IOCTL */
static inline void __init pcmcia_setup_ioctl(void) { return; }
static inline void __exit pcmcia_cleanup_ioctl(void) { return; }
static inline void handle_event(struct pcmcia_socket *s, event_t event)
{
return;
}
static inline int handle_request(struct pcmcia_socket *s, event_t event)
{
return 0;
}
#endif /* CONFIG_PCMCIA_IOCTL */
#endif /* _LINUX_CS_INTERNAL_H */

View file

@ -29,7 +29,6 @@
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/ss.h>
#include <asm/mach-au1x00/au1000.h>

View file

@ -10,7 +10,7 @@
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
*
* (C) 1999 David A. Hinds
* (C) 2003 - 2006 Dominik Brodowski
* (C) 2003 - 2010 Dominik Brodowski
*/
#include <linux/kernel.h>
@ -26,7 +26,6 @@
#include <linux/dma-mapping.h>
#include <linux/slab.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/ds.h>
@ -213,7 +212,7 @@ EXPORT_SYMBOL(pcmcia_unregister_driver);
/* pcmcia_device handling */
struct pcmcia_device *pcmcia_get_dev(struct pcmcia_device *p_dev)
static struct pcmcia_device *pcmcia_get_dev(struct pcmcia_device *p_dev)
{
struct device *tmp_dev;
tmp_dev = get_device(&p_dev->dev);
@ -222,7 +221,7 @@ struct pcmcia_device *pcmcia_get_dev(struct pcmcia_device *p_dev)
return to_pcmcia_dev(tmp_dev);
}
void pcmcia_put_dev(struct pcmcia_device *p_dev)
static void pcmcia_put_dev(struct pcmcia_device *p_dev)
{
if (p_dev)
put_device(&p_dev->dev);
@ -294,7 +293,7 @@ static int pcmcia_device_probe(struct device *dev)
}
mutex_lock(&s->ops_mutex);
if ((s->pcmcia_state.has_pfc) &&
if ((s->pcmcia_pfc) &&
(p_dev->socket->device_count == 1) && (p_dev->device_no == 0))
pcmcia_parse_uevents(s, PCMCIA_UEVENT_REQUERY);
mutex_unlock(&s->ops_mutex);
@ -359,7 +358,7 @@ static int pcmcia_device_remove(struct device *dev)
* pseudo multi-function card, we need to unbind
* all devices
*/
if ((p_dev->socket->pcmcia_state.has_pfc) &&
if ((p_dev->socket->pcmcia_pfc) &&
(p_dev->socket->device_count > 0) &&
(p_dev->device_no == 0))
pcmcia_card_remove(p_dev->socket, p_dev);
@ -477,7 +476,8 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev)
}
struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int function)
static struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s,
unsigned int function)
{
struct pcmcia_device *p_dev, *tmp_dev;
int i;
@ -531,7 +531,6 @@ struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int fu
list_for_each_entry(tmp_dev, &s->devices_list, socket_device_list)
if (p_dev->func == tmp_dev->func) {
p_dev->function_config = tmp_dev->function_config;
p_dev->io = tmp_dev->io;
p_dev->irq = tmp_dev->irq;
kref_get(&p_dev->function_config->ref);
}
@ -544,15 +543,29 @@ struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int fu
"IRQ setup failed -- device might not work\n");
if (!p_dev->function_config) {
config_t *c;
dev_dbg(&p_dev->dev, "creating config_t\n");
p_dev->function_config = kzalloc(sizeof(struct config_t),
GFP_KERNEL);
if (!p_dev->function_config) {
c = kzalloc(sizeof(struct config_t), GFP_KERNEL);
if (!c) {
mutex_unlock(&s->ops_mutex);
goto err_unreg;
}
kref_init(&p_dev->function_config->ref);
p_dev->function_config = c;
kref_init(&c->ref);
for (i = 0; i < MAX_IO_WIN; i++) {
c->io[i].name = p_dev->devname;
c->io[i].flags = IORESOURCE_IO;
}
for (i = 0; i< MAX_WIN; i++) {
c->mem[i].name = p_dev->devname;
c->mem[i].flags = IORESOURCE_MEM;
}
}
for (i = 0; i < MAX_IO_WIN; i++)
p_dev->resource[i] = &p_dev->function_config->io[i];
for (; i < (MAX_IO_WIN + MAX_WIN); i++)
p_dev->resource[i] = &p_dev->function_config->mem[i-MAX_IO_WIN];
mutex_unlock(&s->ops_mutex);
dev_printk(KERN_NOTICE, &p_dev->dev,
@ -680,7 +693,7 @@ static void pcmcia_requery(struct pcmcia_socket *s)
* call pcmcia_device_add() -- which will fail if both
* devices are already registered. */
mutex_lock(&s->ops_mutex);
has_pfc = s->pcmcia_state.has_pfc;
has_pfc = s->pcmcia_pfc;
mutex_unlock(&s->ops_mutex);
if (has_pfc)
pcmcia_device_add(s, 0);
@ -812,7 +825,7 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev,
if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) {
dev_dbg(&dev->dev, "this is a pseudo-multi-function device\n");
mutex_lock(&dev->socket->ops_mutex);
dev->socket->pcmcia_state.has_pfc = 1;
dev->socket->pcmcia_pfc = 1;
mutex_unlock(&dev->socket->ops_mutex);
if (dev->device_no != did->device_no)
return 0;
@ -826,7 +839,7 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev,
/* if this is a pseudo-multi-function device,
* we need explicit matches */
if (dev->socket->pcmcia_state.has_pfc)
if (dev->socket->pcmcia_pfc)
return 0;
if (dev->device_no)
return 0;
@ -885,14 +898,6 @@ static int pcmcia_bus_match(struct device *dev, struct device_driver *drv)
}
mutex_unlock(&p_drv->dynids.lock);
#ifdef CONFIG_PCMCIA_IOCTL
/* matching by cardmgr */
if (p_dev->cardmgr == p_drv) {
dev_dbg(dev, "cardmgr matched to %s\n", drv->name);
return 1;
}
#endif
while (did && did->match_flags) {
dev_dbg(dev, "trying to match to %s\n", drv->name);
if (pcmcia_devmatch(p_dev, did)) {
@ -1006,6 +1011,18 @@ pcmcia_device_stringattr(prod_id2, prod_id[1]);
pcmcia_device_stringattr(prod_id3, prod_id[2]);
pcmcia_device_stringattr(prod_id4, prod_id[3]);
static ssize_t pcmcia_show_resources(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
char *str = buf;
int i;
for (i = 0; i < PCMCIA_NUM_RESOURCES; i++)
str += sprintf(str, "%pr\n", p_dev->resource[i]);
return str - buf;
}
static ssize_t pcmcia_show_pm_state(struct device *dev, struct device_attribute *attr, char *buf)
{
@ -1076,6 +1093,7 @@ static ssize_t pcmcia_store_allow_func_id_match(struct device *dev,
static struct device_attribute pcmcia_dev_attrs[] = {
__ATTR(function, 0444, func_show, NULL),
__ATTR(pm_state, 0644, pcmcia_show_pm_state, pcmcia_store_pm_state),
__ATTR(resources, 0444, pcmcia_show_resources, NULL),
__ATTR_RO(func_id),
__ATTR_RO(manf_id),
__ATTR_RO(card_id),
@ -1215,86 +1233,57 @@ static int pcmcia_bus_suspend(struct pcmcia_socket *skt)
return 0;
}
/*======================================================================
The card status event handler.
======================================================================*/
/* Normally, the event is passed to individual drivers after
* informing userspace. Only for CS_EVENT_CARD_REMOVAL this
* is inversed to maintain historic compatibility.
*/
static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
static int pcmcia_bus_remove(struct pcmcia_socket *skt)
{
struct pcmcia_socket *s = pcmcia_get_socket(skt);
atomic_set(&skt->present, 0);
pcmcia_card_remove(skt, NULL);
if (!s) {
dev_printk(KERN_ERR, &skt->dev,
"PCMCIA obtaining reference to socket " \
"failed, event 0x%x lost!\n", event);
return -ENODEV;
mutex_lock(&skt->ops_mutex);
destroy_cis_cache(skt);
pcmcia_cleanup_irq(skt);
mutex_unlock(&skt->ops_mutex);
return 0;
}
static int pcmcia_bus_add(struct pcmcia_socket *skt)
{
atomic_set(&skt->present, 1);
mutex_lock(&skt->ops_mutex);
skt->pcmcia_pfc = 0;
destroy_cis_cache(skt); /* to be on the safe side... */
mutex_unlock(&skt->ops_mutex);
pcmcia_card_add(skt);
return 0;
}
static int pcmcia_bus_early_resume(struct pcmcia_socket *skt)
{
if (!verify_cis_cache(skt)) {
pcmcia_put_socket(skt);
return 0;
}
dev_dbg(&skt->dev, "ds_event(0x%06x, %d, 0x%p)\n",
event, priority, skt);
dev_dbg(&skt->dev, "cis mismatch - different card\n");
switch (event) {
case CS_EVENT_CARD_REMOVAL:
atomic_set(&skt->present, 0);
pcmcia_card_remove(skt, NULL);
handle_event(skt, event);
mutex_lock(&s->ops_mutex);
destroy_cis_cache(s);
pcmcia_cleanup_irq(s);
mutex_unlock(&s->ops_mutex);
break;
/* first, remove the card */
pcmcia_bus_remove(skt);
case CS_EVENT_CARD_INSERTION:
atomic_set(&skt->present, 1);
mutex_lock(&s->ops_mutex);
s->pcmcia_state.has_pfc = 0;
destroy_cis_cache(s); /* to be on the safe side... */
mutex_unlock(&s->ops_mutex);
pcmcia_card_add(skt);
handle_event(skt, event);
break;
mutex_lock(&skt->ops_mutex);
destroy_cis_cache(skt);
kfree(skt->fake_cis);
skt->fake_cis = NULL;
skt->functions = 0;
mutex_unlock(&skt->ops_mutex);
case CS_EVENT_EJECTION_REQUEST:
break;
/* now, add the new card */
pcmcia_bus_add(skt);
return 0;
}
case CS_EVENT_PM_RESUME:
if (verify_cis_cache(skt) != 0) {
dev_dbg(&skt->dev, "cis mismatch - different card\n");
/* first, remove the card */
ds_event(skt, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH);
mutex_lock(&s->ops_mutex);
destroy_cis_cache(skt);
kfree(skt->fake_cis);
skt->fake_cis = NULL;
s->functions = 0;
mutex_unlock(&s->ops_mutex);
/* now, add the new card */
ds_event(skt, CS_EVENT_CARD_INSERTION,
CS_EVENT_PRI_LOW);
}
handle_event(skt, event);
break;
case CS_EVENT_PM_SUSPEND:
case CS_EVENT_RESET_PHYSICAL:
case CS_EVENT_CARD_RESET:
default:
handle_event(skt, event);
break;
}
pcmcia_put_socket(s);
return 0;
} /* ds_event */
/*
* NOTE: This is racy. There's no guarantee the card will still be
@ -1323,10 +1312,12 @@ EXPORT_SYMBOL(pcmcia_dev_present);
static struct pcmcia_callback pcmcia_bus_callback = {
.owner = THIS_MODULE,
.event = ds_event,
.add = pcmcia_bus_add,
.remove = pcmcia_bus_remove,
.requery = pcmcia_requery,
.validate = pccard_validate_cis,
.suspend = pcmcia_bus_suspend,
.early_resume = pcmcia_bus_early_resume,
.resume = pcmcia_bus_resume,
};
@ -1350,11 +1341,8 @@ static int __devinit pcmcia_bus_add_socket(struct device *dev,
return ret;
}
#ifdef CONFIG_PCMCIA_IOCTL
init_waitqueue_head(&socket->queue);
#endif
INIT_LIST_HEAD(&socket->devices_list);
memset(&socket->pcmcia_state, 0, sizeof(u8));
socket->pcmcia_pfc = 0;
socket->device_count = 0;
atomic_set(&socket->present, 0);
@ -1429,8 +1417,6 @@ static int __init init_pcmcia_bus(void)
return ret;
}
pcmcia_setup_ioctl();
return 0;
}
fs_initcall(init_pcmcia_bus); /* one level after subsys_initcall so that
@ -1439,8 +1425,6 @@ fs_initcall(init_pcmcia_bus); /* one level after subsys_initcall so that
static void __exit exit_pcmcia_bus(void)
{
pcmcia_cleanup_ioctl();
class_interface_unregister(&pcmcia_bus_interface);
bus_unregister(&pcmcia_bus_type);

View file

@ -15,7 +15,6 @@
#include <linux/interrupt.h>
#include <linux/device.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/ss.h>
#include <pcmcia/cs.h>

View file

@ -50,7 +50,6 @@
#include <asm/io.h>
#include <asm/system.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/ss.h>
#include <pcmcia/cs.h>

View file

@ -26,7 +26,6 @@
#include <asm/io.h>
#include <asm/system.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/ss.h>
#include <pcmcia/cs.h>

View file

@ -27,7 +27,6 @@
#include <asm/system.h>
#include <asm/addrspace.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/ss.h>
#include <pcmcia/cs.h>

View file

@ -59,7 +59,6 @@
#include <asm/irq.h>
#include <asm/fs_pd.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/cs.h>
#include <pcmcia/ss.h>

View file

@ -19,7 +19,6 @@
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/cisreg.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/ss.h>

File diff suppressed because it is too large Load diff

View file

@ -25,7 +25,6 @@
#include <asm/irq.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/ss.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h>
@ -57,47 +56,23 @@ struct resource *pcmcia_find_mem_region(u_long base, u_long num, u_long align,
}
/** alloc_io_space
*
* Special stuff for managing IO windows, because they are scarce
*/
static int alloc_io_space(struct pcmcia_socket *s, u_int attr,
unsigned int *base, unsigned int num, u_int lines)
{
unsigned int align;
align = (*base) ? (lines ? 1<<lines : 0) : 1;
if (align && (align < num)) {
if (*base) {
dev_dbg(&s->dev, "odd IO request: num %#x align %#x\n",
num, align);
align = 0;
} else
while (align && (align < num))
align <<= 1;
}
if (*base & ~(align-1)) {
dev_dbg(&s->dev, "odd IO request: base %#x align %#x\n",
*base, align);
align = 0;
}
return s->resource_ops->find_io(s, attr, base, num, align);
} /* alloc_io_space */
static void release_io_space(struct pcmcia_socket *s, unsigned int base,
unsigned int num)
static void release_io_space(struct pcmcia_socket *s, struct resource *res)
{
resource_size_t num = resource_size(res);
int i;
dev_dbg(&s->dev, "release_io_space for %pR\n", res);
for (i = 0; i < MAX_IO_WIN; i++) {
if (!s->io[i].res)
continue;
if ((s->io[i].res->start <= base) &&
(s->io[i].res->end >= base+num-1)) {
if ((s->io[i].res->start <= res->start) &&
(s->io[i].res->end >= res->end)) {
s->io[i].InUse -= num;
if (res->parent)
release_resource(res);
res->start = res->end = 0;
res->flags = IORESOURCE_IO;
/* Free the window if no one else is using it */
if (s->io[i].InUse == 0) {
release_resource(s->io[i].res);
@ -108,26 +83,80 @@ static void release_io_space(struct pcmcia_socket *s, unsigned int base,
}
} /* release_io_space */
/** pccard_access_configuration_register
/** alloc_io_space
*
* Access_configuration_register() reads and writes configuration
* registers in attribute memory. Memory window 0 is reserved for
* this and the tuple reading services.
* Special stuff for managing IO windows, because they are scarce
*/
static int alloc_io_space(struct pcmcia_socket *s, struct resource *res,
unsigned int lines)
{
unsigned int align;
unsigned int base = res->start;
unsigned int num = res->end;
int ret;
int pcmcia_access_configuration_register(struct pcmcia_device *p_dev,
conf_reg_t *reg)
res->flags |= IORESOURCE_IO;
dev_dbg(&s->dev, "alloc_io_space request for %pR, %d lines\n",
res, lines);
align = base ? (lines ? 1<<lines : 0) : 1;
if (align && (align < num)) {
if (base) {
dev_dbg(&s->dev, "odd IO request\n");
align = 0;
} else
while (align && (align < num))
align <<= 1;
}
if (base & ~(align-1)) {
dev_dbg(&s->dev, "odd IO request\n");
align = 0;
}
ret = s->resource_ops->find_io(s, res->flags, &base, num, align,
&res->parent);
if (ret) {
dev_dbg(&s->dev, "alloc_io_space request failed (%d)\n", ret);
return -EINVAL;
}
res->start = base;
res->end = res->start + num - 1;
if (res->parent) {
ret = request_resource(res->parent, res);
if (ret) {
dev_warn(&s->dev,
"request_resource %pR failed: %d\n", res, ret);
res->parent = NULL;
release_io_space(s, res);
}
}
dev_dbg(&s->dev, "alloc_io_space request result %d: %pR\n", ret, res);
return ret;
} /* alloc_io_space */
/**
* pcmcia_access_config() - read or write card configuration registers
*
* pcmcia_access_config() reads and writes configuration registers in
* attribute memory. Memory window 0 is reserved for this and the tuple
* reading services. Drivers must use pcmcia_read_config_byte() or
* pcmcia_write_config_byte().
*/
static int pcmcia_access_config(struct pcmcia_device *p_dev,
off_t where, u8 *val,
int (*accessf) (struct pcmcia_socket *s,
int attr, unsigned int addr,
unsigned int len, void *ptr))
{
struct pcmcia_socket *s;
config_t *c;
int addr;
u_char val;
int ret = 0;
if (!p_dev || !p_dev->function_config)
return -EINVAL;
s = p_dev->socket;
mutex_lock(&s->ops_mutex);
@ -139,44 +168,57 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev,
return -EACCES;
}
addr = (c->ConfigBase + reg->Offset) >> 1;
addr = (c->ConfigBase + where) >> 1;
ret = accessf(s, 1, addr, 1, val);
switch (reg->Action) {
case CS_READ:
ret = pcmcia_read_cis_mem(s, 1, addr, 1, &val);
reg->Value = val;
break;
case CS_WRITE:
val = reg->Value;
pcmcia_write_cis_mem(s, 1, addr, 1, &val);
break;
default:
dev_dbg(&s->dev, "Invalid conf register request\n");
ret = -EINVAL;
break;
}
mutex_unlock(&s->ops_mutex);
return ret;
} /* pcmcia_access_configuration_register */
EXPORT_SYMBOL(pcmcia_access_configuration_register);
} /* pcmcia_access_config */
/**
* pcmcia_read_config_byte() - read a byte from a card configuration register
*
* pcmcia_read_config_byte() reads a byte from a configuration register in
* attribute memory.
*/
int pcmcia_read_config_byte(struct pcmcia_device *p_dev, off_t where, u8 *val)
{
return pcmcia_access_config(p_dev, where, val, pcmcia_read_cis_mem);
}
EXPORT_SYMBOL(pcmcia_read_config_byte);
/**
* pcmcia_write_config_byte() - write a byte to a card configuration register
*
* pcmcia_write_config_byte() writes a byte to a configuration register in
* attribute memory.
*/
int pcmcia_write_config_byte(struct pcmcia_device *p_dev, off_t where, u8 val)
{
return pcmcia_access_config(p_dev, where, &val, pcmcia_write_cis_mem);
}
EXPORT_SYMBOL(pcmcia_write_config_byte);
int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh,
memreq_t *req)
unsigned int offset)
{
struct pcmcia_socket *s = p_dev->socket;
struct resource *res = wh;
unsigned int w;
int ret;
wh--;
if (wh >= MAX_WIN)
w = ((res->flags & IORESOURCE_BITS & WIN_FLAGS_REQ) >> 2) - 1;
if (w >= MAX_WIN)
return -EINVAL;
if (req->Page != 0) {
dev_dbg(&s->dev, "failure: requested page is zero\n");
return -EINVAL;
}
mutex_lock(&s->ops_mutex);
s->win[wh].card_start = req->CardOffset;
ret = s->ops->set_mem_map(s, &s->win[wh]);
s->win[w].card_start = offset;
ret = s->ops->set_mem_map(s, &s->win[w]);
if (ret)
dev_warn(&s->dev, "failed to set_mem_map\n");
mutex_unlock(&s->ops_mutex);
@ -316,32 +358,26 @@ int pcmcia_release_configuration(struct pcmcia_device *p_dev)
* don't bother checking the port ranges against the current socket
* values.
*/
static int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req)
static int pcmcia_release_io(struct pcmcia_device *p_dev)
{
struct pcmcia_socket *s = p_dev->socket;
int ret = -EINVAL;
config_t *c;
mutex_lock(&s->ops_mutex);
c = p_dev->function_config;
if (!p_dev->_io)
goto out;
c = p_dev->function_config;
release_io_space(s, &c->io[0]);
if (c->io[1].end)
release_io_space(s, &c->io[1]);
p_dev->_io = 0;
if ((c->io.BasePort1 != req->BasePort1) ||
(c->io.NumPorts1 != req->NumPorts1) ||
(c->io.BasePort2 != req->BasePort2) ||
(c->io.NumPorts2 != req->NumPorts2))
goto out;
c->state &= ~CONFIG_IO_REQ;
release_io_space(s, req->BasePort1, req->NumPorts1);
if (req->NumPorts2)
release_io_space(s, req->BasePort2, req->NumPorts2);
out:
mutex_unlock(&s->ops_mutex);
@ -349,19 +385,22 @@ out:
} /* pcmcia_release_io */
int pcmcia_release_window(struct pcmcia_device *p_dev, window_handle_t wh)
int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res)
{
struct pcmcia_socket *s = p_dev->socket;
pccard_mem_map *win;
unsigned int w;
wh--;
if (wh >= MAX_WIN)
dev_dbg(&p_dev->dev, "releasing window %pR\n", res);
w = ((res->flags & IORESOURCE_BITS & WIN_FLAGS_REQ) >> 2) - 1;
if (w >= MAX_WIN)
return -EINVAL;
mutex_lock(&s->ops_mutex);
win = &s->win[wh];
win = &s->win[w];
if (!(p_dev->_win & CLIENT_WIN_REQ(wh))) {
if (!(p_dev->_win & CLIENT_WIN_REQ(w))) {
dev_dbg(&s->dev, "not releasing unknown window\n");
mutex_unlock(&s->ops_mutex);
return -EINVAL;
@ -370,15 +409,16 @@ int pcmcia_release_window(struct pcmcia_device *p_dev, window_handle_t wh)
/* Shut down memory window */
win->flags &= ~MAP_ACTIVE;
s->ops->set_mem_map(s, win);
s->state &= ~SOCKET_WIN_REQ(wh);
s->state &= ~SOCKET_WIN_REQ(w);
/* Release system memory */
if (win->res) {
release_resource(res);
release_resource(win->res);
kfree(win->res);
win->res = NULL;
}
p_dev->_win &= ~CLIENT_WIN_REQ(wh);
p_dev->_win &= ~CLIENT_WIN_REQ(w);
mutex_unlock(&s->ops_mutex);
return 0;
@ -473,13 +513,13 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1, &c->ExtStatus);
}
if (req->Present & PRESENT_IOBASE_0) {
u_char b = c->io.BasePort1 & 0xff;
u8 b = c->io[0].start & 0xff;
pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_0)>>1, 1, &b);
b = (c->io.BasePort1 >> 8) & 0xff;
b = (c->io[0].start >> 8) & 0xff;
pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_1)>>1, 1, &b);
}
if (req->Present & PRESENT_IOSIZE) {
u_char b = c->io.NumPorts1 + c->io.NumPorts2 - 1;
u8 b = resource_size(&c->io[0]) + resource_size(&c->io[1]) - 1;
pcmcia_write_cis_mem(s, 1, (base + CISREG_IOSIZE)>>1, 1, &b);
}
@ -513,28 +553,29 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
EXPORT_SYMBOL(pcmcia_request_configuration);
/** pcmcia_request_io
/**
* pcmcia_request_io() - attempt to reserve port ranges for PCMCIA devices
*
* Request_io() reserves ranges of port addresses for a socket.
* I have not implemented range sharing or alias addressing.
* pcmcia_request_io() attepts to reserve the IO port ranges specified in
* &struct pcmcia_device @p_dev->resource[0] and @p_dev->resource[1]. The
* "start" value is the requested start of the IO port resource; "end"
* reflects the number of ports requested. The number of IO lines requested
* is specified in &struct pcmcia_device @p_dev->io_lines.
*/
int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req)
int pcmcia_request_io(struct pcmcia_device *p_dev)
{
struct pcmcia_socket *s = p_dev->socket;
config_t *c;
config_t *c = p_dev->function_config;
int ret = -EINVAL;
mutex_lock(&s->ops_mutex);
dev_dbg(&s->dev, "pcmcia_request_io: %pR , %pR", &c->io[0], &c->io[1]);
if (!(s->state & SOCKET_PRESENT)) {
dev_dbg(&s->dev, "No card present\n");
dev_dbg(&s->dev, "pcmcia_request_io: No card present\n");
goto out;
}
if (!req)
goto out;
c = p_dev->function_config;
if (c->state & CONFIG_LOCKED) {
dev_dbg(&s->dev, "Configuration is locked\n");
goto out;
@ -543,40 +584,25 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req)
dev_dbg(&s->dev, "IO already configured\n");
goto out;
}
if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)) {
dev_dbg(&s->dev, "bad attribute setting for IO region 1\n");
goto out;
}
if ((req->NumPorts2 > 0) &&
(req->Attributes2 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS))) {
dev_dbg(&s->dev, "bad attribute setting for IO region 2\n");
goto out;
}
dev_dbg(&s->dev, "trying to allocate resource 1\n");
ret = alloc_io_space(s, req->Attributes1, &req->BasePort1,
req->NumPorts1, req->IOAddrLines);
if (ret) {
dev_dbg(&s->dev, "allocation of resource 1 failed\n");
ret = alloc_io_space(s, &c->io[0], p_dev->io_lines);
if (ret)
goto out;
}
if (req->NumPorts2) {
dev_dbg(&s->dev, "trying to allocate resource 2\n");
ret = alloc_io_space(s, req->Attributes2, &req->BasePort2,
req->NumPorts2, req->IOAddrLines);
if (c->io[1].end) {
ret = alloc_io_space(s, &c->io[1], p_dev->io_lines);
if (ret) {
dev_dbg(&s->dev, "allocation of resource 2 failed\n");
release_io_space(s, req->BasePort1, req->NumPorts1);
release_io_space(s, &c->io[0]);
goto out;
}
}
} else
c->io[1].start = 0;
c->io = *req;
c->state |= CONFIG_IO_REQ;
p_dev->_io = 1;
dev_dbg(&s->dev, "allocating resources succeeded: %d\n", ret);
dev_dbg(&s->dev, "pcmcia_request_io succeeded: %pR , %pR",
&c->io[0], &c->io[1]);
out:
mutex_unlock(&s->ops_mutex);
@ -651,7 +677,7 @@ EXPORT_SYMBOL(__pcmcia_request_exclusive_irq);
#ifdef CONFIG_PCMCIA_PROBE
/* mask of IRQs already reserved by other cards, we should avoid using them */
static u8 pcmcia_used_irq[NR_IRQS];
static u8 pcmcia_used_irq[32];
static irqreturn_t test_action(int cpl, void *dev_id)
{
@ -674,6 +700,9 @@ static int pcmcia_setup_isa_irq(struct pcmcia_device *p_dev, int type)
for (try = 0; try < 64; try++) {
irq = try % 32;
if (irq > NR_IRQS)
continue;
/* marked as available by driver, not blocked by userspace? */
if (!((mask >> irq) & 1))
continue;
@ -767,23 +796,18 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha
struct pcmcia_socket *s = p_dev->socket;
pccard_mem_map *win;
u_long align;
struct resource *res;
int w;
if (!(s->state & SOCKET_PRESENT)) {
dev_dbg(&s->dev, "No card present\n");
return -ENODEV;
}
if (req->Attributes & (WIN_PAGED | WIN_SHARED)) {
dev_dbg(&s->dev, "bad attribute setting for iomem region\n");
return -EINVAL;
}
/* Window size defaults to smallest available */
if (req->Size == 0)
req->Size = s->map_size;
align = (((s->features & SS_CAP_MEM_ALIGN) ||
(req->Attributes & WIN_STRICT_ALIGN)) ?
req->Size : s->map_size);
align = (s->features & SS_CAP_MEM_ALIGN) ? req->Size : s->map_size;
if (req->Size & (s->map_size-1)) {
dev_dbg(&s->dev, "invalid map size\n");
return -EINVAL;
@ -797,20 +821,21 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha
align = 0;
/* Allocate system memory window */
mutex_lock(&s->ops_mutex);
for (w = 0; w < MAX_WIN; w++)
if (!(s->state & SOCKET_WIN_REQ(w)))
break;
if (w == MAX_WIN) {
dev_dbg(&s->dev, "all windows are used already\n");
mutex_unlock(&s->ops_mutex);
return -EINVAL;
}
mutex_lock(&s->ops_mutex);
win = &s->win[w];
if (!(s->features & SS_CAP_STATIC_MAP)) {
win->res = pcmcia_find_mem_region(req->Base, req->Size, align,
(req->Attributes & WIN_MAP_BELOW_1MB), s);
0, s);
if (!win->res) {
dev_dbg(&s->dev, "allocating mem region failed\n");
mutex_unlock(&s->ops_mutex);
@ -821,16 +846,8 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha
/* Configure the socket controller */
win->map = w+1;
win->flags = 0;
win->flags = req->Attributes;
win->speed = req->AccessSpeed;
if (req->Attributes & WIN_MEMORY_TYPE)
win->flags |= MAP_ATTRIB;
if (req->Attributes & WIN_ENABLE)
win->flags |= MAP_ACTIVE;
if (req->Attributes & WIN_DATA_WIDTH_16)
win->flags |= MAP_16BIT;
if (req->Attributes & WIN_USE_WAIT)
win->flags |= MAP_USE_WAIT;
win->card_start = 0;
if (s->ops->set_mem_map(s, win) != 0) {
@ -846,8 +863,21 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha
else
req->Base = win->res->start;
/* convert to new-style resources */
res = p_dev->resource[w + MAX_IO_WIN];
res->start = req->Base;
res->end = req->Base + req->Size - 1;
res->flags &= ~IORESOURCE_BITS;
res->flags |= (req->Attributes & WIN_FLAGS_MAP) | (win->map << 2);
res->flags |= IORESOURCE_MEM;
res->parent = win->res;
if (win->res)
request_resource(&iomem_resource, res);
dev_dbg(&s->dev, "request_window results in %pR\n", res);
mutex_unlock(&s->ops_mutex);
*wh = w + 1;
*wh = res;
return 0;
} /* pcmcia_request_window */
@ -855,13 +885,18 @@ EXPORT_SYMBOL(pcmcia_request_window);
void pcmcia_disable_device(struct pcmcia_device *p_dev)
{
int i;
for (i = 0; i < MAX_WIN; i++) {
struct resource *res = p_dev->resource[MAX_IO_WIN + i];
if (res->flags & WIN_FLAGS_REQ)
pcmcia_release_window(p_dev, res);
}
pcmcia_release_configuration(p_dev);
pcmcia_release_io(p_dev, &p_dev->io);
pcmcia_release_io(p_dev);
if (p_dev->_irq) {
free_irq(p_dev->irq, p_dev->priv);
p_dev->_irq = 0;
}
if (p_dev->win)
pcmcia_release_window(p_dev, p_dev->win);
}
EXPORT_SYMBOL(pcmcia_disable_device);

View file

@ -17,7 +17,6 @@
#include <linux/device.h>
#include <linux/io.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/ss.h>
#include <pcmcia/cs.h>

View file

@ -32,7 +32,6 @@
#include <mach/pxa2xx-regs.h>
#include <asm/mach-types.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/ss.h>
#include <pcmcia/cistpl.h>

View file

@ -16,7 +16,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/ss.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h>
@ -88,7 +87,7 @@ static struct resource *__iodyn_find_io_region(struct pcmcia_socket *s,
static int iodyn_find_io(struct pcmcia_socket *s, unsigned int attr,
unsigned int *base, unsigned int num,
unsigned int align)
unsigned int align, struct resource **parent)
{
int i, ret = 0;
@ -129,6 +128,7 @@ static int iodyn_find_io(struct pcmcia_socket *s, unsigned int attr,
((res->flags & ~IORESOURCE_BITS) |
(attr & IORESOURCE_BITS));
s->io[i].InUse = num;
*parent = res;
return 0;
}
@ -140,6 +140,7 @@ static int iodyn_find_io(struct pcmcia_socket *s, unsigned int attr,
continue;
*base = try;
s->io[i].InUse += num;
*parent = res;
return 0;
}
@ -152,6 +153,7 @@ static int iodyn_find_io(struct pcmcia_socket *s, unsigned int attr,
continue;
*base = try;
s->io[i].InUse += num;
*parent = res;
return 0;
}
}
@ -164,8 +166,6 @@ struct pccard_resource_ops pccard_iodyn_ops = {
.validate_mem = NULL,
.find_io = iodyn_find_io,
.find_mem = NULL,
.add_io = NULL,
.add_mem = NULL,
.init = static_init,
.exit = NULL,
};

View file

@ -16,7 +16,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/ss.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h>
@ -48,11 +47,12 @@ struct resource *pcmcia_make_resource(unsigned long start, unsigned long end,
static int static_find_io(struct pcmcia_socket *s, unsigned int attr,
unsigned int *base, unsigned int num,
unsigned int align)
unsigned int align, struct resource **parent)
{
if (!s->io_offset)
return -EINVAL;
*base = s->io_offset | (*base & 0x0fff);
*parent = NULL;
return 0;
}
@ -62,8 +62,6 @@ struct pccard_resource_ops pccard_static_ops = {
.validate_mem = NULL,
.find_io = static_find_io,
.find_mem = NULL,
.add_io = NULL,
.add_mem = NULL,
.init = static_init,
.exit = NULL,
};

View file

@ -28,7 +28,6 @@
#include <asm/irq.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/ss.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h>
@ -64,6 +63,9 @@ struct socket_data {
#define MEM_PROBE_LOW (1 << 0)
#define MEM_PROBE_HIGH (1 << 1)
/* Action field */
#define REMOVE_MANAGED_RESOURCE 1
#define ADD_MANAGED_RESOURCE 2
/*======================================================================
@ -716,7 +718,7 @@ static struct resource *__nonstatic_find_io_region(struct pcmcia_socket *s,
static int nonstatic_find_io(struct pcmcia_socket *s, unsigned int attr,
unsigned int *base, unsigned int num,
unsigned int align)
unsigned int align, struct resource **parent)
{
int i, ret = 0;
@ -758,6 +760,7 @@ static int nonstatic_find_io(struct pcmcia_socket *s, unsigned int attr,
((res->flags & ~IORESOURCE_BITS) |
(attr & IORESOURCE_BITS));
s->io[i].InUse = num;
*parent = res;
return 0;
}
@ -773,6 +776,7 @@ static int nonstatic_find_io(struct pcmcia_socket *s, unsigned int attr,
continue;
*base = try;
s->io[i].InUse += num;
*parent = res;
return 0;
}
}
@ -791,6 +795,7 @@ static int nonstatic_find_io(struct pcmcia_socket *s, unsigned int attr,
continue;
*base = try;
s->io[i].InUse += num;
*parent = res;
return 0;
}
}
@ -1055,8 +1060,6 @@ struct pccard_resource_ops pccard_nonstatic_ops = {
.validate_mem = pcmcia_nonstatic_validate_mem,
.find_io = nonstatic_find_io,
.find_mem = nonstatic_find_mem_region,
.add_io = adjust_io,
.add_mem = adjust_memory,
.init = nonstatic_init,
.exit = nonstatic_release_resource_db,
};
@ -1115,8 +1118,6 @@ static ssize_t store_io_db(struct device *dev,
mutex_lock(&s->ops_mutex);
ret = adjust_io(s, add, start_addr, end_addr);
if (!ret)
s->resource_setup_new = 1;
mutex_unlock(&s->ops_mutex);
return ret ? ret : count;
@ -1183,8 +1184,6 @@ static ssize_t store_mem_db(struct device *dev,
mutex_lock(&s->ops_mutex);
ret = adjust_memory(s, add, start_addr, end_addr);
if (!ret)
s->resource_setup_new = 1;
mutex_unlock(&s->ops_mutex);
return ret ? ret : count;

View file

@ -35,7 +35,6 @@
#include <linux/slab.h>
#include <linux/platform_device.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/cs.h>
#include <pcmcia/ss.h>

View file

@ -11,7 +11,6 @@
/* include the world */
#include <linux/cpufreq.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/cs.h>
#include <pcmcia/ss.h>
#include <pcmcia/cistpl.h>

View file

@ -26,7 +26,6 @@
#include <asm/system.h>
#include <asm/irq.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/ss.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h>

View file

@ -49,7 +49,6 @@
#include <asm/io.h>
#include <asm/system.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/cs.h>
#include <pcmcia/ss.h>
#include "tcic.h"

View file

@ -17,7 +17,6 @@
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/cs.h>
#include <pcmcia/ss.h>
#include <pcmcia/cistpl.h>

View file

@ -19,7 +19,6 @@
#include <linux/io.h>
#include <linux/slab.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/ss.h>
#include <pcmcia/cs.h>