summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/lseek'Sascha Hauer2019-02-133-6/+6
|\
| * devfs: Drop dev_lseek_default()Andrey Smirnov2019-01-291-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only the following cdevs do not declare an .lseek() operation: - Console devices in common/console.c - Firmware framework in common/firmware.c - JTAG driver in drivers/misc/jtag.c - UBI in drivers/mtd/ubi/barebox.c Of those four, first two are marked DEVFS_IS_CHARACTER_DEV and implement only .write() operation and the last two don't implement anything but .ioctl(). While there's probably no meaningful way to use lseek() against any of those devices, there doesn't seem to be any harm in allowing it either. Change devfs_lseek() to ignore absense of .lseek() callback and drop dev_lseek_default() and all references to it in the codebase. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * common: firmware: Don't use FILE_SIZE_STREAM directlyAndrey Smirnov2019-01-291-1/+1
| | | | | | | | | | | | | | | | Don't use FILE_SIZE_STREAM directly, use DEVFS_IS_CHARACTER_DEV to denote that underlying cdev is a "character device". Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * commands: Get rid of mem_rw_bufAndrey Smirnov2019-01-291-4/+5
| | | | | | | | | | | | | | | | | | | | There doesn't seem to be any good reason for all of the memory commands (md, mw, etc.) to rely on a shared pre-allocated buffer anymore. So, to simplify things, drop the shared buffer and adjust all of the utilites to allocate needed memory. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | treewide: Introduce MAP_FAILED and replace ad-hoc constants with itAndrey Smirnov2019-01-161-1/+1
|/ | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/net'Sascha Hauer2019-01-151-0/+2
|\
| * defaultenv: resolve global.net.server before using itSascha Hauer2019-01-071-0/+1
| | | | | | | | | | | | | | global.net.server may contain a hostname, so we have to resolve it before using it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * defaultenv: defaultenv uses ip_route_getSascha Hauer2019-01-041-0/+1
| | | | | | | | | | | | | | The default environment uses the ip_route_get command, so select it when networking is enabled. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2019-01-152-6/+6
|\ \
| * | memory_display: Fix type of argument passed to %*sAndrey Smirnov2019-01-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | On AArch64, pointer arithmetic in (pos - line) resolves into "long int", whereas "%*s" is expecting regular "int". Add explicit cast to avoid compiler warnings. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: state: fix another alignmentRoland Hieber2019-01-081-1/+1
| | | | | | | | | | | | | | | | | | | | | Fixes: 7126dffd0be ("common: state: Add variable_type to state_variable") Fixes: 6096a0cfa4a ("common: state: fix alignment") Signed-off-by: Roland Hieber <rhi@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: state: fix alignmentRoland Hieber2019-01-071-4/+4
| | | | | | | | | | | | | | | | | | Fixes: 7126dffd0be ("common: state: Add variable_type to state_variable") Signed-off-by: Roland Hieber <rhi@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/kconfig'Sascha Hauer2019-01-151-10/+2
|\ \ \
| * | | kconfig: sync to Linux 4.20Masahiro Yamada2019-01-031-10/+2
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous sync was commit 18895514dc5e ("kconfig: update to v3.18-rc6"). Some commits were applied on top of that since then, but equivalent fixups were done in Linux. So, this commit overwrites everything scripts/kconfig/ with the one from Linux 4.20 Highlights: - 'silentoldconfig' has been renamed to 'syncconfig' (the top Makefile needs to be adjusted) - 'testconfig' target has been added for unit-tests (the top Makefile needs to export PYTHON3 because the test frame relies on Python3 and pytest) - The perfect hash table generated by gperf has been removed - The localization support has been removed - The 'option env=VAR' has been replaced with more generic variable reference syntax $(VAR) (./Kconfig and common/Kconfig need to be adjusted) Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/imx'Sascha Hauer2019-01-151-5/+7
|\ \ \
| * | | imx-bbu-nand-fcb: Remove unused variable partition_sizeAlexander Shiyan2019-01-031-3/+1
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | imx-bbu-nand-fcb: Check the required space a bit earlierAlexander Shiyan2019-01-031-2/+6
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | If the partition size is too small for imx_bbu_nand_update(), this can lead to an infinite loop in the imx_bbu_firmware_fcb_start_page() function, because imx_bbu_firmware_max_blocks() returns zero. Fix this by place imx_bbu_firmware_max_blocks() a bit early. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | envfs: Sort files when generating on build machineBaeuerle, Florian2019-01-081-2/+2
| |/ |/| | | | | | | | | | | | | | | | | | | | | The resulting environment was dependend of the build machines' filesystem, i.e. the order in which readdir returns dirents depends on the filesystem implementation. Sort file entries in scripts/bareboxenv.c for generating a reproducible built-in environment. Signed-off-by: Florian Bäuerle <florian.baeuerle@allegion.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | globalvar: fix crash if CONFIG_NVVAR is not setAntony Pavlov2018-12-131-0/+9
|/ | | | | | | | | | | | | | | | | | | | | | | At the moment globalvar code tries to use nv_device even if nv_device is not registered. How to reproduce the problem: barebox$ make sandbox_defconfig ... barebox$ sed -i "s/\(CONFIG_NVVAR\)=y/# \1 is not set/" .config barebox$ sed -i "s/\(CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW\)=y/# \1 is not set\n# CONFIG_DEFAULT_ENVIRONMENT_GENERIC is not set/" .config barebox$ make oldconfig ... barebox$ make ... barebox$ ./barebox Segmentation fault This patch blocks nv_device use if CONFIG_NVVAR is not set. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/net'Sascha Hauer2018-12-071-2/+4
|\
| * net: dns: return error codesSascha Hauer2018-11-291-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The resolv() function used to return the IP address. When net_udp_new() fails we return an error code though which the callers of resolv() take as an IP address. This is wrong of course and we could return 0 in this case. Instead we return an error code and pass the resolved IP as a pointer which allows us to return proper error codes. This patch also adds error messages and error returns to the various callers of resolv() which used to just continue with a zero IP and let the user figure out what went wrong. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/missing-prototypes'Sascha Hauer2018-12-072-15/+2
|\ \
| * | state: remove unused functionSascha Hauer2018-11-191-13/+0
| | | | | | | | | | | | | | | | | | state_find_type() is unused and doesn't have a prototype. Remove it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | imx-bbu-nand: Make locally used functions staticSascha Hauer2018-11-121-2/+2
| | | | | | | | | | | | | | | | | | To avoid missing prototypes warning. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/checkpatch'Sascha Hauer2018-12-076-55/+93
|\ \ \ | |_|/ |/| |
| * | common/parser.c: s/%d/%zu/ when printing size_tAhmad Fatoum2018-12-051-2/+2
| | | | | | | | | | | | | | | Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | Add pr_memory_displaySascha Hauer2018-12-031-5/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | pr_memory_display is a memory_display variant that takes a MSG_* loglevel priority with which the hexdump is printed. Like the normal pr_* function this is optimized out when the priority is below the compile time priority. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | memory_display: Print whole line at onceSascha Hauer2018-12-031-17/+18
| | | | | | | | | | | | | | | | | | | | | | | | Instead of using many printf assemble a printed line first and print it at once. This has the purpose of being able to pick different output functions in the next step. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | imd: fix missing error messageThorsten K. Scherer2018-11-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | imd -t just returns 'imd: error 61', if there is not tag for <type> reference: common/imd.c:357 if (!imd) { ... Signed-off-by: Thorsten K. Scherer <t.scherer@eckelmann.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | hush: Add extra define for hush debuggingSascha Hauer2018-11-271-25/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've seen people increasing the compile loglevel to get more debugging output from barebox. This is generally a good idea, but the tons of hush debugging printed makes barebox quite unusable. This patch puts hush debugging behind an extra HUSH_DEBUG define so increasing the compile loglevel no longer results in hush debugging. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | hush: Add pr_fmt defineSascha Hauer2018-11-271-0/+3
| | | | | | | | | | | | | | | | | | To give the hush debug output more context. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | memory_display: add padding to simplify countingRoland Hieber2018-11-211-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Trying to count single bytes (e.g. when adding an offset) in 'word' or 'byte' output mode is not easy in the current formatting, and (at least for me) has a high chance of miscounting or losing track of groups: barebox@boardname:/ md -b 0x149983f0+32 149983f0: 18 00 00 00 00 00 0d 86 00 00 00 00 00 00 00 00 ................ 14998400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ barebox@boardname:/ md -w 0x149983f0+32 149983f0: 0018 0000 0000 860d 0000 0000 0000 0000 ................ 14998400: 0000 0000 0000 0000 0000 0000 0000 0000 ................ With an additional space after 8 bytes, counting becomes easier: barebox@boardname:/ md -b 0x149983f0+32 149983f0: 18 00 00 00 00 00 0d 86 00 00 00 00 00 00 00 00 ................ 14998400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ barebox@boardname:/ md -w 0x149983f0+32 149983f0: 0018 0000 0000 860d 0000 0000 0000 0000 ................ 14998400: 0000 0000 0000 0000 0000 0000 0000 0000 ................ The 'quad' and 'long' output modes stay the same and are already much more easier to count because they build bigger and therefore less groups of bytes per line. Signed-off-by: Roland Hieber <r.hieber@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | ddr_spd: remove unused arrayOleksij Rempel2018-11-191-2/+0
| | | | | | | | | | | | | | | Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | ubiformat: print messages after checking a block is not badSascha Hauer2018-11-141-6/+6
| |/ | | | | | | | | | | | | | | | | ubiformat prints its "flashing eraseblock x" and "formatting eraseblock x" messages before having checked that a block is actually good. This is misleading, so first check if a block is good and only if it is print a message. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | FIT: support hash-1/signature-1 nodes in signature checkMatthias Schiffer2018-11-231-2/+6
| | | | | | | | | | | | | | | | | | | | | | The examples in the U-boot docs use "hash-N" and "signature-N" as the names for hash/signature nodes. It seems "@N" was used instead at some point during the development of the FIT format and "-N" is more correct (in fact, dtc throws warnings when using "@N" without a reg attribute). Support for the "@N" node names is preserved for backward compatibility. Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | bootm: Print which file cannot be openedSascha Hauer2018-11-151-7/+4
|/ | | | | | | | | | | When opening the OS image fails we used to print a message *which* file could not be opened. This message is no longer printed since we now fail in read_file_2 when there is an error. Move the message in the read_file_2 failure path to print it again. file_detect_type() needs no handling for ret < 0, in case of failure it returns filetype_unknown which is handled later, so we can remove the error handling there. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/usb'Sascha Hauer2018-11-093-0/+152
|\
| * usbgadget: autostart: add DFU supportLadislav Michl2018-10-293-0/+152
| | | | | | | | | | | | | | | | | | | | | | Use global variable dfu_function to autostart DFU. As similar code is used to start multifunction gadget using command, move common code to common/usbgadget.c and consolidate it. It turned out that '-s' option of usbgadget command does nothing, so remove its help text and make it function as '-a'. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/state'Sascha Hauer2018-11-093-25/+62
|\ \
| * | bootchooser: Add reference countingSascha Hauer2018-10-181-5/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds reference counting to the bootchooser. Instead of creating a new bootchooser instance with each bootchooser_get() we return a reference to the existing bootchooser. This makes the behaviour consistent when bootchooser_get() is called multiple times. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | bootchooser: put bootchooser after creating a boot entrySascha Hauer2018-10-181-13/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | Between creating a boot entry for bootchooser and actually using it the underlying state may have been modified, so make sure to get a current bootchooser when booting it, thus do a bootchooser_put after having created the entry and a bootchooser_get again when booting it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | state: backend_bucket_circular: remove unused variablesUlrich Ölmann2018-10-121-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | This has been forgotten in commit 9d6d91931afb ("state: Remove -EUCLEAN check from userspace tool"). Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: state: fix typoUlrich Ölmann2018-10-101-1/+1
| | | | | | | | | | | | | | | Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | state: backend_bucket_circular: fix memory leakUlrich Ölmann2018-10-101-4/+7
| | | | | | | | | | | | | | | Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/net-switch-mv88e6xxx'Sascha Hauer2018-11-092-3/+3
|\ \ \
| * | | drivers: Introduce dev_set_name()Andrey Smirnov2018-10-182-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce dev_set_name() in order to hide implementation details of setting device's name so it'd be easier to change it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | ratp: fix compile warningsOleksij Rempel2018-10-181-1/+1
| | |/ | |/| | | | | | | | | | Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/missing-prototypes'Sascha Hauer2018-11-091-1/+1
|\ \ \
| * | | ratp: fix compile warningsOleksij Rempel2018-10-231-1/+1
| |/ / | | | | | | | | | | | | Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/misc'Sascha Hauer2018-11-094-7/+5
|\ \ \