linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Michael Hennerich <michael.hennerich@analog.com>,
	Alexandru Ardelean <alexandru.ardelean@analog.com>,
	Mark Brown <broonie@kernel.org>
Subject: [PATCH 4.4 31/31] spi: cadence: cache reference clock rate during probe
Date: Fri, 22 Jan 2021 15:08:45 +0100	[thread overview]
Message-ID: <20210122135733.110337130@linuxfoundation.org> (raw)
In-Reply-To: <20210122135731.873346566@linuxfoundation.org>

From: Michael Hennerich <michael.hennerich@analog.com>

commit 4d163ad79b155c71bf30366dc38f8d2502f78844 upstream.

The issue is that using SPI from a callback under the CCF lock will
deadlock, since this code uses clk_get_rate().

Fixes: c474b38665463 ("spi: Add driver for Cadence SPI controller")
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20210114154217.51996-1-alexandru.ardelean@analog.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/spi/spi-cadence.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/spi/spi-cadence.c
+++ b/drivers/spi/spi-cadence.c
@@ -116,6 +116,7 @@ struct cdns_spi {
 	void __iomem *regs;
 	struct clk *ref_clk;
 	struct clk *pclk;
+	unsigned int clk_rate;
 	u32 speed_hz;
 	const u8 *txbuf;
 	u8 *rxbuf;
@@ -257,7 +258,7 @@ static void cdns_spi_config_clock_freq(s
 	u32 ctrl_reg, baud_rate_val;
 	unsigned long frequency;
 
-	frequency = clk_get_rate(xspi->ref_clk);
+	frequency = xspi->clk_rate;
 
 	ctrl_reg = cdns_spi_read(xspi, CDNS_SPI_CR_OFFSET);
 
@@ -557,8 +558,9 @@ static int cdns_spi_probe(struct platfor
 	master->set_cs = cdns_spi_chipselect;
 	master->mode_bits = SPI_CPOL | SPI_CPHA;
 
+	xspi->clk_rate = clk_get_rate(xspi->ref_clk);
 	/* Set to default valid value */
-	master->max_speed_hz = clk_get_rate(xspi->ref_clk) / 4;
+	master->max_speed_hz = xspi->clk_rate / 4;
 	xspi->speed_hz = master->max_speed_hz;
 
 	master->bits_per_word_mask = SPI_BPW_MASK(8);



  parent reply	other threads:[~2021-01-22 20:08 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-22 14:08 [PATCH 4.4 00/31] 4.4.253-rc1 review Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 01/31] ASoC: dapm: remove widget from dirty list on free Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 02/31] MIPS: Fix malformed NT_FILE and NT_SIGINFO in 32bit coredumps Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 03/31] mm/hugetlb: fix potential missing huge page size info Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 04/31] ext4: fix bug for rename with RENAME_WHITEOUT Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 05/31] ARC: build: add boot_targets to PHONY Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 06/31] ethernet: ucc_geth: fix definition and size of ucc_geth_tx_global_pram Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 07/31] arch/arc: add copy_user_page() to <asm/page.h> to fix build error on ARC Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 08/31] misdn: dsp: select CONFIG_BITREVERSE Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 09/31] net: ethernet: fs_enet: Add missing MODULE_LICENSE Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 10/31] ACPI: scan: add stub acpi_create_platform_device() for !CONFIG_ACPI Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 11/31] ARM: picoxcell: fix missing interrupt-parent properties Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 12/31] Input: uinput - avoid FF flush when destroying device Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 13/31] dump_common_audit_data(): fix racy accesses to ->d_name Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 14/31] NFS: nfs_igrab_and_active must first reference the superblock Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 15/31] ext4: fix superblock checksum failure when setting password salt Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 16/31] RDMA/usnic: Fix memleak in find_free_vf_and_create_qp_grp Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 17/31] mm, slub: consider rest of partial list if acquire_slab() fails Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 18/31] net: sunrpc: interpret the return value of kstrtou32 correctly Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 19/31] usb: ohci: Make distrust_firmware param default to false Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 20/31] compiler.h: Raise minimum version of GCC to 5.1 for arm64 Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 21/31] iio: buffer: Fix demux update Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 22/31] nfsd4: readdirplus shouldnt return parent of export Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 23/31] net: cdc_ncm: correct overhead in delayed_ndp_size Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 24/31] netxen_nic: fix MSI/MSI-x interrupts Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 25/31] rndis_host: set proper input size for OID_GEN_PHYSICAL_MEDIUM request Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 26/31] net: dcb: Validate netlink message in DCB handler Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 27/31] net: dcb: Accept RTM_GETDCB messages carrying set-like DCB commands Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 28/31] net: sit: unregister_netdevice on newlinks error path Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 29/31] rxrpc: Fix handling of an unsupported token type in rxrpc_read() Greg Kroah-Hartman
2021-01-22 14:08 ` [PATCH 4.4 30/31] net: avoid 32 x truesize under-estimation for tiny skbs Greg Kroah-Hartman
2021-01-22 14:08 ` Greg Kroah-Hartman [this message]
2021-01-23  0:25 ` [PATCH 4.4 00/31] 4.4.253-rc1 review Shuah Khan

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=20210122135733.110337130@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=alexandru.ardelean@analog.com \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.hennerich@analog.com \
    --cc=stable@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).