mirror of
https://github.com/torvalds/linux.git
synced 2026-11-10 08:53:02 +01:00
leds: trigger: Move led_trigger_group to the right place
Currently led_trigger_group and its members are placed at led-class.c, but they falls into the triggers namespace and does triggers stuff. Placing them at led-class.c also requires the read and write callback to be exported and results in an extra #ifdef block. Move it into led-triggers.c, so that it becomes the only symbol to be exported for sysfs attributes. Signed-off-by: Rong Zhang <i@rong.moe> Link: https://patch.msgid.link/20260921-leds-trigger-hw-changed-v7-4-fe3cdb6dec51@rong.moe Signed-off-by: Lee Jones <lee@kernel.org>
This commit is contained in:
parent
96b4ddd6d2
commit
43b83e7462
|
|
@ -90,17 +90,6 @@ static ssize_t max_brightness_show(struct device *dev,
|
|||
}
|
||||
static DEVICE_ATTR_RO(max_brightness);
|
||||
|
||||
#ifdef CONFIG_LEDS_TRIGGERS
|
||||
static const BIN_ATTR(trigger, 0644, led_trigger_read, led_trigger_write, 0);
|
||||
static const struct bin_attribute *const led_trigger_bin_attrs[] = {
|
||||
&bin_attr_trigger,
|
||||
NULL,
|
||||
};
|
||||
static const struct attribute_group led_trigger_group = {
|
||||
.bin_attrs = led_trigger_bin_attrs,
|
||||
};
|
||||
#endif
|
||||
|
||||
static struct attribute *led_class_attrs[] = {
|
||||
&dev_attr_brightness.attr,
|
||||
&dev_attr_max_brightness.attr,
|
||||
|
|
|
|||
|
|
@ -52,9 +52,9 @@ bool led_trigger_is_hw_controlled(struct led_classdev *led_cdev)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(led_trigger_is_hw_controlled);
|
||||
|
||||
ssize_t led_trigger_write(struct file *filp, struct kobject *kobj,
|
||||
const struct bin_attribute *bin_attr, char *buf,
|
||||
loff_t pos, size_t count)
|
||||
static ssize_t trigger_write(struct file *filp, struct kobject *kobj,
|
||||
const struct bin_attribute *bin_attr, char *buf,
|
||||
loff_t pos, size_t count)
|
||||
{
|
||||
struct device *dev = kobj_to_dev(kobj);
|
||||
struct led_classdev *led_cdev = dev_get_drvdata(dev);
|
||||
|
|
@ -97,7 +97,6 @@ ssize_t led_trigger_write(struct file *filp, struct kobject *kobj,
|
|||
mutex_unlock(&led_cdev->led_access);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(led_trigger_write);
|
||||
|
||||
__printf(3, 4)
|
||||
static int led_trigger_snprintf(char *buf, ssize_t size, const char *fmt, ...)
|
||||
|
|
@ -149,9 +148,9 @@ static int led_trigger_format(char *buf, size_t size,
|
|||
* attribute, which is not limited by length. This is _not_ good design, do not
|
||||
* copy it.
|
||||
*/
|
||||
ssize_t led_trigger_read(struct file *filp, struct kobject *kobj,
|
||||
const struct bin_attribute *attr, char *buf,
|
||||
loff_t pos, size_t count)
|
||||
static ssize_t trigger_read(struct file *filp, struct kobject *kobj,
|
||||
const struct bin_attribute *attr, char *buf,
|
||||
loff_t pos, size_t count)
|
||||
{
|
||||
struct device *dev = kobj_to_dev(kobj);
|
||||
struct led_classdev *led_cdev = dev_get_drvdata(dev);
|
||||
|
|
@ -179,7 +178,17 @@ ssize_t led_trigger_read(struct file *filp, struct kobject *kobj,
|
|||
|
||||
return len;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(led_trigger_read);
|
||||
static const BIN_ATTR_RW(trigger, 0);
|
||||
|
||||
static const struct bin_attribute *const led_trigger_bin_attrs[] = {
|
||||
&bin_attr_trigger,
|
||||
NULL
|
||||
};
|
||||
|
||||
const struct attribute_group led_trigger_group = {
|
||||
.bin_attrs = led_trigger_bin_attrs,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(led_trigger_group);
|
||||
|
||||
/* Caller must ensure led_cdev->trigger_lock held */
|
||||
int led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)
|
||||
|
|
|
|||
|
|
@ -21,14 +21,9 @@ void led_init_core(struct led_classdev *led_cdev);
|
|||
void led_stop_software_blink(struct led_classdev *led_cdev);
|
||||
void led_set_brightness_nopm(struct led_classdev *led_cdev, unsigned int value);
|
||||
void led_set_brightness_nosleep(struct led_classdev *led_cdev, unsigned int value);
|
||||
ssize_t led_trigger_read(struct file *filp, struct kobject *kobj,
|
||||
const struct bin_attribute *attr, char *buf,
|
||||
loff_t pos, size_t count);
|
||||
ssize_t led_trigger_write(struct file *filp, struct kobject *kobj,
|
||||
const struct bin_attribute *bin_attr, char *buf,
|
||||
loff_t pos, size_t count);
|
||||
|
||||
extern struct rw_semaphore leds_list_lock;
|
||||
extern struct list_head leds_list;
|
||||
extern const struct attribute_group led_trigger_group;
|
||||
|
||||
#endif /* __LEDS_H_INCLUDED */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user