From 1c09638b6765969f2468dd82b9c079acaae17e6a Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Fri, 8 Apr 2011 21:54:39 +0300 Subject: [PATCH] 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: Pekka Enberg --- tools/kvm/8250-serial.c | 5 +++-- tools/kvm/kvm-cmd.c | 23 ++++++++++++----------- tools/kvm/kvm-run.c | 4 ++-- tools/kvm/kvm.c | 7 +++---- tools/kvm/term.c | 5 ++--- tools/kvm/virtio-blk.c | 7 +++---- 6 files changed, 25 insertions(+), 26 deletions(-) diff --git a/tools/kvm/8250-serial.c b/tools/kvm/8250-serial.c index 639afb21b32d..9f047ca70eea 100644 --- a/tools/kvm/8250-serial.c +++ b/tools/kvm/8250-serial.c @@ -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; } diff --git a/tools/kvm/kvm-cmd.c b/tools/kvm/kvm-cmd.c index 3c15006f4452..b63e033a4cde 100644 --- a/tools/kvm/kvm-cmd.c +++ b/tools/kvm/kvm-cmd.c @@ -7,17 +7,18 @@ /* user defined header files */ #include -/* 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) diff --git a/tools/kvm/kvm-run.c b/tools/kvm/kvm-run.c index ab385ac1a216..9b0786a64bd1 100644 --- a/tools/kvm/kvm-run.c +++ b/tools/kvm/kvm-run.c @@ -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; diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c index 188cd98b0d06..2cd206d00e1d 100644 --- a/tools/kvm/kvm.c +++ b/tools/kvm/kvm.c @@ -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; diff --git a/tools/kvm/term.c b/tools/kvm/term.c index 6c44eb66019e..9b235d0d7629 100644 --- a/tools/kvm/term.c +++ b/tools/kvm/term.c @@ -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); diff --git a/tools/kvm/virtio-blk.c b/tools/kvm/virtio-blk.c index d14a04b4b3c7..874e92eddf50 100644 --- a/tools/kvm/virtio-blk.c +++ b/tools/kvm/virtio-blk.c @@ -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); } -- 2.39.5