Re: [PATCH v3 1/2] i2c: Add driver for Cadence I2C controller

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Thu, 2014-04-03 at 09:25AM +0200, Michal Simek wrote:
> On 04/03/2014 09:10 AM, Wolfram Sang wrote:
> > 
> > Please don't quote large parts of the message f you are not referring to
> > it.
> 
> Normally I do it. Forgot sorry.
> 
> >>> +#ifdef CONFIG_PM_SLEEP
> >>> +/**
> >>> + * cdns_i2c_suspend - Suspend method for the driver
> >>> + * @_dev:	Address of the platform_device structure
> >>> + * Return: 0 always
> >>> + *
> >>> + * Put the driver into low power mode.
> >>> + */
> >>> +static int cdns_i2c_suspend(struct device *_dev)
> >>> +{
> >>> +	struct platform_device *pdev = container_of(_dev,
> >>> +			struct platform_device, dev);
> >>> +	struct cdns_i2c *xi2c = platform_get_drvdata(pdev);
> >>> +
> >>> +	clk_disable(xi2c->clk);
> >>> +	xi2c->suspended = 1;
> >>> +
> >>> +	return 0;
> >>> +}
> >>> +
> >>> +/**
> >>> + * cdns_i2c_resume - Resume from suspend
> >>> + * @_dev:	Address of the platform_device structure
> >>> + * Return: 0 on success and error value on error
> >>> + *
> >>> + * Resume operation after suspend.
> >>> + */
> >>> +static int cdns_i2c_resume(struct device *_dev)
> >>> +{
> >>> +	struct platform_device *pdev = container_of(_dev,
> >>> +			struct platform_device, dev);
> >>> +	struct cdns_i2c *xi2c = platform_get_drvdata(pdev);
> >>> +	int ret;
> >>> +
> >>> +	ret = clk_enable(xi2c->clk);
> >>> +	if (ret) {
> >>> +		dev_err(_dev, "Cannot enable clock.\n");
> >>> +		return ret;
> >>> +	}
> >>> +
> >>> +	xi2c->suspended = 0;
> >>> +
> >>> +	return 0;
> >>> +}
> >>> +#endif
> >>
> >> Can you also please remove this #ifdef and use __maybe_used
> >> instead? Better not to have any ifdef in the code.
> > 
> > Is this a new pattern? For PM_SLEEP, #ifdef seems to be quite common.
> 
> The first suggestion to do it came from CAN maintainer.
> It is valid in general for ifdef.
> I have checked all our drivers and we are changing them to use __maybe_used
> because then we can easily find out if there is any problem
> when function prototype has changed.

I already have that change in my current version. I hope to send v4 to the list
soon.

	Sören


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux