All of lore.kernel.org
 help / color / mirror / Atom feed
From: hrhaan@gmail.com (Harro Haan)
To: linux-arm-kernel@lists.infradead.org
Subject: [patch 2/2] at91_udc.c use spinlocks instead of local_irq_xxx
Date: Thu, 28 Jan 2010 13:52:17 +0100	[thread overview]
Message-ID: <6681f8e11001280452l2f819b17x97213ff510366f52@mail.gmail.com> (raw)
In-Reply-To: <BD79186B4FD85F4B8E60E381CAEE1909020E94E2@mi8nycmail19.Mi8.com>

Hartley,

Thanks for the feedback.

> For consistency (and better grepping) it would be better to keep the same use throughout the file.

I agree on the naming consistency. I reused the variable when it was already
present, but will make it consistent.

> This one should be &udc->lock

Yes, the spin_lock_irqsave() in proc_ep_show() is incorrect. It compiled because
CONFIG_USB_GADGET_DEBUG_FILES is not defined. Will fix this.

> Strange unlock/lock sequence.

This trick is used to avoid recursive locking. It is also used in:
amd5536udc.c, atmel_usba_udc.c, ci3xxx_udc.c, fsl_qe_udc.c,
fsl_udc_core.c, goku_udc.c, lh7a40x_udc.c, m66592-udc.c and omap_udc.c

> Who does the initial locking and who does the final unlock?

The unlock/lock sequence is used by the following functions:

handle_setup() _ handle_ep0() _ at91_udc_irq()

stop_activity() _ pullup() (only called with spinlock)
stop_activity() _ at91_udc_irq()

done() _ read_fifo() _ at91_ep_queue() (uses spinlock)
done() _ read_fifo() _ handle_ep() _ handle_setup() _ handle_ep0() _
at91_udc_irq()
done() _ read_fifo() _ handle_ep() _ handle_ep0() _ at91_udc_irq()
done() _ read_fifo() _ handle_ep() _ at91_udc_irq()
done() _ write_fifo() _ at91_ep_queue() (uses spinlock)
done() _ write_fifo() _ handle_ep() _ handle_setup() _ handle_ep0() _
at91_udc_irq()
done() _ write_fifo() _ handle_ep() _ handle_ep0() _ at91_udc_irq()
done() _ write_fifo() _ handle_ep() _ at91_udc_irq()
done() _ nuke() _ stop_activity() _ pullup() (only called with spinlock)
done() _ nuke() _ stop_activity() _ at91_udc_irq()
done() _ nuke() _ handle_ep0() _ at91_udc_irq()
done() _ nuke() _ at91_ep_disable() (uses spinlock)
done() _ at91_ep_dequeue() (uses spinlock)
done() _ handle_ep0() _ at91_udc_irq()

> You are in an irq path.  Is this locking and the unlock/lock below really needed?

Yes, to avoid recursive locking.

udc->driver->suspend() = at91udc_suspend() (uses spinlock)
udc->driver->resume() = at91udc_resume() (uses spinlock)

Regards,

Harro

  reply	other threads:[~2010-01-28 12:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-27 16:30 [patch 0/2] at91_udc driver: read_fifo timing issue + use spinlocks Harro Haan
2010-01-27 16:30 ` [patch 1/2] at91_udc.c read_fifo timing issue Harro Haan
2010-01-27 16:30 ` [patch 2/2] at91_udc.c use spinlocks instead of local_irq_xxx Harro Haan
2010-01-27 17:37   ` H Hartley Sweeten
2010-01-28 12:52     ` Harro Haan [this message]
2010-01-29 16:20 ` [patch v2 0/2] at91_udc driver: read_fifo timing issue + use spinlocks Harro Haan
2010-01-29 16:20   ` [patch v2 1/2] at91_udc.c read_fifo timing issue Harro Haan
2010-01-29 17:04     ` Remy Bohmer
2010-01-29 17:04       ` Remy Bohmer
2010-01-31 20:08       ` Ryan Mallon
2010-01-31 20:08         ` Ryan Mallon
2010-01-31 22:34     ` Anti Sullin
2010-01-31 22:34       ` Anti Sullin
2010-02-03 14:37       ` [patch v3 0/3] at91_udc: fix soft lockup, HW glitch and use spinlocks Harro Haan
2010-02-03 14:37         ` [patch v3 1/3] Fix soft lockup in at91 udc driver Harro Haan
2010-02-03 14:37         ` [patch v3 2/3] at91_udc HW glitch Harro Haan
2010-03-23 20:26           ` Andrew Victor
2010-03-23 20:26             ` Andrew Victor
2010-03-25 12:03             ` Harro Haan
2010-03-25 12:03               ` Harro Haan
2010-03-25 13:09               ` Anti Sullin
2010-03-25 13:09                 ` Anti Sullin
2010-02-03 14:37         ` [patch v3 3/3] at91_udc.c use spinlocks instead of local_irq_xxx Harro Haan
2010-01-29 16:20   ` [patch v2 2/2] " Harro Haan
2010-01-29 17:27     ` H Hartley Sweeten
2010-01-29 17:27       ` H Hartley Sweeten

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=6681f8e11001280452l2f819b17x97213ff510366f52@mail.gmail.com \
    --to=hrhaan@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.