gpioled_fdt.c (2828dafcf3e7b225b70cbb380eb8c7dae452493e) | gpioled_fdt.c (217d17bcd3f525fbdf124cfbc926f8033da69805) |
---|---|
1/*- 2 * Copyright (c) 2009 Oleksandr Tymoshenko <gonzo@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 75 unchanged lines hidden (view full) --- 84 char *name; 85 int state, err; 86 char *default_state; 87 88 led->parent_sc = sc; 89 90 state = 0; 91 if (OF_getprop_alloc(node, "default-state", | 1/*- 2 * Copyright (c) 2009 Oleksandr Tymoshenko <gonzo@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 75 unchanged lines hidden (view full) --- 84 char *name; 85 int state, err; 86 char *default_state; 87 88 led->parent_sc = sc; 89 90 state = 0; 91 if (OF_getprop_alloc(node, "default-state", |
92 sizeof(char), (void **)&default_state) != -1) { | 92 (void **)&default_state) != -1) { |
93 if (strcasecmp(default_state, "on") == 0) 94 state = 1; 95 else if (strcasecmp(default_state, "off") == 0) 96 state = 0; 97 else if (strcasecmp(default_state, "keep") == 0) 98 state = -1; 99 else { 100 state = -1; 101 device_printf(sc->sc_dev, 102 "unknown value for default-state in FDT\n"); 103 } 104 OF_prop_free(default_state); 105 } 106 107 name = NULL; | 93 if (strcasecmp(default_state, "on") == 0) 94 state = 1; 95 else if (strcasecmp(default_state, "off") == 0) 96 state = 0; 97 else if (strcasecmp(default_state, "keep") == 0) 98 state = -1; 99 else { 100 state = -1; 101 device_printf(sc->sc_dev, 102 "unknown value for default-state in FDT\n"); 103 } 104 OF_prop_free(default_state); 105 } 106 107 name = NULL; |
108 if (OF_getprop_alloc(node, "label", 1, (void **)&name) == -1) 109 OF_getprop_alloc(node, "name", 1, (void **)&name); | 108 if (OF_getprop_alloc(node, "label", (void **)&name) == -1) 109 OF_getprop_alloc(node, "name", (void **)&name); |
110 111 if (name == NULL) { 112 device_printf(sc->sc_dev, 113 "no name provided for gpio LED, skipping\n"); 114 return; 115 } 116 117 err = gpio_pin_get_by_ofw_idx(sc->sc_dev, node, 0, &led->pin); --- 113 unchanged lines hidden --- | 110 111 if (name == NULL) { 112 device_printf(sc->sc_dev, 113 "no name provided for gpio LED, skipping\n"); 114 return; 115 } 116 117 err = gpio_pin_get_by_ofw_idx(sc->sc_dev, node, 0, &led->pin); --- 113 unchanged lines hidden --- |