mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-06 14:48:06 +00:00
[PATCH] pcmcia: access config_t using pointer instead of array
Access the PCMCIA config_t struct (one per device function) using a pointer in struct pcmcia_device, instead of looking them up in an array. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
parent
1ae9c7d819
commit
dbb22f0d65
4 changed files with 12 additions and 16 deletions
|
@ -94,12 +94,6 @@ static inline void cs_socket_put(struct pcmcia_socket *skt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CHECK_SOCKET(s) \
|
|
||||||
(((s) >= sockets) || (socket_table[s]->ops == NULL))
|
|
||||||
|
|
||||||
#define SOCKET(h) (h->socket)
|
|
||||||
#define CONFIG(h) (&SOCKET(h)->config[(h)->func])
|
|
||||||
|
|
||||||
/* In cardbus.c */
|
/* In cardbus.c */
|
||||||
int cb_alloc(struct pcmcia_socket *s);
|
int cb_alloc(struct pcmcia_socket *s);
|
||||||
void cb_free(struct pcmcia_socket *s);
|
void cb_free(struct pcmcia_socket *s);
|
||||||
|
|
|
@ -399,6 +399,7 @@ static int pcmcia_device_probe(struct device * dev)
|
||||||
goto put_module;
|
goto put_module;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
p_dev->function_config = &s->config[p_dev->func];
|
||||||
|
|
||||||
ret = p_drv->probe(p_dev);
|
ret = p_drv->probe(p_dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|
|
@ -372,9 +372,7 @@ int pccard_get_status(struct pcmcia_socket *s, unsigned int function,
|
||||||
|
|
||||||
int pcmcia_get_status(client_handle_t handle, cs_status_t *status)
|
int pcmcia_get_status(client_handle_t handle, cs_status_t *status)
|
||||||
{
|
{
|
||||||
struct pcmcia_socket *s;
|
return pccard_get_status(handle->socket, handle->func, status);
|
||||||
s = SOCKET(handle);
|
|
||||||
return pccard_get_status(s, handle->func, status);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(pcmcia_get_status);
|
EXPORT_SYMBOL(pcmcia_get_status);
|
||||||
|
|
||||||
|
@ -422,7 +420,8 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev,
|
||||||
config_t *c;
|
config_t *c;
|
||||||
|
|
||||||
s = p_dev->socket;
|
s = p_dev->socket;
|
||||||
c = CONFIG(p_dev);
|
c = p_dev->function_config;
|
||||||
|
|
||||||
if (!(s->state & SOCKET_PRESENT))
|
if (!(s->state & SOCKET_PRESENT))
|
||||||
return CS_NO_CARD;
|
return CS_NO_CARD;
|
||||||
if (!(c->state & CONFIG_LOCKED))
|
if (!(c->state & CONFIG_LOCKED))
|
||||||
|
@ -470,7 +469,7 @@ int pcmcia_release_configuration(struct pcmcia_device *p_dev)
|
||||||
p_dev->state &= ~CLIENT_CONFIG_LOCKED;
|
p_dev->state &= ~CLIENT_CONFIG_LOCKED;
|
||||||
|
|
||||||
if (!(p_dev->state & CLIENT_STALE)) {
|
if (!(p_dev->state & CLIENT_STALE)) {
|
||||||
config_t *c = CONFIG(p_dev);
|
config_t *c = p_dev->function_config;
|
||||||
if (--(s->lock_count) == 0) {
|
if (--(s->lock_count) == 0) {
|
||||||
s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */
|
s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */
|
||||||
s->socket.Vpp = 0;
|
s->socket.Vpp = 0;
|
||||||
|
@ -512,7 +511,7 @@ int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req)
|
||||||
p_dev->state &= ~CLIENT_IO_REQ;
|
p_dev->state &= ~CLIENT_IO_REQ;
|
||||||
|
|
||||||
if (!(p_dev->state & CLIENT_STALE)) {
|
if (!(p_dev->state & CLIENT_STALE)) {
|
||||||
config_t *c = CONFIG(p_dev);
|
config_t *c = p_dev->function_config;
|
||||||
if (c->state & CONFIG_LOCKED)
|
if (c->state & CONFIG_LOCKED)
|
||||||
return CS_CONFIGURATION_LOCKED;
|
return CS_CONFIGURATION_LOCKED;
|
||||||
if ((c->io.BasePort1 != req->BasePort1) ||
|
if ((c->io.BasePort1 != req->BasePort1) ||
|
||||||
|
@ -540,7 +539,7 @@ int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req)
|
||||||
p_dev->state &= ~CLIENT_IRQ_REQ;
|
p_dev->state &= ~CLIENT_IRQ_REQ;
|
||||||
|
|
||||||
if (!(p_dev->state & CLIENT_STALE)) {
|
if (!(p_dev->state & CLIENT_STALE)) {
|
||||||
config_t *c = CONFIG(p_dev);
|
config_t *c= p_dev->function_config;
|
||||||
if (c->state & CONFIG_LOCKED)
|
if (c->state & CONFIG_LOCKED)
|
||||||
return CS_CONFIGURATION_LOCKED;
|
return CS_CONFIGURATION_LOCKED;
|
||||||
if (c->irq.Attributes != req->Attributes)
|
if (c->irq.Attributes != req->Attributes)
|
||||||
|
@ -610,7 +609,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
|
||||||
|
|
||||||
if (req->IntType & INT_CARDBUS)
|
if (req->IntType & INT_CARDBUS)
|
||||||
return CS_UNSUPPORTED_MODE;
|
return CS_UNSUPPORTED_MODE;
|
||||||
c = CONFIG(p_dev);
|
c = p_dev->function_config;
|
||||||
if (c->state & CONFIG_LOCKED)
|
if (c->state & CONFIG_LOCKED)
|
||||||
return CS_CONFIGURATION_LOCKED;
|
return CS_CONFIGURATION_LOCKED;
|
||||||
|
|
||||||
|
@ -730,7 +729,7 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req)
|
||||||
|
|
||||||
if (!req)
|
if (!req)
|
||||||
return CS_UNSUPPORTED_MODE;
|
return CS_UNSUPPORTED_MODE;
|
||||||
c = CONFIG(p_dev);
|
c = p_dev->function_config;
|
||||||
if (c->state & CONFIG_LOCKED)
|
if (c->state & CONFIG_LOCKED)
|
||||||
return CS_CONFIGURATION_LOCKED;
|
return CS_CONFIGURATION_LOCKED;
|
||||||
if (c->state & CONFIG_IO_REQ)
|
if (c->state & CONFIG_IO_REQ)
|
||||||
|
@ -786,7 +785,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
|
||||||
|
|
||||||
if (!(s->state & SOCKET_PRESENT))
|
if (!(s->state & SOCKET_PRESENT))
|
||||||
return CS_NO_CARD;
|
return CS_NO_CARD;
|
||||||
c = CONFIG(p_dev);
|
c = p_dev->function_config;
|
||||||
if (c->state & CONFIG_LOCKED)
|
if (c->state & CONFIG_LOCKED)
|
||||||
return CS_CONFIGURATION_LOCKED;
|
return CS_CONFIGURATION_LOCKED;
|
||||||
if (c->state & CONFIG_IRQ_REQ)
|
if (c->state & CONFIG_IRQ_REQ)
|
||||||
|
|
|
@ -131,6 +131,7 @@ typedef struct dev_link_t {
|
||||||
|
|
||||||
|
|
||||||
struct pcmcia_socket;
|
struct pcmcia_socket;
|
||||||
|
struct config_t;
|
||||||
|
|
||||||
struct pcmcia_driver {
|
struct pcmcia_driver {
|
||||||
int (*probe) (struct pcmcia_device *dev);
|
int (*probe) (struct pcmcia_device *dev);
|
||||||
|
@ -160,6 +161,7 @@ struct pcmcia_device {
|
||||||
/* the hardware "function" device; certain subdevices can
|
/* the hardware "function" device; certain subdevices can
|
||||||
* share one hardware "function" device. */
|
* share one hardware "function" device. */
|
||||||
u8 func;
|
u8 func;
|
||||||
|
struct config_t* function_config;
|
||||||
|
|
||||||
struct list_head socket_device_list;
|
struct list_head socket_device_list;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue