Hi Maxime, On Mon, Sep 15, 2014 at 08:57:38AM +0200, Maxime Coquelin wrote:
> >+ err = dev->acquire_ownership(dev->dev); > Have you considered using hwspinlocks instead? No, I've not used it before but it looks applicable here. I'll take a look. > >@@ -212,6 +259,25 @@ static int dw_i2c_probe(struct platform_device *pdev) > > adap->dev.parent = &pdev->dev; > > adap->dev.of_node = pdev->dev.of_node; > > > >+#if IS_ENABLED(CONFIG_I2C_SHARED_CONTROLLER) > >+ if (dev->shared_host) > >+ adap->algo = &i2c_sc_algo; > >+ > >+ r = i2c_add_numbered_adapter(adap); > >+ if (r) { > >+ dev_err(&pdev->dev, "failure adding adapter\n"); > >+ return r; > >+ } > >+ > >+ if (dev->shared_host) > >+ pm_runtime_forbid(&pdev->dev); > >+ else { > >+ pm_runtime_set_autosuspend_delay(&pdev->dev, 1000); > >+ pm_runtime_use_autosuspend(&pdev->dev); > >+ pm_runtime_set_active(&pdev->dev); > >+ pm_runtime_enable(&pdev->dev); > >+ } > >+#else > Why do you put all this under config flags? So that this additional code only compiles for this very specific implementation. > >@@ -268,7 +334,11 @@ static int dw_i2c_resume(struct device *dev) > > struct dw_i2c_dev *i_dev = platform_get_drvdata(pdev); > > > > clk_prepare_enable(i_dev->clk); > >- i2c_dw_init(i_dev); > >+ > >+#if IS_ENABLED(CONFIG_I2C_SHARED_CONTROLLER) > >+ if (!i_dev->shared_host) > >+#endif > Putting this under config flag should not be needed. > > And even not under config flags, why don't you re-initialize your > device in case of resume? Because the device is already being managed by hardware, not the OS. David Box -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/