diff options
author | Tom Rini <trini@konsulko.com> | 2017-09-12 09:32:51 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2017-09-12 09:32:51 -0400 |
commit | de2ad2c40db389e4747f566e44aa7f1a1aec91fb (patch) | |
tree | 76bd1340bc1b8b25e5acffeed74bceea5913969a | |
parent | d81a1de96e2636163783c342b8fda965e696e382 (diff) | |
parent | ee87a097b0f66158ce2985940a5f28ba15a3552d (diff) |
Merge git://git.denx.de/u-boot-dm
-rw-r--r-- | arch/arm/mach-tegra/xusb-padctl-common.c | 8 | ||||
-rw-r--r-- | arch/sandbox/Kconfig | 22 | ||||
-rw-r--r-- | arch/sandbox/dts/test.dts | 10 | ||||
-rw-r--r-- | board/sandbox/README.sandbox | 7 | ||||
-rw-r--r-- | doc/bounces | 3 | ||||
-rw-r--r-- | drivers/block/blk-uclass.c | 8 | ||||
-rw-r--r-- | drivers/block/sandbox.c | 2 | ||||
-rw-r--r-- | drivers/core/dump.c | 8 | ||||
-rw-r--r-- | drivers/core/ofnode.c | 9 | ||||
-rw-r--r-- | drivers/core/root.c | 34 | ||||
-rw-r--r-- | drivers/misc/cros_ec.c | 3 | ||||
-rw-r--r-- | drivers/power/pmic/pmic-uclass.c | 4 | ||||
-rw-r--r-- | drivers/scsi/scsi.c | 2 | ||||
-rw-r--r-- | include/blk.h | 8 | ||||
-rw-r--r-- | include/dm/ofnode.h | 24 | ||||
-rw-r--r-- | include/dm/root.h | 14 | ||||
-rw-r--r-- | lib/libfdt/pylibfdt/libfdt.i | 2 | ||||
-rw-r--r-- | scripts/config_whitelist.txt | 1 | ||||
-rw-r--r-- | test/dm/blk.c | 6 | ||||
-rw-r--r-- | test/dm/test-main.c | 2 | ||||
-rw-r--r-- | tools/buildman/kconfiglib.py | 22 | ||||
-rwxr-xr-x | tools/genboardscfg.py | 7 | ||||
-rwxr-xr-x | tools/moveconfig.py | 6 | ||||
-rw-r--r-- | tools/patman/README | 12 | ||||
-rw-r--r-- | tools/patman/series.py | 5 | ||||
-rw-r--r-- | tools/patman/settings.py | 18 |
26 files changed, 191 insertions, 56 deletions
diff --git a/arch/arm/mach-tegra/xusb-padctl-common.c b/arch/arm/mach-tegra/xusb-padctl-common.c index 37b5b8fb5b..abc18c03a5 100644 --- a/arch/arm/mach-tegra/xusb-padctl-common.c +++ b/arch/arm/mach-tegra/xusb-padctl-common.c @@ -224,9 +224,7 @@ tegra_xusb_padctl_config_parse_dt(struct tegra_xusb_padctl *padctl, config->name = ofnode_get_name(node); - for (subnode = ofnode_first_subnode(node); - ofnode_valid(subnode); - subnode = ofnode_next_subnode(subnode)) { + ofnode_for_each_subnode(subnode, node) { struct tegra_xusb_padctl_group *group; int err; @@ -256,9 +254,7 @@ static int tegra_xusb_padctl_parse_dt(struct tegra_xusb_padctl *padctl, return err; } - for (subnode = ofnode_first_subnode(node); - ofnode_valid(subnode); - subnode = ofnode_next_subnode(subnode)) { + ofnode_for_each_subnode(subnode, node) { struct tegra_xusb_padctl_config *config = &padctl->config; debug("%s: subnode=%s\n", __func__, ofnode_get_name(subnode)); diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig index f7a6e1aef8..87418e3986 100644 --- a/arch/sandbox/Kconfig +++ b/arch/sandbox/Kconfig @@ -18,4 +18,26 @@ config SYS_CONFIG_NAME default "sandbox_spl" if SANDBOX_SPL default "sandbox" if !SANDBOX_SPL +choice + prompt "Run sandbox on 32/64-bit host" + default SANDBOX_64BIT + help + Sandbox can be built on 32-bit and 64-bit hosts. + The default is to build on a 64-bit host and run + on a 64-bit host. If you want to run sandbox on + a 32-bit host, change it here. + +config SANDBOX_32BIT + bool "32-bit host" + +config SANDBOX_64BIT + bool "64-bit host" + +endchoice + +config SANDBOX_BITS_PER_LONG + int + default 32 if SANDBOX_32BIT + default 64 if SANDBOX_64BIT + endmenu diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 65b2f8ecda..e67d428eb2 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -127,10 +127,12 @@ compatible = "denx,u-boot-fdt-test"; }; - clk_fixed: clk-fixed { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <1234>; + clocks { + clk_fixed: clk-fixed { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <1234>; + }; }; clk_sandbox: clk-sbox { diff --git a/board/sandbox/README.sandbox b/board/sandbox/README.sandbox index 9dc2eb09d1..2e2c819384 100644 --- a/board/sandbox/README.sandbox +++ b/board/sandbox/README.sandbox @@ -24,6 +24,9 @@ single board in board/sandbox. CONFIG_SANDBOX_BIG_ENDIAN should be defined when running on big-endian machines. +By default sandbox builds and runs on 64-bit hosts. If you are going to build +and run sandbox on a 32-bit host, select CONFIG_SANDBOX_32BIT. + Note that standalone/API support is not available at present. @@ -44,10 +47,6 @@ Note: make sandbox_defconfig all NO_SDL=1 ./u-boot - If you are building on a 32-bit machine you may get errors from __ffs.h - about shifting more than the machine word size. Edit the config file - include/configs/sandbox.h and change CONFIG_SANDBOX_BITS_PER_LONG to 32. - U-Boot will start on your computer, showing a sandbox emulation of the serial console: diff --git a/doc/bounces b/doc/bounces new file mode 100644 index 0000000000..d1c5f0d246 --- /dev/null +++ b/doc/bounces @@ -0,0 +1,3 @@ +# List of addresses picked up by patman/get_maintainer.pl that are known to +# bounce. Addresses are listed one per line and need to match the author +# information recorded in git. diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c index 3c5a87b60a..aee2a50d62 100644 --- a/drivers/block/blk-uclass.c +++ b/drivers/block/blk-uclass.c @@ -546,7 +546,7 @@ static int blk_claim_devnum(enum if_type if_type, int devnum) int blk_create_device(struct udevice *parent, const char *drv_name, const char *name, int if_type, int devnum, int blksz, - lbaint_t size, struct udevice **devp) + lbaint_t lba, struct udevice **devp) { struct blk_desc *desc; struct udevice *dev; @@ -567,7 +567,7 @@ int blk_create_device(struct udevice *parent, const char *drv_name, desc = dev_get_uclass_platdata(dev); desc->if_type = if_type; desc->blksz = blksz; - desc->lba = size / blksz; + desc->lba = lba; desc->part_type = PART_TYPE_UNKNOWN; desc->bdev = dev; desc->devnum = devnum; @@ -578,7 +578,7 @@ int blk_create_device(struct udevice *parent, const char *drv_name, int blk_create_devicef(struct udevice *parent, const char *drv_name, const char *name, int if_type, int devnum, int blksz, - lbaint_t size, struct udevice **devp) + lbaint_t lba, struct udevice **devp) { char dev_name[30], *str; int ret; @@ -589,7 +589,7 @@ int blk_create_devicef(struct udevice *parent, const char *drv_name, return -ENOMEM; ret = blk_create_device(parent, drv_name, str, if_type, devnum, - blksz, size, devp); + blksz, lba, devp); if (ret) { free(str); return ret; diff --git a/drivers/block/sandbox.c b/drivers/block/sandbox.c index 34d1c638bc..98df6b33b6 100644 --- a/drivers/block/sandbox.c +++ b/drivers/block/sandbox.c @@ -129,7 +129,7 @@ int host_dev_bind(int devnum, char *filename) } ret = blk_create_device(gd->dm_root, "sandbox_host_blk", str, IF_TYPE_HOST, devnum, 512, - os_lseek(fd, 0, OS_SEEK_END), &dev); + os_lseek(fd, 0, OS_SEEK_END) / 512, &dev); if (ret) goto err_file; ret = device_probe(dev); diff --git a/drivers/core/dump.c b/drivers/core/dump.c index c3e109e7ed..6c6b944453 100644 --- a/drivers/core/dump.c +++ b/drivers/core/dump.c @@ -14,12 +14,10 @@ static void show_devices(struct udevice *dev, int depth, int last_flag) { int i, is_last; struct udevice *child; - char class_name[12]; /* print the first 11 characters to not break the tree-format. */ - strlcpy(class_name, dev->uclass->uc_drv->name, sizeof(class_name)); - printf(" %-11s [ %c ] ", class_name, - dev->flags & DM_FLAG_ACTIVATED ? '+' : ' '); + printf(" %-10.10s [ %c ] %-10.10s ", dev->uclass->uc_drv->name, + dev->flags & DM_FLAG_ACTIVATED ? '+' : ' ', dev->driver->name); for (i = depth; i >= 0; i--) { is_last = (last_flag >> i) & 1; @@ -50,7 +48,7 @@ void dm_dump_all(void) root = dm_root(); if (root) { - printf(" Class Probed Name\n"); + printf(" Class Probed Driver Name\n"); printf("----------------------------------------\n"); show_devices(root, -1, 0); } diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index 0685b689d8..c6ca13fabf 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -390,10 +390,11 @@ int ofnode_decode_display_timing(ofnode parent, int index, if (!ofnode_valid(timings)) return -EINVAL; - for (i = 0, node = ofnode_first_subnode(timings); - ofnode_valid(node) && i != index; - node = ofnode_first_subnode(node)) - i++; + i = 0; + ofnode_for_each_subnode(node, timings) { + if (i++ == index) + break; + } if (!ofnode_valid(node)) return -EINVAL; diff --git a/drivers/core/root.c b/drivers/core/root.c index d691d6ff94..757d109e57 100644 --- a/drivers/core/root.c +++ b/drivers/core/root.c @@ -312,8 +312,38 @@ int dm_scan_fdt(const void *blob, bool pre_reloc_only) #endif return dm_scan_fdt_node(gd->dm_root, blob, 0, pre_reloc_only); } +#else +static int dm_scan_fdt_node(struct udevice *parent, const void *blob, + int offset, bool pre_reloc_only) +{ + return 0; +} #endif +int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only) +{ + int node, ret; + + ret = dm_scan_fdt(gd->fdt_blob, pre_reloc_only); + if (ret) { + debug("dm_scan_fdt() failed: %d\n", ret); + return ret; + } + + /* bind fixed-clock */ + node = ofnode_to_offset(ofnode_path("/clocks")); + /* if no DT "clocks" node, no need to go further */ + if (node < 0) + return ret; + + ret = dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node, + pre_reloc_only); + if (ret) + debug("dm_scan_fdt_node() failed: %d\n", ret); + + return ret; +} + __weak int dm_scan_other(bool pre_reloc_only) { return 0; @@ -335,9 +365,9 @@ int dm_init_and_scan(bool pre_reloc_only) } if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) { - ret = dm_scan_fdt(gd->fdt_blob, pre_reloc_only); + ret = dm_extended_scan_fdt(gd->fdt_blob, pre_reloc_only); if (ret) { - debug("dm_scan_fdt() failed: %d\n", ret); + debug("dm_extended_scan_dt() failed: %d\n", ret); return ret; } } diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c index feaa5d8567..eefaaa53ad 100644 --- a/drivers/misc/cros_ec.c +++ b/drivers/misc/cros_ec.c @@ -1038,8 +1038,7 @@ int cros_ec_decode_ec_flash(struct udevice *dev, struct fdt_cros_ec *config) config->flash_erase_value = ofnode_read_s32_default(flash_node, "erase-value", -1); - for (node = ofnode_first_subnode(flash_node); ofnode_valid(node); - node = ofnode_next_subnode(node)) { + ofnode_for_each_subnode(node, flash_node) { const char *name = ofnode_get_name(node); enum ec_flash_region region; diff --git a/drivers/power/pmic/pmic-uclass.c b/drivers/power/pmic/pmic-uclass.c index 953bbe5026..64964e4e96 100644 --- a/drivers/power/pmic/pmic-uclass.c +++ b/drivers/power/pmic/pmic-uclass.c @@ -34,9 +34,7 @@ int pmic_bind_children(struct udevice *pmic, ofnode parent, debug("%s for '%s' at node offset: %d\n", __func__, pmic->name, dev_of_offset(pmic)); - for (node = ofnode_first_subnode(parent); - ofnode_valid(node); - node = ofnode_next_subnode(node)) { + ofnode_for_each_subnode(node, parent) { node_name = ofnode_get_name(node); debug("* Found child node: '%s'\n", node_name); diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 1a65a3f9b9..df998921f5 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -580,7 +580,7 @@ static int do_scsi_scan_one(struct udevice *dev, int id, int lun, bool verbose) */ snprintf(str, sizeof(str), "id%dlun%d", id, lun); ret = blk_create_devicef(dev, "scsi_blk", str, IF_TYPE_SCSI, -1, - bd.blksz, bd.blksz * bd.lba, &bdev); + bd.blksz, bd.lba, &bdev); if (ret) { debug("Can't create device\n"); return ret; diff --git a/include/blk.h b/include/blk.h index 27abfddb94..1965812a9d 100644 --- a/include/blk.h +++ b/include/blk.h @@ -315,12 +315,12 @@ int blk_next_device(struct udevice **devp); * @devnum: Device number, specific to the interface type, or -1 to * allocate the next available number * @blksz: Block size of the device in bytes (typically 512) - * @size: Total size of the device in bytes + * @lba: Total number of blocks of the device * @devp: the new device (which has not been probed) */ int blk_create_device(struct udevice *parent, const char *drv_name, const char *name, int if_type, int devnum, int blksz, - lbaint_t size, struct udevice **devp); + lbaint_t lba, struct udevice **devp); /** * blk_create_devicef() - Create a new named block device @@ -332,12 +332,12 @@ int blk_create_device(struct udevice *parent, const char *drv_name, * @devnum: Device number, specific to the interface type, or -1 to * allocate the next available number * @blksz: Block size of the device in bytes (typically 512) - * @size: Total size of the device in bytes + * @lba: Total number of blocks of the device * @devp: the new device (which has not been probed) */ int blk_create_devicef(struct udevice *parent, const char *drv_name, const char *name, int if_type, int devnum, int blksz, - lbaint_t size, struct udevice **devp); + lbaint_t lba, struct udevice **devp); /** * blk_prepare_device() - Prepare a block device for use diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index de2769ed53..79374b8f91 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -628,4 +628,28 @@ int ofnode_read_resource(ofnode node, uint index, struct resource *res); int ofnode_read_resource_byname(ofnode node, const char *name, struct resource *res); +/** + * ofnode_for_each_subnode() - iterate over all subnodes of a parent + * + * @node: child node (ofnode, lvalue) + * @parent: parent node (ofnode) + * + * This is a wrapper around a for loop and is used like so: + * + * ofnode node; + * + * ofnode_for_each_subnode(node, parent) { + * Use node + * ... + * } + * + * Note that this is implemented as a macro and @node is used as + * iterator in the loop. The parent variable can be a constant or even a + * literal. + */ +#define ofnode_for_each_subnode(node, parent) \ + for (node = ofnode_first_subnode(parent); \ + ofnode_valid(node); \ + node = ofnode_next_subnode(node)) + #endif diff --git a/include/dm/root.h b/include/dm/root.h index 50a6011644..b075eef2c1 100644 --- a/include/dm/root.h +++ b/include/dm/root.h @@ -56,6 +56,20 @@ int dm_scan_platdata(bool pre_reloc_only); int dm_scan_fdt(const void *blob, bool pre_reloc_only); /** + * dm_extended_scan_fdt() - Scan the device tree and bind drivers + * + * This calls dm_scna_dft() which scans the device tree and creates a driver + * for each node. the top-level subnodes are examined and also all sub-nodes + * of "clocks" node. + * + * @blob: Pointer to device tree blob + * @pre_reloc_only: If true, bind only drivers with the DM_FLAG_PRE_RELOC + * flag. If false bind all drivers. + * @return 0 if OK, -ve on error + */ +int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only); + +/** * dm_scan_other() - Scan for other devices * * Some devices may not be visible to Driver Model. This weak function can diff --git a/lib/libfdt/pylibfdt/libfdt.i b/lib/libfdt/pylibfdt/libfdt.i index 3b11bb0c95..146f4b942a 100644 --- a/lib/libfdt/pylibfdt/libfdt.i +++ b/lib/libfdt/pylibfdt/libfdt.i @@ -8,6 +8,8 @@ %module libfdt +%include <stdint.i> + %{ #define SWIG_FILE_WITH_INIT #include "libfdt.h" diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 4a0eae3633..3b07df245f 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -1950,7 +1950,6 @@ CONFIG_SAMSUNG CONFIG_SAMSUNG_ONENAND CONFIG_SANDBOX_ARCH CONFIG_SANDBOX_BIG_ENDIAN -CONFIG_SANDBOX_BITS_PER_LONG CONFIG_SANDBOX_SDL CONFIG_SANDBOX_SPI_MAX_BUS CONFIG_SANDBOX_SPI_MAX_CS diff --git a/test/dm/blk.c b/test/dm/blk.c index 923e8d95f0..30d1e6184d 100644 --- a/test/dm/blk.c +++ b/test/dm/blk.c @@ -23,9 +23,9 @@ static int dm_test_blk_base(struct unit_test_state *uts) /* Create two, one the parent of the other */ ut_assertok(blk_create_device(gd->dm_root, "sandbox_host_blk", "test", - IF_TYPE_HOST, 1, 512, 1024, &blk)); + IF_TYPE_HOST, 1, 512, 2, &blk)); ut_assertok(blk_create_device(blk, "usb_storage_blk", "test", - IF_TYPE_USB, 3, 512, 1024, &usb_blk)); + IF_TYPE_USB, 3, 512, 2, &usb_blk)); /* Check we can find them */ ut_asserteq(-ENODEV, blk_get_device(IF_TYPE_HOST, 0, &dev)); @@ -101,7 +101,7 @@ static int dm_test_blk_find(struct unit_test_state *uts) struct udevice *blk, *dev; ut_assertok(blk_create_device(gd->dm_root, "sandbox_host_blk", "test", - IF_TYPE_HOST, 1, 512, 1024, &blk)); + IF_TYPE_HOST, 1, 512, 2, &blk)); ut_asserteq(-ENODEV, blk_find_device(IF_TYPE_HOST, 0, &dev)); ut_assertok(blk_find_device(IF_TYPE_HOST, 1, &dev)); ut_asserteq_ptr(blk, dev); diff --git a/test/dm/test-main.c b/test/dm/test-main.c index 9d88d31467..4478e6b8fc 100644 --- a/test/dm/test-main.c +++ b/test/dm/test-main.c @@ -92,7 +92,7 @@ static int dm_do_test(struct unit_test_state *uts, struct unit_test *test, if (test->flags & DM_TESTF_PROBE_TEST) ut_assertok(do_autoprobe(uts)); if (test->flags & DM_TESTF_SCAN_FDT) - ut_assertok(dm_scan_fdt(gd->fdt_blob, false)); + ut_assertok(dm_extended_scan_fdt(gd->fdt_blob, false)); /* * Silence the console and rely on console reocrding to get diff --git a/tools/buildman/kconfiglib.py b/tools/buildman/kconfiglib.py index d28bbf0b49..352ad438ee 100644 --- a/tools/buildman/kconfiglib.py +++ b/tools/buildman/kconfiglib.py @@ -204,6 +204,7 @@ class Config(object): self.print_warnings = print_warnings self.print_undef_assign = print_undef_assign + self._warnings = [] # For parsing routines that stop when finding a line belonging to a # different construct, these holds that line and the tokenized version @@ -398,8 +399,12 @@ class Config(object): need to refer to the top-level kernel directory with "$srctree". replace (default: True): True if the configuration should replace the - old configuration; False if it should add to it.""" + old configuration; False if it should add to it. + Returns a list or warnings (hopefully empty) + """ + + self._warnings = [] # Put this first so that a missing file doesn't screw up our state filename = os.path.expandvars(filename) line_feeder = _FileFeed(filename) @@ -449,7 +454,7 @@ class Config(object): while 1: line = line_feeder.get_next() if line is None: - return + return self._warnings line = line.rstrip() @@ -1763,8 +1768,10 @@ class Config(object): def _warn(self, msg, filename=None, linenr=None): """For printing warnings to stderr.""" + msg = _build_msg("warning: " + msg, filename, linenr) if self.print_warnings: - _stderr_msg("warning: " + msg, filename, linenr) + sys.stderr.write(msg + "\n") + self._warnings.append(msg) class Item(object): @@ -3369,10 +3376,13 @@ def _clean_up_path(path): path = path[2:] return path.rstrip("/") -def _stderr_msg(msg, filename, linenr): +def _build_msg(msg, filename, linenr): if filename is not None: - sys.stderr.write("{0}:{1}: ".format(_clean_up_path(filename), linenr)) - sys.stderr.write(msg + "\n") + msg = "{0}:{1}: ".format(_clean_up_path(filename), linenr) + msg + return msg + +def _stderr_msg(msg, filename, linenr): + sys.stderr.write(_build_msg(msg, filename, linenr) + "\n") def _tokenization_error(s, filename, linenr): loc = "" if filename is None else "{0}:{1}: ".format(filename, linenr) diff --git a/tools/genboardscfg.py b/tools/genboardscfg.py index 2e871feaf4..2345a19798 100755 --- a/tools/genboardscfg.py +++ b/tools/genboardscfg.py @@ -124,7 +124,7 @@ class KconfigScanner: os.environ['srctree'] = os.getcwd() os.environ['UBOOTVERSION'] = 'dummy' os.environ['KCONFIG_OBJDIR'] = '' - self._conf = kconfiglib.Config() + self._conf = kconfiglib.Config(print_warnings=False) def __del__(self): """Delete a leftover temporary file before exit. @@ -166,7 +166,10 @@ class KconfigScanner: else: f.write(line[colon + 1:]) - self._conf.load_config(self._tmpfile) + warnings = self._conf.load_config(self._tmpfile) + if warnings: + for warning in warnings: + print '%s: %s' % (defconfig, warning) try_remove(self._tmpfile) self._tmpfile = None diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 8a03850192..6f549a51c1 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -1877,10 +1877,10 @@ def main(): if options.build_db: with open(CONFIG_DATABASE, 'w') as fd: for defconfig, configs in config_db.iteritems(): - print >>fd, '%s' % defconfig + fd.write('%s\n' % defconfig) for config in sorted(configs.keys()): - print >>fd, ' %s=%s' % (config, configs[config]) - print >>fd + fd.write(' %s=%s\n' % (config, configs[config])) + fd.write('\n') if __name__ == '__main__': main() diff --git a/tools/patman/README b/tools/patman/README index e36857dede..8582ed6ba1 100644 --- a/tools/patman/README +++ b/tools/patman/README @@ -84,6 +84,18 @@ Aliases are recursive. The checkpatch.pl in the U-Boot tools/ subdirectory will be located and used. Failing that you can put it into your path or ~/bin/checkpatch.pl +If you want to avoid sending patches to email addresses that are picked up +by patman but are known to bounce you can add a [bounces] section to your +.patman file. Unlike the [alias] section these are simple key: value pairs +that are not recursive. + +>>> + +[bounces] +gonefishing: Fred Bloggs <f.bloggs@napier.net> + +<<< + If you want to change the defaults for patman's command-line arguments, you can add a [settings] section to your .patman file. This can be used diff --git a/tools/patman/series.py b/tools/patman/series.py index d3947a7c2a..73ee394486 100644 --- a/tools/patman/series.py +++ b/tools/patman/series.py @@ -10,6 +10,7 @@ import os import get_maintainer import gitutil +import settings import terminal # Series-xxx tags that we understand @@ -218,6 +219,7 @@ class Series(dict): Return: Filename of temp file created """ + col = terminal.Color() # Look for commit tags (of the form 'xxx:' at the start of the subject) fname = '/tmp/patman.%d' % os.getpid() fd = open(fname, 'w') @@ -233,6 +235,9 @@ class Series(dict): cc += add_maintainers elif add_maintainers: cc += get_maintainer.GetMaintainer(commit.patch) + for x in set(cc) & set(settings.bounces): + print(col.Color(col.YELLOW, 'Skipping "%s"' % x)) + cc = set(cc) - set(settings.bounces) cc = [m.encode('utf-8') if type(m) != str else m for m in cc] all_ccs += cc print(commit.patch, ', '.join(set(cc)), file=fd) diff --git a/tools/patman/settings.py b/tools/patman/settings.py index 5f207f5ef1..d735ff9ba3 100644 --- a/tools/patman/settings.py +++ b/tools/patman/settings.py @@ -269,6 +269,19 @@ def _ReadAliasFile(fname): if bad_line: print(bad_line) +def _ReadBouncesFile(fname): + """Read in the bounces file if it exists + + Args: + fname: Filename to read. + """ + if os.path.exists(fname): + with open(fname) as fd: + for line in fd: + if line.startswith('#'): + continue + bounces.add(line.strip()) + def Setup(parser, project_name, config_fname=''): """Set up the settings module by reading config files. @@ -293,10 +306,15 @@ def Setup(parser, project_name, config_fname=''): for name, value in config.items('alias'): alias[name] = value.split(',') + _ReadBouncesFile('doc/bounces') + for name, value in config.items('bounces'): + bounces.add(value) + _UpdateDefaults(parser, config) # These are the aliases we understand, indexed by alias. Each member is a list. alias = {} +bounces = set() if __name__ == "__main__": import doctest |