led: Fix and cleanup initialization
The structure returned by readdir is may be statically allocated. Keeping a pointer to it is broken. The LED path is generally not a directory, it's a link to a directory. And even if it were a directory, that would tell nothing about the caller's access permissions. And then there is a lot of duplication between mraa_led_init and mraa_led_init_raw. This addresses that all. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
@@ -273,8 +273,7 @@ struct _iio {
|
||||
struct _led {
|
||||
/*@{*/
|
||||
int count; /**< total LED count in a platform */
|
||||
char *led_name; /**< LED name */
|
||||
char led_path[64]; /**< sysfs path of the LED */
|
||||
const char *led_path; /**< sysfs path of the LED */
|
||||
int trig_fd; /**< trigger file descriptor */
|
||||
int bright_fd; /**< brightness file descriptor */
|
||||
int max_bright_fd; /**< maximum brightness file descriptor */
|
||||
|
||||
Reference in New Issue
Block a user