您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ sysfs_remove_group函数代码示例

51自学网 2021-06-03 08:38:24
  C++
这篇教程C++ sysfs_remove_group函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中sysfs_remove_group函数的典型用法代码示例。如果您正苦于以下问题:C++ sysfs_remove_group函数的具体用法?C++ sysfs_remove_group怎么用?C++ sysfs_remove_group使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了sysfs_remove_group函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: lm63_probe

static int lm63_probe(struct i2c_client *client,		      const struct i2c_device_id *id){	struct lm63_data *data;	int err;	data = kzalloc(sizeof(struct lm63_data), GFP_KERNEL);	if (!data) {		err = -ENOMEM;		goto exit;	}	i2c_set_clientdata(client, data);	data->valid = 0;	mutex_init(&data->update_lock);	/* Set the device type */	data->kind = id->driver_data;	if (data->kind == lm64)		data->temp2_offset = 16000;	/* Initialize chip */	lm63_init_client(client);	/* Register sysfs hooks */	err = sysfs_create_group(&client->dev.kobj, &lm63_group);	if (err)		goto exit_free;	if (data->config & 0x04) { /* tachometer enabled */		err = sysfs_create_group(&client->dev.kobj, &lm63_group_fan1);		if (err)			goto exit_remove_files;	}	if (data->kind == lm96163) {		err = device_create_file(&client->dev, &dev_attr_temp2_type);		if (err)			goto exit_remove_files;		err = sysfs_create_group(&client->dev.kobj,					 &lm63_group_extra_lut);		if (err)			goto exit_remove_files;	}	data->hwmon_dev = hwmon_device_register(&client->dev);	if (IS_ERR(data->hwmon_dev)) {		err = PTR_ERR(data->hwmon_dev);		goto exit_remove_files;	}	return 0;exit_remove_files:	sysfs_remove_group(&client->dev.kobj, &lm63_group);	sysfs_remove_group(&client->dev.kobj, &lm63_group_fan1);	if (data->kind == lm96163) {		device_remove_file(&client->dev, &dev_attr_temp2_type);		sysfs_remove_group(&client->dev.kobj, &lm63_group_extra_lut);	}exit_free:	kfree(data);exit:	return err;}
开发者ID:0xroot,项目名称:Blackphone-BP1-Kernel,代码行数:64,


示例2: svec_remove_sysfs_files

void svec_remove_sysfs_files (struct svec_dev *card){	sysfs_remove_group(&card->dev->kobj, &svec_attr_group);}
开发者ID:dcobas,项目名称:svec,代码行数:4,


示例3: dpm_sysfs_remove

void dpm_sysfs_remove(struct device *dev){	rpm_sysfs_remove(dev);	sysfs_unmerge_group(&dev->kobj, &pm_wakeup_attr_group);	sysfs_remove_group(&dev->kobj, &pm_attr_group);}
开发者ID:AdrianHuang,项目名称:linux-3.8.13,代码行数:6,


示例4: ipath_driver_remove_group

void ipath_driver_remove_group(struct device_driver *drv){	sysfs_remove_group(&drv->kobj, &driver_attr_group);}
开发者ID:ManiacTwister,项目名称:linux-hnd,代码行数:4,


示例5: sensor_probe

static intsensor_probe(struct platform_device *pdev){    struct sensor_data *data = NULL;    struct input_dev *input_data = NULL;    int input_registered = 0, sysfs_created = 0;    int rt;    data = kzalloc(sizeof(struct sensor_data), GFP_KERNEL);    if (!data) {        rt = -ENOMEM;        goto err;    }    data->enabled = 0;    data->delay = SENSOR_DEFAULT_DELAY;    input_data = input_allocate_device();    if (!input_data) {        rt = -ENOMEM;        YLOGE(("sensor_probe: Failed to allocate input_data device/n"));        goto err;    }    input_alloc_absinfo(input_data);    set_bit(EV_ABS, input_data->evbit);    input_set_capability(input_data, EV_ABS, ABS_X);#if SENSOR_TYPE <= 4    input_set_capability(input_data, EV_ABS, ABS_Y);    input_set_capability(input_data, EV_ABS, ABS_Z);    input_set_capability(input_data, EV_ABS, ABS_RUDDER);#endif    input_set_capability(input_data, EV_ABS, ABS_STATUS); /* status */    input_set_capability(input_data, EV_ABS, ABS_WAKE); /* wake */    input_set_capability(input_data, EV_ABS, ABS_CONTROL_REPORT); /* enabled/delay */    input_data->name = SENSOR_NAME;    rt = input_register_device(input_data);    if (rt) {        YLOGE(("sensor_probe: Unable to register input_data device: %s/n",               input_data->name));        goto err;    }    input_set_drvdata(input_data, data);    input_registered = 1;    rt = sysfs_create_group(&input_data->dev.kobj,            &sensor_attribute_group);    if (rt) {        YLOGE(("sensor_probe: sysfs_create_group failed[%s]/n",               input_data->name));        goto err;    }    sysfs_created = 1;    mutex_init(&data->mutex);    this_data = input_data;    return 0;err:    if (data != NULL) {        if (input_data != NULL) {            if (sysfs_created) {                sysfs_remove_group(&input_data->dev.kobj,                        &sensor_attribute_group);            }            if (input_registered) {                input_unregister_device(input_data);            }            else {                input_free_device(input_data);            }            input_data = NULL;        }        kfree(data);    }    return rt;}
开发者ID:Thinkware-Device,项目名称:willow,代码行数:78,


示例6: fsl_dcm_probe

static int fsl_dcm_probe(struct platform_device *pdev){	struct device_node *np = pdev->dev.of_node;	struct fsl_dcm_data *dcm;	int ret;	u8 ver;	dcm = kzalloc(sizeof(struct fsl_dcm_data), GFP_KERNEL);	if (!dcm)		return -ENOMEM;	dcm->base = of_iomap(np, 0);	if (!dcm->base) {		dev_err(&pdev->dev, "could not map fpga node/n");		ret = -ENOMEM;		goto error_kzalloc;	}	dcm->dev = &pdev->dev;	dcm->board = pdev->dev.platform_data;	/*	 * write 0x1F to GDC register then read GDD register	 * to get GMSA version.	 * 0x00: v1  -> pixis	 * 0x01: v2  -> qixis	 */	out_8(dcm->base + 0x16, 0x1F);	ver = in_8(dcm->base + 0x17);	if (ver == 0x0) {		dcm->addr = dcm->base + 0x0a;		dcm->data = dcm->base + 0x0d;	} else if (ver == 0x01) {		dcm->addr = dcm->base + 0x12;		dcm->data = dcm->base + 0x13;	}	dcm->ocmd = dcm->base + 0x14;	dcm->omsg = dcm->base + 0x15;	dcm->mack = dcm->base + 0x18;	/* Check to make sure the DCM is enable and working */	if (!is_sram_available(dcm)) {		dev_err(&pdev->dev, "dcm is not responding/n");		ret = -ENODEV;		goto error_iomap;	}	dev_set_drvdata(&pdev->dev, dcm);	ret = sysfs_create_group(&pdev->dev.kobj, &fsl_dcm_attr_group);	if (ret) {		dev_err(&pdev->dev, "could not create sysfs group/n");		goto error_iomap;	}	if (!select_dcm_channels(dcm, dcm->board->mask)) {		dev_err(&pdev->dev, "could not set crecord mask/n");		ret = -ENODEV;		goto error_sysfs;	}	/* Set the timer to the fastest support rate. */	if (!set_dcm_frequency(dcm, 1)) {		dev_err(&pdev->dev, "could not set frequency/n");		ret = -ENODEV;		goto error_sysfs;	}	return 0;error_sysfs:	sysfs_remove_group(&pdev->dev.kobj, &fsl_dcm_attr_group);error_iomap:	iounmap(dcm->base);error_kzalloc:	kfree(dcm);	return ret;}
开发者ID:sonoble,项目名称:linux-3.8.13,代码行数:82,


示例7: aoedisk_rm_sysfs

voidaoedisk_rm_sysfs(struct aoedev *d){	sysfs_remove_group(&disk_to_dev(d->gd)->kobj, &attr_group);}
开发者ID:adis1313,项目名称:android_kernel_samsung_msm8974,代码行数:5,


示例8: rpi_power_switch_init

int __init rpi_power_switch_init(void){	int ret = 0;	if (gpio_pin < 0) {		pr_err(POWER_SWITCH_CLASS_NAME ": missing argument: gpio_pin/n");		return -EINVAL;	}	old_pm_power_off = pm_power_off;	pm_power_off = rpi_power_switch_power_off;	pr_info("Switch driver v%s/n",		RPI_POWER_SWITCH_VERSION);	INIT_DELAYED_WORK(&initiate_shutdown_work, initiate_shutdown);	/* Register our own class for the power switch */	ret = class_register(&power_switch_class);	if (ret < 0) {		pr_err("%s: Unable to register class/n", power_switch_class.name);		goto out0;	}	/* Create devices for each PWM present */	switch_dev = device_create(&power_switch_class, &platform_bus,				MKDEV(0, 0), NULL, "pswitch%u", 0);	if (IS_ERR(switch_dev)) {		pr_err("%s: device_create failed/n", power_switch_class.name);		ret = PTR_ERR(switch_dev);		goto out1;	}	ret = sysfs_create_group(&switch_dev->kobj,				 &rpi_power_switch_attribute_group);	if (ret < 0) {		pr_err("%s: create_group failed/n", power_switch_class.name);		goto out2;	}	/* GPIO register memory must be mapped before doing any direct	 * accesses such as changing GPIO alt functions or changing GPIO	 * pull ups or pull downs.	 */	gpio_reg = ioremap(GPIO_BASE, 1024);	/* Set the specified pin as a GPIO input */	SET_GPIO_INPUT(gpio_pin);	/* Set the pin as a pulldown.  Most pins should default to having	 * pulldowns, and this seems most intuitive.	 */	set_gpio_pull(gpio_pin, GPIO_PULL_UP);	gpio_request(gpio_pin, "Power switch");	gpio_direction_input(gpio_pin);	/* The targeted polarity should be the opposite of the current value.	 * I.e. we want the pin to transition to this state in order to	 * initiate a shutdown.	 */	gpio_pol = !gpio_get_value(gpio_pin);	/* Request an interrupt to fire when the pin transitions to our	 * desired state.	 */	ret = request_irq(__gpio_to_irq(gpio_pin), power_isr,			  gpio_pol?IRQF_TRIGGER_RISING:IRQF_TRIGGER_FALLING,			  "Power button", NULL);	if (ret) {		pr_err("Unable to request IRQ/n");		goto out3;	}	return 0;	/* Error handling */out3:	sysfs_remove_group(&switch_dev->kobj,&rpi_power_switch_attribute_group);out2:	device_unregister(switch_dev);out1:	class_unregister(&power_switch_class);out0:	iounmap(gpio_reg);	pm_power_off = old_pm_power_off;	return ret;}
开发者ID:badowsky,项目名称:rpi-scripts,代码行数:91,


示例9: bridge_destroy_sysfs

static void bridge_destroy_sysfs(void){	sysfs_remove_group(&omap_dspbridge_dev->dev.kobj, &attr_group);}
开发者ID:dancing-leaves,项目名称:nst-linux-kernel,代码行数:4,


示例10: hdaps_init

static int __init hdaps_init(void){	int ret;	/* Determine axis orientation orientation */	if (hdaps_invert == HDAPS_ORIENT_UNDEFINED) /* set by module param? */		if (dmi_check_system(hdaps_whitelist) < 1) /* in whitelist? */			hdaps_invert = 0; /* default */	/* Init timer before platform_driver_register, in case of suspend */	init_timer(&hdaps_timer);	hdaps_timer.function = hdaps_mousedev_poll;	ret = platform_driver_register(&hdaps_driver);	if (ret)		goto out;	pdev = platform_device_register_simple("hdaps", -1, NULL, 0);	if (IS_ERR(pdev)) {		ret = PTR_ERR(pdev);		goto out_driver;	}	ret = sysfs_create_group(&pdev->dev.kobj, &hdaps_attribute_group);	if (ret)		goto out_device;	hdaps_idev = input_allocate_device();	if (!hdaps_idev) {		ret = -ENOMEM;		goto out_group;	}	hdaps_idev_raw = input_allocate_device();	if (!hdaps_idev_raw) {		ret = -ENOMEM;		goto out_idev_first;	}	/* calibration for the input device (deferred to avoid delay) */	needs_calibration = 1;	/* initialize the joystick-like fuzzed input device */	hdaps_idev->name = "ThinkPad HDAPS joystick emulation";	hdaps_idev->phys = "hdaps/input0";	hdaps_idev->id.bustype = BUS_HOST;	hdaps_idev->id.vendor  = HDAPS_INPUT_VENDOR;	hdaps_idev->id.product = HDAPS_INPUT_PRODUCT;	hdaps_idev->id.version = HDAPS_INPUT_JS_VERSION;#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)	hdaps_idev->cdev.dev = &pdev->dev;#endif	hdaps_idev->evbit[0] = BIT(EV_ABS);	hdaps_idev->open = hdaps_mousedev_open;	hdaps_idev->close = hdaps_mousedev_close;	input_set_abs_params(hdaps_idev, ABS_X,			-256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT);	input_set_abs_params(hdaps_idev, ABS_Y,			-256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT);	ret = input_register_device(hdaps_idev);	if (ret)		goto out_idev;	/* initialize the raw data input device */	hdaps_idev_raw->name = "ThinkPad HDAPS accelerometer data";	hdaps_idev_raw->phys = "hdaps/input1";	hdaps_idev_raw->id.bustype = BUS_HOST;	hdaps_idev_raw->id.vendor  = HDAPS_INPUT_VENDOR;	hdaps_idev_raw->id.product = HDAPS_INPUT_PRODUCT;	hdaps_idev_raw->id.version = HDAPS_INPUT_RAW_VERSION;#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)	hdaps_idev_raw->cdev.dev = &pdev->dev;#endif	hdaps_idev_raw->evbit[0] = BIT(EV_ABS);	hdaps_idev_raw->open = hdaps_mousedev_open;	hdaps_idev_raw->close = hdaps_mousedev_close;	input_set_abs_params(hdaps_idev_raw, ABS_X, -32768, 32767, 0, 0);	input_set_abs_params(hdaps_idev_raw, ABS_Y, -32768, 32767, 0, 0);	ret = input_register_device(hdaps_idev_raw);	if (ret)		goto out_idev_reg_first;	printk(KERN_INFO "hdaps: driver successfully loaded./n");	return 0;out_idev_reg_first:	input_unregister_device(hdaps_idev);out_idev:	input_free_device(hdaps_idev_raw);out_idev_first:	input_free_device(hdaps_idev);out_group:	sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group);out_device:	platform_device_unregister(pdev);out_driver:	platform_driver_unregister(&hdaps_driver);	hdaps_device_shutdown();out://.........这里部分代码省略.........
开发者ID:chantk,项目名称:nec-lavie-acpi,代码行数:101,


示例11: gp2a_opt_probe

//.........这里部分代码省略.........	value = 0x00;	/* shutdown mode op[3]=0 */	err = opt_i2c_write((u8) (COMMAND1), &value);	if (err < 0) {		pr_err("%s failed : threre is no such device./n", __func__);		goto err_no_device;	}	/* Setup irq */	err = gp2a_setup_irq(gp2a);	if (err) {		pr_err("%s: could not setup irq/n", __func__);		goto err_setup_irq;	}	/* set sysfs for proximity sensor */	gp2a->proximity_dev = sensors_classdev_register("proximity_sensor");	if (IS_ERR(gp2a->proximity_dev)) {		pr_err("%s: could not create proximity_dev/n", __func__);		goto err_proximity_device_create;	}	if (device_create_file(gp2a->proximity_dev, &dev_attr_state) < 0) {		pr_err("%s: could not create device file(%s)!/n", __func__,		       dev_attr_state.attr.name);		goto err_proximity_device_create_file1;	}	if (device_create_file(gp2a->proximity_dev, &dev_attr_prox_avg) < 0) {		pr_err("%s: could not create device file(%s)!/n", __func__,		       dev_attr_prox_avg.attr.name);		goto err_proximity_device_create_file2;	}	if (device_create_file(gp2a->proximity_dev,						&dev_attr_prox_thresh) < 0) {		pr_err("%s: could not create device file(%s)!/n", __func__,		       dev_attr_prox_thresh.attr.name);		goto err_proximity_device_create_file3;	}	if (device_create_file(gp2a->proximity_dev,						&dev_attr_vendor) < 0) {		pr_err("%s: could not create device file(%s)!/n", __func__,		       dev_attr_vendor.attr.name);		goto err_proximity_device_create_file4;	}	if (device_create_file(gp2a->proximity_dev,						&dev_attr_name) < 0) {		pr_err("%s: could not create device file(%s)!/n", __func__,		       dev_attr_name.attr.name);		goto err_proximity_device_create_file5;	}	if (device_create_file(gp2a->proximity_dev, &dev_attr_raw_data) < 0) {		pr_err("%s: could not create device file(%s)!/n", __func__,		       dev_attr_raw_data.attr.name);		goto err_proximity_device_create_file6;	}#ifdef CONFIG_SLP	device_init_wakeup(gp2a->proximity_dev, true);#endif	dev_set_drvdata(gp2a->proximity_dev, gp2a);	device_init_wakeup(&pdev->dev, 1);	gprintk("probe success!/n");	return 0;err_proximity_device_create_file6:	device_remove_file(gp2a->proximity_dev, &dev_attr_raw_data);err_proximity_device_create_file5:	device_remove_file(gp2a->proximity_dev, &dev_attr_name);err_proximity_device_create_file4:	device_remove_file(gp2a->proximity_dev, &dev_attr_vendor);err_proximity_device_create_file3:	device_remove_file(gp2a->proximity_dev, &dev_attr_prox_avg);err_proximity_device_create_file2:	device_remove_file(gp2a->proximity_dev, &dev_attr_state);err_proximity_device_create_file1:	sensors_classdev_unregister(gp2a->proximity_dev);err_proximity_device_create:	gpio_free(pdata->p_out);err_setup_irq:err_no_device:	sysfs_remove_group(&gp2a->input_dev->dev.kobj,			   &proximity_attribute_group);	wake_lock_destroy(&gp2a->prx_wake_lock);err_sysfs_create_group_proximity:	input_unregister_device(gp2a->input_dev);error_setup_reg:	destroy_workqueue(gp2a->prox_wq);err_create_prox_workqueue:	kfree(gp2a);	return err;}
开发者ID:ARMP,项目名称:ARMP-i9300,代码行数:101,


示例12: gpio_keys_probe

//.........这里部分代码省略.........    input->dev.parent = &pdev->dev;#ifdef CONFIG_SENSORS_HALL    input->evbit[0] |= BIT_MASK(EV_SW);    input_set_capability(input, EV_SW, SW_FLIP);#endif    input->open = gpio_keys_open;    input->close = gpio_keys_close;    input->id.bustype = BUS_HOST;    input->id.vendor = 0x0001;    input->id.product = 0x0001;    input->id.version = 0x0100;    /* Enable auto repeat feature of Linux input subsystem */    if (pdata->rep)        __set_bit(EV_REP, input->evbit);    for (i = 0; i < pdata->nbuttons; i++) {        button = &pdata->buttons[i];        bdata = &ddata->data[i];        error = gpio_keys_setup_key(pdev, input, bdata, button);        if (error)            goto fail2;        if (button->wakeup)            wakeup = 1;    }#ifdef KEY_BOOSTER    error = gpio_key_init_dvfs(bdata);    if (error < 0) {        dev_err(dev, "Fail get dvfs level for touch booster/n");        goto fail2;    }#endif    error = sysfs_create_group(&pdev->dev.kobj, &gpio_keys_attr_group);    if (error) {        dev_err(dev, "Unable to export keys/switches, error: %d/n",                error);        goto fail2;    }    error = input_register_device(input);    if (error) {        dev_err(dev, "Unable to register input device, error: %d/n",                error);        goto fail3;    }    /* get current state of buttons that are connected to GPIOs */    for (i = 0; i < pdata->nbuttons; i++) {        struct gpio_button_data *bdata = &ddata->data[i];        if (gpio_is_valid(bdata->button->gpio))            gpio_keys_gpio_report_event(bdata);    }    input_sync(input);#ifdef CONFIG_SENSORS_HALL    sec_key = device_create(sec_class, NULL, 0, NULL, "sec_key");    if (IS_ERR(sec_key))        pr_err("Failed to create device(sec_key)!/n");    ret = device_create_file(sec_key, &dev_attr_hall_detect);    if (ret < 0) {        pr_err("Failed to create device file(%s)!, error: %d/n",               dev_attr_hall_detect.attr.name, ret);    }    ret = device_create_file(sec_key, &dev_attr_sec_key_pressed);    if (ret) {        pr_err("Failed to create device file in sysfs entries(%s)!/n",               dev_attr_sec_key_pressed.attr.name);    }    ret = device_create_file(sec_key, &dev_attr_wakeup_keys);    if (ret < 0) {        pr_err("Failed to create device file(%s), error: %d/n",               dev_attr_wakeup_keys.attr.name, ret);    }    dev_set_drvdata(sec_key, ddata);#endif    device_init_wakeup(&pdev->dev, 1);    return 0;fail3:    sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group);fail2:    while (--i >= 0)        gpio_remove_key(&ddata->data[i]);    platform_set_drvdata(pdev, NULL);fail1:    input_free_device(input);    kfree(ddata);    /* If we have no platform_data, we allocated buttons dynamically. */    if (!pdev->dev.platform_data)        kfree(pdata->buttons);    return error;}
开发者ID:carlos4,项目名称:android_kernel_samsung_jfltevzw,代码行数:101,


示例13: lenovo_remove_cptkbd

static void lenovo_remove_cptkbd(struct hid_device *hdev){	sysfs_remove_group(&hdev->dev.kobj,			&lenovo_attr_group_cptkbd);}
开发者ID:Kirill2013,项目名称:kasan,代码行数:5,


示例14: adp8860_probe

static int __devinit adp8860_probe(struct i2c_client *client,					const struct i2c_device_id *id){	struct backlight_device *bl;	struct adp8860_bl *data;	struct adp8860_backlight_platform_data *pdata =		client->dev.platform_data;	struct backlight_properties props;	uint8_t reg_val;	int ret;	if (!i2c_check_functionality(client->adapter,					I2C_FUNC_SMBUS_BYTE_DATA)) {		dev_err(&client->dev, "SMBUS Byte Data not Supported/n");		return -EIO;	}	if (!pdata) {		dev_err(&client->dev, "no platform data?/n");		return -EINVAL;	}	data = kzalloc(sizeof(*data), GFP_KERNEL);	if (data == NULL)		return -ENOMEM;	ret = adp8860_read(client, ADP8860_MFDVID, &reg_val);	if (ret < 0)		goto out2;	switch (ADP8860_MANID(reg_val)) {	case ADP8863_MANUFID:		data->gdwn_dis = !!pdata->gdwn_dis;	case ADP8860_MANUFID:		data->en_ambl_sens = !!pdata->en_ambl_sens;		break;	case ADP8861_MANUFID:		data->gdwn_dis = !!pdata->gdwn_dis;		break;	default:		dev_err(&client->dev, "failed to probe/n");		ret = -ENODEV;		goto out2;	}	/* It's confirmed that the DEVID field is actually a REVID */	data->revid = ADP8860_DEVID(reg_val);	data->client = client;	data->pdata = pdata;	data->id = id->driver_data;	data->current_brightness = 0;	i2c_set_clientdata(client, data);	memset(&props, 0, sizeof(props));	props.max_brightness = ADP8860_MAX_BRIGHTNESS;	mutex_init(&data->lock);	bl = backlight_device_register(dev_driver_string(&client->dev),			&client->dev, data, &adp8860_bl_ops, &props);	if (IS_ERR(bl)) {		dev_err(&client->dev, "failed to register backlight/n");		ret = PTR_ERR(bl);		goto out2;	}	bl->props.max_brightness =		bl->props.brightness = ADP8860_MAX_BRIGHTNESS;	data->bl = bl;	if (data->en_ambl_sens)		ret = sysfs_create_group(&bl->dev.kobj,			&adp8860_bl_attr_group);	if (ret) {		dev_err(&client->dev, "failed to register sysfs/n");		goto out1;	}	ret = adp8860_bl_setup(bl);	if (ret) {		ret = -EIO;		goto out;	}	backlight_update_status(bl);	dev_info(&client->dev, "%s Rev.%d Backlight/n",		client->name, data->revid);	if (pdata->num_leds)		adp8860_led_probe(client);	return 0;out:	if (data->en_ambl_sens)		sysfs_remove_group(&data->bl->dev.kobj,//.........这里部分代码省略.........
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:101,


示例15: usb_notify_dev_unregister

void usb_notify_dev_unregister(struct usb_notify_dev *udev){	sysfs_remove_group(&udev->dev->kobj, &usb_notify_attr_grp);	device_destroy(usb_notify_data.usb_notify_class, MKDEV(0, udev->index));	dev_set_drvdata(udev->dev, NULL);}
开发者ID:MikeForeskin,项目名称:Vindicator-S6,代码行数:6,


示例16: hall_probe

static int hall_probe(struct platform_device *pdev){	struct device *dev = &pdev->dev;	struct hall_drvdata *ddata;	struct input_dev *input;	int error;	int wakeup = 0;	ddata = kzalloc(sizeof(struct hall_drvdata), GFP_KERNEL);	if (!ddata) {		dev_err(dev, "failed to allocate state/n");		return -ENOMEM;	}#ifdef CONFIG_OF	if(dev->of_node) {		error = of_hall_data_parsing_dt(ddata);		if (error < 0) {			pr_info("%s : fail to get the dt (HALL)/n", __func__);			goto fail1;		}	}#endif	input = input_allocate_device();	if (!input) {		dev_err(dev, "failed to allocate state/n");		error = -ENOMEM;		goto fail1;	}	ddata->input = input;	wake_lock_init(&ddata->flip_wake_lock, WAKE_LOCK_SUSPEND,		"flip wake lock");	platform_set_drvdata(pdev, ddata);	input_set_drvdata(input, ddata);	input->name = "hall";	input->phys = "hall";	input->dev.parent = &pdev->dev;	input->evbit[0] |= BIT_MASK(EV_SW);	input_set_capability(input, EV_SW, SW_LID);	input->open = hall_open;	input->close = hall_close;	/* Enable auto repeat feature of Linux input subsystem */	__set_bit(EV_REP, input->evbit);#ifdef CONFIG_SENSORS_HALL_IRQ_CTRL	mutex_init(&ddata->irq_lock);	ddata->gsm_area = false;	ddata->cover_state = false;	g_drvdata = ddata;#endif	init_hall_ic_irq(input);	error = sysfs_create_group(&sec_key->kobj, &hall_attr_group);	if (error) {		dev_err(dev, "Unable to export keys/switches, error: %d/n",			error);		goto fail2;	}	error = input_register_device(input);	if (error) {		dev_err(dev, "Unable to register input device, error: %d/n",			error);		goto fail3;	}	device_init_wakeup(&pdev->dev, wakeup);	return 0; fail3:	sysfs_remove_group(&pdev->dev.kobj, &hall_attr_group); fail2:	platform_set_drvdata(pdev, NULL);	wake_lock_destroy(&ddata->flip_wake_lock);	input_free_device(input); fail1:	kfree(ddata);	return error;}
开发者ID:Fevax,项目名称:kernel_samsung_exynos5422,代码行数:91,


示例17: pccard_sysfs_remove_socket

void pccard_sysfs_remove_socket(struct device *dev){	sysfs_remove_bin_file(&dev->kobj, &pccard_cis_attr);	sysfs_remove_group(&dev->kobj, &socket_attrs);}
开发者ID:AdrianHuang,项目名称:uclinux-robutest,代码行数:5,


示例18: sysaufs_fin

void sysaufs_fin(void){	dbgaufs_fin();	sysfs_remove_group(&sysaufs_ket->kobj, sysaufs_attr_group);	kset_unregister(sysaufs_ket);}
开发者ID:ArthySundaram,项目名称:firstrepo,代码行数:6,


示例19: s3c_hwmon_remove_raw

static inline void s3c_hwmon_remove_raw(struct device *dev){	sysfs_remove_group(&dev->kobj, &s3c_hwmon_attrgroup);}
开发者ID:03199618,项目名称:linux,代码行数:4,


示例20: igbuio_pci_probe

//.........这里部分代码省略.........		udev->info.irq = 0;		break;	default:		dev_err(&dev->dev, "invalid IRQ mode %u",			igbuio_intr_mode_preferred);		err = -EINVAL;		goto fail_release_iomem;	}	err = sysfs_create_group(&dev->dev.kobj, &dev_attr_grp);	if (err != 0)		goto fail_release_iomem;	/* initialize the corresponding netdev */	netdev = alloc_etherdev(sizeof(struct net_adapter));	if (!netdev) {		err = -ENOMEM;		goto fail_alloc_etherdev;	}	SET_NETDEV_DEV(netdev, pci_dev_to_dev(dev));	adapter = netdev_priv(netdev);	adapter->netdev = netdev;	adapter->pdev = dev;	udev->adapter = adapter;	adapter->type = retrieve_dev_specs(id);	/* recover device-specific mac address */	switch (adapter->type) {	case IXGBE:		hw_i = &adapter->hw._ixgbe_hw;		hw_i->back = adapter;		hw_i->hw_addr = ioremap(pci_resource_start(dev, 0),				       pci_resource_len(dev, 0));		if (!hw_i->hw_addr) {			err = -EIO;			goto fail_ioremap;		}		break;	case IGB:		hw_e = &adapter->hw._e1000_hw;		hw_e->back = adapter;		hw_e->hw_addr = ioremap(pci_resource_start(dev, 0),				      pci_resource_len(dev, 0));		if (!hw_e->hw_addr) {			err = -EIO;			goto fail_ioremap;		}		break;	}	netdev_assign_netdev_ops(netdev);	strncpy(netdev->name, pci_name(dev), sizeof(netdev->name) - 1);	retrieve_dev_addr(netdev, adapter);	strcpy(netdev->name, "dpdk%d");	err = register_netdev(netdev);	if (err)		goto fail_ioremap;	adapter->netdev_registered = true;		if (sscanf(netdev->name, "dpdk%hu", &adapter->bd_number) <= 0)		goto fail_bdnumber;	//printk(KERN_DEBUG "ifindex picked: %hu/n", adapter->bd_number);	dev_info(&dev->dev, "ifindex picked: %hu/n", adapter->bd_number);	/* register uio driver */	err = uio_register_device(&dev->dev, &udev->info);	if (err != 0)		goto fail_remove_group;	pci_set_drvdata(dev, udev);	dev_info(&dev->dev, "uio device registered with irq %lx/n",		 udev->info.irq);	/* reset nstats */	memset(&adapter->nstats, 0, sizeof(struct net_device_stats));	return 0; fail_bdnumber: fail_ioremap:	free_netdev(netdev); fail_alloc_etherdev:	pci_release_selected_regions(dev,                                     pci_select_bars(dev, IORESOURCE_MEM));fail_remove_group:	sysfs_remove_group(&dev->dev.kobj, &dev_attr_grp);fail_release_iomem:	igbuio_pci_release_iomem(&udev->info);	if (udev->mode == RTE_INTR_MODE_MSIX)		pci_disable_msix(udev->pdev);	pci_release_regions(dev);fail_disable:	pci_disable_device(dev);fail_free:	kfree(udev);	return err;}
开发者ID:Cppowboy,项目名称:mtcp,代码行数:101,


示例21: k3_bq24161_charger_probe

//.........这里部分代码省略.........	ret = blockmux_set(di->piomux_block, di->pblock_config, NORMAL);	if (ret) {		dev_err(&client->dev, "blockmux_set NORMAL failed, ret=%d/n", ret);		goto err_kfree;	}#endif    /*set gpio_074 to control CD pin to disable/enable bq24161 IC*/	ret = gpio_request(di->gpio, "gpio_074_cd");	if (ret) {		dev_err(&client->dev, "could not request irq/n");		ret = -ENOMEM;		goto err_io;	}	 /* set charger CD pin to low level and enable it to supply power normally*/	gpio_direction_output(di->gpio, 0);	 /**********ADD BY 00186176 END****************/	di->enable_low_chg = ENABLE_LOW_CHG;	/*enable low charge,100mA charging*/	k3_bq24161_config_safety_reg(di);	/*disable charge current termination*/	di->enable_iterm = DISABLE_ITERM;	di->factory_flag = 0;	di->enable_ce = ENABLE_CE;	di->hz_mode = 0;	di->cd_active = 0;#if BQ2416X_USE_WAKE_LOCK	wake_lock_init(&di->charger_wake_lock, WAKE_LOCK_SUSPEND, "charger_wake_lock");#endif	INIT_DELAYED_WORK(&di->bq24161_charger_work,				k3_bq24161_charger_work);	INIT_WORK(&di->usb_work, k3_bq24161_usb_charger_work);	di->active = 0;	di->params.enable = 1;	di->cfg_params = 1;	/*di->enable_iterm = 1;*/	k3_bq24161_config_control_reg(di);	k3_bq24161_config_voltage_reg(di);	k3_bq24161_config_current_reg(di);	k3_bq24161_config_dppm_voltage_reg(di, di->dppm_voltagemV);	k3_bq24161_config_safety_reg(di);	ret = sysfs_create_group(&client->dev.kobj, &k3_bq24161_attr_group);	if (ret) {		dev_err(&client->dev, "could not create sysfs files/n");		goto err_gpio;	}	/**********ADD BY 00186176 begin****************/	di->nb.notifier_call = k3_bq24161_usb_notifier_call;	ret = hiusb_charger_registe_notifier(&di->nb);	if (ret < 0) {		dev_err(&client->dev, "hiusb_charger_registe_notifier failed/n");		goto err_sysfs;	}	plugin_stat = get_charger_name();	if ((CHARGER_TYPE_USB == plugin_stat) || (CHARGER_TYPE_NON_STANDARD == plugin_stat)) {		di->event = plugin_stat;		k3_bq24161_start_500mA_charger(di);	} else if (CHARGER_TYPE_BC_USB == plugin_stat) {		k3_bq24161_start_BCUSB_charger(di);	} else if (CHARGER_TYPE_STANDARD == plugin_stat) {		k3_bq24161_start_ac_charger(di);	} else {		k3_bq24161_stop_charger(di);	}	return 0;err_sysfs:	sysfs_remove_group(&client->dev.kobj, &k3_bq24161_attr_group);err_gpio:	gpio_free(di->gpio);err_io:#ifdef CONFIG_GPIO_BAT	if (blockmux_set(di->piomux_block, di->pblock_config, LOWPOWER))		dev_err(&client->dev, "blockmux_set LOWPOWER failed/n");#endif	/**********ADD BY 00186176 END****************/err_kfree:	kfree(di);	di = NULL;	return ret;}
开发者ID:darkspr1te,项目名称:kernel_hws10101l,代码行数:101,


示例22: lenovo_probe_tpkbd

static int lenovo_probe_tpkbd(struct hid_device *hdev){	struct device *dev = &hdev->dev;	struct lenovo_drvdata_tpkbd *data_pointer;	size_t name_sz = strlen(dev_name(dev)) + 16;	char *name_mute, *name_micmute;	int i;	int ret;	/*	 * Only register extra settings against subdevice where input_mapping	 * set drvdata to 1, i.e. the trackpoint.	 */	if (!hid_get_drvdata(hdev))		return 0;	hid_set_drvdata(hdev, NULL);	/* Validate required reports. */	for (i = 0; i < 4; i++) {		if (!hid_validate_values(hdev, HID_FEATURE_REPORT, 4, i, 1))			return -ENODEV;	}	if (!hid_validate_values(hdev, HID_OUTPUT_REPORT, 3, 0, 2))		return -ENODEV;	ret = sysfs_create_group(&hdev->dev.kobj, &lenovo_attr_group_tpkbd);	if (ret)		hid_warn(hdev, "Could not create sysfs group: %d/n", ret);	data_pointer = devm_kzalloc(&hdev->dev,				    sizeof(struct lenovo_drvdata_tpkbd),				    GFP_KERNEL);	if (data_pointer == NULL) {		hid_err(hdev, "Could not allocate memory for driver data/n");		ret = -ENOMEM;		goto err;	}	// set same default values as windows driver	data_pointer->sensitivity = 0xa0;	data_pointer->press_speed = 0x38;	name_mute = devm_kzalloc(&hdev->dev, name_sz, GFP_KERNEL);	name_micmute = devm_kzalloc(&hdev->dev, name_sz, GFP_KERNEL);	if (name_mute == NULL || name_micmute == NULL) {		hid_err(hdev, "Could not allocate memory for led data/n");		ret = -ENOMEM;		goto err;	}	snprintf(name_mute, name_sz, "%s:amber:mute", dev_name(dev));	snprintf(name_micmute, name_sz, "%s:amber:micmute", dev_name(dev));	hid_set_drvdata(hdev, data_pointer);	data_pointer->led_mute.name = name_mute;	data_pointer->led_mute.brightness_get = lenovo_led_brightness_get_tpkbd;	data_pointer->led_mute.brightness_set = lenovo_led_brightness_set_tpkbd;	data_pointer->led_mute.dev = dev;	led_classdev_register(dev, &data_pointer->led_mute);	data_pointer->led_micmute.name = name_micmute;	data_pointer->led_micmute.brightness_get =		lenovo_led_brightness_get_tpkbd;	data_pointer->led_micmute.brightness_set =		lenovo_led_brightness_set_tpkbd;	data_pointer->led_micmute.dev = dev;	led_classdev_register(dev, &data_pointer->led_micmute);	lenovo_features_set_tpkbd(hdev);	return 0;err:	sysfs_remove_group(&hdev->dev.kobj, &lenovo_attr_group_tpkbd);	return ret;}
开发者ID:Kirill2013,项目名称:kasan,代码行数:76,


示例23: gp2a_opt_probe

//.........这里部分代码省略.........	if (device_create_file(gp2a->light_dev,		&dev_attr_light_enable) < 0) {		pr_err("%s: could not create device file(%s)!/n", __func__,		       dev_attr_light_enable.attr.name);		goto err_light_device_create_file2;	}	if (device_create_file(gp2a->light_dev,		&dev_attr_vendor) < 0) {		pr_err("%s: could not create device file(%s)!/n", __func__,		       dev_attr_vendor.attr.name);		goto err_light_device_create_file3;	}	if (device_create_file(gp2a->light_dev,		&dev_attr_name) < 0) {		pr_err("%s: could not create device file(%s)!/n", __func__,		       dev_attr_name.attr.name);		goto err_light_device_create_file4;	}	if (device_create_file(gp2a->light_dev,		&dev_attr_raw_data) < 0) {		pr_err("%s: could not create device file(%s)!/n", __func__,		       dev_attr_raw_data.attr.name);		goto err_light_device_create_file5;	}	dev_set_drvdata(gp2a->proximity_dev, gp2a);	dev_set_drvdata(gp2a->light_dev, gp2a);	device_init_wakeup(&pdev->dev, 1);	if (pdata->gp2a_led_on) {                   pdata->gp2a_led_on(0);               printk(KERN_INFO "[GP2A] gpio_get_value of GPIO(%d) is %d/n",pdata ->power_gpio,                 gpio_get_value(pdata ->power_gpio));	}	/* set initial proximity value as 1 */	input_report_abs(gp2a->proximity_input_dev, ABS_DISTANCE, 1);	input_sync(gp2a->proximity_input_dev);        gp2a_opt_data = gp2a;        	printk(KERN_INFO"[GP2A] %s : probe success!/n", __func__);	return 0;err_light_device_create_file5:	device_remove_file(gp2a->light_dev, &dev_attr_name);err_light_device_create_file4:	device_remove_file(gp2a->light_dev, &dev_attr_vendor);err_light_device_create_file3:	device_remove_file(gp2a->light_dev, &dev_attr_light_enable);err_light_device_create_file2:	device_remove_file(gp2a->light_dev, &dev_attr_lux);err_light_device_create_file1:	device_remove_file(gp2a->proximity_dev, &dev_attr_prox_thresh);err_proximity_device_create_file8:	device_remove_file(gp2a->proximity_dev, &dev_attr_prox_offset_pass);err_proximity_device_create_file7:	device_remove_file(gp2a->proximity_dev, &dev_attr_prox_cal);err_proximity_device_create_file6:	device_remove_file(gp2a->proximity_dev, &dev_attr_name);err_proximity_device_create_file5:	device_remove_file(gp2a->proximity_dev, &dev_attr_vendor);err_proximity_device_create_file4:	device_remove_file(gp2a->proximity_dev, &dev_attr_proximity_enable);err_proximity_device_create_file3:	device_remove_file(gp2a->proximity_dev, &dev_attr_prox_avg);err_proximity_device_create_file2:	device_remove_file(gp2a->proximity_dev, &dev_attr_state);err_proximity_device_create_file1:err_light_device_create:	device_destroy(sensors_class, 0);err_proximity_device_create:	gpio_free(pdata->p_out);err_setup_irq:err_no_device:	wake_lock_destroy(&gp2a->prx_wake_lock);	mutex_destroy(&gp2a->light_mutex);	mutex_destroy(&gp2a->data_mutex);	sysfs_remove_group(&gp2a->light_input_dev->dev.kobj,			   &lightsensor_attribute_group);err_sysfs_create_group_light:	sysfs_remove_group(&gp2a->proximity_input_dev->dev.kobj,			   &proximity_attribute_group);err_sysfs_create_group_proximity:	input_unregister_device(gp2a->light_input_dev);error_setup_reg_light:	input_unregister_device(gp2a->proximity_input_dev);error_setup_reg_prox:	misc_deregister(&gp2a_opt_misc_device);    error_setup_reg_misc:	if (pdata->power_on)		pdata->power_on(0);	kfree(gp2a);	return err;}
开发者ID:PsychoGame,项目名称:android_kernel_samsung_royss_old,代码行数:101,


示例24: bh1721fvc_probe

//.........这里部分代码省略.........	if (!input_dev) {		pr_err("%s: could not allocate input device/n", __func__);		err = -ENOMEM;		goto err_input_allocate_device_light;	}	input_set_drvdata(input_dev, bh1721fvc);	input_dev->name = "light_sensor";	input_set_capability(input_dev, EV_ABS, ABS_MISC);	input_set_abs_params(input_dev, ABS_MISC,		LUX_MIN_VALUE, LUX_MAX_VALUE, 0, 0);	bh1721fvc_dbmsg("registering lightsensor-level input device/n");	err = input_register_device(input_dev);	if (err < 0) {		pr_err("%s: could not register input device/n", __func__);		input_free_device(input_dev);		goto err_input_register_device_light;	}	bh1721fvc->input_dev = input_dev;	err = sysfs_create_group(&input_dev->dev.kobj,		&bh1721fvc_attribute_group);	if (err) {		pr_err("%s: could not create sysfs group/n", __func__);		goto err_sysfs_create_group_light;	}	bh1721fvc->factory_class = class_create(THIS_MODULE, "lightsensor");	if (IS_ERR(bh1721fvc->factory_class)) {		pr_err("Failed to create class(lightsensor)!/n");		err = PTR_ERR(bh1721fvc->factory_class);		goto err_factory_sysfs_create;	}	bh1721fvc->factory_dev = device_create(bh1721fvc->factory_class, NULL,			0, bh1721fvc, "switch_cmd");	if (IS_ERR(bh1721fvc->factory_dev)) {		pr_err("Failed to create device(switch_cmd_dev)!/n");		err = PTR_ERR(bh1721fvc->factory_dev);		goto err_factory_device_create;	}	err = device_create_file(bh1721fvc->factory_dev,			&dev_attr_lightsensor_file_cmd);	if (err < 0) {		pr_err("Failed to create device file(%s)!/n",				dev_attr_lightsensor_file_cmd.attr.name);		goto err_file_cmd_attr_create;	}	err = device_create_file(bh1721fvc->factory_dev,			&dev_attr_lightsensor_file_illuminance);	if (err < 0) {		pr_err("Failed to create device file(%s)!/n",			dev_attr_lightsensor_file_illuminance.attr.name);		goto err_illuminance_attr_create;	}	err = device_create_file(bh1721fvc->factory_dev,			&dev_attr_sensor_info);	if (err < 0) {		pr_err("Failed to create device file(%s)!/n",			dev_attr_sensor_info.attr.name);		goto err_sensor_info_attr_create;	}	printk(KERN_INFO"%s: success!/n", __func__);	goto done;err_sensor_info_attr_create:	device_remove_file(bh1721fvc->factory_dev,			&dev_attr_lightsensor_file_illuminance);err_illuminance_attr_create:	device_remove_file(bh1721fvc->factory_dev,			&dev_attr_lightsensor_file_cmd);err_file_cmd_attr_create:	device_destroy(bh1721fvc->factory_class, 0);err_factory_device_create:	class_destroy(bh1721fvc->factory_class);err_factory_sysfs_create:	sysfs_remove_group(&bh1721fvc->input_dev->dev.kobj,				&bh1721fvc_attribute_group);err_sysfs_create_group_light:	input_unregister_device(bh1721fvc->input_dev);err_input_register_device_light:err_input_allocate_device_light:	destroy_workqueue(bh1721fvc->wq);err_create_workqueue:err_test_lightsensor:	mutex_destroy(&bh1721fvc->lock);err_reset_failed:err_reset_null:	kfree(bh1721fvc);done:	return err;}
开发者ID:1yankeedt,项目名称:D710BST_FL24_Kernel,代码行数:101,



注:本文中的sysfs_remove_group函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ sysfs_streq函数代码示例
C++ sysfs_remove_file函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。