Merge git://git.skbuff.net/gitroot/yoshfuji/linux-2.6.14+advapi-fix/
[powerpc.git] / drivers / char / hvc_vio.c
index 430a2c2..f5212eb 100644 (file)
@@ -39,12 +39,34 @@ char hvc_driver_name[] = "hvc_console";
 
 static struct vio_device_id hvc_driver_table[] __devinitdata = {
        {"serial", "hvterm1"},
-       { NULL, }
+       { "", "" }
 };
 MODULE_DEVICE_TABLE(vio, hvc_driver_table);
 
+static int filtered_get_chars(uint32_t vtermno, char *buf, int count)
+{
+       unsigned long got;
+       int i;
+
+       got = hvc_get_chars(vtermno, buf, count);
+
+       /*
+        * Work around a HV bug where it gives us a null
+        * after every \r.  -- paulus
+        */
+       for (i = 1; i < got; ++i) {
+               if (buf[i] == 0 && buf[i-1] == '\r') {
+                       --got;
+                       if (i < got)
+                               memmove(&buf[i], &buf[i+1],
+                                       got - i);
+               }
+       }
+       return got;
+}
+
 static struct hv_ops hvc_get_put_ops = {
-       .get_chars = hvc_get_chars,
+       .get_chars = filtered_get_chars,
        .put_chars = hvc_put_chars,
 };
 
@@ -73,11 +95,11 @@ static int __devexit hvc_vio_remove(struct vio_dev *vdev)
 }
 
 static struct vio_driver hvc_vio_driver = {
-       .name           = hvc_driver_name,
        .id_table       = hvc_driver_table,
        .probe          = hvc_vio_probe,
        .remove         = hvc_vio_remove,
        .driver         = {
+               .name   = hvc_driver_name,
                .owner  = THIS_MODULE,
        }
 };