cregit-Linux how code gets into the kernel

Release 4.7 drivers/base/isa.c

Directory: drivers/base
/*
 * ISA bus.
 */

#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/dma-mapping.h>
#include <linux/isa.h>


static struct device isa_bus = {
	.init_name	= "isa"
};


struct isa_dev {
	
struct device dev;
	
struct device *next;
	
unsigned int id;
};


#define to_isa_dev(x) container_of((x), struct isa_dev, dev)


static int isa_bus_match(struct device *dev, struct device_driver *driver) { struct isa_driver *isa_driver = to_isa_driver(driver); if (dev->platform_data == isa_driver) { if (!isa_driver->match || isa_driver->match(dev, to_isa_dev(dev)->id)) return 1; dev->platform_data = NULL; } return 0; }

Contributors

PersonTokensPropCommitsCommitProp
rene hermanrene herman69100.00%1100.00%
Total69100.00%1100.00%


static int isa_bus_probe(struct device *dev) { struct isa_driver *isa_driver = dev->platform_data; if (isa_driver->probe) return isa_driver->probe(dev, to_isa_dev(dev)->id); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
rene hermanrene herman44100.00%1100.00%
Total44100.00%1100.00%


static int isa_bus_remove(struct device *dev) { struct isa_driver *isa_driver = dev->platform_data; if (isa_driver->remove) return isa_driver->remove(dev, to_isa_dev(dev)->id); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
rene hermanrene herman44100.00%1100.00%
Total44100.00%1100.00%


static void isa_bus_shutdown(struct device *dev) { struct isa_driver *isa_driver = dev->platform_data; if (isa_driver->shutdown) isa_driver->shutdown(dev, to_isa_dev(dev)->id); }

Contributors

PersonTokensPropCommitsCommitProp
rene hermanrene herman40100.00%1100.00%
Total40100.00%1100.00%


static int isa_bus_suspend(struct device *dev, pm_message_t state) { struct isa_driver *isa_driver = dev->platform_data; if (isa_driver->suspend) return isa_driver->suspend(dev, to_isa_dev(dev)->id, state); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
rene hermanrene herman49100.00%1100.00%
Total49100.00%1100.00%


static int isa_bus_resume(struct device *dev) { struct isa_driver *isa_driver = dev->platform_data; if (isa_driver->resume) return isa_driver->resume(dev, to_isa_dev(dev)->id); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
rene hermanrene herman44100.00%1100.00%
Total44100.00%1100.00%

static struct bus_type isa_bus_type = { .name = "isa", .match = isa_bus_match, .probe = isa_bus_probe, .remove = isa_bus_remove, .shutdown = isa_bus_shutdown, .suspend = isa_bus_suspend, .resume = isa_bus_resume };
static void isa_dev_release(struct device *dev) { kfree(to_isa_dev(dev)); }

Contributors

PersonTokensPropCommitsCommitProp
rene hermanrene herman19100.00%1100.00%
Total19100.00%1100.00%


void isa_unregister_driver(struct isa_driver *isa_driver) { struct device *dev = isa_driver->devices; while (dev) { struct device *tmp = to_isa_dev(dev)->next; device_unregister(dev); dev = tmp; } driver_unregister(&isa_driver->driver); }

Contributors

PersonTokensPropCommitsCommitProp
rene hermanrene herman54100.00%1100.00%
Total54100.00%1100.00%

EXPORT_SYMBOL_GPL(isa_unregister_driver);
int isa_register_driver(struct isa_driver *isa_driver, unsigned int ndev) { int error; unsigned int id; isa_driver->driver.bus = &isa_bus_type; isa_driver->devices = NULL; error = driver_register(&isa_driver->driver); if (error) return error; for (id = 0; id < ndev; id++) { struct isa_dev *isa_dev; isa_dev = kzalloc(sizeof *isa_dev, GFP_KERNEL); if (!isa_dev) { error = -ENOMEM; break; } isa_dev->dev.parent = &isa_bus; isa_dev->dev.bus = &isa_bus_type; dev_set_name(&isa_dev->dev, "%s.%u", isa_driver->driver.name, id); isa_dev->dev.platform_data = isa_driver; isa_dev->dev.release = isa_dev_release; isa_dev->id = id; isa_dev->dev.coherent_dma_mask = DMA_BIT_MASK(24); isa_dev->dev.dma_mask = &isa_dev->dev.coherent_dma_mask; error = device_register(&isa_dev->dev); if (error) { put_device(&isa_dev->dev); break; } if (isa_dev->dev.platform_data) { isa_dev->next = isa_driver->devices; isa_driver->devices = &isa_dev->dev; } else device_unregister(&isa_dev->dev); } if (!error && !isa_driver->devices) error = -ENODEV; if (error) isa_unregister_driver(isa_driver); return error; }

Contributors

PersonTokensPropCommitsCommitProp
rene hermanrene herman26197.75%250.00%
yang hongyangyang hongyang41.50%125.00%
kay sieverskay sievers20.75%125.00%
Total267100.00%4100.00%

EXPORT_SYMBOL_GPL(isa_register_driver);
static int __init isa_bus_init(void) { int error; error = bus_register(&isa_bus_type); if (!error) { error = device_register(&isa_bus); if (error) bus_unregister(&isa_bus_type); } return error; }

Contributors

PersonTokensPropCommitsCommitProp
rene hermanrene herman48100.00%1100.00%
Total48100.00%1100.00%

postcore_initcall(isa_bus_init);

Overall Contributors

PersonTokensPropCommitsCommitProp
rene hermanrene herman78698.99%240.00%
yang hongyangyang hongyang40.50%120.00%
kay sieverskay sievers30.38%120.00%
william breathitt graywilliam breathitt gray10.13%120.00%
Total794100.00%5100.00%
Directory: drivers/base
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
{% endraw %}