lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 2 Dec 2020 17:09:20 +0100
From:   Paul Kocialkowski <paul.kocialkowski@...tlin.com>
To:     Maxime Ripard <maxime@...no.tech>
Cc:     linux-media@...r.kernel.org, devicetree@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        linux-doc@...r.kernel.org, devel@...verdev.osuosl.org,
        linux-sunxi@...glegroups.com, Yong Deng <yong.deng@...ewell.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Rob Herring <robh+dt@...nel.org>, Chen-Yu Tsai <wens@...e.org>,
        Jernej Skrabec <jernej.skrabec@...l.net>,
        Jonathan Corbet <corbet@....net>,
        Kishon Vijay Abraham I <kishon@...com>,
        Vinod Koul <vkoul@...nel.org>,
        Helen Koike <helen.koike@...labora.com>,
        Dafna Hirschfeld <dafna.hirschfeld@...labora.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Philipp Zabel <p.zabel@...gutronix.de>,
        Sakari Ailus <sakari.ailus@...ux.intel.com>,
        Hans Verkuil <hans.verkuil@...co.com>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
        kevin.lhopital@...mail.com
Subject: Re: [PATCH v2 13/19] media: sunxi: Add support for the A31 MIPI
 CSI-2 controller

Hi,

On Wed 02 Dec 20, 16:48, Maxime Ripard wrote:
> On Wed, Dec 02, 2020 at 03:44:47PM +0100, Paul Kocialkowski wrote:
> > > > +static int __maybe_unused sun6i_mipi_csi2_suspend(struct device *dev)
> > > > +{
> > > > +	struct sun6i_mipi_csi2_dev *cdev = dev_get_drvdata(dev);
> > > > +
> > > > +	clk_disable_unprepare(cdev->clk_mod);
> > > > +	clk_disable_unprepare(cdev->clk_bus);
> > > > +	reset_control_assert(cdev->reset);
> > > > +
> > > > +	return 0;
> > > > +}
> > > > +
> > > > +static int __maybe_unused sun6i_mipi_csi2_resume(struct device *dev)
> > > > +{
> > > > +	struct sun6i_mipi_csi2_dev *cdev = dev_get_drvdata(dev);
> > > > +	int ret;
> > > > +
> > > > +	ret = reset_control_deassert(cdev->reset);
> > > > +	if (ret) {
> > > > +		dev_err(cdev->dev, "failed to deassert reset\n");
> > > > +		return ret;
> > > > +	}
> > > > +
> > > > +	ret = clk_prepare_enable(cdev->clk_bus);
> > > > +	if (ret) {
> > > > +		dev_err(cdev->dev, "failed to enable bus clock\n");
> > > > +		goto error_reset;
> > > > +	}
> > > > +
> > > > +	ret = clk_prepare_enable(cdev->clk_mod);
> > > > +	if (ret) {
> > > > +		dev_err(cdev->dev, "failed to enable module clock\n");
> > > > +		goto error_clk_bus;
> > > > +	}
> > > > +
> > > > +	return 0;
> > > > +
> > > > +error_clk_bus:
> > > > +	clk_disable_unprepare(cdev->clk_bus);
> > > > +
> > > > +error_reset:
> > > > +	reset_control_assert(cdev->reset);
> > > > +
> > > > +	return ret;
> > > > +}
> > > 
> > > I'm guessing you set the __maybe_unused attribute because you're using
> > > SET_RUNTIME_PM_OPS, but what would happen if runtime_pm isn't selected?
> > > It looks like you don't handle that case.
> > 
> > Indeed, __maybe_unused is because of the conditional definition of
> > SET_RUNTIME_PM_OPS. If CONFIG_PM is not selected, then I guess the controller
> > wouldn't be powered and wouldn't work. So I should definitely add a Kconfig
> > dependency on PM then, right?
> 
> There's two ways we can do it. What you suggested is one, the other is
> to have something like our SPI driver to call directly the resume
> function if there's no runtime pm support.

Understood! I think I'll stick to depending on PM (unless you prefer not to)
but it's good to know.

Cheers,

Paul

-- 
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ