define TOOL_templ include $(1)/Makefile $(1) $(1)%: BUILD_DIR := $(1) $(1) $(1)%: CFLAGS += $$($(1)-eflags) $(1)_prehook: $(Q)echo "$(bold)$(WHAT) $(1):$(normal)" $(1): $(1)_prehook $$($(1)-lex) $$($(1)-yaac) $$(patsubst %.o,$(1)/%.o,$$($(1)-objs)) $(1)_clean: $(1)_clean_custom $(Q)$$(call RM,$(1)/*.o $(1)/$(1) $(1)/*.gz) $(1)_do_install: $(Q)$$(call INSTX,$(1)/$(1),$$(DESTDIR)$$(SBINDIR)) $(Q)$(GZIP) $(1).8 > $(1)/$(1).8.gz $(Q)$$(call INST,$(1)/$(1).8.gz,$$(DESTDIR)$$(MAN8DIR)) $(Q)$$(foreach file,$$($(1)-confs),$$(call INST,$$(file),$$(DESTDIR)$$(ETCDIRE));) $(1)_install: $(1)_do_install $(1)_post_install $(1)_uninstall: $(1)_uninstall_custom $(Q)$$(call RM,$$(DESTDIR)$$(SBINDIR)/$(1)) $(Q)$$(call RM,$$(DESTDIR)$$(MAN8DIR)/$(1).8.gz) $(1)/%.yy.o: $(1)/%.yy.c $$(CCQ) $$(CFLAGS) -o $$@ -c $$< $(1)/%.tab.o: $(1)/%.tab.c $$(CCQ) $$(CFLAGS) -o $$@ -c $$< $(1)/%.o: %.c %.h $$(CHECK) $$(CFLAGS) $$(CHECKFLAGS) $$< $$(CCQ) $$(CFLAGS) -o $(1)/$$(shell basename $$@) -c $$< $(1)/%.o: %.c $$(CHECK) $$(CFLAGS) $$(CHECKFLAGS) $$< $$(CCQ) $$(CFLAGS) -o $(1)/$$(shell basename $$@) -c $$< endef n> net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Hunter <jonathanh@nvidia.com>2016-03-08 12:28:20 +0000
committerMark Brown <broonie@kernel.org>2016-03-09 09:31:39 +0700
commit49023d2e4ead0fc9e0896331037746b267d46ad4 (patch)
tree4550038559a27f6698a6702b3ee20c833a669f7c
parent628269704f19fcfc765499b7158effccfc79b6cf (diff)
spi: core: Fix deadlock when sending messages
The function __spi_pump_messages() is called by spi_pump_messages() and __spi_sync(). The function __spi_sync() has an argument 'bus_locked' that indicates if it is called with the SPI bus mutex held or not. If 'bus_locked' is false then __spi_sync() will acquire the mutex itself. Commit 556351f14e74 ("spi: introduce accelerated read support for spi flash devices") made a change to acquire the SPI bus mutex within __spi_pump_messages(). However, this change did not check to see if the mutex is already held. If __spi_sync() is called with the mutex held (ie. 'bus_locked' is true), then a deadlock occurs when __spi_pump_messages() is called. Fix this deadlock by passing the 'bus_locked' state from __spi_sync() to __spi_pump_messages() and only acquire the mutex if not already held. In the case where __spi_pump_messages() is called from spi_pump_messages() it is assumed that the mutex is not held and so call __spi_pump_messages() with 'bus_locked' set to false. Finally, move the unlocking of the mutex to the end of the __spi_pump_messages() function to simplify the code and only call cond_resched() if there are no errors. Fixes: 556351f14e74 ("spi: introduce accelerated read support for spi flash devices") Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat