char *buf)
 {
        struct ehci_hcd         *ehci;
-       int                     nports, index, n;
-       int                     count = PAGE_SIZE;
-       char                    *ptr = buf;
+       int                     nports, index;
+       int                     len = 0;
 
        ehci = hcd_to_ehci(dev_get_drvdata(dev));
        nports = HCS_N_PORTS(ehci->hcs_params);
 
        for (index = 0; index < nports; ++index) {
-               if (test_bit(index, &ehci->companion_ports)) {
-                       n = scnprintf(ptr, count, "%d\n", index + 1);
-                       ptr += n;
-                       count -= n;
-               }
+               if (test_bit(index, &ehci->companion_ports))
+                       len += sysfs_emit_at(buf, len, "%d\n", index + 1);
        }
-       return ptr - buf;
+       return len;
 }
 
 /*
                                        char *buf)
 {
        struct ehci_hcd         *ehci;
-       int                     n;
 
        ehci = hcd_to_ehci(dev_get_drvdata(dev));
-       n = scnprintf(buf, PAGE_SIZE, "%d\n", ehci->uframe_periodic_max);
-       return n;
+       return sysfs_emit(buf, "%d\n", ehci->uframe_periodic_max);
 }