Lines Matching refs:edev

44 			 struct eisa_device *edev)  in is_forced_dev()  argument
49 x = (root->bus_nr << 8) | edev->slot; in is_forced_dev()
57 static void __init eisa_name_device(struct eisa_device *edev) in eisa_name_device() argument
62 if (!strcmp(edev->id.sig, eisa_table[i].id.sig)) { in eisa_name_device()
63 strlcpy(edev->pretty_name, in eisa_name_device()
65 sizeof(edev->pretty_name)); in eisa_name_device()
71 sprintf(edev->pretty_name, "EISA device %.7s", edev->id.sig); in eisa_name_device()
110 struct eisa_device *edev = to_eisa_device(dev); in eisa_bus_match() local
118 if (!strcmp(eids->sig, edev->id.sig) && in eisa_bus_match()
119 edev->state & EISA_CONFIG_ENABLED) { in eisa_bus_match()
120 edev->id.driver_data = eids->driver_data; in eisa_bus_match()
132 struct eisa_device *edev = to_eisa_device(dev); in eisa_bus_uevent() local
134 add_uevent_var(env, "MODALIAS=" EISA_DEVICE_MODALIAS_FMT, edev->id.sig); in eisa_bus_uevent()
161 struct eisa_device *edev = to_eisa_device(dev); in eisa_show_sig() local
162 return sprintf(buf, "%s\n", edev->id.sig); in eisa_show_sig()
171 struct eisa_device *edev = to_eisa_device(dev); in eisa_show_state() local
172 return sprintf(buf, "%d\n", edev->state & EISA_CONFIG_ENABLED); in eisa_show_state()
181 struct eisa_device *edev = to_eisa_device(dev); in eisa_show_modalias() local
182 return sprintf(buf, EISA_DEVICE_MODALIAS_FMT "\n", edev->id.sig); in eisa_show_modalias()
188 struct eisa_device *edev, in eisa_init_device() argument
201 memcpy(edev->id.sig, sig, EISA_SIG_LEN); in eisa_init_device()
202 edev->slot = slot; in eisa_init_device()
203 edev->state = inb(SLOT_ADDRESS(root, slot) + EISA_CONFIG_OFFSET) in eisa_init_device()
205 edev->base_addr = SLOT_ADDRESS(root, slot); in eisa_init_device()
206 edev->dma_mask = root->dma_mask; /* Default DMA mask */ in eisa_init_device()
207 eisa_name_device(edev); in eisa_init_device()
208 edev->dev.parent = root->dev; in eisa_init_device()
209 edev->dev.bus = &eisa_bus_type; in eisa_init_device()
210 edev->dev.dma_mask = &edev->dma_mask; in eisa_init_device()
211 edev->dev.coherent_dma_mask = edev->dma_mask; in eisa_init_device()
212 dev_set_name(&edev->dev, "%02X:%02X", root->bus_nr, slot); in eisa_init_device()
216 edev->res[i].name = edev->pretty_name; in eisa_init_device()
218 edev->res[i].name = edev->id.sig; in eisa_init_device()
222 if (is_forced_dev(enable_dev, enable_dev_count, root, edev)) in eisa_init_device()
223 edev->state = EISA_CONFIG_ENABLED | EISA_CONFIG_FORCED; in eisa_init_device()
225 if (is_forced_dev(disable_dev, disable_dev_count, root, edev)) in eisa_init_device()
226 edev->state = EISA_CONFIG_FORCED; in eisa_init_device()
231 static int __init eisa_register_device(struct eisa_device *edev) in eisa_register_device() argument
233 int rc = device_register(&edev->dev); in eisa_register_device()
235 put_device(&edev->dev); in eisa_register_device()
239 rc = device_create_file(&edev->dev, &dev_attr_signature); in eisa_register_device()
242 rc = device_create_file(&edev->dev, &dev_attr_enabled); in eisa_register_device()
245 rc = device_create_file(&edev->dev, &dev_attr_modalias); in eisa_register_device()
252 device_remove_file(&edev->dev, &dev_attr_enabled); in eisa_register_device()
254 device_remove_file(&edev->dev, &dev_attr_signature); in eisa_register_device()
256 device_unregister(&edev->dev); in eisa_register_device()
261 struct eisa_device *edev, in eisa_request_resources() argument
274 edev->res[i].start = edev->res[i].end = 0; in eisa_request_resources()
279 edev->res[i].name = NULL; in eisa_request_resources()
280 edev->res[i].start = SLOT_ADDRESS(root, slot) in eisa_request_resources()
282 edev->res[i].end = edev->res[i].start + 0xff; in eisa_request_resources()
283 edev->res[i].flags = IORESOURCE_IO; in eisa_request_resources()
285 edev->res[i].name = NULL; in eisa_request_resources()
286 edev->res[i].start = SLOT_ADDRESS(root, slot) in eisa_request_resources()
288 edev->res[i].end = edev->res[i].start + 3; in eisa_request_resources()
289 edev->res[i].flags = IORESOURCE_IO | IORESOURCE_BUSY; in eisa_request_resources()
292 if (request_resource(root->res, &edev->res[i])) in eisa_request_resources()
300 release_resource(&edev->res[i]); in eisa_request_resources()
305 static void __init eisa_release_resources(struct eisa_device *edev) in eisa_release_resources() argument
310 if (edev->res[i].start || edev->res[i].end) in eisa_release_resources()
311 release_resource(&edev->res[i]); in eisa_release_resources()
317 struct eisa_device *edev; in eisa_probe() local
325 edev = kzalloc(sizeof(*edev), GFP_KERNEL); in eisa_probe()
326 if (!edev) in eisa_probe()
329 if (eisa_request_resources(root, edev, 0)) { in eisa_probe()
332 kfree(edev); in eisa_probe()
338 if (eisa_init_device(root, edev, 0)) { in eisa_probe()
339 eisa_release_resources(edev); in eisa_probe()
340 kfree(edev); in eisa_probe()
346 dev_info(&edev->dev, "EISA: Mainboard %s detected\n", edev->id.sig); in eisa_probe()
348 if (eisa_register_device(edev)) { in eisa_probe()
349 dev_err(&edev->dev, "EISA: Failed to register %s\n", in eisa_probe()
350 edev->id.sig); in eisa_probe()
351 eisa_release_resources(edev); in eisa_probe()
352 kfree(edev); in eisa_probe()
358 edev = kzalloc(sizeof(*edev), GFP_KERNEL); in eisa_probe()
359 if (!edev) { in eisa_probe()
365 if (eisa_request_resources(root, edev, i)) { in eisa_probe()
369 kfree(edev); in eisa_probe()
373 if (eisa_init_device(root, edev, i)) { in eisa_probe()
374 eisa_release_resources(edev); in eisa_probe()
375 kfree(edev); in eisa_probe()
379 if (edev->state == (EISA_CONFIG_ENABLED | EISA_CONFIG_FORCED)) in eisa_probe()
381 else if (edev->state == EISA_CONFIG_FORCED) in eisa_probe()
383 else if (edev->state == 0) in eisa_probe()
388 dev_info(&edev->dev, "EISA: slot %d: %s detected%s\n", i, in eisa_probe()
389 edev->id.sig, enabled_str); in eisa_probe()
393 if (eisa_register_device(edev)) { in eisa_probe()
394 dev_err(&edev->dev, "EISA: Failed to register %s\n", in eisa_probe()
395 edev->id.sig); in eisa_probe()
396 eisa_release_resources(edev); in eisa_probe()
397 kfree(edev); in eisa_probe()