[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 3/7] merge review: fix fsf address & compare style



changes coming from upstream merge review (style only, no code changes).
 - Update FSF address.
 - Fix strage compare style.

Signed-off-by: Gerd Hoffmann <kraxel@xxxxxxxxxx>
---
 hw/xen_backend.c    |   54 +++++++++++++++++++++++++-------------------------
 hw/xen_console.c    |   12 +++++-----
 hw/xen_machine_pv.c |    2 +-
 hw/xenfb.c          |   35 +++++++++++++++++----------------
 4 files changed, 52 insertions(+), 51 deletions(-)

diff --git a/hw/xen_backend.c b/hw/xen_backend.c
index 2bd4433..56b001f 100644
--- a/hw/xen_backend.c
+++ b/hw/xen_backend.c
@@ -11,9 +11,9 @@
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 /*
@@ -162,7 +162,7 @@ struct XenDevice *xen_be_find_xendev(const char *type, int 
dom, int dev)
            continue;
        if (xendev->dev != dev)
            continue;
-       if (0 != strcmp(xendev->type, type))
+       if (strcmp(xendev->type, type) != 0)
            continue;
        return xendev;
     }
@@ -278,8 +278,8 @@ static struct XenDevice *xen_be_del_xendev(int dom, int dev)
  */
 static void xen_be_backend_changed(struct XenDevice *xendev, const char *node)
 {
-    if (NULL == node  ||  0 == strcmp(node, "online")) {
-       if (-1 == xenstore_read_be_int(xendev, "online", &xendev->online))
+    if (node == NULL  ||  strcmp(node, "online") == 0) {
+       if (xenstore_read_be_int(xendev, "online", &xendev->online) == -1)
            xendev->online = 0;
     }
 
@@ -294,8 +294,8 @@ static void xen_be_frontend_changed(struct XenDevice 
*xendev, const char *node)
 {
     int fe_state;
 
-    if (NULL == node  ||  0 == strcmp(node, "state")) {
-       if (-1 == xenstore_read_fe_int(xendev, "state", &fe_state))
+    if (node == NULL  ||  strcmp(node, "state") == 0) {
+       if (xenstore_read_fe_int(xendev, "state", &fe_state) == -1)
            fe_state = XenbusStateUnknown;
        if (xendev->fe_state != fe_state)
            xen_be_printf(xendev, 1, "frontend state: %s -> %s\n",
@@ -303,7 +303,7 @@ static void xen_be_frontend_changed(struct XenDevice 
*xendev, const char *node)
                          xenbus_strstate(fe_state));
        xendev->fe_state = fe_state;
     }
-    if (NULL == node  ||  0 == strcmp(node, "protocol")) {
+    if (node == NULL  ||  strcmp(node, "protocol") == 0) {
        qemu_free(xendev->protocol);
        xendev->protocol = xenstore_read_fe_str(xendev, "protocol");
        if (xendev->protocol)
@@ -333,7 +333,7 @@ static int xen_be_try_setup(struct XenDevice *xendev)
     char token[XEN_BUFSIZE];
     int be_state;
 
-    if (-1 == xenstore_read_be_int(xendev, "state", &be_state)) {
+    if (xenstore_read_be_int(xendev, "state", &be_state) == -1) {
        xen_be_printf(xendev, 0, "reading backend state failed\n");
        return -1;
     }
@@ -345,7 +345,7 @@ static int xen_be_try_setup(struct XenDevice *xendev)
     }
 
     xendev->fe = xenstore_read_be_str(xendev, "frontend");
-    if (NULL == xendev->fe) {
+    if (xendev->fe == NULL) {
        xen_be_printf(xendev, 0, "reading frontend path failed\n");
        return -1;
     }
@@ -383,7 +383,7 @@ static int xen_be_try_init(struct XenDevice *xendev)
 
     if (xendev->ops->init)
        rc = xendev->ops->init(xendev);
-    if (0 != rc) {
+    if (rc != 0) {
        xen_be_printf(xendev, 1, "init() failed\n");
        return rc;
     }
@@ -416,7 +416,7 @@ static int xen_be_try_connect(struct XenDevice *xendev)
 
     if (xendev->ops->connect)
        rc = xendev->ops->connect(xendev);
-    if (0 != rc) {
+    if (rc != 0) {
        xen_be_printf(xendev, 0, "connect() failed\n");
        return rc;
     }
@@ -485,7 +485,7 @@ void xen_be_check_state(struct XenDevice *xendev)
        default:
            rc = -1;
        }
-       if (0 != rc)
+       if (rc != 0)
            break;
     }
 }
@@ -515,7 +515,7 @@ static int xenstore_scan(const char *type, int dom, struct 
XenDevOps *ops)
        return 0;
     for (j = 0; j < cdev; j++) {
        xendev = xen_be_get_xendev(type, dom, atoi(dev[j]), ops);
-       if (NULL == xendev)
+       if (xendev == NULL)
            continue;
        xen_be_check_state(xendev);
     }
@@ -533,14 +533,14 @@ static void xenstore_update_be(char *watch, char *type, 
int dom,
     dom0 = xs_get_domain_path(xenstore, 0);
     len = snprintf(path, sizeof(path), "%s/backend/%s/%d", dom0, type, dom);
     free(dom0);
-    if (0 != strncmp(path, watch, len))
+    if (strncmp(path, watch, len) != 0)
        return;
-    if (2 != sscanf(watch+len, "/%u/%255s", &dev, path)) {
+    if (sscanf(watch+len, "/%u/%255s", &dev, path) != 2) {
        strcpy(path, "");
-       if (1 != sscanf(watch+len, "/%u", &dev))
+       if (sscanf(watch+len, "/%u", &dev) != 1)
            dev = -1;
     }
-    if (-1 == dev)
+    if (dev == -1)
        return;
 
     if (0) {
@@ -549,7 +549,7 @@ static void xenstore_update_be(char *watch, char *type, int 
dom,
     }
 
     xendev = xen_be_get_xendev(type, dom, dev, ops);
-    if (NULL != xendev) {
+    if (xendev != NULL) {
        xen_be_backend_changed(xendev, path);
        xen_be_check_state(xendev);
     }
@@ -561,7 +561,7 @@ static void xenstore_update_fe(char *watch, struct 
XenDevice *xendev)
     unsigned int len;
 
     len = strlen(xendev->fe);
-    if (0 != strncmp(xendev->fe, watch, len))
+    if (strncmp(xendev->fe, watch, len) != 0)
        return;
     if (watch[len] != '/')
        return;
@@ -578,13 +578,13 @@ static void xenstore_update(void *unused)
     unsigned int dom, count;
 
     vec = xs_read_watch(xenstore, &count);
-    if (NULL == vec)
+    if (vec == NULL)
        goto cleanup;
 
-    if (3 == sscanf(vec[XS_WATCH_TOKEN], "be:%" PRIxPTR ":%d:%" PRIxPTR,
-                   &type, &dom, &ops))
+    if (sscanf(vec[XS_WATCH_TOKEN], "be:%" PRIxPTR ":%d:%" PRIxPTR,
+               &type, &dom, &ops) == 3)
        xenstore_update_be(vec[XS_WATCH_PATH], (void*)type, dom, (void*)ops);
-    if (1 == sscanf(vec[XS_WATCH_TOKEN], "fe:%" PRIxPTR, &ptr))
+    if (sscanf(vec[XS_WATCH_TOKEN], "fe:%" PRIxPTR, &ptr) == 1)
        xenstore_update_fe(vec[XS_WATCH_PATH], (void*)ptr);
 
 cleanup:
@@ -622,7 +622,7 @@ int xen_be_init(void)
        goto err;
 
     xen_xc = xc_interface_open();
-    if (-1 == xen_xc) {
+    if (xen_xc == -1) {
        fprintf(stderr, "can't open xen interface\n");
        goto err;
     }
@@ -647,7 +647,7 @@ int xen_be_bind_evtchn(struct XenDevice *xendev)
        return 0;
     xendev->local_port = xc_evtchn_bind_interdomain
        (xendev->evtchndev, xendev->dom, xendev->remote_port);
-    if (-1 == xendev->local_port) {
+    if (xendev->local_port == -1) {
        xen_be_printf(xendev, 0, "xc_evtchn_bind_interdomain failed\n");
        return -1;
     }
diff --git a/hw/xen_console.c b/hw/xen_console.c
index c172cf2..707075e 100644
--- a/hw/xen_console.c
+++ b/hw/xen_console.c
@@ -15,9 +15,9 @@
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdlib.h>
@@ -214,11 +214,11 @@ static int con_connect(struct XenDevice *xendev)
     struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);
     int limit;
 
-    if (-1 == xenstore_read_int(con->console, "ring-ref", &con->ring_ref))
+    if (xenstore_read_int(con->console, "ring-ref", &con->ring_ref) == -1)
        return -1;
-    if (-1 == xenstore_read_int(con->console, "port", 
&con->xendev.remote_port))
+    if (xenstore_read_int(con->console, "port", &con->xendev.remote_port) == 
-1)
        return -1;
-    if (0 == xenstore_read_int(con->console, "limit", &limit))
+    if (xenstore_read_int(con->console, "limit", &limit) == 0)
        con->buffer.max_capacity = limit;
 
     con->sring = xc_map_foreign_range(xen_xc, con->xendev.dom,
diff --git a/hw/xen_machine_pv.c b/hw/xen_machine_pv.c
index 4c0ee92..34fe4d4 100644
--- a/hw/xen_machine_pv.c
+++ b/hw/xen_machine_pv.c
@@ -62,7 +62,7 @@ static void xen_init_pv(ram_addr_t ram_size, int vga_ram_size,
     env->halted = 1;
 
     /* Initialize backend core & drivers */
-    if (-1 == xen_be_init()) {
+    if (xen_be_init() != 0) {
         fprintf(stderr, "%s: xen backend core setup failed\n", __FUNCTION__);
         exit(1);
     }
diff --git a/hw/xenfb.c b/hw/xenfb.c
index 135764d..8336c82 100644
--- a/hw/xenfb.c
+++ b/hw/xenfb.c
@@ -20,9 +20,9 @@
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdarg.h>
@@ -102,15 +102,15 @@ static int common_bind(struct common *c)
 {
     int mfn;
 
-    if (-1 == xenstore_read_fe_int(&c->xendev, "page-ref", &mfn))
+    if (xenstore_read_fe_int(&c->xendev, "page-ref", &mfn) == -1)
        return -1;
-    if (-1 == xenstore_read_fe_int(&c->xendev, "event-channel", 
&c->xendev.remote_port))
+    if (xenstore_read_fe_int(&c->xendev, "event-channel", 
&c->xendev.remote_port) == -1)
        return -1;
 
     c->page = xc_map_foreign_range(xen_xc, c->xendev.dom,
                                   XC_PAGE_SIZE,
                                   PROT_READ | PROT_WRITE, mfn);
-    if (NULL == c->page)
+    if (c->page == NULL)
        return -1;
 
     xen_be_bind_evtchn(&c->xendev);
@@ -366,11 +366,12 @@ static int input_connect(struct XenDevice *xendev)
     struct XenInput *in = container_of(xendev, struct XenInput, c.xendev);
     int rc;
 
-    if (-1 == xenstore_read_fe_int(xendev, "request-abs-pointer", 
&in->abs_pointer_wanted))
+    if (xenstore_read_fe_int(xendev, "request-abs-pointer",
+                             &in->abs_pointer_wanted) == -1)
        in->abs_pointer_wanted = 0;
 
     rc = common_bind(&in->c);
-    if (0 != rc)
+    if (rc != 0)
        return rc;
 
     qemu_add_kbd_event_handler(xenfb_key_event, in);
@@ -450,7 +451,7 @@ static int xenfb_map_fb(struct XenFB *xenfb)
        ptr64 = (void*)page->pd;
 #endif
        if (ptr32) {
-           if (0 == ptr32[1]) {
+           if (ptr32[1] == 0) {
                mode = 32;
                pd   = ptr32;
            } else {
@@ -459,12 +460,12 @@ static int xenfb_map_fb(struct XenFB *xenfb)
            }
        }
 #if defined(__x86_64__)
-    } else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_X86_32)) {
+    } else if (strcmp(protocol, XEN_IO_PROTO_ABI_X86_32) == 0) {
        /* 64bit dom0, 32bit domU */
        mode = 32;
        pd   = ((void*)page->pd) - 4;
 #elif defined(__i386__)
-    } else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_X86_64)) {
+    } else if (strcmp(protocol, XEN_IO_PROTO_ABI_X86_64) == 0) {
        /* 32bit dom0, 64bit domU */
        mode = 64;
        pd   = ((void*)page->pd) + 4;
@@ -874,22 +875,22 @@ static int fb_connect(struct XenDevice *xendev)
     int videoram;
     int rc;
 
-    if (-1 == xenstore_read_fe_int(xendev, "videoram", &videoram))
+    if (xenstore_read_fe_int(xendev, "videoram", &videoram) == -1)
        videoram = 0;
 
     rc = common_bind(&fb->c);
-    if (0 != rc)
+    if (rc != 0)
        return rc;
 
     fb_page = fb->c.page;
     rc = xenfb_configure_fb(fb, videoram * 1024 * 1024U,
                            fb_page->width, fb_page->height, fb_page->depth,
                            fb_page->mem_length, 0, fb_page->line_length);
-    if (0 != rc)
+    if (rc != 0)
        return rc;
 
     rc = xenfb_map_fb(fb);
-    if (0 != rc)
+    if (rc != 0)
        return rc;
 
 #if 0  /* handled in xen_init_display() for now */
@@ -903,7 +904,7 @@ static int fb_connect(struct XenDevice *xendev)
     }
 #endif
 
-    if (-1 == xenstore_read_fe_int(xendev, "feature-update", 
&fb->feature_update))
+    if (xenstore_read_fe_int(xendev, "feature-update", &fb->feature_update) == 
-1)
        fb->feature_update = 0;
     if (fb->feature_update)
        xenstore_write_be_int(xendev, "request-update", 1);
@@ -939,7 +940,7 @@ static void fb_frontend_changed(struct XenDevice *xendev, 
const char *node)
      * to connected.  We must trigger the watch a second time to
      * workaround a frontend bug.
      */
-    if (0 == fb->bug_trigger && 0 == strcmp(node, "state") &&
+    if (fb->bug_trigger == 0 && strcmp(node, "state") == 0 &&
         xendev->fe_state == XenbusStateConnected &&
         xendev->be_state == XenbusStateConnected) {
         xen_be_printf(xendev, 2, "re-trigger connected (frontend bug)\n");
-- 
1.6.2.2


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.