summaryrefslogtreecommitdiffstats
path: root/include/linux/printk.h
Commit message (Collapse)AuthorAgeFilesLines
* commands: dmesg: support aborting dmesg output with ctrl-cAhmad Fatoum2024-03-081-1/+1
| | | | | | | | | | | | | dmesg output can get very long, especially if debug messages are compiled in and the maximum number of retained log messages is increased. Therefore, follow what we do for other potentially long-running commands and allow the user to abort it with ctrl+c. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240306184519.626594-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: implement dev_warn_once and friendsAhmad Fatoum2023-11-231-1/+28
| | | | | | | | | We already have pr_*_once, so duplicate it for dev_warn and friends as well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231122172951.376531-16-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* console: allocate only once instead of twice per log messageAhmad Fatoum2023-08-041-1/+1
| | | | | | | | | | | | | | We do two allocations for each log message, one for the log message string itself and another for the struct log_entry referencing it. We could just make the log message directly follow the log entry and save the space for the pointer and the time to do a second allocation. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230804081147.559379-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* linux/printk.h: drop unused log_entry::dummy memberAhmad Fatoum2023-08-041-1/+0
| | | | | | | | The pointer is used no where, so let's save that space. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230804081147.559379-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: linux/printk: define new dev_errp_probeAhmad Fatoum2023-06-231-0/+3
| | | | | | | | | | | | We have a number of APIs like regulator, clocks or reset, which return an error pointer. To format that pointer for dev_err_probe, we need to pass it through PTR_ERR(). Let's make such code more concise by defining dev_errp_probe, which calls PTR_ERR() on its second argument. Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230622072329.1339317-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* dmesg: factor out str_to_loglevel()Sascha Hauer2023-06-121-10/+0
| | | | | | | | | | dmesg open codes functionality to convert a string to a loglevel. Make a separate function from it which will be useful in the next patch. While at it remove the BAREBOX_LOG_PRINT_* defines and use MSG_* defines directly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add dev_WARN_ONCE()Sascha Hauer2023-03-241-0/+13
| | | | | | | dev_WARN_ONCE() is like WARN_ONCE(), but with a struct device *argument to print device context. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: linux/printk: implement pr_*_once macrosAhmad Fatoum2023-02-031-0/+20
| | | | | | | | | These are useful as a less verbose alternative to WARN_ONCE, which also prints a stack trace if possible. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230202133415.319020-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct device_d to deviceSascha Hauer2023-01-101-6/+8
| | | | | | | | | | | | | The '_d' suffix was originally introduced in case we want to import Linux struct device as a separate struct into barebox. Over time it became clear that this won't happen, instead barebox struct device_d is basically the same as Linux struct device. Rename the struct name accordingly to make porting Linux code easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* base: driver: print dev_err_probe message on permanent probe deferralJohannes Zink2022-07-121-3/+3
| | | | | | | | | | | | | | | This stores the probe deferral reason in the device structure. If a probe is permanently deferred, the last reason is displayed. Example output on a permanently deferred probe: ERROR: imx-pgc-domain0: probe permanently deferred (Failed to get domain's regulator) Other dev_err_probe outputs are displayed as before. Signed-off-by: Johannes Zink <j.zink@pengutronix.de> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220708094138.112060-1-j.zink@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2021-12-151-0/+12
|\
| * driver: implement dev_err_probe()Ahmad Fatoum2021-11-251-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | The function like it's Linux equivalent is meant to be used during driver probe whenever an error occurs that would lead to aborting the probe. This allows moving EPROBE_DEFER checks out of drivers and in future could allow selectively compiling out only error probe messages, as they are mainly interesting during bring up. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211030175926.2277259-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | include: linux/printk.h: include <stdarg.h> to make header self-containedAhmad Fatoum2021-12-131-0/+1
|/ | | | | | | | | | The point of <linux/printk.h> is to have a minimal self-contained header for use where ever printing is required. va_list was used, but not defined, remedy this. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20211211084026.443756-1-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: add dedicated header for printf/printkAhmad Fatoum2021-11-011-0/+173
Including <stdio.h> for printf is a bit problematic, because it pulls in other headers for <console.h>, which includes quite a few more headers as well. To make it easier to share code between barebox and host tools make <printk.h> the new minimal header for printf and move the extra logging stuff into <linux/printk.h>. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211030141739.2207431-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>