public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 00/46] dm: Print device name in dev_xxx like Linux
Date: Wed, 30 Sep 2020 09:08:21 -0400	[thread overview]
Message-ID: <20200930130821.GA7180@bill-the-cat> (raw)
In-Reply-To: <20200915144522.509493-1-seanga2@gmail.com>

On Tue, Sep 15, 2020 at 10:44:36AM -0400, Sean Anderson wrote:

> This series adds some additional information to dev_xxx output. This requires
> the first argument to dev_xxx to be a struct udevice. The first argument has
> never been used in U-Boot, so many drivers have some invalid calls. To fix these
> drivers, the following strategies were generally followed
> 
> * If there is a udevice already passed to the function, use it.
> * If there is a udevice contained in a struct passed to the function, use it.
>   When there are multiple possible devices, I have tried to use whatever "makes
>   sense" given the content of the message.
> * If there is no udevice passed to the function either directly or indirectly,
>   but all the callers of said function can access a udevice, modify the function
>   signature to pass in a udevice and use that.
> * If the driver does not use DM, convert the log statements to log_xxx.
> * If the driver uses DM only some of the time, use ifdefs to select an
>   appropriate log function.
> 
> I have done a little bit of cleanup beyond these strategies, but for the most
> part I have tried to *only* to the minimum necessary. Many drivers could use a
> follow-up patch to convert their printf()s and debug()s to an appropriate log
> function.
> 
> I have tried to CC relevant maintainers/reviewers only for patches they
> maintain/review. If I have left someone out, please let me know and I will add
> them.
> 
> CI is passing at [1]. This does not necessarily mean that this series is free of
> bugs, so I would appreciate testing on hardware. During my refactoring, I
> noticed a few bugs like
> 
> 	struct udevice *dev;
> 
> 	if (some_condition)
> 		dev_err(dev, "Something went wrong\n");
> 
> 	dev = some_function();
> 
> I have fixed such errors when I have encountered them, but they will not always
> warn or error on build.
> 
> Removal of the duplicate definitions in <linux/compat.h> will be done in a
> follow-up patch due to the already-large size of this series.
> 
> To test this series on sandbox, apply the following options in addition to
> sandbox_defconfig
> 
> CONFIG_LOGLEVEL=8
> CONFIG_LOG=n
> CONFIG_CMD_LOG=n
> CONFIG_CMD_TPM=n
> 
> Note that there is a soft dependency on [2] if you would like to test this patch
> with CONFIG_LOG and a higher LOG_LEVEL than LOGL_INFO.
> 
> [1] https://dev.azure.com/seanga2/u-boot/_build/results?buildId=34&view=results
> [2] https://patchwork.ozlabs.org/project/uboot/list/?series=201343
> 
> Changes in v2:
> - Support logging with struct device as well as struct udevice. A lot of
>   drivers, especially USB gadgets, log with devices and not udevices. There
>   is no major reason why they can't use udevice, but big changes like that
>   are outside the scope of this series.
> - Add some comments to __dev_printk and dev_printk_emit
> - Handle struct device as well as struct udevice
> - Match format strings for the NULL path to the regular path. This reduces the
>   amount of duplicated strings.
> - Print the device name before the driver name
> - Many new patches added to fix build bugs
> 
> Sean Anderson (46):
>   dm: syscon: Fix calling dev_dbg with an uninitialized device
>   firmware: ti_sci: Fix not calling dev_err with a device
>   i2c: mxc: Fix dev_err being called on a nonexistant variable
>   mtd: nand: pxa3xx: Fix not calling dev_xxx with a device
>   mtd: nand: sunxi: Fix not calling dev_err with a device
>   mtd: spi: Include dm.h in spi-nor-core.c
>   mtd: spi: Fix logging in spi-nor-tiny
>   mtd: spi-nand: Fix not calling dev_err with a device
>   mmc: Add mmc_dev()
>   mmc: bcm2835-host: Fix not calling dev_dbg with a device
>   mmc: mtk-sd: Fix not calling dev_err with a device
>   mailbox: k3: Fix not calling dev_err with a device
>   nand: atmel: Fix not calling dev_xxx with a device
>   nand: brcmnand: Fix not calling dev_err() with a device
>   nand: vybrid: Re-introduce vf610_nfc.dev
>   net: bcm6368: Fix not calling dev_info with a device
>   net: mdio: Fix not calling dev_dbg with a device
>   net: mvneta: Fix not always calling dev_err with a device
>   net: mvneta: Convert netdev_xxx to dev_xxx
>   net: mvpp2: Fix not calling dev_xxx with a device
>   net: mvpp2: Convert netdev_xxx to dev_xxx
>   linux/compat.h: Remove netdev_xxx functions
>   net: sunxi: Fix not calling dev_xxx with a device
>   net: sun8i_emac: Fix not calling dev_xxx with a device
>   net: ti: cpsw: Fix not calling dev_dbg with a device
>   phy: marvell: Fix not calling dev_err with a device
>   phy: rockchip: Fix not calling dev_err with a device
>   phy: sun4i-usb: Fix not calling dev_err with a device
>   phy: ti: Fix not calling dev_err with a device
>   phy: usbphyc: Fix not calling dev_err with a device
>   remoteproc: Remove unused function rproc_elf_sanity_check
>   remoteproc: k3-r5: Fix not calling dev_xxx with a device
>   remoteproc: k3: Fix not calling dev_xxx with a device
>   soc: qualcomm: Fix not calling dev_err with a device
>   spi: sunxi: Fix not calling dev_err with a device
>   spi: zynqmp_gqspi: Fix not calling dev_err with a device
>   sysreset: ti: Fix not calling dev_err with a device
>   usb: cdns3: Fix not calling dev_xxx with a device
>   usb: dwc2: Fix not calling dev_xxx with a device
>   usb: dwc3: Fix not calling dev_xxx with a device
>   usb: dwc3: ti: Fix not calling dev_err with a device
>   usb: dwc3: Don't include asm-generic/io.h
>   usb: musb-new: sunxi: Fix not calling dev_err with a device
>   video: stm32: Fix not calling dev_xxx with a device
>   dm: Use symbolic constants for log levels in dev_xxx
>   dm: Print device name in dev_xxx like Linux
> 
>  drivers/core/syscon-uclass.c              |   2 +-
>  drivers/firmware/ti_sci.c                 |  23 ++--
>  drivers/i2c/mxc_i2c.c                     |   7 +-
>  drivers/mailbox/k3-sec-proxy.c            |   6 +-
>  drivers/mmc/bcm2835_sdhost.c              |  34 +++---
>  drivers/mmc/mtk-sd.c                      |  24 ++--
>  drivers/mtd/nand/raw/atmel_nand.c         |  69 +++++++-----
>  drivers/mtd/nand/raw/brcmnand/brcmnand.c  |  20 +---
>  drivers/mtd/nand/raw/pxa3xx_nand.c        |  30 ++---
>  drivers/mtd/nand/raw/sunxi_nand.c         |  45 ++++----
>  drivers/mtd/nand/raw/vf610_nfc.c          |  38 ++++---
>  drivers/mtd/nand/spi/core.c               |   8 +-
>  drivers/mtd/spi/spi-nor-core.c            |   1 +
>  drivers/mtd/spi/spi-nor-tiny.c            |  21 +++-
>  drivers/net/bcm6368-eth.c                 |   3 +-
>  drivers/net/mvneta.c                      |  56 +++++-----
>  drivers/net/mvpp2.c                       |  87 ++++++++-------
>  drivers/net/sun8i_emac.c                  |   9 +-
>  drivers/net/sunxi_emac.c                  |   5 +-
>  drivers/net/ti/cpsw.c                     |   6 +
>  drivers/phy/allwinner/phy-sun4i-usb.c     |  12 +-
>  drivers/phy/marvell/comphy_core.c         |   6 +-
>  drivers/phy/phy-stm32-usbphyc.c           |   2 +-
>  drivers/phy/phy-ti-am654.c                |   4 +-
>  drivers/phy/rockchip/phy-rockchip-pcie.c  |  14 +--
>  drivers/phy/rockchip/phy-rockchip-typec.c |   6 +-
>  drivers/remoteproc/k3_system_controller.c |   9 +-
>  drivers/remoteproc/rproc-elf-loader.c     |  16 ---
>  drivers/remoteproc/ti_k3_r5f_rproc.c      |  24 ++--
>  drivers/smem/msm_smem.c                   |   2 +-
>  drivers/spi/spi-sunxi.c                   |   6 +-
>  drivers/spi/zynqmp_gqspi.c                |   6 +-
>  drivers/sysreset/sysreset-ti-sci.c        |   3 +-
>  drivers/usb/cdns3/ep0.c                   |   5 +-
>  drivers/usb/cdns3/gadget.c                |   3 +-
>  drivers/usb/dwc3/core.c                   |  15 +--
>  drivers/usb/dwc3/dwc3-generic.c           |   1 -
>  drivers/usb/dwc3/ep0.c                    |   1 +
>  drivers/usb/dwc3/gadget.c                 |  23 ++--
>  drivers/usb/dwc3/ti_usb_phy.c             |   4 +-
>  drivers/usb/host/dwc2.c                   |  39 ++++---
>  drivers/usb/musb-new/sunxi.c              |   9 +-
>  drivers/video/dw_mipi_dsi.c               |  24 ++--
>  include/dm/device_compat.h                | 127 ++++++++++++++++------
>  include/linux/compat.h                    |  19 ----
>  include/mmc.h                             |   2 +
>  include/remoteproc.h                      |  13 ---
>  net/mdio-uclass.c                         |   4 +-
>  48 files changed, 486 insertions(+), 407 deletions(-)

For the series, applied to u-boot/next, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200930/a91aa67f/attachment.sig>

      parent reply	other threads:[~2020-09-30 13:08 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-15 14:44 [PATCH v2 00/46] dm: Print device name in dev_xxx like Linux Sean Anderson
2020-09-15 14:44 ` [PATCH v2 01/46] dm: syscon: Fix calling dev_dbg with an uninitialized device Sean Anderson
2020-09-16 12:44   ` Patrick DELAUNAY
2020-09-16 12:51     ` Sean Anderson
2020-09-15 14:44 ` [PATCH v2 02/46] firmware: ti_sci: Fix not calling dev_err with a device Sean Anderson
2020-09-16  1:26   ` Nishanth Menon
2020-09-15 14:44 ` [PATCH v2 03/46] i2c: mxc: Fix dev_err being called on a nonexistant variable Sean Anderson
2020-09-17  1:10   ` Simon Glass
2020-09-17  7:50   ` Heiko Schocher
2020-09-15 14:44 ` [PATCH v2 04/46] mtd: nand: pxa3xx: Fix not calling dev_xxx with a device Sean Anderson
2020-09-15 14:44 ` [PATCH v2 05/46] mtd: nand: sunxi: Fix not calling dev_err " Sean Anderson
2020-09-15 14:44 ` [PATCH v2 06/46] mtd: spi: Include dm.h in spi-nor-core.c Sean Anderson
2020-09-15 14:44 ` [PATCH v2 07/46] mtd: spi: Fix logging in spi-nor-tiny Sean Anderson
2020-09-15 14:44 ` [PATCH v2 08/46] mtd: spi-nand: Fix not calling dev_err with a device Sean Anderson
2020-09-17  1:10   ` Simon Glass
2020-09-15 14:44 ` [PATCH v2 09/46] mmc: Add mmc_dev() Sean Anderson
2020-09-17  1:10   ` Simon Glass
2020-09-15 14:44 ` [PATCH v2 10/46] mmc: bcm2835-host: Fix not calling dev_dbg with a device Sean Anderson
2020-09-15 14:44 ` [PATCH v2 11/46] mmc: mtk-sd: Fix not calling dev_err " Sean Anderson
2020-09-17  1:10   ` Simon Glass
2020-09-15 14:44 ` [PATCH v2 12/46] mailbox: k3: " Sean Anderson
2020-09-17  1:10   ` Simon Glass
2020-09-15 14:44 ` [PATCH v2 13/46] nand: atmel: Fix not calling dev_xxx " Sean Anderson
2020-09-17  1:10   ` Simon Glass
2020-09-15 14:44 ` [PATCH v2 14/46] nand: brcmnand: Fix not calling dev_err() " Sean Anderson
2020-09-15 14:44 ` [PATCH v2 15/46] nand: vybrid: Re-introduce vf610_nfc.dev Sean Anderson
2020-09-15 14:44 ` [PATCH v2 16/46] net: bcm6368: Fix not calling dev_info with a device Sean Anderson
2020-09-15 14:44 ` [PATCH v2 17/46] net: mdio: Fix not calling dev_dbg " Sean Anderson
2020-09-15 14:44 ` [PATCH v2 18/46] net: mvneta: Fix not always calling dev_err " Sean Anderson
2020-09-17  1:10   ` Simon Glass
2020-09-15 14:44 ` [PATCH v2 19/46] net: mvneta: Convert netdev_xxx to dev_xxx Sean Anderson
2020-09-17  1:10   ` Simon Glass
2020-09-15 14:44 ` [PATCH v2 20/46] net: mvpp2: Fix not calling dev_xxx with a device Sean Anderson
2020-09-17  1:10   ` Simon Glass
2020-09-15 14:44 ` [PATCH v2 21/46] net: mvpp2: Convert netdev_xxx to dev_xxx Sean Anderson
2020-09-17  1:10   ` Simon Glass
2020-09-15 14:44 ` [PATCH v2 22/46] linux/compat.h: Remove netdev_xxx functions Sean Anderson
2020-09-17  1:10   ` Simon Glass
2020-09-15 14:44 ` [PATCH v2 23/46] net: sunxi: Fix not calling dev_xxx with a device Sean Anderson
2020-09-17  1:10   ` Simon Glass
2020-09-15 14:45 ` [PATCH v2 24/46] net: sun8i_emac: " Sean Anderson
2020-09-17  1:10   ` Simon Glass
2020-09-15 14:45 ` [PATCH v2 25/46] net: ti: cpsw: Fix not calling dev_dbg " Sean Anderson
2020-09-15 14:45 ` [PATCH v2 26/46] phy: marvell: Fix not calling dev_err " Sean Anderson
2020-09-15 14:45 ` [PATCH v2 27/46] phy: rockchip: " Sean Anderson
2020-09-28  2:43   ` Kever Yang
2020-09-15 14:45 ` [PATCH v2 28/46] phy: sun4i-usb: " Sean Anderson
2020-09-15 14:45 ` [PATCH v2 29/46] phy: ti: " Sean Anderson
2020-09-15 14:45 ` [PATCH v2 30/46] phy: usbphyc: " Sean Anderson
2020-09-16  7:47   ` Patrice CHOTARD
2020-09-16 12:45   ` Patrick DELAUNAY
2020-09-15 14:45 ` [PATCH v2 31/46] remoteproc: Remove unused function rproc_elf_sanity_check Sean Anderson
2020-09-15 14:45 ` [PATCH v2 32/46] remoteproc: k3-r5: Fix not calling dev_xxx with a device Sean Anderson
2020-09-15 14:45 ` [PATCH v2 33/46] remoteproc: k3: " Sean Anderson
2020-09-15 14:45 ` [PATCH v2 34/46] soc: qualcomm: Fix not calling dev_err " Sean Anderson
2020-09-17  1:10   ` Simon Glass
2020-09-15 14:45 ` [PATCH v2 35/46] spi: sunxi: " Sean Anderson
2020-09-15 14:45 ` [PATCH v2 36/46] spi: zynqmp_gqspi: " Sean Anderson
2020-09-16  7:45   ` Michal Simek
2020-09-15 14:45 ` [PATCH v2 37/46] sysreset: ti: " Sean Anderson
2020-09-15 14:45 ` [PATCH v2 38/46] usb: cdns3: Fix not calling dev_xxx " Sean Anderson
2020-09-15 14:45 ` [PATCH v2 39/46] usb: dwc2: " Sean Anderson
2020-09-16  7:51   ` Patrice CHOTARD
2020-09-16 12:52     ` Sean Anderson
2020-09-16 13:30   ` Patrick DELAUNAY
2020-09-16 13:43     ` Sean Anderson
2020-09-17  7:33       ` Patrick DELAUNAY
2020-09-15 14:45 ` [PATCH v2 40/46] usb: dwc3: " Sean Anderson
2020-09-15 14:45 ` [PATCH v2 41/46] usb: dwc3: ti: Fix not calling dev_err " Sean Anderson
2020-09-15 14:45 ` [PATCH v2 42/46] usb: dwc3: Don't include asm-generic/io.h Sean Anderson
2020-09-15 14:45 ` [PATCH v2 43/46] usb: musb-new: sunxi: Fix not calling dev_err with a device Sean Anderson
2020-09-15 14:45 ` [PATCH v2 44/46] video: stm32: Fix not calling dev_xxx " Sean Anderson
2020-09-16 13:19   ` Patrick DELAUNAY
2020-09-15 14:45 ` [PATCH v2 45/46] dm: Use symbolic constants for log levels in dev_xxx Sean Anderson
2020-09-17  1:10   ` Simon Glass
2020-09-15 14:45 ` [PATCH v2 46/46] dm: Print device name in dev_xxx like Linux Sean Anderson
2020-09-16 13:43 ` [PATCH v2 00/46] " Patrick DELAUNAY
2020-09-30 13:01 ` Tom Rini
2020-09-30 13:08 ` Tom Rini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200930130821.GA7180@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox