Commit 0ea58e5b authored by Pekka Enberg's avatar Pekka Enberg Committed by Will Deacon
Browse files

kvm tools: Make code mostly checkpatch clean



This patch fixes code style issues pointed out by scripts/checkpatch. However,
some reported errors are false positives. In particular, the warning:

  WARNING: line over 80 characters

is too strict for our code and thus needs to action to be taken.

Signed-off-by: default avatarPekka Enberg <penberg@kernel.org>
parent d6c58e5b
......@@ -184,9 +184,10 @@ static bool serial8250_out(struct kvm *self, uint16_t port, void *data, int size
switch (offset) {
case UART_TX: {
char *addr = data;
if (!(dev->mcr & UART_MCR_LOOP)) {
if (!(dev->mcr & UART_MCR_LOOP))
term_putc(CONSOLE_8250, addr, size * count);
}
dev->iir = UART_IIR_NO_INT;
break;
}
......
......@@ -7,17 +7,18 @@
/* user defined header files */
#include <kvm/kvm-cmd.h>
/* kvm_get_command: Searches the command in an array of the commands and
returns a pointer to cmd_struct if a match is found.
Input parameters:
command: Array of possible commands. The last entry in the array must be
NULL.
cmd: A string command to search in the array
Return Value:
NULL: If the cmd is not matched with any of the command in the command array
p: Pointer to cmd_struct of the matching command
/*
* kvm_get_command: Searches the command in an array of the commands and
* returns a pointer to cmd_struct if a match is found.
*
* Input parameters:
* command: Array of possible commands. The last entry in the array must be
* NULL.
* cmd: A string command to search in the array
*
* Return Value:
* NULL: If the cmd is not matched with any of the command in the command array
* p: Pointer to cmd_struct of the matching command
*/
static struct cmd_struct *kvm_get_command(struct cmd_struct *command,
const char *cmd)
......
......@@ -52,8 +52,8 @@ static const char *kernel_filename;
static const char *initrd_filename;
static const char *image_filename;
static const char *kvm_dev;
static bool single_step = false;
static bool virtio_console = false;
static bool single_step;
static bool virtio_console;
extern bool ioport_debug;
extern int active_console;
......
......@@ -299,12 +299,11 @@ static bool load_bzimage(struct kvm *self, int fd_kernel,
if (read(fd_kernel, &boot, sizeof(boot)) != sizeof(boot))
return false;
if (memcmp(&boot.hdr.header, BZIMAGE_MAGIC, strlen(BZIMAGE_MAGIC)))
if (memcmp(&boot.hdr.header, BZIMAGE_MAGIC, strlen(BZIMAGE_MAGIC)))
return false;
if (boot.hdr.version < BOOT_PROTOCOL_REQUIRED) {
if (boot.hdr.version < BOOT_PROTOCOL_REQUIRED)
die("Too old kernel");
}
if (lseek(fd_kernel, 0, SEEK_SET) < 0)
die_perror("lseek");
......@@ -820,7 +819,7 @@ void kvm__dump_mem(struct kvm *self, unsigned long addr, unsigned long size)
p = guest_flat_to_host(self, addr);
for (n = 0; n < size; n+=8) {
for (n = 0; n < size; n += 8) {
if (!host_ptr_in_ram(self, p + n))
break;
......
......@@ -30,9 +30,8 @@ int term_putc(int who, char *addr, int cnt)
if (who != active_console)
return -1;
while (cnt--) {
while (cnt--)
fprintf(stdout, "%c", *addr++);
}
fflush(stdout);
return cnt;
......@@ -81,7 +80,7 @@ void term_init(void)
die("unable to save initial standard input settings");
term = orig_term;
term.c_lflag &= ~(ICANON |ECHO | ISIG);
term.c_lflag &= ~(ICANON | ECHO | ISIG);
tcsetattr(STDIN_FILENO, TCSANOW, &term);
atexit(term_cleanup);
......
......@@ -151,12 +151,11 @@ static bool virtio_blk_do_io_request(struct kvm *self, struct virt_queue *queue)
static void virtio_blk_handle_callback(struct kvm *self, uint16_t queue_index)
{
struct virt_queue *vq;
struct virt_queue *vq = &blk_device.vqs[queue_index];
vq = &blk_device.vqs[queue_index];
while (virt_queue__available(vq)) {
while (virt_queue__available(vq))
virtio_blk_do_io_request(self, vq);
}
kvm__irq_line(self, VIRTIO_BLK_IRQ, 1);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment