diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2010-07-24 06:23:21 -0400 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2010-08-03 03:02:35 -0400 |
commit | 1d5cc192d431bce2ebe9fde64054ce903200e179 (patch) | |
tree | cdcdfb77712349bf46f0876d420e2be81f901d74 /drivers/pcmcia/pcmcia_resource.c | |
parent | ac8b422838046ffc26be4874a3cbae0d313f4209 (diff) |
pcmcia: use pcmica_{read,write}_config_byte
Use pcmcia_read_config_byte and pcmcia_write_config_byte instead
of pcmcia_access_configuration_register.
CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-serial@vger.kernel.org
CC: Michael Buesch <mb@bu3sch.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/pcmcia_resource.c')
-rw-r--r-- | drivers/pcmcia/pcmcia_resource.c | 70 |
1 files changed, 42 insertions, 28 deletions
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 2394de468602..563750e77eaf 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c | |||
@@ -108,25 +108,25 @@ static void release_io_space(struct pcmcia_socket *s, unsigned int base, | |||
108 | } /* release_io_space */ | 108 | } /* release_io_space */ |
109 | 109 | ||
110 | 110 | ||
111 | /** pccard_access_configuration_register | 111 | /** |
112 | * pcmcia_access_config() - read or write card configuration registers | ||
112 | * | 113 | * |
113 | * Access_configuration_register() reads and writes configuration | 114 | * pcmcia_access_config() reads and writes configuration registers in |
114 | * registers in attribute memory. Memory window 0 is reserved for | 115 | * attribute memory. Memory window 0 is reserved for this and the tuple |
115 | * this and the tuple reading services. | 116 | * reading services. Drivers must use pcmcia_read_config_byte() or |
117 | * pcmcia_write_config_byte(). | ||
116 | */ | 118 | */ |
117 | 119 | static int pcmcia_access_config(struct pcmcia_device *p_dev, | |
118 | int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, | 120 | off_t where, u8 *val, |
119 | conf_reg_t *reg) | 121 | int (*accessf) (struct pcmcia_socket *s, |
122 | int attr, unsigned int addr, | ||
123 | unsigned int len, void *ptr)) | ||
120 | { | 124 | { |
121 | struct pcmcia_socket *s; | 125 | struct pcmcia_socket *s; |
122 | config_t *c; | 126 | config_t *c; |
123 | int addr; | 127 | int addr; |
124 | u_char val; | ||
125 | int ret = 0; | 128 | int ret = 0; |
126 | 129 | ||
127 | if (!p_dev || !p_dev->function_config) | ||
128 | return -EINVAL; | ||
129 | |||
130 | s = p_dev->socket; | 130 | s = p_dev->socket; |
131 | 131 | ||
132 | mutex_lock(&s->ops_mutex); | 132 | mutex_lock(&s->ops_mutex); |
@@ -138,26 +138,40 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, | |||
138 | return -EACCES; | 138 | return -EACCES; |
139 | } | 139 | } |
140 | 140 | ||
141 | addr = (c->ConfigBase + reg->Offset) >> 1; | 141 | addr = (c->ConfigBase + where) >> 1; |
142 | |||
143 | ret = accessf(s, 1, addr, 1, val); | ||
142 | 144 | ||
143 | switch (reg->Action) { | ||
144 | case CS_READ: | ||
145 | ret = pcmcia_read_cis_mem(s, 1, addr, 1, &val); | ||
146 | reg->Value = val; | ||
147 | break; | ||
148 | case CS_WRITE: | ||
149 | val = reg->Value; | ||
150 | pcmcia_write_cis_mem(s, 1, addr, 1, &val); | ||
151 | break; | ||
152 | default: | ||
153 | dev_dbg(&s->dev, "Invalid conf register request\n"); | ||
154 | ret = -EINVAL; | ||
155 | break; | ||
156 | } | ||
157 | mutex_unlock(&s->ops_mutex); | 145 | mutex_unlock(&s->ops_mutex); |
146 | |||
158 | return ret; | 147 | return ret; |
159 | } /* pcmcia_access_configuration_register */ | 148 | } /* pcmcia_access_config */ |
160 | EXPORT_SYMBOL(pcmcia_access_configuration_register); | 149 | |
150 | |||
151 | /** | ||
152 | * pcmcia_read_config_byte() - read a byte from a card configuration register | ||
153 | * | ||
154 | * pcmcia_read_config_byte() reads a byte from a configuration register in | ||
155 | * attribute memory. | ||
156 | */ | ||
157 | int pcmcia_read_config_byte(struct pcmcia_device *p_dev, off_t where, u8 *val) | ||
158 | { | ||
159 | return pcmcia_access_config(p_dev, where, val, pcmcia_read_cis_mem); | ||
160 | } | ||
161 | EXPORT_SYMBOL(pcmcia_read_config_byte); | ||
162 | |||
163 | |||
164 | /** | ||
165 | * pcmcia_write_config_byte() - write a byte to a card configuration register | ||
166 | * | ||
167 | * pcmcia_write_config_byte() writes a byte to a configuration register in | ||
168 | * attribute memory. | ||
169 | */ | ||
170 | int pcmcia_write_config_byte(struct pcmcia_device *p_dev, off_t where, u8 val) | ||
171 | { | ||
172 | return pcmcia_access_config(p_dev, where, &val, pcmcia_write_cis_mem); | ||
173 | } | ||
174 | EXPORT_SYMBOL(pcmcia_write_config_byte); | ||
161 | 175 | ||
162 | 176 | ||
163 | int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh, | 177 | int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh, |