Device Extensions

王朝other·作者佚名  2006-01-10
窄屏简体版  字體: |||超大  

Device Extensions

Introduction

~~~~~~~~~~~~

Device extensions are internal extensions to a device, bus, or class

driver. Extensions may or may not have an external interface

associated with them and typically apply to every of a particular driver.

An example of an extension is the procfs or driverfs interface for PCI

devices. Each PCI device gets a procfs file and two driverfs files.

These extensions may or may not be present based on configuration

options; or they may be included in a module. Instead of hard coding

calls to add the devices to these interfaces, the extensions can be

registered with the driver and each device added implicitly.

Programming Interface

~~~~~~~~~~~~~~~~~~~~~

struct device_extension {

char* name;

rwlock_tlock;

struct list_headnode;

dev_add_tadd_device;

dev_remove_tremove_device;

};

extern int dev_ext_register(struct device_extension *);

extern void dev_ext_unregister(struct device_extension *);

extern int bus_ext_register(struct bus_type *, struct device_extension *);

extern void bus_ext_unregister(struct bus_type *, struct device_extension *);

extern int class_ext_register(struct device_class *, struct device_extension *);

extern void class_ext_unregister(struct device_class *, struct device_extension *);

Extensions are specific to a particular driver, but the structure is

common for each type of extension. So, a pointer to the entity that

the extension belongs to must be passed to the registration function.

Devices

~~~~~~~

As devices are added to the various drivers, it is added to each

extension of that driver. Extensions don't have to be applied to each

device, but it is up to the extension to determine that.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航