Author: ian
Date: Wed Feb 27 04:16:32 2019
New Revision: 344614
URL: https://svnweb.freebsd.org/changeset/base/344614

Log:
  Rename some functions and variables to have shorter names, which allows
  unwrapping multiple lines of code.  Also, convert some short multiline
  comments into single-line comments.  Change old-school FALSE to false.
  
  All in all, no functional changes, it's just more compact and readable.

Modified:
  head/sys/dev/fdt/fdt_slicer.c

Modified: head/sys/dev/fdt/fdt_slicer.c
==============================================================================
--- head/sys/dev/fdt/fdt_slicer.c       Wed Feb 27 03:30:49 2019        
(r344613)
+++ head/sys/dev/fdt/fdt_slicer.c       Wed Feb 27 04:16:32 2019        
(r344614)
@@ -46,19 +46,19 @@ __FBSDID("$FreeBSD$");
 #define debugf(fmt, args...)
 #endif
 
-static int fdt_flash_fill_slices(device_t dev, const char *provider,
+static int fill_slices(device_t dev, const char *provider,
     struct flash_slice *slices, int *slices_num);
 static void fdt_slicer_init(void);
 
 static int
-fdt_flash_fill_slices(device_t dev, const char *provider __unused,
+fill_slices(device_t dev, const char *provider __unused,
     struct flash_slice *slices, int *slices_num)
 {
        char *slice_name;
-       phandle_t dt_node, dt_child;
+       phandle_t node, child;
        u_long base, size;
        int i;
-       ssize_t name_len;
+       ssize_t nmlen;
 
        /*
         * We assume the caller provides buffer for FLASH_SLICES_MAX_NUM
@@ -69,19 +69,17 @@ fdt_flash_fill_slices(device_t dev, const char *provid
                return (ENOMEM);
        }
 
-       dt_node = ofw_bus_get_node(dev);
-       for (dt_child = OF_child(dt_node), i = 0; dt_child != 0;
-           dt_child = OF_peer(dt_child)) {
+       i = 0;
+       node = ofw_bus_get_node(dev);
+       for (child = OF_child(node); child != 0; child = OF_peer(child)) {
 
                if (i == FLASH_SLICES_MAX_NUM) {
                        debugf("not enough buffer for slice i=%d\n", i);
                        break;
                }
 
-               /*
-                * Retrieve start and size of the slice.
-                */
-               if (fdt_regsize(dt_child, &base, &size) != 0) {
+               /* Retrieve start and size of the slice. */
+               if (fdt_regsize(child, &base, &size) != 0) {
                        debugf("error during processing reg property, i=%d\n",
                            i);
                        continue;
@@ -92,24 +90,19 @@ fdt_flash_fill_slices(device_t dev, const char *provid
                        continue;
                }
 
-               /*
-                * Retrieve label.
-                */
-               name_len = OF_getprop_alloc(dt_child, "label",
-                   (void **)&slice_name);
-               if (name_len <= 0) {
+               /* Retrieve label. */
+               nmlen = OF_getprop_alloc(child, "label", (void **)&slice_name);
+               if (nmlen <= 0) {
                        /* Use node name if no label defined */
-                       name_len = OF_getprop_alloc(dt_child, "name",
+                       nmlen = OF_getprop_alloc(child, "name", 
                            (void **)&slice_name);
-                       if (name_len <= 0) {
+                       if (nmlen <= 0) {
                                debugf("slice i=%d with no name\n", i);
                                slice_name = NULL;
                        }
                }
 
-               /*
-                * Fill slice entry data.
-                */
+               /* Fill slice entry data. */
                slices[i].base = base;
                slices[i].size = size;
                slices[i].label = slice_name;
@@ -124,12 +117,9 @@ static void
 fdt_slicer_init(void)
 {
 
-       flash_register_slicer(fdt_flash_fill_slices, FLASH_SLICES_TYPE_NAND,
-          FALSE);
-       flash_register_slicer(fdt_flash_fill_slices, FLASH_SLICES_TYPE_CFI,
-          FALSE);
-       flash_register_slicer(fdt_flash_fill_slices, FLASH_SLICES_TYPE_SPI,
-          FALSE);
+       flash_register_slicer(fill_slices, FLASH_SLICES_TYPE_NAND, false);
+       flash_register_slicer(fill_slices, FLASH_SLICES_TYPE_CFI, false);
+       flash_register_slicer(fill_slices, FLASH_SLICES_TYPE_SPI, false);
 }
 
 static void
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to