Mercurial > hvf > hvf
view cp/shell/cmd_enable.c @ 650:6fca4100a886
include: change uint64_t LP64 definition to be unsigned long
This matches what is normally used in the Unix world.
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Tue, 30 Jul 2019 14:56:02 -0400 |
parents | 732345b0925c |
children |
line wrap: on
line source
/* * (C) Copyright 2007-2019 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> * * This file is released under the GPLv2. See the COPYING file for more * details. */ /* *!!! ENABLE *!! SYNTAX *! \tok{\sc ENAble} *! \begin{stack} \tok{ALL} \\ <rdev> \end{stack} *!! XATNYS *!! AUTH A *!! PURPOSE *! Enables a real device. */ static int cmd_enable(struct virt_sys *sys, char *cmd, int len) { u64 devnum; struct device *dev; struct console *con; SHELL_CMD_AUTH(sys, A); if (!strcasecmp(cmd, "ALL")) { con_printf(sys->con, "ENABLE ALL not yet implemented!\n"); return 0; } cmd = __extract_hex(cmd, &devnum); if (IS_ERR(cmd)) return PTR_ERR(cmd); /* device number must be 16-bit */ if (devnum & ~0xffffUL) return -EINVAL; dev = find_device_by_ccuu(devnum); if (IS_ERR(dev)) { con_printf(sys->con, "Device %04lX not found in configuration\n", devnum); return 0; } mutex_lock(&dev->lock); if (dev->in_use) { con_printf(sys->con, "Device %04lX is already in use\n", devnum); goto out_err; } if (!dev->dev->enable) { con_printf(sys->con, "Device type %-4s cannot be enabled\n", type2name(dev->type)); goto out_err; } con = dev->dev->enable(dev); if (IS_ERR(con)) { con_printf(sys->con, "Failed to enable %04lX: %s\n", devnum, errstrings[-PTR_ERR(con)]); goto out_err; } mutex_unlock(&dev->lock); return 0; out_err: mutex_unlock(&dev->lock); dev_put(dev); return 0; }