fix coding style and use of typedef type
cover fix coding style and use of typedef type
patch 1-2
fix the coding style related to space indent and brance position
patch 3-5
remove the 'struct' from the type which has been typedef
Chih-Min Chao (5):
bitops : fix coding style
ui/vnc : fix coding style
ui/vnc : remove 'struct' of 'typedef struct' ui/console : remove 'struct' from 'typedef struct' type hw/display : remove 'struct' from 'typedef QXL struct'
hw/display/qxl.c | 2 +- include/qemu/bitops.h | 61 +++++++++++++++++++++++++------------------------- ui/console.c | 4 ++-- ui/spice-display.c | 8 +++---- ui/vnc-auth-vencrypt.c | 8 ++++--- ui/vnc-tls.c | 10 ++++----- ui/vnc-ws.c | 4 ++-- ui/vnc.c | 2 +- 8 files changed, 51 insertions(+), 48 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/5 bitops : fix coding style
don't mix tab and space. The rule is 4 spaces
--- include/qemu/bitops.h | 61 ++++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 30 deletions(-)
include/qemu/bitops.h +31 -30
@@ -20,10 +20,10 @@#define BITS_PER_BYTE CHAR_BIT#define BITS_PER_LONG (sizeof (unsigned long) * BITS_PER_BYTE) -#define BIT (nr) (1UL << (nr)) -#define BIT_MASK (nr) (1UL << ((nr) % BITS_PER_LONG)) -#define BIT_WORD (nr) ((nr) / BITS_PER_LONG) -#define BITS_TO_LONGS (nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) +#define BIT (nr) (1UL << (nr)) +#define BIT_MASK (nr) (1UL << ((nr) % BITS_PER_LONG)) +#define BIT_WORD (nr) ((nr) / BITS_PER_LONG) +#define BITS_TO_LONGS (nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))/** * set_bit - Set a bit in memory
@@ -32,10 +32,10 @@*/ static inline void set_bit (long nr,unsigned long *addr) { -unsigned long mask =BIT_MASK (nr); -unsigned long *p = addr +BIT_WORD (nr); +unsigned long mask =BIT_MASK (nr); +unsigned long *p = addr +BIT_WORD (nr); - *p |= mask; + *p |= mask; }/**
@@ -45,10 +45,10 @@ static inline void set_bit(long nr, unsigned long *addr)*/ static inline void clear_bit (long nr,unsigned long *addr) { -unsigned long mask =BIT_MASK (nr); -unsigned long *p = addr +BIT_WORD (nr); +unsigned long mask =BIT_MASK (nr); +unsigned long *p = addr +BIT_WORD (nr); - *p &= ~mask; + *p &= ~mask; }/**
@@ -58,10 +58,10 @@ static inline void clear_bit(long nr, unsigned long *addr)*/ static inline void change_bit (long nr,unsigned long *addr) { -unsigned long mask =BIT_MASK (nr); -unsigned long *p = addr +BIT_WORD (nr); +unsigned long mask =BIT_MASK (nr); +unsigned long *p = addr +BIT_WORD (nr); - *p ^= mask; + *p ^= mask; }/**
@@ -71,12 +71,12 @@ static inline void change_bit(long nr, unsigned long *addr)*/ static inline int test_and_set_bit (long nr,unsigned long *addr) { -unsigned long mask =BIT_MASK (nr); -unsigned long *p = addr +BIT_WORD (nr); -unsigned long old = *p; +unsigned long mask =BIT_MASK (nr); +unsigned long *p = addr +BIT_WORD (nr); +unsigned long old = *p; - *p = old | mask; -return (old & mask) !=0 ; + *p = old | mask; +return (old & mask) !=0 ; }/**
@@ -86,12 +86,12 @@ static inline int test_and_set_bit(long nr, unsigned long *addr)*/ static inline int test_and_clear_bit (long nr,unsigned long *addr) { -unsigned long mask =BIT_MASK (nr); -unsigned long *p = addr +BIT_WORD (nr); -unsigned long old = *p; +unsigned long mask =BIT_MASK (nr); +unsigned long *p = addr +BIT_WORD (nr); +unsigned long old = *p; - *p = old & ~mask; -return (old & mask) !=0 ; + *p = old & ~mask; +return (old & mask) !=0 ; }/**
@@ -101,12 +101,12 @@ static inline int test_and_clear_bit(long nr, unsigned long *addr)*/ static inline int test_and_change_bit (long nr,unsigned long *addr) { -unsigned long mask =BIT_MASK (nr); -unsigned long *p = addr +BIT_WORD (nr); -unsigned long old = *p; +unsigned long mask =BIT_MASK (nr); +unsigned long *p = addr +BIT_WORD (nr); +unsigned long old = *p; - *p = old ^ mask; -return (old & mask) !=0 ; + *p = old ^ mask; +return (old & mask) !=0 ; }/**
@@ -116,7 +116,7 @@ static inline int test_and_change_bit(long nr, unsigned long *addr)*/ static inline int test_bit (long nr,const unsigned long *addr) { -return 1UL & (addr[BIT_WORD (nr)] >> (nr & (BITS_PER_LONG -1 ))); +return 1UL & (addr[BIT_WORD (nr)] >> (nr & (BITS_PER_LONG -1 ))); }/**
@@ -136,7 +136,8 @@ unsigned long find_last_bit(const unsigned long *addr,* @size: The bitmap size in bits */ unsigned long find_next_bit (const unsigned long *addr, -unsigned long size,unsigned long offset); +unsigned long size, +unsigned long offset);/** * find_next_zero_bit - find the next cleared bit in a memory region
Signature · 1 line
1.9.1
PATCH 2/5 ui/vnc : fix coding style
In reply to Chih-Min Chaoreported by checkpatch.pl
--- ui/vnc-auth-vencrypt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
ui/vnc-auth-vencrypt.c +4 -2
@@ -65,7 +65,8 @@ static void start_auth_vencrypt_subauth(VncState *vs)static void vnc_tls_handshake_io (void *opaque); -static int vnc_start_vencrypt_handshake (struct VncState *vs) { +static int vnc_start_vencrypt_handshake (struct VncState *vs) +{int ret;if ((ret =gnutls_handshake (vs->tls.session)) <0 ) {
@@ -100,7 +101,8 @@ static int vnc_start_vencrypt_handshake(struct VncState *vs) {return 0 ; } -static void vnc_tls_handshake_io (void *opaque) { +static void vnc_tls_handshake_io (void *opaque) +{struct VncState *vs = (struct VncState *)opaque;VNC_DEBUG ("Handshake IO continue\n" );
Signature · 1 line
1.9.1
PATCH 3/5 ui/vnc : remove 'struct' of 'typedef struct'
In reply to Chih-Min Chao--- ui/vnc-auth-vencrypt.c | 4 ++-- ui/vnc-tls.c | 10 +++++----- ui/vnc-ws.c | 4 ++-- ui/vnc.c | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-)
ui/vnc-auth-vencrypt.c +2 -2
@@ -65,7 +65,7 @@ static void start_auth_vencrypt_subauth(VncState *vs)static void vnc_tls_handshake_io (void *opaque); -static int vnc_start_vencrypt_handshake (struct VncState *vs) +static int vnc_start_vencrypt_handshake (VncState *vs) {int ret;
@@ -103,7 +103,7 @@ static int vnc_start_vencrypt_handshake(struct VncState *vs)static void vnc_tls_handshake_io (void *opaque) { -struct VncState *vs = (struct VncState *)opaque; +VncState *vs = (VncState *)opaque;VNC_DEBUG ("Handshake IO continue\n" );vnc_start_vencrypt_handshake (vs);
ui/vnc-tls.c +5 -5
@@ -68,7 +68,7 @@ static int vnc_tls_initialize(void)static ssize_t vnc_tls_push (gnutls_transport_ptr_t transport,const void *data,size_t len) { -struct VncState *vs = (struct VncState *)transport; +VncState *vs = (VncState *)transport;int ret; retry:
@@ -85,7 +85,7 @@ static ssize_t vnc_tls_push(gnutls_transport_ptr_t transport,static ssize_t vnc_tls_pull (gnutls_transport_ptr_t transport,void *data,size_t len) { -struct VncState *vs = (struct VncState *)transport; +VncState *vs = (VncState *)transport;int ret; retry:
@@ -170,7 +170,7 @@ static gnutls_certificate_credentials_t vnc_tls_initialize_x509_cred(VncDisplay } -int vnc_tls_validate_certificate (struct VncState *vs) +int vnc_tls_validate_certificate (VncState *vs) {int ret;unsigned int status;
@@ -332,7 +332,7 @@ static int vnc_set_gnutls_priority(gnutls_session_t s, int x509)#endif -int vnc_tls_client_setup (struct VncState *vs, +int vnc_tls_client_setup (VncState *vs,int needX509Creds) {VNC_DEBUG ("Do TLS setup\n" );if (vnc_tls_initialize () <0 ) {
@@ -410,7 +410,7 @@ int vnc_tls_client_setup(struct VncState *vs, } -void vnc_tls_client_cleanup (struct VncState *vs) +void vnc_tls_client_cleanup (VncState *vs) {if (vs->tls.session) {gnutls_deinit (vs->tls.session);
ui/vnc-ws.c +2 -2
@@ -24,7 +24,7 @@#ifdef CONFIG_VNC_TLS #include "qemu/sockets.h" -static int vncws_start_tls_handshake (struct VncState *vs) +static int vncws_start_tls_handshake (VncState *vs) {int ret =gnutls_handshake (vs->tls.session);
@@ -63,7 +63,7 @@ static int vncws_start_tls_handshake(struct VncState *vs)void vncws_tls_handshake_io (void *opaque) { -struct VncState *vs = (struct VncState *)opaque; +VncState *vs = (VncState *)opaque;if (!vs->tls.session) {VNC_DEBUG ("TLS Websocket setup\n" );
ui/vnc.c +1 -1
@@ -1046,7 +1046,7 @@ static void vnc_dpy_cursor_define(DisplayChangeListener *dcl, } } -static int find_and_clear_dirty_height (struct VncState *vs, +static int find_and_clear_dirty_height (VncState *vs,int y,int last_x,int x,int height) {int h;
Signature · 1 line
1.9.1
PATCH 4/5 ui/console : remove 'struct' from 'typedef struct' type
In reply to Chih-Min Chao--- ui/console.c | 4 ++-- ui/spice-display.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
ui/console.c +2 -2
@@ -269,7 +269,7 @@ void graphic_hw_invalidate(QemuConsole *con) } } -static void ppm_save (const char *filename,struct DisplaySurface *ds, +static void ppm_save (const char *filename,DisplaySurface *ds,Error **errp) {int width =pixman_image_get_width (ds->image);
@@ -1535,7 +1535,7 @@ void dpy_text_update(QemuConsole *con, int x, int y, int w, int h)void dpy_text_resize (QemuConsole *con,int w,int h) {DisplayState *s = con->ds; -struct DisplayChangeListener *dcl; +DisplayChangeListener *dcl;if (!qemu_console_is_visible (con)) {return ;
ui/spice-display.c +1 -1
@@ -715,7 +715,7 @@ static void display_update(DisplayChangeListener *dcl, }static void display_switch (DisplayChangeListener *dcl, -struct DisplaySurface *surface) +DisplaySurface *surface) {SimpleSpiceDisplay *ssd =container_of (dcl, SimpleSpiceDisplay, dcl);qemu_spice_display_switch (ssd, surface);
Signature · 1 line
1.9.1
PATCH 5/5 hw/display : remove 'struct' from 'typedef QXL struct'
In reply to Chih-Min Chao--- hw/display/qxl.c | 2 +- ui/spice-display.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
hw/display/qxl.c +1 -1
@@ -696,7 +696,7 @@ static inline void qxl_push_free_res(PCIQXLDevice *d, int flush)/* called from spice server thread context only */ static void interface_release_resource (QXLInstance *sin, -struct QXLReleaseInfoExt ext) +QXLReleaseInfoExt ext) {PCIQXLDevice *qxl =container_of (sin, PCIQXLDevice, ssd.qxl);QXLReleaseRing *ring;
ui/spice-display.c +3 -3
@@ -536,7 +536,7 @@ static void interface_get_init_info(QXLInstance *sin, QXLDevInitInfo *info) info->n_surfaces = ssd->num_surfaces; } -static int interface_get_command (QXLInstance *sin,struct QXLCommandExt *ext) +static int interface_get_command (QXLInstance *sin,QXLCommandExt *ext) {SimpleSpiceDisplay *ssd =container_of (sin, SimpleSpiceDisplay, qxl);SimpleSpiceUpdate *update;
@@ -563,7 +563,7 @@ static int interface_req_cmd_notification(QXLInstance *sin) }static void interface_release_resource (QXLInstance *sin, -struct QXLReleaseInfoExt rext) +QXLReleaseInfoExt rext) {SimpleSpiceDisplay *ssd =container_of (sin, SimpleSpiceDisplay, qxl);SimpleSpiceUpdate *update;
@@ -586,7 +586,7 @@ static void interface_release_resource(QXLInstance *sin, } } -static int interface_get_cursor_command (QXLInstance *sin,struct QXLCommandExt *ext) +static int interface_get_cursor_command (QXLInstance *sin,QXLCommandExt *ext) {SimpleSpiceDisplay *ssd =container_of (sin, SimpleSpiceDisplay, qxl);int ret;
Signature · 1 line
1.9.1
Quoted 5 lines · Chih-Min Chao
bitops : fix coding style
ui/vnc : fix coding style
ui/vnc : remove 'struct' of 'typedef struct' ui/console : remove 'struct' from 'typedef struct' type hw/display : remove 'struct' from 'typedef QXL struct'
Michael Tokarev
AppliedQuoted 13 lines · Chih-Min Chao
patch 1-2
fix the coding style related to space indent and brance positionpatch 3-5
remove the 'struct' from the type which has been typedefChih-Min Chao (5):
bitops : fix coding style
ui/vnc : fix coding style
ui/vnc : remove 'struct' of 'typedef struct' ui/console : remove 'struct' from 'typedef struct' type hw/display : remove 'struct' from 'typedef QXL struct'
Quoted 9 lines
hw/display/qxl.c | 2 +- include/qemu/bitops.h | 61 +++++++++++++++++++++++++------------------------- ui/console.c | 4 ++-- ui/spice-display.c | 8 +++---- ui/vnc-auth-vencrypt.c | 8 ++++--- ui/vnc-tls.c | 10 ++++----- ui/vnc-ws.c | 4 ++-- ui/vnc.c | 2 +- 8 files changed, 51 insertions(+), 48 deletions(-)
Applied to -trivial, thank you!
/mjt