2 * (C) Copyright 2007-2010 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
4 * This file is released under the GPLv2. See the COPYING file for more
12 *! \begin{stack} \tok{ALL} \\ <rdev> \end{stack}
16 *! Enables a real device.
18 static int cmd_enable(struct virt_sys
*sys
, char *cmd
, int len
)
24 SHELL_CMD_AUTH(sys
, A
);
26 if (!strcasecmp(cmd
, "ALL")) {
27 con_printf(sys
->con
, "ENABLE ALL not yet implemented!\n");
31 cmd
= __extract_hex(cmd
, &devnum
);
35 /* device number must be 16-bit */
36 if (devnum
& ~0xffffUL
)
39 dev
= find_device_by_ccuu(devnum
);
41 con_printf(sys
->con
, "Device %04llX not found in configuration\n", devnum
);
45 mutex_lock(&dev
->lock
);
48 con_printf(sys
->con
, "Device %04llX is already in use\n", devnum
);
52 if (!dev
->dev
->enable
) {
53 con_printf(sys
->con
, "Device type %-4s cannot be enabled\n",
54 type2name(dev
->type
));
58 con
= dev
->dev
->enable(dev
);
60 con_printf(sys
->con
, "Failed to enable %04llX: %s\n",
61 devnum
, errstrings
[-PTR_ERR(con
)]);
65 mutex_unlock(&dev
->lock
);
69 mutex_unlock(&dev
->lock
);