This reverts commit
426237c515b42b9f06d9a2b1021a6d2c4d440c51.
Someone decided that all use of spin_lock_irq was to be considered a bug
and went on a search-and-replace type "bug-fixing" spree last week.
This is however just plain wrong. Using spin_lock_irq is perfectly fine
in paths were interrupts have not been disabled, and this is in fact
even preferred over the lazy approach of always using spin_lock_irqsave
instead of understanding the code that is being written or modified.
All current uses of spin_lock_irq have already been vetted in this
respect. Also note that it is only used in functions that may sleep,
that is, in functions that must not be called with interrupts disabled
in the first place.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* DISCONNECTING.
*/
static void gb_connection_cancel_operations(struct gb_connection *connection,
* DISCONNECTING.
*/
static void gb_connection_cancel_operations(struct gb_connection *connection,
- int errno, unsigned long *flags)
__must_hold(&connection->lock)
{
struct gb_operation *operation;
__must_hold(&connection->lock)
{
struct gb_operation *operation;
operation = list_last_entry(&connection->operations,
struct gb_operation, links);
gb_operation_get(operation);
operation = list_last_entry(&connection->operations,
struct gb_operation, links);
gb_operation_get(operation);
- spin_unlock_irqrestore(&connection->lock, *flags);
+ spin_unlock_irq(&connection->lock);
if (gb_operation_is_incoming(operation))
gb_operation_cancel_incoming(operation, errno);
if (gb_operation_is_incoming(operation))
gb_operation_cancel_incoming(operation, errno);
gb_operation_put(operation);
gb_operation_put(operation);
- spin_lock_irqsave(&connection->lock, *flags);
+ spin_lock_irq(&connection->lock);
*/
static void
gb_connection_flush_incoming_operations(struct gb_connection *connection,
*/
static void
gb_connection_flush_incoming_operations(struct gb_connection *connection,
- int errno, unsigned long *flags)
__must_hold(&connection->lock)
{
struct gb_operation *operation;
__must_hold(&connection->lock)
{
struct gb_operation *operation;
- spin_unlock_irqrestore(&connection->lock, *flags);
+ spin_unlock_irq(&connection->lock);
/* FIXME: flush, not cancel? */
gb_operation_cancel_incoming(operation, errno);
gb_operation_put(operation);
/* FIXME: flush, not cancel? */
gb_operation_cancel_incoming(operation, errno);
gb_operation_put(operation);
- spin_lock_irqsave(&connection->lock, *flags);
+ spin_lock_irq(&connection->lock);
static int _gb_connection_enable(struct gb_connection *connection, bool rx)
{
int ret;
static int _gb_connection_enable(struct gb_connection *connection, bool rx)
{
int ret;
/* Handle ENABLED_TX -> ENABLED transitions. */
if (connection->state == GB_CONNECTION_STATE_ENABLED_TX) {
if (!(connection->handler && rx))
return 0;
/* Handle ENABLED_TX -> ENABLED transitions. */
if (connection->state == GB_CONNECTION_STATE_ENABLED_TX) {
if (!(connection->handler && rx))
return 0;
- spin_lock_irqsave(&connection->lock, flags);
+ spin_lock_irq(&connection->lock);
connection->state = GB_CONNECTION_STATE_ENABLED;
connection->state = GB_CONNECTION_STATE_ENABLED;
- spin_unlock_irqrestore(&connection->lock, flags);
+ spin_unlock_irq(&connection->lock);
if (ret)
goto err_svc_connection_destroy;
if (ret)
goto err_svc_connection_destroy;
- spin_lock_irqsave(&connection->lock, flags);
+ spin_lock_irq(&connection->lock);
if (connection->handler && rx)
connection->state = GB_CONNECTION_STATE_ENABLED;
else
connection->state = GB_CONNECTION_STATE_ENABLED_TX;
if (connection->handler && rx)
connection->state = GB_CONNECTION_STATE_ENABLED;
else
connection->state = GB_CONNECTION_STATE_ENABLED_TX;
- spin_unlock_irqrestore(&connection->lock, flags);
+ spin_unlock_irq(&connection->lock);
ret = gb_connection_control_connected(connection);
if (ret)
ret = gb_connection_control_connected(connection);
if (ret)
err_control_disconnecting:
gb_connection_control_disconnecting(connection);
err_control_disconnecting:
gb_connection_control_disconnecting(connection);
- spin_lock_irqsave(&connection->lock, flags);
+ spin_lock_irq(&connection->lock);
connection->state = GB_CONNECTION_STATE_DISCONNECTING;
connection->state = GB_CONNECTION_STATE_DISCONNECTING;
- gb_connection_cancel_operations(connection, -ESHUTDOWN, &flags);
- spin_unlock_irqrestore(&connection->lock, flags);
+ gb_connection_cancel_operations(connection, -ESHUTDOWN);
+ spin_unlock_irq(&connection->lock);
/* Transmit queue should already be empty. */
gb_connection_hd_cport_flush(connection);
/* Transmit queue should already be empty. */
gb_connection_hd_cport_flush(connection);
void gb_connection_disable_rx(struct gb_connection *connection)
{
void gb_connection_disable_rx(struct gb_connection *connection)
{
mutex_lock(&connection->mutex);
mutex_lock(&connection->mutex);
- spin_lock_irqsave(&connection->lock, flags);
+ spin_lock_irq(&connection->lock);
if (connection->state != GB_CONNECTION_STATE_ENABLED) {
if (connection->state != GB_CONNECTION_STATE_ENABLED) {
- spin_unlock_irqrestore(&connection->lock, flags);
+ spin_unlock_irq(&connection->lock);
goto out_unlock;
}
connection->state = GB_CONNECTION_STATE_ENABLED_TX;
goto out_unlock;
}
connection->state = GB_CONNECTION_STATE_ENABLED_TX;
- gb_connection_flush_incoming_operations(connection, -ESHUTDOWN, &flags);
- spin_unlock_irqrestore(&connection->lock, flags);
+ gb_connection_flush_incoming_operations(connection, -ESHUTDOWN);
+ spin_unlock_irq(&connection->lock);
trace_gb_connection_disable(connection);
trace_gb_connection_disable(connection);
void gb_connection_disable(struct gb_connection *connection)
{
void gb_connection_disable(struct gb_connection *connection)
{
mutex_lock(&connection->mutex);
if (connection->state == GB_CONNECTION_STATE_DISABLED)
mutex_lock(&connection->mutex);
if (connection->state == GB_CONNECTION_STATE_DISABLED)
gb_connection_control_disconnecting(connection);
gb_connection_control_disconnecting(connection);
- spin_lock_irqsave(&connection->lock, flags);
+ spin_lock_irq(&connection->lock);
connection->state = GB_CONNECTION_STATE_DISCONNECTING;
connection->state = GB_CONNECTION_STATE_DISCONNECTING;
- gb_connection_cancel_operations(connection, -ESHUTDOWN, &flags);
- spin_unlock_irqrestore(&connection->lock, flags);
+ gb_connection_cancel_operations(connection, -ESHUTDOWN);
+ spin_unlock_irq(&connection->lock);
gb_connection_hd_cport_flush(connection);
gb_connection_hd_cport_flush(connection);
/* Disable a connection without communicating with the remote end. */
void gb_connection_disable_forced(struct gb_connection *connection)
{
/* Disable a connection without communicating with the remote end. */
void gb_connection_disable_forced(struct gb_connection *connection)
{
mutex_lock(&connection->mutex);
if (connection->state == GB_CONNECTION_STATE_DISABLED)
mutex_lock(&connection->mutex);
if (connection->state == GB_CONNECTION_STATE_DISABLED)
trace_gb_connection_disable(connection);
trace_gb_connection_disable(connection);
- spin_lock_irqsave(&connection->lock, flags);
+ spin_lock_irq(&connection->lock);
connection->state = GB_CONNECTION_STATE_DISABLED;
connection->state = GB_CONNECTION_STATE_DISABLED;
- gb_connection_cancel_operations(connection, -ESHUTDOWN, &flags);
- spin_unlock_irqrestore(&connection->lock, flags);
+ gb_connection_cancel_operations(connection, -ESHUTDOWN);
+ spin_unlock_irq(&connection->lock);
gb_connection_hd_cport_flush(connection);
gb_connection_hd_cport_features_disable(connection);
gb_connection_hd_cport_flush(connection);
gb_connection_hd_cport_features_disable(connection);