mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
xen: Fix coding style errors
Fixes the following errors: * ERROR: line over 90 characters * ERROR: code indent should never use tabs * ERROR: space prohibited after that open square bracket '[' * ERROR: do not initialise statics to 0 or NULL * ERROR: "(foo*)" should be "(foo *)" Signed-off-by: Emil Condrea <emilcondrea@gmail.com> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org> Signed-off-by: Quan Xu <xuquan8@huawei.com> Acked-by: Anthony PERARD <anthony.perard@citrix.com>
This commit is contained in:
parent
5b2ecabaea
commit
c22e91b1d8
4 changed files with 76 additions and 64 deletions
|
@ -90,21 +90,22 @@ static int common_bind(struct common *c)
|
|||
xen_pfn_t mfn;
|
||||
|
||||
if (xenstore_read_fe_uint64(&c->xendev, "page-ref", &val) == -1)
|
||||
return -1;
|
||||
return -1;
|
||||
mfn = (xen_pfn_t)val;
|
||||
assert(val == mfn);
|
||||
|
||||
if (xenstore_read_fe_int(&c->xendev, "event-channel", &c->xendev.remote_port) == -1)
|
||||
return -1;
|
||||
return -1;
|
||||
|
||||
c->page = xenforeignmemory_map(xen_fmem, c->xendev.dom,
|
||||
PROT_READ | PROT_WRITE, 1, &mfn, NULL);
|
||||
if (c->page == NULL)
|
||||
return -1;
|
||||
return -1;
|
||||
|
||||
xen_be_bind_evtchn(&c->xendev);
|
||||
xen_be_printf(&c->xendev, 1, "ring mfn %"PRI_xen_pfn", remote-port %d, local-port %d\n",
|
||||
mfn, c->xendev.remote_port, c->xendev.local_port);
|
||||
xen_be_printf(&c->xendev, 1,
|
||||
"ring mfn %"PRI_xen_pfn", remote-port %d, local-port %d\n",
|
||||
mfn, c->xendev.remote_port, c->xendev.local_port);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -500,8 +501,8 @@ out:
|
|||
}
|
||||
|
||||
static int xenfb_configure_fb(struct XenFB *xenfb, size_t fb_len_lim,
|
||||
int width, int height, int depth,
|
||||
size_t fb_len, int offset, int row_stride)
|
||||
int width, int height, int depth,
|
||||
size_t fb_len, int offset, int row_stride)
|
||||
{
|
||||
size_t mfn_sz = sizeof(*((struct xenfb_page *)0)->pd);
|
||||
size_t pd_len = sizeof(((struct xenfb_page *)0)->pd) / mfn_sz;
|
||||
|
@ -510,40 +511,47 @@ static int xenfb_configure_fb(struct XenFB *xenfb, size_t fb_len_lim,
|
|||
int max_width, max_height;
|
||||
|
||||
if (fb_len_lim > fb_len_max) {
|
||||
xen_be_printf(&xenfb->c.xendev, 0, "fb size limit %zu exceeds %zu, corrected\n",
|
||||
fb_len_lim, fb_len_max);
|
||||
fb_len_lim = fb_len_max;
|
||||
xen_be_printf(&xenfb->c.xendev, 0,
|
||||
"fb size limit %zu exceeds %zu, corrected\n",
|
||||
fb_len_lim, fb_len_max);
|
||||
fb_len_lim = fb_len_max;
|
||||
}
|
||||
if (fb_len_lim && fb_len > fb_len_lim) {
|
||||
xen_be_printf(&xenfb->c.xendev, 0, "frontend fb size %zu limited to %zu\n",
|
||||
fb_len, fb_len_lim);
|
||||
fb_len = fb_len_lim;
|
||||
xen_be_printf(&xenfb->c.xendev, 0,
|
||||
"frontend fb size %zu limited to %zu\n",
|
||||
fb_len, fb_len_lim);
|
||||
fb_len = fb_len_lim;
|
||||
}
|
||||
if (depth != 8 && depth != 16 && depth != 24 && depth != 32) {
|
||||
xen_be_printf(&xenfb->c.xendev, 0, "can't handle frontend fb depth %d\n",
|
||||
depth);
|
||||
return -1;
|
||||
xen_be_printf(&xenfb->c.xendev, 0,
|
||||
"can't handle frontend fb depth %d\n",
|
||||
depth);
|
||||
return -1;
|
||||
}
|
||||
if (row_stride <= 0 || row_stride > fb_len) {
|
||||
xen_be_printf(&xenfb->c.xendev, 0, "invalid frontend stride %d\n", row_stride);
|
||||
return -1;
|
||||
xen_be_printf(&xenfb->c.xendev, 0, "invalid frontend stride %d\n",
|
||||
row_stride);
|
||||
return -1;
|
||||
}
|
||||
max_width = row_stride / (depth / 8);
|
||||
if (width < 0 || width > max_width) {
|
||||
xen_be_printf(&xenfb->c.xendev, 0, "invalid frontend width %d limited to %d\n",
|
||||
width, max_width);
|
||||
width = max_width;
|
||||
xen_be_printf(&xenfb->c.xendev, 0,
|
||||
"invalid frontend width %d limited to %d\n",
|
||||
width, max_width);
|
||||
width = max_width;
|
||||
}
|
||||
if (offset < 0 || offset >= fb_len) {
|
||||
xen_be_printf(&xenfb->c.xendev, 0, "invalid frontend offset %d (max %zu)\n",
|
||||
offset, fb_len - 1);
|
||||
return -1;
|
||||
xen_be_printf(&xenfb->c.xendev, 0,
|
||||
"invalid frontend offset %d (max %zu)\n",
|
||||
offset, fb_len - 1);
|
||||
return -1;
|
||||
}
|
||||
max_height = (fb_len - offset) / row_stride;
|
||||
if (height < 0 || height > max_height) {
|
||||
xen_be_printf(&xenfb->c.xendev, 0, "invalid frontend height %d limited to %d\n",
|
||||
height, max_height);
|
||||
height = max_height;
|
||||
xen_be_printf(&xenfb->c.xendev, 0,
|
||||
"invalid frontend height %d limited to %d\n",
|
||||
height, max_height);
|
||||
height = max_height;
|
||||
}
|
||||
xenfb->fb_len = fb_len;
|
||||
xenfb->row_stride = row_stride;
|
||||
|
@ -554,7 +562,7 @@ static int xenfb_configure_fb(struct XenFB *xenfb, size_t fb_len_lim,
|
|||
xenfb->up_fullscreen = 1;
|
||||
xenfb->do_resize = 1;
|
||||
xen_be_printf(&xenfb->c.xendev, 1, "framebuffer %dx%dx%d offset %d stride %d\n",
|
||||
width, height, depth, offset, row_stride);
|
||||
width, height, depth, offset, row_stride);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -696,9 +704,9 @@ static void xenfb_update(void *opaque)
|
|||
return;
|
||||
|
||||
if (!xenfb->feature_update) {
|
||||
/* we don't get update notifications, thus use the
|
||||
* sledge hammer approach ... */
|
||||
xenfb->up_fullscreen = 1;
|
||||
/* we don't get update notifications, thus use the
|
||||
* sledge hammer approach ... */
|
||||
xenfb->up_fullscreen = 1;
|
||||
}
|
||||
|
||||
/* resize if needed */
|
||||
|
@ -729,18 +737,19 @@ static void xenfb_update(void *opaque)
|
|||
|
||||
/* run queued updates */
|
||||
if (xenfb->up_fullscreen) {
|
||||
xen_be_printf(&xenfb->c.xendev, 3, "update: fullscreen\n");
|
||||
xenfb_guest_copy(xenfb, 0, 0, xenfb->width, xenfb->height);
|
||||
xen_be_printf(&xenfb->c.xendev, 3, "update: fullscreen\n");
|
||||
xenfb_guest_copy(xenfb, 0, 0, xenfb->width, xenfb->height);
|
||||
} else if (xenfb->up_count) {
|
||||
xen_be_printf(&xenfb->c.xendev, 3, "update: %d rects\n", xenfb->up_count);
|
||||
for (i = 0; i < xenfb->up_count; i++)
|
||||
xenfb_guest_copy(xenfb,
|
||||
xenfb->up_rects[i].x,
|
||||
xenfb->up_rects[i].y,
|
||||
xenfb->up_rects[i].w,
|
||||
xenfb->up_rects[i].h);
|
||||
xen_be_printf(&xenfb->c.xendev, 3, "update: %d rects\n",
|
||||
xenfb->up_count);
|
||||
for (i = 0; i < xenfb->up_count; i++)
|
||||
xenfb_guest_copy(xenfb,
|
||||
xenfb->up_rects[i].x,
|
||||
xenfb->up_rects[i].y,
|
||||
xenfb->up_rects[i].w,
|
||||
xenfb->up_rects[i].h);
|
||||
} else {
|
||||
xen_be_printf(&xenfb->c.xendev, 3, "update: nothing\n");
|
||||
xen_be_printf(&xenfb->c.xendev, 3, "update: nothing\n");
|
||||
}
|
||||
xenfb->up_count = 0;
|
||||
xenfb->up_fullscreen = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue