本文整理汇总了C++中class_destroy函数的典型用法代码示例。如果您正苦于以下问题:C++ class_destroy函数的具体用法?C++ class_destroy怎么用?C++ class_destroy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了class_destroy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dsps_probe
/**
* platform driver
*
*/
static int __devinit dsps_probe(struct platform_device *pdev)
{
int ret;
pr_debug("%s.\n", __func__);
if (pdev->dev.platform_data == NULL) {
pr_err("%s: platform data is NULL.\n", __func__);
return -ENODEV;
}
drv = kzalloc(sizeof(*drv), GFP_KERNEL);
if (drv == NULL) {
pr_err("%s: kzalloc fail.\n", __func__);
goto alloc_err;
}
drv->pdata = pdev->dev.platform_data;
ret = dsps_alloc_resources(pdev);
if (ret) {
pr_err("%s: failed to allocate dsps resources.\n", __func__);
goto res_err;
}
drv->dev_class = class_create(THIS_MODULE, DRV_NAME);
if (drv->dev_class == NULL) {
pr_err("%s: class_create fail.\n", __func__);
goto res_err;
}
ret = alloc_chrdev_region(&drv->dev_num, 0, 1, DRV_NAME);
if (ret) {
pr_err("%s: alloc_chrdev_region fail.\n", __func__);
goto alloc_chrdev_region_err;
}
drv->dev = device_create(drv->dev_class, NULL,
drv->dev_num,
drv, DRV_NAME);
if (IS_ERR(drv->dev)) {
pr_err("%s: device_create fail.\n", __func__);
goto device_create_err;
}
drv->cdev = cdev_alloc();
if (drv->cdev == NULL) {
pr_err("%s: cdev_alloc fail.\n", __func__);
goto cdev_alloc_err;
}
cdev_init(drv->cdev, &dsps_fops);
drv->cdev->owner = THIS_MODULE;
ret = cdev_add(drv->cdev, drv->dev_num, 1);
if (ret) {
pr_err("%s: cdev_add fail.\n", __func__);
goto cdev_add_err;
}
return 0;
cdev_add_err:
kfree(drv->cdev);
cdev_alloc_err:
device_destroy(drv->dev_class, drv->dev_num);
device_create_err:
unregister_chrdev_region(drv->dev_num, 1);
alloc_chrdev_region_err:
class_destroy(drv->dev_class);
res_err:
kfree(drv);
drv = NULL;
alloc_err:
return -ENODEV;
}
开发者ID:0-t,项目名称:samsung-kernel-msm7x30,代码行数:78,代码来源:msm_dsps.c
示例2: leds_exit
static void __exit leds_exit(void)
{
class_destroy(leds_class);
}
开发者ID:VanirAOSP,项目名称:kernel_lge_f320k,代码行数:4,代码来源:led-class.c
示例3: genwqe_exit_module
/**
* genwqe_exit_module() - Driver exit
*/
static void __exit genwqe_exit_module(void)
{
pci_unregister_driver(&genwqe_driver);
debugfs_remove(debugfs_genwqe);
class_destroy(class_genwqe);
}
开发者ID:020gzh,项目名称:linux,代码行数:9,代码来源:card_base.c
示例4: ofcd_init
static int __init ofcd_init(void) /* Constructor */
{
int err;
printk(KERN_INFO DRV_NAME " : Registered\n");
test_data.irq_pin = 46;
test_data.gpio_pin = 38;
test_data.led_pin = 54;
if (alloc_chrdev_region(&first, 0, 1, "JON") < 0) { goto err_return; }
if ((cl = class_create(THIS_MODULE, "gpio-irq-test")) == NULL) { goto err_unregister_chrdev_return; }
if (device_create(cl, NULL, first, NULL, "gpio-irq-test") == NULL) { goto err_class_destroy_return; }
cdev_init(&c_dev, &pugs_fops);
if (cdev_add(&c_dev, first, 1) == -1) { goto err_device_destroy_return; }
/* Confiure GPIO Pins*/
if (gpio_request(test_data.gpio_pin, "out pin")) {
printk(KERN_ALERT DRV_NAME " : Unable to register output pin %d\n", test_data.gpio_pin);
goto err_device_destroy_return;
}
if(gpio_request(test_data.led_pin, "led pin")) {
printk(KERN_ALERT DRV_NAME " : Unable to register led pin %d\n", test_data.led_pin);
goto err_free_outpin_return;
}
if (gpio_request(test_data.irq_pin, "irq pin")) {
printk(KERN_ALERT DRV_NAME " : Unable to register irq pin %d\n", test_data.led_pin);
goto err_free_ledpin_return;
}
gpio_direction_output(test_data.led_pin, 0);
gpio_direction_output(test_data.gpio_pin, 0);
gpio_direction_input(test_data.irq_pin);
/* Confiure IRQ*/
err = gpio_to_irq(test_data.irq_pin);
if (err < 0) {
printk(KERN_ALERT DRV_NAME " : failed to get IRQ for pin %d.\n", test_data.irq_pin);
goto err_free_irqpin_return;
} else {
test_data.irq = (u16)err;
err = 0;
}
err = request_any_context_irq(test_data.irq, gpio_test_irq_interrupt_handler, IRQF_TRIGGER_RISING | IRQF_DISABLED, DRV_NAME, (void*)&test_data);
if (err < 0) {
printk(KERN_ALERT DRV_NAME " : failed to enable IRQ %d for pin %d.\n", test_data.irq, test_data.irq_pin);
goto err_free_irqpin_return;
} else
test_data.irq_enabled = 1;
return 0;
/* Cleanup of registers */
err_free_irqpin_return:
gpio_free(test_data.irq_pin);
err_free_ledpin_return:
gpio_free(test_data.led_pin);
err_free_outpin_return:
gpio_free(test_data.gpio_pin);
err_device_destroy_return:
device_destroy(cl, first);
err_class_destroy_return:
class_destroy(cl);
err_unregister_chrdev_return:
unregister_chrdev_region(first, 1);
err_return:
return -1;
}
开发者ID:jonhenneberg,项目名称:emb4,代码行数:72,代码来源:gpio-irq-test.c
示例5: ilo_exit
static void __exit ilo_exit(void)
{
pci_unregister_driver(&ilo_driver);
unregister_chrdev_region(MKDEV(ilo_major, 0), MAX_OPEN);
class_destroy(ilo_class);
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:6,代码来源:hpilo.c
示例6: main
/* ******************************* */
int main(int argc, char *argv[]) {
/* ******************************* */
// standard counter
int32 i;
// check if the parameter exist otherwise print help and exit
if(argc < 2) {
printf("no class file name given\n");
return -1;
}
// check if the given filename exist
char * filename = argv[1];
if(!fopen(filename,"r")) {
printf("no class file found\n");
return -1;
}
// bootstrap class loader
bootstrap_cache_load();
// should be threaded
// NCC = native class count
STACK * ncl_list;
ncl_list = (STACK *) mmalloc(sizeof(STACK));
stack_init(ncl_list, sizeof(CLASS));
for(i = 0; i < NCC; i++) {
CLASS * clc = load_class(ncs[i].name);
STACK_ELEM * stack_elem;
stack_elem = (STACK_ELEM *) mmalloc(sizeof(STACK_ELEM));
stack_elem->data = clc;
stack_push(ncl_list,stack_elem);
}
// user defined class loader
CLASS * cl = load_class(argv[1]);
// link class file
/**
* Verification: ensures the correctness of the imported type
* Preparation: allocates memory for class variables and initializing the memory to default values
* Resolution: transforms symbolic references from the type into direct references.
*/
linker(cl);
/* cache the result of parsing and linking */
//cache();
// starting the main interprer process
MACHINE * vm;
vm = (MACHINE *) mmalloc(sizeof(MACHINE));
virtual_machine_init(vm);
stack_init(vm->native_ms, sizeof(CLASS));
virtual_machine_exec(vm,cl);
/* memory cleanup */
virtual_machine_destroy(vm);
stack_destroy(ncl_list);
class_destroy(cl);
/* always return zero at the end */
return 0;
}
开发者ID:CppArchMasters,项目名称:lightweight-java-vm,代码行数:67,代码来源:main.c
示例7: devinfo_exit
/******************************************************************************
* devinfo_exit
*
* DESCRIPTION:
* Free the device driver !
*
* PARAMETERS:
* None
*
* RETURNS:
* None
*
* NOTES:
* None
*
******************************************************************************/
static void __exit devinfo_exit(void)
{
cdev_del(&devinfo_cdev);
class_destroy(devinfo_class);
unregister_chrdev_region(devinfo_dev, 1);
}
开发者ID:P-D-A,项目名称:android_kernel_lge_mt6753,代码行数:22,代码来源:devinfo.c
示例8: S3C_BC_ModInit
static int __init S3C_BC_ModInit(void)
{
#if defined(LDM_PLATFORM) || defined(LDM_PCI)
struct device *psDev;
#endif
#if defined(LMA)
struct pci_dev *psPCIDev;
int error;
#endif
#if defined(LMA)
psPCIDev = pci_get_device(VENDOR_ID_PVR, DEVICE_ID_PVR, NULL);
if (psPCIDev == NULL)
{
printk(KERN_ERR DRVNAME ": S3C_BC_ModInit: pci_get_device failed\n");
goto ExitError;
}
if ((error = pci_enable_device(psPCIDev)) != 0)
{
printk(KERN_ERR DRVNAME ": S3C_BC_ModInit: pci_enable_device failed (%d)\n", error);
goto ExitError;
}
#endif
AssignedMajorNumber = register_chrdev(0, DEVNAME, &S3C_BC_fops);
if (AssignedMajorNumber <= 0)
{
printk(KERN_ERR DRVNAME ": S3C_BC_ModInit: unable to get major number\n");
goto ExitDisable;
}
#if defined(DEBUG)
printk(KERN_DEBUG DRVNAME ": S3C_BC_ModInit: major device %d\n", AssignedMajorNumber);
#endif
#if defined(LDM_PLATFORM) || defined(LDM_PCI)
psPvrClass = class_create(THIS_MODULE, DEVNAME);
if (IS_ERR(psPvrClass))
{
printk(KERN_ERR DRVNAME ": S3C_BC_ModInit: unable to create class (%ld)", PTR_ERR(psPvrClass));
goto ExitUnregister;
}
psDev = device_create(psPvrClass, NULL, MKDEV(AssignedMajorNumber, 0),
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26))
NULL,
#endif
DEVNAME);
if (IS_ERR(psDev))
{
printk(KERN_ERR DRVNAME ": S3C_BC_ModInit: unable to create device (%ld)", PTR_ERR(psDev));
goto ExitDestroyClass;
}
#endif
if(S3C_BC_Register() != S3C_BC_OK)
{
printk (KERN_ERR DRVNAME ": S3C_BC_ModInit: can't init device\n");
goto ExitUnregister;
}
//printk("s3c_bc: physical base addres = 0x%x\n", S3C_BC_DEVICE_PHYS_ADDR_START);
#if defined(LMA)
pci_disable_device(psPCIDev);
#endif
return 0;
#if defined(LDM_PLATFORM) || defined(LDM_PCI)
ExitDestroyClass:
class_destroy(psPvrClass);
#endif
ExitUnregister:
unregister_chrdev(AssignedMajorNumber, DEVNAME);
ExitDisable:
#if defined(LMA)
pci_disable_device(psPCIDev);
ExitError:
#endif
return -EBUSY;
}
开发者ID:sirgatez,项目名称:Android-Eclair-3D-Kernel-Module-Source-v2.6.29.6,代码行数:90,代码来源:s3c_bc_linux.c
示例9: switch_class_exit
static void __exit switch_class_exit(void)
{
class_destroy(switch_class);
}
开发者ID:SamdroidMod,项目名称:spica_kernel_29,代码行数:4,代码来源:switch_class.c
示例10: shm_driver_init
static int __init shm_driver_init(void)
{
int res, i;
/* Figure out our device number. */
res = register_chrdev_region(MKDEV(GALOIS_SHM_MAJOR, 0), GALOIS_SHM_MINORS, SHM_DEVICE_NAME);
if (res < 0) {
shm_error("unable to get shm device major [%d]\n", GALOIS_SHM_MAJOR);
goto err_reg_device;
}
shm_debug("register cdev device major [%d]\n", GALOIS_SHM_MAJOR);
/* Now setup cdevs. */
for (i = 0; i < ARRAY_SIZE(shm_driver_dev_list); i++) {
res = shm_driver_setup_cdev(shm_driver_dev_list[i].cdev,
GALOIS_SHM_MAJOR, shm_driver_dev_list[i].minor, shm_driver_dev_list[i].fops);
if (res) {
shm_error("shm_driver_setup_cdev failed in [%d].\n", i);
goto err_add_device;
}
shm_debug("setup cdevs device minor [%d]\n", shm_driver_dev_list[i].minor);
}
/* add shm devices to sysfs */
shm_dev_class = class_create(THIS_MODULE, SHM_DEVICE_NAME);
if (IS_ERR(shm_dev_class)) {
shm_error("class_create failed.\n");
res = -ENODEV;
goto err_add_device;
}
for (i = 0; i < ARRAY_SIZE(shm_driver_dev_list); i++) {
device_create(shm_dev_class, NULL,
MKDEV(GALOIS_SHM_MAJOR, shm_driver_dev_list[i].minor),
NULL, shm_driver_dev_list[i].name);
shm_debug("create device sysfs [%s]\n", shm_driver_dev_list[i].name);
}
/* create shm device*/
res = shm_device_create(&shm_device, shm_base, shm_size, SHM_DEVICE_THRESHOLD);
if (res != 0) {
shm_error("shm_device_create failed.\n");
goto err_add_device;
}
/* create shm kernel API */
res = MV_SHM_Init(shm_device);
if (res != 0) {
shm_error("MV_SHM_Init failed !!!\n");
goto err_SHM_Init;
}
/* create shm device proc file*/
shm_driver_procdir = proc_mkdir(SHM_DEVICE_NAME, NULL);
shm_driver_procdir->owner = THIS_MODULE;
create_proc_read_entry(SHM_DEVICE_PROCFILE_MEMINFO, 0, shm_driver_procdir, read_proc_meminfo, NULL);
create_proc_read_entry(SHM_DEVICE_PROCFILE_BASEINFO, 0, shm_driver_procdir, read_proc_baseinfo, NULL);
create_proc_read_entry(SHM_DEVICE_PROCFILE_DETAIL, 0, shm_driver_procdir, read_proc_detail, NULL);
shm_trace("shm_driver_init OK\n");
return 0;
err_SHM_Init:
shm_trace("shm_driver_init Undo ...\n");
shm_device_destroy(&shm_device);
/* del sysfs entries */
for (i = 0; i < ARRAY_SIZE(shm_driver_dev_list); i++) {
device_destroy(shm_dev_class, MKDEV(GALOIS_SHM_MAJOR, shm_driver_dev_list[i].minor));
shm_debug("delete device sysfs [%s]\n", shm_driver_dev_list[i].name);
}
class_destroy(shm_dev_class);
err_add_device:
for (i = 0; i < ARRAY_SIZE(shm_driver_dev_list); i++) {
cdev_del(shm_driver_dev_list[i].cdev);
}
unregister_chrdev_region(MKDEV(GALOIS_SHM_MAJOR, 0), GALOIS_SHM_MINORS);
err_reg_device:
shm_trace("shm_driver_init failed !!! (%d)\n", res);
return res;
}
开发者ID:deepikateriar,项目名称:Onlive-Source-Backup,代码行数:89,代码来源:shm_driver.c
示例11: usb_major_cleanup
void usb_major_cleanup(void)
{
class_destroy(usb_class);
unregister_chrdev(USB_MAJOR, "usb");
}
开发者ID:me-oss,项目名称:me-linux,代码行数:5,代码来源:file.c
示例12: drv_init
//.........这里部分代码省略.........
&& (device->kernels[gcvCORE_MAJOR]->hardware->mmuVersion != 0))
{
status = gckMMU_Enable(device->kernels[gcvCORE_MAJOR]->mmu, mmuBaseAddress, physSize);
//status = gckMMU_Enable(device->kernels[gcvCORE_MAJOR]->mmu, (gctUINT32)device->contiguousStart, contiguousSize);
gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_DRIVER,
"Enable new MMU: status=%d\n", status);
if ((device->kernels[gcvCORE_2D] != gcvNULL)
&& (device->kernels[gcvCORE_2D]->hardware->mmuVersion != 0))
{
status = gckMMU_Enable(device->kernels[gcvCORE_2D]->mmu, mmuBaseAddress, physSize);
gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_DRIVER,
"Enable new MMU for 2D: status=%d\n", status);
}
/* Reset the base address */
device->baseAddress = 0;
}
for (i = 0; i < gcdMAX_GPU_COUNT; i++)
{
if(device->kernels[i] != gcvNULL)
{
device->kernels[i]->bTryIdleGPUEnable = gcvTRUE;
}
}
/* Register the character device. */
ret = register_chrdev(major, DRV_NAME, &driver_fops);
if (ret < 0)
{
gcmkTRACE_ZONE(
gcvLEVEL_ERROR, gcvZONE_DRIVER,
"%s(%d): Could not allocate major number for mmap.\n",
__FUNCTION__, __LINE__
);
gcmkONERROR(gcvSTATUS_OUT_OF_MEMORY);
}
if (major == 0)
{
major = ret;
}
/* Create the device class. */
device_class = class_create(THIS_MODULE, "graphics_class");
if (IS_ERR(device_class))
{
gcmkTRACE_ZONE(
gcvLEVEL_ERROR, gcvZONE_DRIVER,
"%s(%d): Failed to create the class.\n",
__FUNCTION__, __LINE__
);
gcmkONERROR(gcvSTATUS_OUT_OF_RESOURCES);
}
if (pdevice == gcvNULL)
gcmkONERROR(gcvSTATUS_DEVICE);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
device_create(device_class, pdevice, MKDEV(major, 0), NULL, "galcore");
#else
device_create(device_class, pdevice, MKDEV(major, 0), "galcore");
#endif
galDevice = device;
gpuClass = device_class;
gcmkTRACE_ZONE(
gcvLEVEL_INFO, gcvZONE_DRIVER,
"%s(%d): irqLine=%d, contiguousSize=%lu, memBase=0x%lX\n",
__FUNCTION__, __LINE__,
irqLine, contiguousSize, registerMemBase
);
/* Success. */
gcmkFOOTER_NO();
return 0;
OnError:
/* Roll back. */
if (device_class != gcvNULL)
{
device_destroy(device_class, MKDEV(major, 0));
class_destroy(device_class);
}
if (device != gcvNULL)
{
gcmkVERIFY_OK(gckGALDEVICE_Stop(device));
gcmkVERIFY_OK(gckGALDEVICE_Destroy(device));
}
gcmkFOOTER();
return result;
}
开发者ID:Gabrius99,项目名称:kernel_goldenvess3g,代码行数:101,代码来源:gc_hal_kernel_driver.c
示例13: typec_exit
static void __exit typec_exit(void)
{
class_destroy(typec_class);
sysfs_remove_group(&typec_dev->kobj, &typec_attr_group);
}
开发者ID:CM13-HI6210SFT,项目名称:hisi_kernel_3.10.86_hi6210sft,代码行数:5,代码来源:hw_typec.c
示例14: register_attributes
static int register_attributes(void)
{
int ret = 0;
hi->htc_accessory_class = class_create(THIS_MODULE, "htc_accessory");
if (IS_ERR(hi->htc_accessory_class)) {
ret = PTR_ERR(hi->htc_accessory_class);
hi->htc_accessory_class = NULL;
goto err_create_class;
}
/* Register TTY attributes */
hi->tty_dev = device_create(hi->htc_accessory_class,
NULL, 0, "%s", "tty");
if (unlikely(IS_ERR(hi->tty_dev))) {
ret = PTR_ERR(hi->tty_dev);
hi->tty_dev = NULL;
goto err_create_tty_device;
}
ret = device_create_file(hi->tty_dev, &dev_attr_tty);
if (ret)
goto err_create_tty_device_file;
/* Register FM attributes */
hi->fm_dev = device_create(hi->htc_accessory_class,
NULL, 0, "%s", "fm");
if (unlikely(IS_ERR(hi->fm_dev))) {
ret = PTR_ERR(hi->fm_dev);
hi->fm_dev = NULL;
goto err_create_fm_device;
}
ret = device_create_file(hi->fm_dev, &dev_attr_fm);
if (ret)
goto err_create_fm_device_file;
/* Register debug attributes */
hi->debug_dev = device_create(hi->htc_accessory_class,
NULL, 0, "%s", "debug");
if (unlikely(IS_ERR(hi->debug_dev))) {
ret = PTR_ERR(hi->debug_dev);
hi->debug_dev = NULL;
goto err_create_debug_device;
}
/* register the attributes */
ret = device_create_file(hi->debug_dev, &dev_attr_debug);
if (ret)
goto err_create_debug_device_file;
return 0;
err_create_debug_device_file:
device_unregister(hi->debug_dev);
err_create_debug_device:
device_remove_file(hi->fm_dev, &dev_attr_fm);
err_create_fm_device_file:
device_unregister(hi->fm_dev);
err_create_fm_device:
device_remove_file(hi->tty_dev, &dev_attr_tty);
err_create_tty_device_file:
device_unregister(hi->tty_dev);
err_create_tty_device:
class_destroy(hi->htc_accessory_class);
err_create_class:
return ret;
}
开发者ID:RuNuH,项目名称:eViL-sense-3x,代码行数:75,代码来源:htc_headset_mgr.c
示例15: mdnie_probe
//.........这里部分代码省略.........
pr_err("no platform data specified\n");
ret = -EINVAL;
goto error2;
}
mdnie->bd = backlight_device_register("panel", mdnie->dev,
mdnie, &mdnie_backlight_ops, NULL);
mdnie->bd->props.max_brightness = MAX_BRIGHTNESS_LEVEL;
mdnie->bd->props.brightness = DEFAULT_BRIGHTNESS;
mdnie->bd_enable = TRUE;
mdnie->lcd_pd = pdata->lcd_pd;
ret = device_create_file(&mdnie->bd->dev, &dev_attr_auto_brightness);
if (ret < 0)
dev_err(&mdnie->bd->dev, "failed to add sysfs entries, %d\n", __LINE__);
#endif
mdnie->scenario = UI_MODE;
mdnie->mode = STANDARD;
mdnie->tone = TONE_NORMAL;
mdnie->outdoor = OUTDOOR_OFF;
#if defined(CONFIG_FB_MDNIE_PWM)
mdnie->cabc = CABC_ON;
mdnie->power_lut_idx = LUT_LEVEL_MANUAL_AND_INDOOR;
mdnie->auto_brightness = 0;
#else
mdnie->cabc = CABC_OFF;
#endif
#if defined(CONFIG_FB_S5P_S6C1372)
mdnie->cabc = CABC_OFF;
#endif
mdnie->enable = TRUE;
mdnie->tunning = FALSE;
mdnie->negative = NEGATIVE_OFF;
mutex_init(&mdnie->lock);
mutex_init(&mdnie->dev_lock);
platform_set_drvdata(pdev, mdnie);
dev_set_drvdata(mdnie->dev, mdnie);
#ifdef CONFIG_HAS_WAKELOCK
#ifdef CONFIG_HAS_EARLYSUSPEND
#if 1 /* defined(CONFIG_FB_MDNIE_PWM) */
mdnie->early_suspend.suspend = mdnie_early_suspend;
mdnie->early_suspend.resume = mdnie_late_resume;
mdnie->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN; //EARLY_SUSPEND_LEVEL_DISABLE_FB - 1;
register_early_suspend(&mdnie->early_suspend);
#endif
#endif
#endif
#if defined(CONFIG_FB_S5P_S6C1372)
check_lcd_type();
dev_info(mdnie->dev, "lcdtype = %d\n", pdata->display_type);
if (pdata->display_type == 1) {
b_value.max = 1441;
b_value.mid = 784;
b_value.low = 16;
b_value.dim = 16;
} else {
b_value.max = 1216; /* 76% */
b_value.mid = 679; /* 39% */
b_value.low = 16; /* 1% */
b_value.dim = 16; /* 1% */
}
#endif
#if defined(CONFIG_FB_S5P_S6F1202A)
if (pdata->display_type == 0) {
memcpy(tunning_table, tunning_table_hydis, sizeof(tunning_table));
memcpy(etc_table, etc_table_hydis, sizeof(etc_table));
memcpy(camera_table, camera_table_hydis, sizeof(camera_table));
} else if (pdata->display_type == 1) {
memcpy(tunning_table, tunning_table_sec, sizeof(tunning_table));
memcpy(etc_table, etc_table_sec, sizeof(etc_table));
memcpy(camera_table, camera_table_sec, sizeof(camera_table));
} else if (pdata->display_type == 2) {
memcpy(tunning_table, tunning_table_boe, sizeof(tunning_table));
memcpy(etc_table, etc_table_boe, sizeof(etc_table));
memcpy(camera_table, camera_table_boe, sizeof(camera_table));
}
#endif
g_mdnie = mdnie;
set_mdnie_value(mdnie, 0);
dev_info(mdnie->dev, "registered successfully\n");
return 0;
error2:
kfree(mdnie);
error1:
class_destroy(mdnie_class);
error0:
return ret;
}
开发者ID:Art-Chen,项目名称:android_kernel_samsung_galaxys2plus-common,代码行数:101,代码来源:mdnie.c
示例16: WMT_init
//.........这里部分代码省略.........
WMT_ERR_FUNC("fail to register chrdev\n");
return ret;
}
cdev_init(&gWmtCdev, &gWmtFops);
gWmtCdev.owner = THIS_MODULE;
cdevErr = cdev_add(&gWmtCdev, devID, WMT_DEV_NUM);
if (cdevErr) {
WMT_ERR_FUNC("cdev_add() fails (%d)\n", cdevErr);
goto error;
}
WMT_INFO_FUNC("driver(major %d) installed\n", gWmtMajor);
#if REMOVE_MK_NODE
wmt_class = class_create(THIS_MODULE, "stpwmt");
if (IS_ERR(wmt_class))
goto error;
wmt_dev = device_create(wmt_class, NULL, devID, NULL, "stpwmt");
if (IS_ERR(wmt_dev))
goto error;
#endif
#if 0
pWmtDevCtx = wmt_drv_create();
if (!pWmtDevCtx) {
WMT_ERR_FUNC("wmt_drv_create() fails\n");
goto error;
}
ret = wmt_drv_init(pWmtDevCtx);
if (ret) {
WMT_ERR_FUNC("wmt_drv_init() fails (%d)\n", ret);
goto error;
}
WMT_INFO_FUNC("stp_btmcb_reg\n");
wmt_cdev_btmcb_reg();
ret = wmt_drv_start(pWmtDevCtx);
if (ret) {
WMT_ERR_FUNC("wmt_drv_start() fails (%d)\n", ret);
goto error;
}
#endif
ret = wmt_lib_init();
if (ret) {
WMT_ERR_FUNC("wmt_lib_init() fails (%d)\n", ret);
goto error;
}
#if CFG_WMT_DBG_SUPPORT
wmt_dev_dbg_setup();
#endif
#if CFG_WMT_PROC_FOR_AEE
wmt_dev_proc_for_aee_setup();
#endif
mtk_wcn_hif_sdio_update_cb_reg(wmt_dev_tra_sdio_update);
#if CONSYS_WMT_REG_SUSPEND_CB_ENABLE
ret = register_pm_notifier(&wmt_pm_notifier_block);
if (ret)
WMT_ERR_FUNC("WMT failed to register PM notifier failed(%d)\n", ret);
#endif
gWmtInitDone = 1;
wake_up(&gWmtInitWq);
#if CONSYS_EARLYSUSPEND_ENABLE
osal_sleepable_lock_init(&g_es_lr_lock);
register_early_suspend(&wmt_early_suspend_handler);
WMT_INFO_FUNC("register_early_suspend finished\n");
#endif
WMT_INFO_FUNC("success \n");
return 0;
error:
wmt_lib_deinit();
#if CFG_WMT_DBG_SUPPORT
wmt_dev_dbg_remove();
#endif
#if REMOVE_MK_NODE
if (!IS_ERR(wmt_dev))
device_destroy(wmt_class, devID);
if (!IS_ERR(wmt_class)) {
class_destroy(wmt_class);
wmt_class = NULL;
}
#endif
if (cdevErr == 0) {
cdev_del(&gWmtCdev);
}
if (ret == 0) {
unregister_chrdev_region(devID, WMT_DEV_NUM);
gWmtMajor = -1;
}
WMT_ERR_FUNC("fail\n");
return -1;
}
开发者ID:AudioGod,项目名称:MediaTek-HelioX10-Kernel,代码行数:101,代码来源:wmt_dev.c
示例17: gpio_pmodoled_of_probe
//.........这里部分代码省略.........
/* Alloc Space for platform data structure */
gpio_pmodoled_pdev = kzalloc(sizeof(*gpio_pmodoled_pdev), GFP_KERNEL);
if (!gpio_pmodoled_pdev) {
status = -ENOMEM;
goto pdev_alloc_err;
}
/* Fill up Platform Device Structure */
gpio_pmodoled_pdev->name = "spi_gpio";
gpio_pmodoled_pdev->id = gpio_pmodoled_dev->spi_id;
gpio_pmodoled_pdev->dev.platform_data = gpio_pmodoled_pdata;
gpio_pmodoled_dev->pdev = gpio_pmodoled_pdev;
/* Register spi_gpio master */
status = platform_device_register(gpio_pmodoled_dev->pdev);
if (status < 0) {
dev_err(&pdev->dev, "platform_device_register failed: %d\n", status);
goto pdev_reg_err;
}
#ifdef CONFIG_PMODS_DEBUG
pr_info(DRIVER_NAME " %s: spi_gpio platform device registered.\n", np->name);
#endif
gpio_pmodoled_dev->name = np->name;
/* Fill up Board Info for SPI device */
status = add_gpio_pmodoled_device_to_bus(gpio_pmodoled_dev);
if (status < 0) {
dev_err(&pdev->dev, "add_gpio_pmodoled_device_to_bus failed: %d\n", status);
goto spi_add_err;
}
#ifdef CONFIG_PMODS_DEBUG
pr_info(DRIVER_NAME " %s: spi device registered.\n", np->name);
#endif
/* Point device node data to gpio_pmodoled_device structure */
if (np->data == NULL)
np->data = gpio_pmodoled_dev;
if (gpio_pmodoled_dev_id == 0) {
/* Alloc Major & Minor number for char device */
status = alloc_chrdev_region(&gpio_pmodoled_dev_id, 0, MAX_PMODOLED_GPIO_DEV_NUM, DRIVER_NAME);
if (status) {
dev_err(&pdev->dev, "Character device region not allocated correctly: %d\n", status);
goto err_alloc_chrdev_region;
}
#ifdef CONFIG_PMODS_DEBUG
pr_info(DRIVER_NAME " : Char Device Region Registered, with Major: %d.\n",
MAJOR(gpio_pmodoled_dev_id));
#endif
}
if (gpio_pmodoled_class == NULL) {
/* Create Pmodoled-gpio Device Class */
gpio_pmodoled_class = class_create(THIS_MODULE, DRIVER_NAME);
if (IS_ERR(gpio_pmodoled_class)) {
status = PTR_ERR(gpio_pmodoled_class);
goto err_create_class;
}
#ifdef CONFIG_PMODS_DEBUG
pr_info(DRIVER_NAME " : pmodoled_gpio device class registered.\n");
#endif
}
if (spi_drv_registered == 0) {
/* Register SPI Driver for Pmodoled Device */
status = spi_register_driver(&gpio_pmodoled_spi_driver);
if (status < 0) {
dev_err(&pdev->dev, "gpio_pmodoled_spi_driver register failed: %d\n", status);
goto err_spi_register;
}
spi_drv_registered = 1;
}
device_num++;
return status;
err_spi_register:
class_destroy(gpio_pmodoled_class);
gpio_pmodoled_class = NULL;
err_create_class:
unregister_chrdev_region(gpio_pmodoled_dev_id, MAX_PMODOLED_GPIO_DEV_NUM);
gpio_pmodoled_dev_id = 0;
err_alloc_chrdev_region:
spi_unregister_device(gpio_pmodoled_dev->spi);
spi_add_err:
platform_device_unregister(gpio_pmodoled_dev->pdev);
pdev_reg_err:
kfree(gpio_pmodoled_pdev);
pdev_alloc_err:
kfree(gpio_pmodoled_pdata);
pdata_alloc_err:
kfree(gpio_pmodoled_dev->disp_buf);
disp_buf_alloc_err:
kfree(gpio_pmodoled_dev);
dev_alloc_err:
return status;
}
开发者ID:SovanKundu,项目名称:linux-xlnx,代码行数:101,代码来源:pmodoled-gpio.c
示例18: tape_exit
static void __exit tape_exit(void)
{
class_destroy(tape_class);
tape_class = NULL;
}
开发者ID:274914765,项目名称:C,代码行数:5,代码来源:tape_class.c
示例19: lg_fw_diag_class_exit
static void __exit lg_fw_diag_class_exit(void)
{
class_destroy(lg_fw_diag_class);
}
开发者ID:cm-m3s,项目名称:android_kernel_lge_m3s,代码行数:4,代码来源:lge_diag_class.c
示例20: notify_class_exit
static void __exit notify_class_exit(void)
{
class_destroy(host_notify.host_notify_class);
}
开发者ID:carvsdriver,项目名称:msm8660-common_marla,代码行数:4,代码来源:host_notify_class.c
注:本文中的class_destroy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论