Пример #1
0
static int lm63_remove(struct i2c_client *client)
{
	struct lm63_data *data = i2c_get_clientdata(client);

	hwmon_device_unregister(data->hwmon_dev);
	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);
	}

	kfree(data);
	return 0;
}
Пример #2
0
static int smsc47b397_detach_client(struct i2c_client *client)
{
	struct smsc47b397_data *data = i2c_get_clientdata(client);
	int err;

	hwmon_device_unregister(data->class_dev);

	if ((err = i2c_detach_client(client)))
		return err;

	release_region(client->addr, SMSC_EXTENT);
	kfree(data);

	return 0;
}
Пример #3
0
static int __devexit smsc47m1_remove(struct platform_device *pdev)
{
	struct smsc47m1_data *data = platform_get_drvdata(pdev);
	struct resource *res;

	hwmon_device_unregister(data->hwmon_dev);
	sysfs_remove_group(&pdev->dev.kobj, &smsc47m1_group);

	res = platform_get_resource(pdev, IORESOURCE_IO, 0);
	release_region(res->start, SMSC_EXTENT);
	platform_set_drvdata(pdev, NULL);
	kfree(data);

	return 0;
}
Пример #4
0
static int __devexit da9052_adc_remove(struct platform_device *pdev)
{
	struct da9052_adc_priv *priv = platform_get_drvdata(pdev);

	mutex_destroy(&priv->da9052->manconv_lock);

	hwmon_device_unregister(priv->hwmon_dev);

	sysfs_remove_group(&pdev->dev.kobj, &da9052_group);

	platform_set_drvdata(pdev, NULL);
	kfree(priv);

	return 0;
}
Пример #5
0
static int __devexit s3c_hwmon_remove(struct platform_device *dev)
{
	struct s3c_hwmon *hwmon = platform_get_drvdata(dev);
	int i;

	s3c_hwmon_remove_raw(&dev->dev);

	for (i = 0; i < ARRAY_SIZE(hwmon->attrs); i++)
		s3c_hwmon_remove_attr(&dev->dev, &hwmon->attrs[i]);

	hwmon_device_unregister(hwmon->hwmon_dev);
	s3c_adc_release(hwmon->client);

	return 0;
}
Пример #6
0
static int abx500_temp_probe(struct platform_device *pdev)
{
	struct abx500_temp *data;
	int err;

	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
	if (!data)
		return -ENOMEM;

	data->pdev = pdev;
	mutex_init(&data->lock);

	/* Chip specific initialization */
	err = abx500_hwmon_init(data);
	if (err	< 0 || !data->ops.read_sensor || !data->ops.show_name ||
			!data->ops.show_label)
		return err;

	INIT_DEFERRABLE_WORK(&data->work, gpadc_monitor);

	platform_set_drvdata(pdev, data);

	err = sysfs_create_group(&pdev->dev.kobj, &abx500_temp_group);
	if (err < 0) {
		dev_err(&pdev->dev, "Create sysfs group failed (%d)\n", err);
		return err;
	}

	data->hwmon_dev = hwmon_device_register(&pdev->dev);
	if (IS_ERR(data->hwmon_dev)) {
		err = PTR_ERR(data->hwmon_dev);
		dev_err(&pdev->dev, "Class registration failed (%d)\n", err);
		goto exit_sysfs_group;
	}

	if (data->ops.irq_handler) {
		err = setup_irqs(pdev);
		if (err < 0)
			goto exit_hwmon_reg;
	}
	return 0;

exit_hwmon_reg:
	hwmon_device_unregister(data->hwmon_dev);
exit_sysfs_group:
	sysfs_remove_group(&pdev->dev.kobj, &abx500_temp_group);
	return err;
}
Пример #7
0
static int __devinit lm70_probe(struct spi_device *spi)
{
    int chip = spi_get_device_id(spi)->driver_data;
    struct lm70 *p_lm70;
    int status;

    /* signaling is SPI_MODE_0 for both LM70 and TMP121 */
    if (spi->mode & (SPI_CPOL | SPI_CPHA))
        return -EINVAL;

    /* 3-wire link (shared SI/SO) for LM70 */
    if (chip == LM70_CHIP_LM70 && !(spi->mode & SPI_3WIRE))
        return -EINVAL;

    /* NOTE:  we assume 8-bit words, and convert to 16 bits manually */

    p_lm70 = kzalloc(sizeof *p_lm70, GFP_KERNEL);
    if (!p_lm70)
        return -ENOMEM;

    mutex_init(&p_lm70->lock);
    p_lm70->chip = chip;

    /* sysfs hook */
    p_lm70->hwmon_dev = hwmon_device_register(&spi->dev);
    if (IS_ERR(p_lm70->hwmon_dev)) {
        dev_dbg(&spi->dev, "hwmon_device_register failed.\n");
        status = PTR_ERR(p_lm70->hwmon_dev);
        goto out_dev_reg_failed;
    }
    dev_set_drvdata(&spi->dev, p_lm70);

    if ((status = device_create_file(&spi->dev, &dev_attr_temp1_input))
            || (status = device_create_file(&spi->dev, &dev_attr_name))) {
        dev_dbg(&spi->dev, "device_create_file failure.\n");
        goto out_dev_create_file_failed;
    }

    return 0;

out_dev_create_file_failed:
    device_remove_file(&spi->dev, &dev_attr_temp1_input);
    hwmon_device_unregister(p_lm70->hwmon_dev);
out_dev_reg_failed:
    dev_set_drvdata(&spi->dev, NULL);
    kfree(p_lm70);
    return status;
}
static int __devexit abituguru_remove(struct platform_device *pdev)
{
    int i;
    struct abituguru_data *data = platform_get_drvdata(pdev);

    hwmon_device_unregister(data->hwmon_dev);
    for (i = 0; data->sysfs_attr[i].dev_attr.attr.name; i++)
        device_remove_file(&pdev->dev, &data->sysfs_attr[i].dev_attr);
    for (i = 0; i < ARRAY_SIZE(abituguru_sysfs_attr); i++)
        device_remove_file(&pdev->dev,
                           &abituguru_sysfs_attr[i].dev_attr);
    platform_set_drvdata(pdev, NULL);
    kfree(data);

    return 0;
}
Пример #9
0
static int __devexit pc87427_remove(struct platform_device *pdev)
{
	struct pc87427_data *data = platform_get_drvdata(pdev);
	int res_count;

	res_count = (data->address[0] != 0) + (data->address[1] != 0);

	hwmon_device_unregister(data->hwmon_dev);
	pc87427_remove_files(&pdev->dev);
	platform_set_drvdata(pdev, NULL);
	kfree(data);

	pc87427_release_regions(pdev, res_count);

	return 0;
}
Пример #10
0
static int __devexit mc32x0_remove(struct i2c_client *client)
{
	int result;

	mutex_lock(&sensor_lock);
	result = i2c_smbus_write_byte_data(client, MC32X0_Mode_Feature_REG, MC32X0_MODE_SLEEP);
	assert(result==0);

	mutex_unlock(&sensor_lock);
	//free_irq(plat_data->irq, NULL);
	free_irq(client->irq, NULL);
	sysfs_remove_group(&client->dev.kobj, &mc32x0_group);
	hwmon_device_unregister(hwmon_dev);

	return result;
}
Пример #11
0
void
nouveau_hwmon_fini(struct drm_device *dev)
{
#if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE))
	struct nouveau_hwmon *hwmon = nouveau_hwmon(dev);

	if (!hwmon)
		return;

	if (hwmon->hwmon)
		hwmon_device_unregister(hwmon->hwmon);

	nouveau_drm(dev)->hwmon = NULL;
	kfree(hwmon);
#endif
}
Пример #12
0
static int acpi_power_meter_remove(struct acpi_device *device, int type)
{
	struct acpi_power_meter_resource *resource;

	if (!device || !acpi_driver_data(device))
		return -EINVAL;

	resource = acpi_driver_data(device);
	hwmon_device_unregister(resource->hwmon_dev);

	free_capabilities(resource);
	remove_attrs(resource);

	kfree(resource);
	return 0;
}
Пример #13
0
static int __devexit i5k_amb_remove(struct platform_device *pdev)
{
	int i;
	struct i5k_amb_data *data = platform_get_drvdata(pdev);

	hwmon_device_unregister(data->hwmon_dev);
	device_remove_file(&pdev->dev, &dev_attr_name);
	for (i = 0; i < data->num_attrs; i++)
		device_remove_file(&pdev->dev, &data->attrs[i].s_attr.dev_attr);
	kfree(data->attrs);
	iounmap(data->amb_mmio);
	release_mem_region(data->amb_base, data->amb_len);
	platform_set_drvdata(pdev, NULL);
	kfree(data);
	return 0;
}
Пример #14
0
static void igb_sysfs_del_adapter(struct igb_adapter *adapter)
{
	int i;

	if (adapter == NULL)
		return;

	for (i = 0; i < adapter->igb_hwmon_buff.n_hwmon; i++) {
		device_remove_file(&adapter->pdev->dev,
			   &adapter->igb_hwmon_buff.hwmon_list[i].dev_attr);
	}

	kfree(adapter->igb_hwmon_buff.hwmon_list);

	if (adapter->igb_hwmon_buff.device)
		hwmon_device_unregister(adapter->igb_hwmon_buff.device);
}
Пример #15
0
static int __devexit axp_mfd_remove(struct i2c_client *client)
{
	struct axp_mfd_chip *chip = i2c_get_clientdata(client);

	pm_power_off = NULL;
	axp = NULL;

#ifdef CONFIG_AXP_HWMON
	if (chip->itm_enabled == 1) {
		hwmon_device_unregister(chip->hwmon_dev);
		sysfs_remove_group(&client->dev.kobj, &axp20_group);
	}
#endif

	axp_mfd_remove_subdevs(chip);
	kfree(chip);
	return 0;
}
Пример #16
0
static void psh_remove(struct pci_dev *pdev)
{
	struct psh_ia_priv *ia_data =
			(struct psh_ia_priv *)dev_get_drvdata(&pdev->dev);
	struct psh_plt_priv *plt_priv =
			(struct psh_plt_priv *)ia_data->platform_priv;

	psh_imr_free(plt_priv->imr_src, plt_priv->ddr, BUF_IA_DDR_SIZE);
	psh_imr_free(plt_priv->imr_src, plt_priv->imr2, APP_IMR_SIZE);

	intel_psh_ipc_unbind(PSH_RECV_CH0);

	hwmon_device_unregister(plt_priv->hwmon_dev);

	kfree(plt_priv);

	psh_ia_common_deinit(&pdev->dev);
}
Пример #17
0
static int tmp102_remove(struct i2c_client *client)
{
	struct tmp102 *tmp102 = i2c_get_clientdata(client);

	thermal_zone_of_sensor_unregister(tmp102->hwmon_dev, tmp102->tz);
	hwmon_device_unregister(tmp102->hwmon_dev);

	/* Stop monitoring if device was stopped originally */
	if (tmp102->config_orig & TMP102_CONF_SD) {
		int config;

		config = i2c_smbus_read_word_swapped(client, TMP102_CONF_REG);
		if (config >= 0)
			i2c_smbus_write_word_swapped(client, TMP102_CONF_REG,
						     config | TMP102_CONF_SD);
	}

	return 0;
}
Пример #18
0
static void ixgbe_sysfs_del_adapter(struct ixgbe_adapter __maybe_unused *adapter)
{
#ifdef IXGBE_HWMON
	int i;

	if (adapter == NULL)
		return;

	for (i = 0; i < adapter->ixgbe_hwmon_buff.n_hwmon; i++) {
		device_remove_file(pci_dev_to_dev(adapter->pdev),
			   &adapter->ixgbe_hwmon_buff.hwmon_list[i].dev_attr);
	}

	kfree(adapter->ixgbe_hwmon_buff.hwmon_list);

	if (adapter->ixgbe_hwmon_buff.device)
		hwmon_device_unregister(adapter->ixgbe_hwmon_buff.device);
#endif /* IXGBE_HWMON */
}
Пример #19
0
static int __devexit f71805f_remove(struct platform_device *pdev)
{
	struct f71805f_data *data = platform_get_drvdata(pdev);
	struct resource *res;
	int i;

	hwmon_device_unregister(data->hwmon_dev);
	sysfs_remove_group(&pdev->dev.kobj, &f71805f_group);
	for (i = 0; i < 4; i++)
		sysfs_remove_group(&pdev->dev.kobj, &f71805f_group_optin[i]);
	sysfs_remove_group(&pdev->dev.kobj, &f71805f_group_pwm_freq);
	platform_set_drvdata(pdev, NULL);
	kfree(data);

	res = platform_get_resource(pdev, IORESOURCE_IO, 0);
	release_region(res->start + ADDR_REG_OFFSET, 2);

	return 0;
}
Пример #20
0
static int tmp401_remove(struct i2c_client *client)
{
	struct tmp401_data *data = i2c_get_clientdata(client);
	int i;

	if (data->hwmon_dev)
		hwmon_device_unregister(data->hwmon_dev);

	for (i = 0; i < ARRAY_SIZE(tmp401_attr); i++)
		device_remove_file(&client->dev, &tmp401_attr[i].dev_attr);

	if (data->kind == tmp411) {
		for (i = 0; i < ARRAY_SIZE(tmp411_attr); i++)
			device_remove_file(&client->dev,
					   &tmp411_attr[i].dev_attr);
	}

	return 0;
}
Пример #21
0
void
nouveau_hwmon_fini(struct drm_device *dev)
{
#if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE))
	struct nouveau_hwmon *hwmon = nouveau_hwmon(dev);

	if (hwmon->hwmon) {
		sysfs_remove_group(&hwmon->hwmon->kobj, &hwmon_default_attrgroup);
		sysfs_remove_group(&hwmon->hwmon->kobj, &hwmon_temp_attrgroup);
		sysfs_remove_group(&hwmon->hwmon->kobj, &hwmon_pwm_fan_attrgroup);
		sysfs_remove_group(&hwmon->hwmon->kobj, &hwmon_fan_rpm_attrgroup);

		hwmon_device_unregister(hwmon->hwmon);
	}

	nouveau_drm(dev)->hwmon = NULL;
	kfree(hwmon);
#endif
}
Пример #22
0
static int __devexit tmp102_remove(struct i2c_client *client)
{
	struct tmp102 *tmp102 = i2c_get_clientdata(client);

	hwmon_device_unregister(tmp102->hwmon_dev);
	sysfs_remove_group(&client->dev.kobj, &tmp102_attr_group);

	/*                                                  */
	if (tmp102->config_orig & TMP102_CONF_SD) {
		int config;

		config = i2c_smbus_read_word_swapped(client, TMP102_CONF_REG);
		if (config >= 0)
			i2c_smbus_write_word_swapped(client, TMP102_CONF_REG,
						     config | TMP102_CONF_SD);
	}

	kfree(tmp102);

	return 0;
}
Пример #23
0
static int __devexit tmp102_remove(struct i2c_client *client)
{
	struct tmp102 *tmp102 = i2c_get_clientdata(client);

	hwmon_device_unregister(tmp102->hwmon_dev);
	sysfs_remove_group(&client->dev.kobj, &tmp102_attr_group);

	/* Stop monitoring if device was stopped originally */
	if (tmp102->config_orig & TMP102_CONF_SD) {
		int config;

		config = tmp102_read_reg(client, TMP102_CONF_REG);
		if (config >= 0)
			tmp102_write_reg(client, TMP102_CONF_REG,
					 config | TMP102_CONF_SD);
	}

	kfree(tmp102);

	return 0;
}
Пример #24
0
static int __devexit sht15_remove(struct platform_device *pdev)
{
	struct sht15_data *data = platform_get_drvdata(pdev);

	
	mutex_lock(&data->read_lock);
	hwmon_device_unregister(data->hwmon_dev);
	sysfs_remove_group(&pdev->dev.kobj, &sht15_attr_group);
	if (!IS_ERR(data->reg)) {
		regulator_unregister_notifier(data->reg, &data->nb);
		regulator_disable(data->reg);
		regulator_put(data->reg);
	}

	free_irq(gpio_to_irq(data->pdata->gpio_data), data);
	gpio_free(data->pdata->gpio_data);
	gpio_free(data->pdata->gpio_sck);
	mutex_unlock(&data->read_lock);
	kfree(data);
	return 0;
}
static int mag3110_remove(struct i2c_client *client)
{
	struct mag3110_data *data;
	int ret;

	data = i2c_get_clientdata(client);

	data->ctl_reg1 = mag3110_read_reg(client, MAG3110_CTRL_REG1);
	ret = mag3110_write_reg(client, MAG3110_CTRL_REG1,
				data->ctl_reg1 & ~MAG3110_AC_MASK);

	free_irq(client->irq, data);
	input_unregister_polled_device(data->poll_dev);
	input_free_polled_device(data->poll_dev);
	hwmon_device_unregister(data->hwmon_dev);
	sysfs_remove_group(&client->dev.kobj, &mag3110_attr_group);
	kfree(data);
	mag3110_pdata = NULL;

	return ret;
}
Пример #26
0
static int __devexit pc87427_remove(struct platform_device *pdev)
{
	struct pc87427_data *data = platform_get_drvdata(pdev);
	struct resource *res;
	int i;

	hwmon_device_unregister(data->hwmon_dev);
	device_remove_file(&pdev->dev, &dev_attr_name);
	for (i = 0; i < 8; i++) {
		if (!(data->fan_enabled & (1 << i)))
			continue;
		sysfs_remove_group(&pdev->dev.kobj, &pc87427_group_fan[i]);
	}
	platform_set_drvdata(pdev, NULL);
	kfree(data);

	res = platform_get_resource(pdev, IORESOURCE_IO, 0);
	release_region(res->start, resource_size(res));

	return 0;
}
Пример #27
0
static int sfh7225_ls_probe(struct platform_device *pdev)
{
	int status;
	if (IS_ERR(hwmon_device_register(&pdev->dev))) {
		printk(KERN_WARNING "hwmon_device_register failed.\n");
		status = -1;
		goto out_dev_reg_failed;
	}
	status = device_create_file(&pdev->dev, &dev_attr_lightness);
	if (status) {
		printk(KERN_WARNING "device_create_file failed.\n");
		goto out_dev_create_file_failed;
	}
	return 0;

out_dev_create_file_failed:
	device_remove_file(&pdev->dev, &dev_attr_lightness);
	hwmon_device_unregister(&pdev->dev);
out_dev_reg_failed:
	return status;
}
Пример #28
0
static int hwmon_init(void)
{
	int res;

	pwm1_value = -1;
	lensl_hwmon_device = hwmon_device_register(&lensl_pdev->dev);
	if (!lensl_hwmon_device) {
		vdbg_printk(LENSL_ERR, "Failed to register hwmon device\n");
		return -ENODEV;
	}

	res = sysfs_create_group(&lensl_hwmon_device->kobj,
				 &hwmon_attr_group);
	if (res < 0) {
		vdbg_printk(LENSL_ERR, "Failed to create hwmon sysfs group\n");
		hwmon_device_unregister(lensl_hwmon_device);
		lensl_hwmon_device = NULL;
		return -ENODEV;
	}
	vdbg_printk(LENSL_DEBUG, "Initialized hwmon subdriver\n");
	return 0;
}
static int __devexit exynos4_tmu_remove(struct platform_device *pdev)
{
	struct exynos4_tmu_data *data = platform_get_drvdata(pdev);

	exynos4_tmu_control(pdev, false);

	hwmon_device_unregister(data->hwmon_dev);
	sysfs_remove_group(&pdev->dev.kobj, &exynos4_tmu_attr_group);

	clk_put(data->clk);

	free_irq(data->irq, data);

	iounmap(data->base);
	release_mem_region(data->mem->start, resource_size(data->mem));

	platform_set_drvdata(pdev, NULL);

	kfree(data);

	return 0;
}
Пример #30
0
static int yeeloong_hwmon_init(struct device *dev)
{
	int ret;

	yeeloong_hwmon_dev = hwmon_device_register(dev);
	if (IS_ERR(yeeloong_hwmon_dev)) {
		printk(KERN_INFO "unable to register yeeloong hwmon device\n");
		yeeloong_hwmon_dev = NULL;
		return PTR_ERR(yeeloong_hwmon_dev);
	}
	ret = sysfs_create_group(&yeeloong_hwmon_dev->kobj,
				 &hwmon_attribute_group);
	if (ret) {
		sysfs_remove_group(&yeeloong_hwmon_dev->kobj,
				   &hwmon_attribute_group);
		hwmon_device_unregister(yeeloong_hwmon_dev);
		yeeloong_hwmon_dev = NULL;
	}
	/* ensure fan is set to auto mode */
	set_fan_pwm_enable(2);

	return 0;
}