patman: Convert camel case in tools.py

Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index 32a7aa9..7e13757 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -396,7 +396,7 @@
             prop_name: Name of property
         """
         self.props[prop_name] = Prop(self, None, prop_name,
-                                     tools.GetBytes(0, 4))
+                                     tools.get_bytes(0, 4))
 
     def AddEmptyProp(self, prop_name, len):
         """Add a property with a fixed data size, for filling in later
@@ -408,7 +408,7 @@
             prop_name: Name of property
             len: Length of data in property
         """
-        value = tools.GetBytes(0, len)
+        value = tools.get_bytes(0, len)
         self.props[prop_name] = Prop(self, None, prop_name, value)
 
     def _CheckProp(self, prop_name):
diff --git a/tools/dtoc/fdt_util.py b/tools/dtoc/fdt_util.py
index 19eb13a..19e645d 100644
--- a/tools/dtoc/fdt_util.py
+++ b/tools/dtoc/fdt_util.py
@@ -75,12 +75,12 @@
         dts_input = os.path.join(tmpdir, 'source.dts')
         dtb_output = os.path.join(tmpdir, 'source.dtb')
     else:
-        dts_input = tools.GetOutputFilename('source.dts')
-        dtb_output = tools.GetOutputFilename('source.dtb')
+        dts_input = tools.get_output_filename('source.dts')
+        dtb_output = tools.get_output_filename('source.dtb')
 
     search_paths = [os.path.join(os.getcwd(), 'include')]
     root, _ = os.path.splitext(fname)
-    cc, args = tools.GetTargetCompileTool('cc')
+    cc, args = tools.get_target_compile_tool('cc')
     args += ['-E', '-P', '-x', 'assembler-with-cpp', '-D__ASSEMBLY__']
     args += ['-Ulinux']
     for path in search_paths:
@@ -92,7 +92,7 @@
     search_list = []
     for path in search_paths:
         search_list.extend(['-i', path])
-    dtc, args = tools.GetTargetCompileTool('dtc')
+    dtc, args = tools.get_target_compile_tool('dtc')
     args += ['-I', 'dts', '-o', dtb_output, '-O', 'dtb',
             '-W', 'no-unit_address_vs_reg']
     args.extend(search_list)
diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py
index ee17b8d..ea88954 100755
--- a/tools/dtoc/test_dtoc.py
+++ b/tools/dtoc/test_dtoc.py
@@ -112,12 +112,12 @@
     """Tests for dtoc"""
     @classmethod
     def setUpClass(cls):
-        tools.PrepareOutputDir(None)
+        tools.prepare_output_dir(None)
         cls.maxDiff = None
 
     @classmethod
     def tearDownClass(cls):
-        tools.FinaliseOutputDir()
+        tools.finalise_output_dir()
 
     @staticmethod
     def _write_python_string(fname, data):
@@ -218,7 +218,7 @@
     def test_empty_file(self):
         """Test output from a device tree file with no nodes"""
         dtb_file = get_dtb_file('dtoc_test_empty.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
 
         # Run this one without saved_scan to complete test coverage
         dtb_platdata.run_steps(['struct'], dtb_file, False, output, [], None,
@@ -801,7 +801,7 @@
     def test_simple(self):
         """Test output from some simple nodes with various types of data"""
         dtb_file = get_dtb_file('dtoc_test_simple.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         self.run_test(['struct'], dtb_file, output)
         with open(output) as infile:
             data = infile.read()
@@ -822,14 +822,14 @@
 
         # Try the 'all' command
         self.run_test(['all'], dtb_file, output)
-        data = tools.ReadFile(output, binary=False)
+        data = tools.read_file(output, binary=False)
         self._check_strings(
             self.decl_text + self.platdata_text + self.struct_text, data)
 
     def test_driver_alias(self):
         """Test output from a device tree file with a driver alias"""
         dtb_file = get_dtb_file('dtoc_test_driver_alias.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         self.run_test(['struct'], dtb_file, output)
         with open(output) as infile:
             data = infile.read()
@@ -875,7 +875,7 @@
     def test_invalid_driver(self):
         """Test output from a device tree file with an invalid driver"""
         dtb_file = get_dtb_file('dtoc_test_invalid_driver.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         with test_util.capture_sys_output() as _:
             dtb_platdata.run_steps(
                 ['struct'], dtb_file, False, output, [], None, False,
@@ -918,7 +918,7 @@
     def test_phandle(self):
         """Test output from a node containing a phandle reference"""
         dtb_file = get_dtb_file('dtoc_test_phandle.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         self.run_test(['struct'], dtb_file, output)
         with open(output) as infile:
             data = infile.read()
@@ -1013,7 +1013,7 @@
     def test_phandle_single(self):
         """Test output from a node containing a phandle reference"""
         dtb_file = get_dtb_file('dtoc_test_phandle_single.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         self.run_test(['struct'], dtb_file, output)
         with open(output) as infile:
             data = infile.read()
@@ -1029,7 +1029,7 @@
     def test_phandle_reorder(self):
         """Test that phandle targets are generated before their references"""
         dtb_file = get_dtb_file('dtoc_test_phandle_reorder.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         self.run_test(['platdata'], dtb_file, output)
         with open(output) as infile:
             data = infile.read()
@@ -1071,7 +1071,7 @@
     def test_phandle_cd_gpio(self):
         """Test that phandle targets are generated when unsing cd-gpios"""
         dtb_file = get_dtb_file('dtoc_test_phandle_cd_gpios.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         dtb_platdata.run_steps(
             ['platdata'], dtb_file, False, output, [], None, False,
             warning_disabled=True, scan=copy_scan())
@@ -1157,7 +1157,7 @@
         """Test a node containing an invalid phandle fails"""
         dtb_file = get_dtb_file('dtoc_test_phandle_bad.dts',
                                 capture_stderr=True)
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         with self.assertRaises(ValueError) as exc:
             self.run_test(['struct'], dtb_file, output)
         self.assertIn("Cannot parse 'clocks' in node 'phandle-source'",
@@ -1167,7 +1167,7 @@
         """Test a phandle target missing its #*-cells property"""
         dtb_file = get_dtb_file('dtoc_test_phandle_bad2.dts',
                                 capture_stderr=True)
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         with self.assertRaises(ValueError) as exc:
             self.run_test(['struct'], dtb_file, output)
         self.assertIn("Node 'phandle-target' has no cells property",
@@ -1176,7 +1176,7 @@
     def test_addresses64(self):
         """Test output from a node with a 'reg' property with na=2, ns=2"""
         dtb_file = get_dtb_file('dtoc_test_addr64.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         self.run_test(['struct'], dtb_file, output)
         with open(output) as infile:
             data = infile.read()
@@ -1245,7 +1245,7 @@
     def test_addresses32(self):
         """Test output from a node with a 'reg' property with na=1, ns=1"""
         dtb_file = get_dtb_file('dtoc_test_addr32.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         self.run_test(['struct'], dtb_file, output)
         with open(output) as infile:
             data = infile.read()
@@ -1299,7 +1299,7 @@
     def test_addresses64_32(self):
         """Test output from a node with a 'reg' property with na=2, ns=1"""
         dtb_file = get_dtb_file('dtoc_test_addr64_32.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         self.run_test(['struct'], dtb_file, output)
         with open(output) as infile:
             data = infile.read()
@@ -1368,7 +1368,7 @@
     def test_addresses32_64(self):
         """Test output from a node with a 'reg' property with na=1, ns=2"""
         dtb_file = get_dtb_file('dtoc_test_addr32_64.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         self.run_test(['struct'], dtb_file, output)
         with open(output) as infile:
             data = infile.read()
@@ -1438,7 +1438,7 @@
         """Test that a reg property with an invalid type generates an error"""
         # Capture stderr since dtc will emit warnings for this file
         dtb_file = get_dtb_file('dtoc_test_bad_reg.dts', capture_stderr=True)
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         with self.assertRaises(ValueError) as exc:
             self.run_test(['struct'], dtb_file, output)
         self.assertIn("Node 'spl-test' reg property is not an int",
@@ -1448,7 +1448,7 @@
         """Test that a reg property with an invalid cell count is detected"""
         # Capture stderr since dtc will emit warnings for this file
         dtb_file = get_dtb_file('dtoc_test_bad_reg2.dts', capture_stderr=True)
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         with self.assertRaises(ValueError) as exc:
             self.run_test(['struct'], dtb_file, output)
         self.assertIn(
@@ -1458,7 +1458,7 @@
     def test_add_prop(self):
         """Test that a subequent node can add a new property to a struct"""
         dtb_file = get_dtb_file('dtoc_test_add_prop.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         self.run_test(['struct'], dtb_file, output)
         with open(output) as infile:
             data = infile.read()
@@ -1523,9 +1523,9 @@
     def test_multi_to_file(self):
         """Test output of multiple pieces to a single file"""
         dtb_file = get_dtb_file('dtoc_test_simple.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         self.run_test(['all'], dtb_file, output)
-        data = tools.ReadFile(output, binary=False)
+        data = tools.read_file(output, binary=False)
         self._check_strings(
             self.decl_text + self.platdata_text + self.struct_text, data)
 
@@ -1539,7 +1539,7 @@
     def test_bad_command(self):
         """Test running dtoc with an invalid command"""
         dtb_file = get_dtb_file('dtoc_test_simple.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         with self.assertRaises(ValueError) as exc:
             self.run_test(['invalid-cmd'], dtb_file, output)
         self.assertIn(
@@ -1557,12 +1557,12 @@
 
     def check_output_dirs(self, instantiate):
         # Remove the directory so that files from other tests are not there
-        tools._RemoveOutputDir()
-        tools.PrepareOutputDir(None)
+        tools._remove_output_dir()
+        tools.prepare_output_dir(None)
 
         # This should create the .dts and .dtb in the output directory
         dtb_file = get_dtb_file('dtoc_test_simple.dts')
-        outdir = tools.GetOutputDir()
+        outdir = tools.get_output_dir()
         fnames = glob.glob(outdir + '/*')
         self.assertEqual(2, len(fnames))
 
@@ -1606,7 +1606,7 @@
                 Scanner: scanner to use
         """
         dtb_file = get_dtb_file('dtoc_test_simple.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
 
         # Take a copy before messing with it
         scan = copy_scan()
@@ -1694,7 +1694,7 @@
     def test_alias_read(self):
         """Test obtaining aliases"""
         dtb_file = get_dtb_file('dtoc_test_inst.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         plat = self.run_test(['struct'], dtb_file, output)
 
         scan = plat._scan
@@ -1716,7 +1716,7 @@
     def test_alias_read_bad(self):
         """Test invalid alias property name"""
         dtb_file = get_dtb_file('dtoc_test_alias_bad.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         with self.assertRaises(ValueError) as exc:
             plat = self.run_test(['struct'], dtb_file, output)
         self.assertIn("Cannot decode alias 'i2c4-'", str(exc.exception))
@@ -1728,7 +1728,7 @@
         #    node (/does/not/exist)
         dtb_file = get_dtb_file('dtoc_test_alias_bad_path.dts', True)
 
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         with self.assertRaises(ValueError) as exc:
             plat = self.run_test(['struct'], dtb_file, output)
         self.assertIn("Alias 'i2c4' path '/does/not/exist' not found",
@@ -1737,7 +1737,7 @@
     def test_alias_read_bad_uclass(self):
         """Test alias for a uclass that doesn't exist"""
         dtb_file = get_dtb_file('dtoc_test_alias_bad_uc.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         with test_util.capture_sys_output() as (stdout, _):
             plat = self.run_test(['struct'], dtb_file, output)
         self.assertEqual("Could not find uclass for alias 'other1'",
@@ -1746,7 +1746,7 @@
     def test_sequence(self):
         """Test assignment of sequence numnbers"""
         dtb_file = get_dtb_file('dtoc_test_inst.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         plat = self.run_test(['struct'], dtb_file, output)
 
         scan = plat._scan
@@ -1762,7 +1762,7 @@
     def test_process_root(self):
         """Test assignment of sequence numnbers"""
         dtb_file = get_dtb_file('dtoc_test_simple.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
 
         # Take a copy before messing with it
         scan = copy_scan()
@@ -1781,7 +1781,7 @@
     def test_simple_inst(self):
         """Test output from some simple nodes with instantiate enabled"""
         dtb_file = get_dtb_file('dtoc_test_inst.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
 
         self.run_test(['decl'], dtb_file, output, True)
         with open(output) as infile:
@@ -1804,7 +1804,7 @@
     def test_inst_no_hdr(self):
         """Test dealing with a struct tsssshat has no header"""
         dtb_file = get_dtb_file('dtoc_test_inst.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
 
         # Run it once to set everything up
         plat = self.run_test(['decl'], dtb_file, output, True)
@@ -1824,7 +1824,7 @@
     def test_missing_props(self):
         """Test detection of a parent node with no properties"""
         dtb_file = get_dtb_file('dtoc_test_noprops.dts', capture_stderr=True)
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         with self.assertRaises(ValueError) as exc:
             self.run_test(['struct'], dtb_file, output)
         self.assertIn("Parent node '/i2c@0' has no properties - do you need",
@@ -1833,13 +1833,13 @@
     def test_single_reg(self):
         """Test detection of a parent node with no properties"""
         dtb_file = get_dtb_file('dtoc_test_single_reg.dts')
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         self.run_test(['struct'], dtb_file, output)
 
     def test_missing_parent(self):
         """Test detection of a parent node with no properties"""
         dtb_file = get_dtb_file('dtoc_test_noparent.dts', capture_stderr=True)
-        output = tools.GetOutputFilename('output')
+        output = tools.get_output_filename('output')
         with self.assertRaises(ValueError) as exc:
             self.run_test(['device'], dtb_file, output, instantiate=True)
         self.assertIn("Node '/i2c@0/spl-test/pmic@9' requires parent node "
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index 55b70e9..5a4e9e0 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -74,11 +74,11 @@
     """
     @classmethod
     def setUpClass(cls):
-        tools.PrepareOutputDir(None)
+        tools.prepare_output_dir(None)
 
     @classmethod
     def tearDownClass(cls):
-        tools.FinaliseOutputDir()
+        tools.finalise_output_dir()
 
     def setUp(self):
         self.dtb = fdt.FdtScan(find_dtb_file('dtoc_test_simple.dts'))
@@ -152,11 +152,11 @@
 
     @classmethod
     def setUpClass(cls):
-        tools.PrepareOutputDir(None)
+        tools.prepare_output_dir(None)
 
     @classmethod
     def tearDownClass(cls):
-        tools.FinaliseOutputDir()
+        tools.finalise_output_dir()
 
     def setUp(self):
         self.dtb = fdt.FdtScan(find_dtb_file('dtoc_test_simple.dts'))
@@ -294,11 +294,11 @@
 
     @classmethod
     def setUpClass(cls):
-        tools.PrepareOutputDir(None)
+        tools.prepare_output_dir(None)
 
     @classmethod
     def tearDownClass(cls):
-        tools.FinaliseOutputDir()
+        tools.finalise_output_dir()
 
     def setUp(self):
         self.dtb = fdt.FdtScan(find_dtb_file('dtoc_test_simple.dts'))
@@ -370,7 +370,7 @@
         """Tests the GetEmpty() function for the various supported types"""
         self.assertEqual(True, fdt.Prop.GetEmpty(Type.BOOL))
         self.assertEqual(chr(0), fdt.Prop.GetEmpty(Type.BYTE))
-        self.assertEqual(tools.GetBytes(0, 4), fdt.Prop.GetEmpty(Type.INT))
+        self.assertEqual(tools.get_bytes(0, 4), fdt.Prop.GetEmpty(Type.INT))
         self.assertEqual('', fdt.Prop.GetEmpty(Type.STRING))
 
     def testGetOffset(self):
@@ -501,7 +501,7 @@
         self.node.AddString('string', val)
         self.dtb.Sync(auto_resize=True)
         data = self.fdt.getprop(self.node.Offset(), 'string')
-        self.assertEqual(tools.ToBytes(val) + b'\0', data)
+        self.assertEqual(tools.to_bytes(val) + b'\0', data)
 
         self.fdt.pack()
         self.node.SetString('string', val + 'x')
@@ -511,24 +511,24 @@
         self.node.SetString('string', val[:-1])
 
         prop = self.node.props['string']
-        prop.SetData(tools.ToBytes(val))
+        prop.SetData(tools.to_bytes(val))
         self.dtb.Sync(auto_resize=False)
         data = self.fdt.getprop(self.node.Offset(), 'string')
-        self.assertEqual(tools.ToBytes(val), data)
+        self.assertEqual(tools.to_bytes(val), data)
 
         self.node.AddEmptyProp('empty', 5)
         self.dtb.Sync(auto_resize=True)
         prop = self.node.props['empty']
-        prop.SetData(tools.ToBytes(val))
+        prop.SetData(tools.to_bytes(val))
         self.dtb.Sync(auto_resize=False)
         data = self.fdt.getprop(self.node.Offset(), 'empty')
-        self.assertEqual(tools.ToBytes(val), data)
+        self.assertEqual(tools.to_bytes(val), data)
 
         self.node.SetData('empty', b'123')
         self.assertEqual(b'123', prop.bytes)
 
         # Trying adding a lot of data at once
-        self.node.AddData('data', tools.GetBytes(65, 20000))
+        self.node.AddData('data', tools.get_bytes(65, 20000))
         self.dtb.Sync(auto_resize=True)
 
     def testFromData(self):
@@ -562,7 +562,7 @@
 
     def testGetFilename(self):
         """Test the dtb filename can be provided"""
-        self.assertEqual(tools.GetOutputFilename('source.dtb'),
+        self.assertEqual(tools.get_output_filename('source.dtb'),
                          self.dtb.GetFilename())
 
 
@@ -575,11 +575,11 @@
     """
     @classmethod
     def setUpClass(cls):
-        tools.PrepareOutputDir(None)
+        tools.prepare_output_dir(None)
 
     @classmethod
     def tearDownClass(cls):
-        tools.FinaliseOutputDir()
+        tools.finalise_output_dir()
 
     def setUp(self):
         self.dtb = fdt.FdtScan(find_dtb_file('dtoc_test_simple.dts'))
diff --git a/tools/dtoc/test_src_scan.py b/tools/dtoc/test_src_scan.py
index f03cf8e..bdfa669 100644
--- a/tools/dtoc/test_src_scan.py
+++ b/tools/dtoc/test_src_scan.py
@@ -43,11 +43,11 @@
     """Tests for src_scan"""
     @classmethod
     def setUpClass(cls):
-        tools.PrepareOutputDir(None)
+        tools.prepare_output_dir(None)
 
     @classmethod
     def tearDownClass(cls):
-        tools.FinaliseOutputDir()
+        tools.finalise_output_dir()
 
     def test_simple(self):
         """Simple test of scanning drivers"""
@@ -113,7 +113,7 @@
             pathname = os.path.join(indir, fname)
             dirname = os.path.dirname(pathname)
             os.makedirs(dirname, exist_ok=True)
-            tools.WriteFile(pathname, '', binary=False)
+            tools.write_file(pathname, '', binary=False)
             fname_list.append(pathname)
 
         try:
@@ -142,7 +142,7 @@
     def test_scan(self):
         """Test scanning of a driver"""
         fname = os.path.join(OUR_PATH, '..', '..', 'drivers/i2c/tegra_i2c.c')
-        buff = tools.ReadFile(fname, False)
+        buff = tools.read_file(fname, False)
         scan = src_scan.Scanner(None, None)
         scan._parse_driver(fname, buff)
         self.assertIn('i2c_tegra', scan._drivers)
@@ -374,8 +374,8 @@
 
     def test_struct_scan_errors(self):
         """Test scanning a header file with an invalid unicode file"""
-        output = tools.GetOutputFilename('output.h')
-        tools.WriteFile(output, b'struct this is a test \x81 of bad unicode')
+        output = tools.get_output_filename('output.h')
+        tools.write_file(output, b'struct this is a test \x81 of bad unicode')
 
         scan = src_scan.Scanner(None, None)
         with test_util.capture_sys_output() as (stdout, _):