aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/firewire/core-device.c40
1 files changed, 14 insertions, 26 deletions
diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c
index 014cabd3afda..c91d7179eb96 100644
--- a/drivers/firewire/core-device.c
+++ b/drivers/firewire/core-device.c
@@ -180,44 +180,32 @@ static int fw_unit_match(struct device *dev, struct device_driver *drv)
180 return 0; 180 return 0;
181} 181}
182 182
183static int get_modalias(struct fw_unit *unit, char *buffer, size_t buffer_size) 183static void get_modalias_ids(const u32 *directory, int *id)
184{ 184{
185 struct fw_device *device = fw_parent_device(unit);
186 struct fw_csr_iterator ci; 185 struct fw_csr_iterator ci;
187
188 int key, value; 186 int key, value;
189 int vendor = 0;
190 int model = 0;
191 int specifier_id = 0;
192 int version = 0;
193 187
194 fw_csr_iterator_init(&ci, &device->config_rom[5]); 188 fw_csr_iterator_init(&ci, directory);
195 while (fw_csr_iterator_next(&ci, &key, &value)) { 189 while (fw_csr_iterator_next(&ci, &key, &value)) {
196 switch (key) { 190 switch (key) {
197 case CSR_VENDOR: 191 case CSR_VENDOR: id[0] = value; break;
198 vendor = value; 192 case CSR_MODEL: id[1] = value; break;
199 break; 193 case CSR_SPECIFIER_ID: id[2] = value; break;
200 case CSR_MODEL: 194 case CSR_VERSION: id[3] = value; break;
201 model = value;
202 break;
203 } 195 }
204 } 196 }
197}
205 198
206 fw_csr_iterator_init(&ci, unit->directory); 199static int get_modalias(struct fw_unit *unit, char *buffer, size_t buffer_size)
207 while (fw_csr_iterator_next(&ci, &key, &value)) { 200{
208 switch (key) { 201 int id[] = {0, 0, 0, 0};
209 case CSR_SPECIFIER_ID: 202
210 specifier_id = value; 203 get_modalias_ids(&fw_parent_device(unit)->config_rom[5], id);
211 break; 204 get_modalias_ids(unit->directory, id);
212 case CSR_VERSION:
213 version = value;
214 break;
215 }
216 }
217 205
218 return snprintf(buffer, buffer_size, 206 return snprintf(buffer, buffer_size,
219 "ieee1394:ven%08Xmo%08Xsp%08Xver%08X", 207 "ieee1394:ven%08Xmo%08Xsp%08Xver%08X",
220 vendor, model, specifier_id, version); 208 id[0], id[1], id[2], id[3]);
221} 209}
222 210
223static int fw_unit_uevent(struct device *dev, struct kobj_uevent_env *env) 211static int fw_unit_uevent(struct device *dev, struct kobj_uevent_env *env)