From: Johan Hovold Date: Mon, 27 Jun 2016 18:07:10 +0000 (+0200) Subject: greybus: Revert "greybus: gb_connections_lock: don't use spin_lock_irq()" X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~210 X-Git-Url: http://git.cascardo.info/?p=cascardo%2Flinux.git;a=commitdiff_plain;h=0b1d262354214daab1a3b7df763dc51c355ec353 greybus: Revert "greybus: gb_connections_lock: don't use spin_lock_irq()" This reverts commit b022fd95108e8b9d202532a74d39e86152bc8f7f. 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c index f26146840ab5..632c8be43cf0 100644 --- a/drivers/staging/greybus/connection.c +++ b/drivers/staging/greybus/connection.c @@ -150,7 +150,6 @@ _gb_connection_create(struct gb_host_device *hd, int hd_cport_id, unsigned long flags) { struct gb_connection *connection; - unsigned long irqflags; int ret; mutex_lock(&gb_connection_mutex); @@ -201,7 +200,7 @@ _gb_connection_create(struct gb_host_device *hd, int hd_cport_id, gb_connection_init_name(connection); - spin_lock_irqsave(&gb_connections_lock, irqflags); + spin_lock_irq(&gb_connections_lock); list_add(&connection->hd_links, &hd->connections); if (bundle) @@ -209,7 +208,7 @@ _gb_connection_create(struct gb_host_device *hd, int hd_cport_id, else INIT_LIST_HEAD(&connection->bundle_links); - spin_unlock_irqrestore(&gb_connections_lock, irqflags); + spin_unlock_irq(&gb_connections_lock); mutex_unlock(&gb_connection_mutex); @@ -852,8 +851,6 @@ EXPORT_SYMBOL_GPL(gb_connection_disable_forced); /* Caller must have disabled the connection before destroying it. */ void gb_connection_destroy(struct gb_connection *connection) { - unsigned long flags; - if (!connection) return; @@ -862,10 +859,10 @@ void gb_connection_destroy(struct gb_connection *connection) mutex_lock(&gb_connection_mutex); - spin_lock_irqsave(&gb_connections_lock, flags); + spin_lock_irq(&gb_connections_lock); list_del(&connection->bundle_links); list_del(&connection->hd_links); - spin_unlock_irqrestore(&gb_connections_lock, flags); + spin_unlock_irq(&gb_connections_lock); destroy_workqueue(connection->wq);