mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-22 11:17:19 +00:00
- Sprinkle some KBD_IS_* and KBD_*_DONE macros in sunkbd_configure() as
a band-aid allowing to call this function savely multiple times, e.g. during sckbdprobe() and sc_probe_unit(). Otherwise calling it a second time results in a non-working keyboard. This needs a lot of more work to actually do the right thing and work like expected. - Let sunkbd_configure() return the number of the found keyboards, i.e. 1 in case probing succeeds, as it's expected. The return values of the keyboard configure functions however currently aren't checked so this doesn't make a difference at the moment. - Use FBSDID.
This commit is contained in:
parent
a831ab3810
commit
3b8c3ece32
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=146475
@ -22,10 +22,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "opt_kbd.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -189,15 +190,21 @@ sunkbd_configure(int flags)
|
||||
{
|
||||
struct sunkbd_softc *sc;
|
||||
|
||||
if (uart_cpu_getdev(UART_DEV_KEYBOARD, &uart_keyboard))
|
||||
return (0);
|
||||
if (uart_probe(&uart_keyboard))
|
||||
return (0);
|
||||
uart_init(&uart_keyboard);
|
||||
if (KBD_IS_CONFIGURED(&sunkbd_softc.sc_kbd))
|
||||
goto found;
|
||||
|
||||
uart_keyboard.type = UART_DEV_KEYBOARD;
|
||||
uart_keyboard.attach = sunkbd_attach;
|
||||
uart_add_sysdev(&uart_keyboard);
|
||||
if (!KBD_IS_INITIALIZED(&sunkbd_softc.sc_kbd)) {
|
||||
if (uart_cpu_getdev(UART_DEV_KEYBOARD, &uart_keyboard))
|
||||
return (0);
|
||||
if (uart_probe(&uart_keyboard))
|
||||
return (0);
|
||||
uart_init(&uart_keyboard);
|
||||
|
||||
uart_keyboard.type = UART_DEV_KEYBOARD;
|
||||
uart_keyboard.attach = sunkbd_attach;
|
||||
uart_add_sysdev(&uart_keyboard);
|
||||
KBD_INIT_DONE(&sunkbd_softc.sc_kbd);
|
||||
}
|
||||
|
||||
if (sunkbd_probe_keyboard(&uart_keyboard) == -1)
|
||||
return (0);
|
||||
@ -215,8 +222,11 @@ sunkbd_configure(int flags)
|
||||
kbd_register(&sc->sc_kbd);
|
||||
|
||||
sc->sc_sysdev = &uart_keyboard;
|
||||
KBD_CONFIG_DONE(&sc->sc_kbd);
|
||||
|
||||
return (0);
|
||||
found:
|
||||
/* Return number of found keyboards. */
|
||||
return (1);
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user