From 5fe7702eccf1bae5b10f0309cef03e02bfdfa6ef Mon Sep 17 00:00:00 2001 From: Jean-Jacques Hiblot Date: Fri, 9 Jun 2017 16:45:18 +0200 Subject: blk: dm: make blk_create_device() take a number of block instead of a size There is an overflow problem when taking the size instead of the number of blocks in blk_create_device(). This results in a wrong device size: the device apparent size is its real size modulo 4GB. Using the number of blocks instead of the device size fixes the problem and is more coherent with the internals of the block layer. Signed-off-by: Jean-Jacques Hiblot Reviewed-by: Simon Glass diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c index 3c5a87b..aee2a50 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 34d1c63..98df6b3 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/scsi/scsi.c b/drivers/scsi/scsi.c index 1a65a3f..df99892 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 27abfdd..1965812 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/test/dm/blk.c b/test/dm/blk.c index 923e8d9..30d1e61 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); -- cgit v0.10.2 From 98cff66027c44e6e15eb48dbb2300f388bcc172c Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Tue, 1 Aug 2017 16:33:33 -0700 Subject: sandbox: Introduce Kconfig option for 32/64 bit host It seems most of the time we are building and running sandbox on 64-bit host. But we do support 32-bit host as well. Introduce Kconfig option for this. Signed-off-by: Bin Meng Reviewed-by: Simon Glass diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig index f7a6e1a..7b07bff 100644 --- a/arch/sandbox/Kconfig +++ b/arch/sandbox/Kconfig @@ -18,4 +18,21 @@ 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 + endmenu -- cgit v0.10.2 From 226b50bbd87b0c4ebf913066dfadbe04306ce402 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Tue, 1 Aug 2017 16:33:34 -0700 Subject: sandbox: Convert SANDBOX_BITS_PER_LONG to Kconfig Convert SANDBOX_BITS_PER_LONG to Kconfig and assign it a correct number depending on which host we are going to build and run. Signed-off-by: Bin Meng Reviewed-by: Simon Glass diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig index 7b07bff..87418e3 100644 --- a/arch/sandbox/Kconfig +++ b/arch/sandbox/Kconfig @@ -35,4 +35,9 @@ config SANDBOX_64BIT endchoice +config SANDBOX_BITS_PER_LONG + int + default 32 if SANDBOX_32BIT + default 64 if SANDBOX_64BIT + endmenu diff --git a/board/sandbox/README.sandbox b/board/sandbox/README.sandbox index 9dc2eb0..2e2c819 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/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 9ce0c3f..0a9da46 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -1951,7 +1951,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 -- cgit v0.10.2 From a0f9acb08bd6f3b4a6f3adcb02c8170e522c074a Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 2 Aug 2017 12:12:01 -0600 Subject: dm: core: Drop use of strlcpy() We can use printf() to limit the string width. Adjust the code to do this instead of using strlcpy() which is a bit clumbsy. Signed-off-by: Simon Glass Reviewed-by: Bin Meng Tested-by: Bin Meng diff --git a/drivers/core/dump.c b/drivers/core/dump.c index c3e109e..1bb6409 100644 --- a/drivers/core/dump.c +++ b/drivers/core/dump.c @@ -14,11 +14,9 @@ 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, + printf(" %-10.10s [ %c ] ", dev->uclass->uc_drv->name, dev->flags & DM_FLAG_ACTIVATED ? '+' : ' '); for (i = depth; i >= 0; i--) { @@ -50,7 +48,7 @@ void dm_dump_all(void) root = dm_root(); if (root) { - printf(" Class Probed Name\n"); + printf(" Class Probed Name\n"); printf("----------------------------------------\n"); show_devices(root, -1, 0); } -- cgit v0.10.2 From ee3e520dad0b368df4541cd0af0d4011cf481e5b Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 2 Aug 2017 12:12:02 -0600 Subject: dm: core: Show driver name with 'dm tree' It is often useful to see which driver was actually selected for each device. Add a new 'Driver' column to provide this information. Sample output: Class Probed Driver Name ---------------------------------------- root [ + ] root_drive root_driver keyboard [ + ] i8042_kbd |-- keyboard serial [ + ] ns16550_se |-- serial rtc [ ] rtc_mc1468 |-- rtc timer [ + ] tsc_timer |-- tsc-timer syscon [ + ] ich6_pinct |-- pch_pinctrl pci [ + ] pci_x86 |-- pci northbridge [ + ] bd82x6x_no | |-- northbridge@0,0 video [ + ] bd82x6x_vi | |-- gma@2,0 vidconsole0 [ + ] vidconsole | | `-- gma@2,0.vidconsole0 ... Signed-off-by: Simon Glass Reviewed-by: Bin Meng Tested-by: Bin Meng diff --git a/drivers/core/dump.c b/drivers/core/dump.c index 1bb6409..6c6b944 100644 --- a/drivers/core/dump.c +++ b/drivers/core/dump.c @@ -16,8 +16,8 @@ static void show_devices(struct udevice *dev, int depth, int last_flag) struct udevice *child; /* print the first 11 characters to not break the tree-format. */ - printf(" %-10.10s [ %c ] ", dev->uclass->uc_drv->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; @@ -48,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); } -- cgit v0.10.2 From 8639f69a61b47971dba47ab5ed72e47436729bb1 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 4 Aug 2017 03:30:30 -0600 Subject: genconfig.py: Print defconfig next to warnings At present we sometimes see warnings of the form: /tmp/tmpMA89kB:36: warning: overriding the value of CMD_SPL. Old value: "y", new value: "y". This is not very useful as it does not show whch defconfig file it relates to. Update the tool to show this. Signed-off-by: Simon Glass diff --git a/tools/buildman/kconfiglib.py b/tools/buildman/kconfiglib.py index d28bbf0..352ad43 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 2e871fe..2345a19 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 -- cgit v0.10.2 From 3991f42ed2e38aff28ba3c24369bfbd90620bea7 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 5 Aug 2017 15:45:54 -0600 Subject: dm: core: Add ofnode_for_each_subnode() Add a convenience macro to iterate over subnodes of a node. Make use of this where appropriate in the code. Signed-off-by: Simon Glass diff --git a/arch/arm/mach-tegra/xusb-padctl-common.c b/arch/arm/mach-tegra/xusb-padctl-common.c index 37b5b8f..abc18c0 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/drivers/core/ofnode.c b/drivers/core/ofnode.c index 0685b68..c6ca13f 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/misc/cros_ec.c b/drivers/misc/cros_ec.c index feaa5d8..eefaaa5 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 953bbe5..64964e4 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/include/dm/ofnode.h b/include/dm/ofnode.h index de2769e..79374b8 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 -- cgit v0.10.2 From c79d18c4b40d10c0a95b56e51f4517aca4515364 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 13 Aug 2017 16:02:54 -0600 Subject: moveconfig: Use fd.write() instead of print >> Adjust this code so that it can work with Python 2 and 3. Fixes: d73fcb1 (moveconfig: Support building a simple config database) Reported-by: Chris Packham Signed-off-by: Simon Glass diff --git a/lib/libfdt/pylibfdt/libfdt.i b/lib/libfdt/pylibfdt/libfdt.i index 3b11bb0..146f4b9 100644 --- a/lib/libfdt/pylibfdt/libfdt.i +++ b/lib/libfdt/pylibfdt/libfdt.i @@ -8,6 +8,8 @@ %module libfdt +%include + %{ #define SWIG_FILE_WITH_INIT #include "libfdt.h" diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 8a03850..6f549a5 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() -- cgit v0.10.2 From e11aa602abd3e8007dfd3ed23ebb829101abcfec Mon Sep 17 00:00:00 2001 From: Chris Packham Date: Fri, 1 Sep 2017 20:57:53 +1200 Subject: patman: add support for omitting bouncing addresses Add support for reading a list of bouncing addresses from a in-tree file (doc/bounces) and from the ~/.patman config file. These addresses are stripped from the Cc list. Signed-off-by: Chris Packham Reviewed-by: Simon Glass Reviewed-by: Philipp Tomsich > diff --git a/doc/bounces b/doc/bounces new file mode 100644 index 0000000..d1c5f0d --- /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/tools/patman/README b/tools/patman/README index e36857d..8582ed6 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 + +<<< + 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 d3947a7..73ee394 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 5f207f5..d735ff9 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 -- cgit v0.10.2 From e81c98649b7a67d43c5baae407430a242d3b26b9 Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Mon, 4 Sep 2017 14:55:56 +0200 Subject: dm: core: add clocks node scan Currently, all fixed-clock declared in "clocks" node in device tree can be binded by clk_fixed_rate.c driver only if each of them have the "simple-bus" compatible string. This constraint has been invoked here [1]. This patch offers a solution to avoid adding "simple-bus" compatible string to nodes that are not busses. [1] https://patchwork.ozlabs.org/patch/558837/ Signed-off-by: Patrice Chotard Reviewed-by: Simon Glass diff --git a/drivers/core/root.c b/drivers/core/root.c index d691d6f..757d109 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/include/dm/root.h b/include/dm/root.h index 50a6011..b075eef 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 -- cgit v0.10.2 From ee87a097b0f66158ce2985940a5f28ba15a3552d Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Mon, 4 Sep 2017 14:55:57 +0200 Subject: dm: test: replace dm_scan_dt() by of dm_extended_scan_fdt() in dm_do_test This allows to scan the DT including all "clocks" node's sub-nodes in which fixed-clock are defined. All fixed-clock should be defined inside a clocks node which collect all external oscillators. Until now, all clocks sub-nodes can't be binded except if the "simple-bus" compatible string is added which is a hack. Update test.dts by moving clk_fixed node inside clocks. Signed-off-by: Patrice Chotard Reviewed-by: Simon Glass Reviewed-by: Simon Glass diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 65b2f8e..e67d428 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/test/dm/test-main.c b/test/dm/test-main.c index 9d88d31..4478e6b 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 -- cgit v0.10.2