[PATCH v2 01/14] PCI: Use sysfs_emit() and sysfs_emit_at() in "show" functions
    Krzysztof Wilczyński 
    kw at linux.com
       
    Sat May 15 15:59:28 AEST 2021
    
    
  
Hi Joe,
[...]
> Ideally, the additional newline check below this would use sysfs_emit_at
> 
> drivers/pci/pci.c-      /*
> drivers/pci/pci.c:       * When set by the command line, resource_alignment_param will not
> drivers/pci/pci.c-       * have a trailing line feed, which is ugly. So conditionally add
> drivers/pci/pci.c-       * it here.
> drivers/pci/pci.c-       */
> drivers/pci/pci.c-      if (count >= 2 && buf[count - 2] != '\n' && count < PAGE_SIZE - 1) {
> drivers/pci/pci.c-              buf[count - 1] = '\n';
> drivers/pci/pci.c-              buf[count++] = 0;
> drivers/pci/pci.c-      }
> drivers/pci/pci.c-
> drivers/pci/pci.c-      return count;
I found some inconsistencies with adding newline this way, and decided
to change the code slightly, see:
  https://lore.kernel.org/linux-pci/20210515052434.1413236-12-kw@linux.com/
Krzysztof
    
    
More information about the Linuxppc-dev
mailing list