¡¾ÇóÖú¡¿driver_registerºó£¬ÔõÑù´ÓÓû§³ÌÐòÖÐʹÓÃÇý¶¯³ÌÐò£¿
¸÷λ´óÏÀ£¬×î½üÎÒÔÚÑо¿Ò»¸öÇý¶¯³ÌÐò£¬¾ÍÊÇIBM µÄRDAC ËüÈçÏ£ºstatic int __init mppLnx_vhba_init(void)
{
int error;
error = device_register(&mppLnx_primary_device);
if(error)
{
goto cleanup_primary;
}
error = bus_register(&mppLnx_mppv_bus);
if(error)
{
goto cleanup_bus;
}
error = driver_register(&mppLnx_mppvbus_driver);
if(error)
{
goto cleanup_driver;
}
error = device_register(&mppLnx_mppvadapter0);
if(error)
{
goto cleanup_adapter;
}
}
×¢²áÁ˼¸¸öÉ豸ºÍÇý¶¯³ÌÐò£¬ËûÃǵĽṹΪ£º
#define MPPLNX_MPP_PRIMARY_DEVICE_NAME "mppvirtual"
static struct device mppLnx_primary_device = {
.bus_id = MPPLNX_MPP_PRIMARY_DEVICE_NAME,
.release = mppLnx_primary_device_release,
};
/*
* the virtual mpp bus
*/
#define MPPLNX_MPP_VBUS_NAME "mppvbus"
static struct bus_type mppLnx_mppv_bus = {
.name = MPPLNX_MPP_VBUS_NAME,
.match = mppLnx_mppvbus_match,
};
/*
*the virtual bus driver
*/
#define MPPLNX_MPP_VBUS_DRIVER_NAME "mppvdb"
static struct device_driver mppLnx_mppvbus_driver = {
.name = MPPLNX_MPP_VBUS_DRIVER_NAME,
.bus = &mppLnx_mppv_bus,
.probe = mppLnx_mppvbus_driver_probe,
.remove = mppLnx_mppvbus_driver_remove,
};
#define MPPLNX_VADAPTER_NAME "mppadapter0"
static struct device mppLnx_mppvadapter0 = {
.bus_id = MPPLNX_VADAPTER_NAME,
.bus = &mppLnx_mppv_bus,
.parent = &mppLnx_primary_device,
.release = mppLnx_mppvadapter0_release,
};
[b][color=red] ÇëÎÊ£º´ÓÓû§½Ç¶È£¬ÔõôʹÓÃÕâ¸öÕû¸öÇý¶¯³ÌÐò£¨Óë×Ö·ûÇý¶¯³ÌÐòÀïµÄopen,closeµÈ²»Ò»Ñù¹þ£©¡£ËûÃǵ÷Ó㨻ò´¥·¢£©Äĸöº¯Êý£¿[/color][/b] Õâ¸ö¡¡
Çý¶¯³ÌÐòÒ»°ã¶¼»á×¢²áÉ豸£¬Ö±½ÓopenÉ豸¾ÍºÃÀ²¡¡
Ò³:
[1]