Thread (17 messages) 17 messages, 3 authors, 2016-04-18

Re: [PATCH V4 4/6] slim: qcom: Add Qualcomm Slimbus controller driver

From: Mark Brown <hidden>
Date: 2016-03-05 12:42:31
Also in: linux-arm-msm, lkml

On Sat, Feb 06, 2016 at 11:44:23AM -0700, Sagar Dharia wrote:
 
+if SLIMBUS
+config SLIM_QCOM_CTRL
+	tristate "Qualcomm Slimbus Manager Component"
+	depends on SLIMBUS
+	default n
+	help
n is the default.
+static irqreturn_t msm_slim_interrupt(int irq, void *d)
+{
+	struct msm_slim_ctrl *dev = d;
+	u32 stat = readl_relaxed(dev->base + MGR_INT_STAT);
+	int err = 0;
+	if (stat & MGR_INT_TX_MSG_SENT || stat & MGR_INT_TX_NACKED_2) {
+	if (stat & MGR_INT_RX_MSG_RCVD) {
+	}
+	/**
+	 * All interrupts are handled: complex RX messages requiring more work
+	 * are queued to work-queue, others are handled above
+	 */
+	return IRQ_HANDLED;
This unconditionally returns IRQ_HANDLED even if no interrupts were
flagged.  This will break if the interrupt gets shared in some hardware
design or if something goes wrong with the hardware.
+	ret = devm_request_irq(&pdev->dev, dev->irq, msm_slim_interrupt,
+				IRQF_TRIGGER_HIGH, "msm_slim_irq", dev);
+	if (ret) {
+		dev_err(&pdev->dev, "request IRQ failed\n");
+		goto err_request_irq_failed;
+	}
Are you sure this is safe and we don't deallocate things the interrupt
handler uses before we disable the interrupt?
+	ret = clk_prepare_enable(hclk);
+	if (ret)
+		goto err_hclk_enable_failed;
+
+	ret = clk_prepare_enable(rclk);
+	if (ret)
+		goto err_rclk_enable_failed;
The remove path doesn't disable these.
+	/* Register with framework before enabling frame, clock */
+	ret = slim_register_controller(&dev->ctrl);
+	if (ret) {
+		dev_err(dev->dev, "error adding controller\n");
+		goto err_ctrl_failed;
+	}
Should we have a devm_ version of slim_register_controller()?  I'd also
expect this to be the last thing we do in probe, things may start using
the device before we've finished initializing it.

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help