[PATCH 3/5] usb: ehci-hcd: detect re-entrance

Sascha Hauer s.hauer at pengutronix.de
Wed Sep 23 07:23:40 PDT 2015


On Tue, Sep 22, 2015 at 06:58:32PM +0300, Peter Mamonov wrote:
> Signed-off-by: Peter Mamonov <pmamonov at gmail.com>
> ---
>  drivers/usb/host/ehci-hcd.c | 38 ++++++++++++++++++++++++++++++++++----
>  1 file changed, 34 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
> index e6748b0..d6df7b8 100644
> --- a/drivers/usb/host/ehci-hcd.c
> +++ b/drivers/usb/host/ehci-hcd.c
> @@ -51,6 +51,8 @@ struct ehci_priv {
>  	int periodic_schedules;
>  	struct QH *periodic_queue;
>  	uint32_t *periodic_list;
> +	int sem;
> +	struct device_d *usedby;
>  };
>  
>  struct int_queue {
> @@ -136,6 +138,16 @@ static struct descriptor {
>  
>  #define ehci_is_TDI()	(ehci->flags & EHCI_HAS_TT)
>  
> +#define ehci_reentrance_detect(ehci) \
> +	if (ehci->sem) \
> +		dev_err(&dev->dev, "%s: re-entrance %d (%s:%s)\n", \
> +			__func__, \
> +			ehci->sem, \
> +			ehci->usedby->driver->name, \
> +			ehci->usedby->name); \
> +	ehci->sem++; \
> +	ehci->usedby = &dev->dev;

This should be a static inline function rather than a define. You can
pass the function name as const char *.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list