void ev3_output_port_disable_raw_mode(struct ev3_output_port_data * data)
{
	int i;

	sysfs_remove_groups(&data->out_port.dev.kobj, ev3_output_port_raw_groups);
	for (i = 0; i < NUM_GPIO; i++)
		gpio_unexport(data->gpio[i].gpio);
	ev3_output_port_float(data);
}
Example #2
0
static int imanager_hwmon_remove(struct platform_device *pdev)
{
	struct imanager_hwmon_data *data = dev_get_drvdata(&pdev->dev);

	hwmon_device_unregister(data->hwmon_dev);
	sysfs_remove_groups(&pdev->dev.kobj, data->groups);

	return 0;
}
Example #3
0
static int scpi_remove(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	struct scpi_drvinfo *scpi_info = platform_get_drvdata(pdev);

	of_platform_depopulate(dev);
	sysfs_remove_groups(&dev->kobj, versions_groups);
	scpi_free_channels(dev, scpi_info->channels, scpi_info->num_chans);
	platform_set_drvdata(pdev, NULL);

	devm_kfree(dev, scpi_info->channels);
	devm_kfree(dev, scpi_info);
	scpi_info = NULL;

	return 0;
}
Example #4
0
static void bus_remove_groups(struct bus_type *bus,
			      const struct attribute_group **groups)
{
	sysfs_remove_groups(&bus->p->subsys.kobj, groups);
}
Example #5
0
void driver_remove_groups(struct device_driver *drv,
			  const struct attribute_group **groups)
{
	sysfs_remove_groups(&drv->p->kobj, groups);
}
Example #6
0
/*
 * Module stuff
 */
static int imanager_hwmon_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	struct imanager_device_data *ec = dev_get_drvdata(dev->parent);
	struct imanager_hwmon_data *data;
	struct device *hwmon_dev;
	int err, i, num_attr_groups = 0;

	if (!ec) {
		dev_err(dev, "Invalid platform data\n");
		return -EINVAL;
	}

	err = hwm_core_init();
	if (err) {
		dev_err(dev, "Hwmon core init failed\n");
		return -EIO;
	}

	data = devm_kzalloc(dev, sizeof(struct imanager_hwmon_data),
			    GFP_KERNEL);
	if (!data)
		return -ENOMEM;

	data->ec = ec;
	platform_set_drvdata(pdev, data);

	data->adc_num = hwm_core_adc_get_max_count();
	data->fan_num = hwm_core_fan_get_max_count();

	for (i = 0; i < data->fan_num; i++) {
		/* set active fan to automatic speed control */
		hwm_core_fan_set_ctrl(i, MODE_AUTO, CTRL_RPM, 0, 0,
				      NULL, NULL);
		hwm_core_fan_get_ctrl(i, &data->hwm.fan[i]);
	}

	data->groups[num_attr_groups++] = &imanager_group_in;

	if (data->adc_num > 3)
		data->groups[num_attr_groups++] = &imanager_group_other;

	if (data->fan_num)
		data->groups[num_attr_groups++] = &imanager_group_fan;

#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
	err = sysfs_create_groups(&dev->kobj, data->groups);
	if (err < 0)
		return err;

	hwmon_dev = hwmon_device_register(dev);
	if (IS_ERR(hwmon_dev)) {
		sysfs_remove_groups(&dev->kobj, data->groups);
		return PTR_ERR(data->hwmon_dev);
	}
	data->hwmon_dev = hwmon_dev;
#else
	hwmon_dev = devm_hwmon_device_register_with_groups(dev,
				"imanager_hwmon", data, data->groups);
#endif

	return PTR_ERR_OR_ZERO(hwmon_dev);
}