mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
pcmcia: use pcmica_{read,write}_config_byte
Use pcmcia_read_config_byte and pcmcia_write_config_byte instead of pcmcia_access_configuration_register. CC: [email protected] CC: [email protected] CC: [email protected] CC: Michael Buesch <[email protected]> Signed-off-by: Dominik Brodowski <[email protected]>
This commit is contained in:
parent
ac8b422838
commit
1d5cc192d4
12 changed files with 104 additions and 178 deletions
|
|
@ -209,7 +209,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;
|
||||
|
|
@ -231,7 +231,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);
|
||||
|
|
@ -256,7 +256,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;
|
||||
|
|
@ -270,6 +270,7 @@ void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
|
|||
addr = 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -158,8 +158,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,
|
||||
|
|
|
|||
|
|
@ -108,25 +108,25 @@ static void release_io_space(struct pcmcia_socket *s, unsigned int base,
|
|||
} /* release_io_space */
|
||||
|
||||
|
||||
/** pccard_access_configuration_register
|
||||
/**
|
||||
* pcmcia_access_config() - read or write card configuration registers
|
||||
*
|
||||
* Access_configuration_register() reads and writes configuration
|
||||
* registers in attribute memory. Memory window 0 is reserved for
|
||||
* this and the tuple reading services.
|
||||
* 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().
|
||||
*/
|
||||
|
||||
int pcmcia_access_configuration_register(struct pcmcia_device *p_dev,
|
||||
conf_reg_t *reg)
|
||||
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);
|
||||
|
|
@ -138,26 +138,40 @@ 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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue