예제 #1
0
static int __exit bd2802_remove(struct i2c_client *client)
{
	struct bd2802_led *led = i2c_get_clientdata(client);
	int i;

	gpio_set_value(led->pdata->reset_gpio, 0);
	bd2802_unregister_led_classdev(led);
	if (led->adf_on)
		bd2802_disable_adv_conf(led);
	for (i = 0; i < ARRAY_SIZE(bd2802_attributes); i++)
		device_remove_file(&led->client->dev, bd2802_attributes[i]);

	return 0;
}
예제 #2
0
static int __exit bd2802_remove(struct i2c_client *client)
{
	struct bd2802_led *led = i2c_get_clientdata(client);

	bd2802_unregister_led_classdev(led);
	gpio_set_value(led->pdata->reset_gpio, 0);
	if (led->adf_on)
		bd2802_disable_adv_conf(led);
	device_remove_file(&client->dev, &bd2802_adv_conf_attr);
	i2c_set_clientdata(client, NULL);
	kfree(led);

	return 0;
}
예제 #3
0
static ssize_t bd2802_store_adv_conf(struct device *dev,
                                     struct device_attribute *attr, const char *buf, size_t count)
{
    struct bd2802_led *led = i2c_get_clientdata(to_i2c_client(dev));

    if (!count)
        return -EINVAL;

    down_write(&led->rwsem);
    if (!led->adf_on && !strncmp(buf, "on", 2))
        bd2802_enable_adv_conf(led);
    else if (led->adf_on && !strncmp(buf, "off", 3))
        bd2802_disable_adv_conf(led);
    up_write(&led->rwsem);

    return count;
}